/* Tokens match recruiting.css so the two pages read as one product. */
:root {
  color-scheme: light;
  --sky: #f5f2ea;
  --sky-raised: #fffdf8;
  --sky-high: #efebe1;
  --line: #d8d4ca;
  --text: #1d2530;
  --muted: #66717e;
  --faint: #a7aeb6;
  --gold: #1f6d5f;
  --aqua: #4f8f82;
  --ochre: #b7862b;
  /* Two more fills, so each of the five node kinds has its own. Chosen to sit
     in the same muted range as the rest rather than shouting over them. */
  --slate: #5b6b7c;
  --indigo: #4a6fa5;
  --danger: #9a382f;
  --on-accent: #ffffff;
  --radius-control: 10px;
  --radius-surface: 16px;
  /* Edges stay quiet so the nodes and their labels carry the meaning. */
  --edge: #90a4ae;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--sky);
}

body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--sky); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

button, .quiet { font: inherit; cursor: pointer; }
.primary {
  border: 0; border-radius: var(--radius-control); padding: 8px 14px;
  background: var(--gold); color: var(--on-accent); font-weight: 600;
}
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: .5; cursor: progress; }
.quiet {
  border: 1px solid var(--line); border-radius: var(--radius-control); padding: 5px 10px;
  background: transparent; color: var(--text); text-decoration: none; font-size: .88rem;
}
.quiet:hover { border-color: var(--muted); }
.quiet.on { border-color: var(--aqua); color: var(--aqua); }

/* The two ways in: a question, or one of the fixed overviews. One row of
   tabs for both, since "your question" is just another picture to look at. */
