:root {
  color-scheme: dark;
  --bg: #07100e;
  --panel: #0e1916;
  --panel-2: #101f1c;
  --line: #24433b;
  --line-soft: rgba(104, 255, 210, 0.16);
  --text: #e9fff7;
  --muted: #8bb0a4;
  --accent: #62ffd1;
  --accent-2: #f1d06b;
  --danger: #ff7c96;
  --blue: #8ab8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 52% 18%, rgba(98, 255, 209, 0.12), transparent 34rem),
    linear-gradient(135deg, #07100e 0%, #0a1413 48%, #11130f 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 340px;
  min-height: 100vh;
}

.rail,
.inspector {
  padding: 22px;
  border-color: var(--line-soft);
}

.rail {
  border-right: 1px solid var(--line-soft);
}

.inspector {
  border-left: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #05100d;
  background: var(--accent);
  font: 800 19px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: 0 0 34px rgba(98, 255, 209, 0.35);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.eyebrow,
.panel-head span,
.source small,
.file-drop small,
.file-drop span,
.ingest span,
.status-strip,
.query-console label {
  color: var(--muted);
}

.panel {
  background: linear-gradient(180deg, rgba(16, 31, 28, 0.9), rgba(11, 20, 18, 0.82));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.panel-head,
.source,
.stage-toolbar,
.status-strip,
.query-row,
.toolbar-actions,
.quick-queries,
.tags {
  display: flex;
  align-items: center;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 13px;
}

.panel-head strong,
.status-strip b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
}

.source-list {
  display: grid;
  gap: 9px;
}

.source {
  justify-content: space-between;
  width: 100%;
  text-align: left;
  height: auto;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  cursor: pointer;
}

.source.active {
  border-color: rgba(98, 255, 209, 0.65);
  background: rgba(98, 255, 209, 0.08);
}

.source strong,
.source small {
  display: block;
}

.source small {
  margin-top: 3px;
  font-size: 12px;
}

.source strong {
  line-height: 1.25;
}

.source em {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px currentColor;
}

.upload-panel input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px dashed rgba(98, 255, 209, 0.42);
  border-radius: 8px;
  background: rgba(98, 255, 209, 0.05);
  cursor: pointer;
}

.file-drop strong {
  line-height: 1.25;
}

.ingest {
  display: grid;
  gap: 14px;
}

.ingest div {
  display: grid;
  gap: 6px;
}

progress {
  width: 100%;
  height: 7px;
  appearance: none;
}

progress::-webkit-progress-bar {
  background: #132521;
  border-radius: 20px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 20px;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(420px, 1fr);
  padding: 26px;
  gap: 18px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(38px, 6vw, 88px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 9px;
  font-size: 24px;
}

.status-strip {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 13px;
}

.status-strip span {
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.query-console {
  border: 1px solid rgba(98, 255, 209, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: rgba(5, 14, 12, 0.76);
}

.query-console label {
  display: block;
  margin-bottom: 8px;
  font: 700 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.query-row {
  gap: 10px;
}

.query-row span,
.query-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.query-row span {
  color: var(--accent);
}

.query-row input {
  min-width: 0;
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

button {
  height: 36px;
  border: 1px solid rgba(98, 255, 209, 0.42);
  border-radius: 7px;
  color: var(--text);
  background: rgba(98, 255, 209, 0.07);
  cursor: pointer;
}

button:hover,
button.active {
  color: #05100d;
  background: var(--accent);
}

.query-row button {
  min-width: 72px;
  font-weight: 800;
}

.quick-queries {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.quick-queries button {
  height: 30px;
  padding: 0 10px;
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.graph-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(rgba(98, 255, 209, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 255, 209, 0.06) 1px, transparent 1px),
    rgba(7, 16, 14, 0.8);
  background-size: 36px 36px;
  min-height: 420px;
}

.stage-toolbar {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  right: 14px;
  justify-content: space-between;
  gap: 14px;
}

.stage-toolbar > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent);
}

.toolbar-actions {
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-actions button {
  height: 30px;
  padding: 0 10px;
}

#graph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.edge {
  stroke: rgba(139, 176, 164, 0.42);
  stroke-width: 1.4;
}

.edge.hot {
  stroke: var(--accent-2);
  stroke-width: 2.6;
}

.node circle {
  stroke: rgba(233, 255, 247, 0.78);
  stroke-width: 1.2;
  filter: drop-shadow(0 0 12px rgba(98, 255, 209, 0.18));
  cursor: pointer;
}

.node text {
  fill: var(--text);
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
}

.node.case text {
  opacity: 0;
}

.node.case:hover text,
.node.case.selected text {
  opacity: 1;
}

.node.entity text {
  fill: #d7e6ff;
}

.node.dim,
.edge.dim {
  opacity: 0.18;
}

.edge.faint {
  stroke-dasharray: 3 6;
  opacity: 0.55;
}

.node.selected circle {
  stroke: var(--accent-2);
  stroke-width: 3;
}

.hero-panel p,
.answer-panel p {
  color: #b9d7cf;
  line-height: 1.55;
}

.tags {
  gap: 7px;
  flex-wrap: wrap;
}

.tags span {
  padding: 6px 8px;
  border-radius: 999px;
  color: #07100e;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.relations {
  display: grid;
  gap: 10px;
}

.relation,
.case-row {
  width: 100%;
  height: auto;
  text-align: left;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.relation strong,
.case-row strong {
  display: block;
  margin-bottom: 4px;
}

.relation span,
.case-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 300px;
  overflow: auto;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .inspector .panel {
    margin-bottom: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .rail,
  .inspector,
  .workspace {
    padding: 16px;
  }

  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    display: block;
  }

  .status-strip {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .stage-toolbar {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 12px;
  }

  .inspector {
    display: block;
  }

  .inspector .panel {
    margin-bottom: 16px;
  }
}

@media (max-width: 560px) {
  .source-list {
    grid-template-columns: 1fr;
  }

  .query-row {
    align-items: stretch;
  }

  .query-row button {
    min-width: 58px;
  }

  h1 {
    font-size: 42px;
  }
}