.ask { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.ask input[type="search"] {
  flex: 1 1 420px; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 9px 12px; background: var(--sky-raised); color: var(--text); font: inherit;
}
.ask input[type="search"]:focus { outline: none; border-color: var(--gold); }
.examples { color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.example {
  border: 1px dashed var(--line); border-radius: 999px; padding: 2px 10px;
  background: transparent; color: var(--aqua); font-size: .82rem;
}
.example:hover { border-color: var(--aqua); }

.view-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.view-divider { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.view-tab {
  border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 6px 12px; background: var(--sky-raised); color: var(--muted);
  font: inherit; font-size: .88rem; cursor: pointer;
}
.view-tab:hover:not(:disabled) { border-color: var(--muted); }
.view-tab:disabled { opacity: .45; cursor: default; }
.view-tab.on { border-color: var(--gold); color: var(--gold); background: var(--sky-high); font-weight: 600; }

/* Category filters: what is shown, and what an expansion asks for. */
.categories { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.categories legend { float: left; margin-right: 6px; color: var(--muted); font-size: .82rem; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 6px;
  font-size: .82rem; color: var(--text); background: var(--sky-raised);
}
.chip input { accent-color: var(--gold); margin: 0; }
.chip:has(input:not(:checked)) { color: var(--faint); background: transparent; }

/* Header */
.top {
  flex: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  width: min(1320px, calc(100% - 32px)); margin: 0 auto; padding: 14px 0 6px;
}
h1 {
  margin: 0; font-family: Georgia, "Songti SC", serif;
  font-size: clamp(1.35rem, 2vw, 1.85rem); font-weight: 500; line-height: 1.1;
}
h2 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 1.05rem; font-weight: 500; }
.status-line { margin: 4px 0 0; color: var(--muted); }
.top-actions { flex: none; display: flex; gap: 8px; align-items: center; }

.banner { width: min(1320px, calc(100% - 32px)); margin: 8px auto; padding: 10px 14px; border-radius: var(--radius-control); }
.banner.error { background: #f6e3e0; color: var(--danger); }
/* Work happening elsewhere: stated, not alarming. */
.banner.working { background: #f5ecd9; color: #6b4e14; }

/* Controls */
.controls {
  width: min(1320px, calc(100% - 32px)); margin: 10px auto 0; box-sizing: border-box;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 14px; background: var(--sky-raised);
  border: 1px solid var(--line); border-radius: var(--radius-surface);
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { color: var(--muted); font-size: .82rem; }
.field select, .field input[type="text"] {
  border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 8px 10px; background: var(--sky-raised); color: var(--text); font: inherit;
}
.field input[type="text"] { min-width: 260px; }
.field select:focus, .field input:focus { outline: none; border-color: var(--gold); }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
/* 44px of hit area for a small control, without drawing a 44px box. */
.field.checkbox input { width: 18px; height: 18px; accent-color: var(--gold); margin: 13px 0; }
.field.checkbox label { color: var(--text); font-size: .9rem; }

/* Board */
.board {
  flex: 1 1 auto; min-height: 0;
  width: min(1320px, calc(100% - 32px)); margin: 14px auto 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start;
}
.picture, .table-view {
  background: var(--sky-raised); border: 1px solid var(--line);
  border-radius: var(--radius-surface); padding: 12px;
}
#canvas { display: block; width: 100%; height: min(68vh, 680px); cursor: grab; touch-action: none; }
#canvas.dragging { cursor: grabbing; }
.picture-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.picture-bar h2 { margin: 0; }
.picture-actions { display: flex; gap: 6px; }
.hint-line { margin: 6px 2px 0; color: var(--muted); font-size: .82rem; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 2px 0; padding: 0; color: var(--muted); font-size: .82rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
/* Set apart from the five kinds above it: this one describes a state, not a
   kind, and should not read as a sixth entry in the taxonomy. */
.legend li.legend-note { margin-left: auto; font-style: italic; color: var(--faint); }
.key { width: 14px; height: 14px; flex: none; }

/* Nodes are told apart by shape as well as colour: five kinds, five shapes,
   five fills, no two alike. 'Part of an incident' is deliberately not a sixth
   kind — it is a state any item or event can be in, so it reads as a red
   outline on whatever shape the node already has. */
.n-person { fill: var(--aqua); }
.n-organization { fill: var(--slate); }
.n-item { fill: var(--gold); }
.n-event { fill: var(--ochre); }
.n-document { fill: var(--indigo); }
.shape.incident { stroke: var(--danger); stroke-width: 2.5; }
/* Two kinds the query API makes up rather than stores: the question at the
   centre, and a "+N more" standing for a category not drawn yet. */
.n-query { fill: var(--text); }
.n-cluster { fill: var(--sky-raised); stroke: var(--muted) !important; stroke-width: 1.5; stroke-dasharray: 3 2; }
.node.kind-cluster .caption { fill: var(--aqua); font-style: italic; }
/* The emergent graph has its own taxonomy, so its own pair of shapes. */
.n-entity { fill: var(--aqua); }
.n-kind { fill: var(--ochre); }

/* Says where the drawing came from, which matters most for the emergent graph:
   it is a snapshot of the last extraction, not something computed just now. */
.provenance {
  width: min(1320px, calc(100% - 32px)); margin: 10px auto 0;
  color: var(--muted); font-size: .82rem;
}

.edge { stroke: var(--edge); stroke-opacity: .6; stroke-width: 1.2; fill: none; }
.edge.involves, .edge.updates_domain { stroke-dasharray: 3 3; }
.edge.more { stroke-dasharray: 1 3; stroke-opacity: .5; }
.edge.matches { stroke: var(--text); stroke-opacity: .25; }
.lane-label { font-size: 10px; fill: var(--faint); }
.node { cursor: pointer; }
.node .shape { stroke: var(--sky-raised); stroke-width: 1.5; }
.node .caption { font-size: 9px; fill: var(--muted); text-anchor: middle; pointer-events: none; }
.node .caption.side { text-anchor: start; }
.node .caption.strong { font-size: 11px; font-weight: 600; fill: var(--text); }
.node.expanded .shape { stroke: var(--muted); }
.node:hover .shape, .node.selected .shape { stroke: var(--text); stroke-width: 2; }
.node:focus-visible { outline: none; }
.node:focus-visible .ring { stroke: var(--gold); stroke-width: 2.5; fill: none; }
.node .ring { stroke: none; fill: none; }

/* Table view: the accessible source of truth for the same relationships. */
.table-scroll { max-height: min(60vh, 560px); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--sky-high); font-weight: 600; }
tbody tr:hover { background: var(--sky-high); }
td.kind { color: var(--muted); white-space: nowrap; }

/* Details rail */
.details {
  background: var(--sky-raised); border: 1px solid var(--line);
  border-radius: var(--radius-surface); padding: 14px; min-height: 120px;
}
.details .empty { margin: 0; color: var(--faint); }
.details dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.details dt { color: var(--muted); font-size: .82rem; }
.details dd { margin: 0; font-size: .9rem; word-break: break-word; }
.details .name { margin: 0 0 2px; font-weight: 600; line-height: 1.35; }
.details .kind-line { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.details .neighbours { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.details .neighbours li { font-size: .86rem; }
.details .neighbours button {
  border: 0; background: none; padding: 0; color: var(--aqua); font: inherit;
  text-align: left; cursor: pointer; text-decoration: underline;
}

/* Attributes/Evidence sub-tabs inside a double-clicked node's details. */
.detail-tabs { display: flex; gap: 6px; margin: 0 0 10px; }
.detail-tab {
  border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 4px 10px; background: transparent; color: var(--muted);
  font: inherit; font-size: .82rem; cursor: pointer;
}
.detail-tab.on { border-color: var(--aqua); color: var(--aqua); font-weight: 600; }
.evidence-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.evidence-list li { border-top: 1px solid var(--line); padding-top: 8px; }
.evidence-list li:first-child { border-top: none; padding-top: 0; }
.evidence-title { margin: 0; font-weight: 600; font-size: .88rem; }
.evidence-excerpt {
  margin: 4px 0 0; color: var(--muted); font-size: .82rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

@media (max-width: 900px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .field input[type="text"] { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
