:root {
  color-scheme: dark;
  --ink: #101312;
  --ink-raised: #161a18;
  --ink-soft: #1c211f;
  --line: #303733;
  --line-strong: #46504a;
  --paper: #f3f0e7;
  --muted: #a6ada7;
  --muted-2: #8f9891;
  --cyan: #62d9d0;
  --green: #74d99f;
  --red: #ff7a72;
  --amber: #e8ba62;
  --violet: #b99cff;
  --gray: #a7b0aa;
  --radius: 14px;
  --topbar-height: 66px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: auto;
  overflow-wrap: anywhere;
  background: var(--ink);
  color: var(--paper);
  font: 16px/1.5 var(--sans);
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; }

button, summary, a[href] { min-height: 44px; }

a[href] { display: inline-flex; align-items: center; }

textarea { min-height: 44px; }

button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, summary:focus-visible, .graph-scroller:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

a { color: inherit; }

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

h1, h2, h3 { text-wrap: balance; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-140%);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 750;
}

.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }

.topbar {
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 18, 0.96);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  font: 800 15px/1 var(--mono);
  letter-spacing: 0.12em;
}

.wordmark-mark {
  width: 27px;
  height: 27px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 5px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--ink-soft);
}

.wordmark-mark i { display: block; height: 2px; border-radius: 2px; background: var(--paper); }
.wordmark-mark i:nth-child(2) { width: 72%; background: var(--cyan); }
.wordmark-mark i:nth-child(3) { width: 42%; background: var(--violet); }

.topbar-case {
  display: grid;
  gap: 1px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.topbar-case span, .eyebrow {
  margin-bottom: 3px;
  color: var(--muted-2);
  font: 700 14px/1.25 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.topbar-case strong { font-size: 14px; font-weight: 650; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.snapshot-badge, .tool-status {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--ink-raised);
  font: 650 14px/1.2 var(--mono);
  overflow-wrap: anywhere;
}

.snapshot-badge time { color: var(--paper); }

.tool-status i, #verdict-status i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent);
}

.tool-status.is-ready i { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.tool-status.is-unavailable i { background: var(--muted-2); box-shadow: none; }

.reset-button, .secondary-button, .primary-button, .accept-button, .reject-button, .text-button, .icon-button {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  cursor: pointer;
  color: var(--paper);
  background: var(--ink-soft);
  font-weight: 700;
}

.reset-button { padding: 8px 13px; background: transparent; font-size: 14px; }
.reset-button:hover, .secondary-button:hover { border-color: var(--muted); background: #242a27; }
.topbar-button { padding: 8px 13px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 260px) minmax(0, 1fr) minmax(300px, 330px);
  grid-template-areas: "sources argument review";
  min-height: calc(100vh - var(--topbar-height));
}

.source-rail, .review-region, .argument-region { min-width: 0; }

.source-rail {
  grid-area: sources;
  padding: 20px 14px 32px;
  border-right: 1px solid var(--line);
  background: #121614;
}

.review-region {
  grid-area: review;
  padding: 16px 14px 32px;
  border-left: 1px solid var(--line);
  background: #121614;
}

.argument-region {
  grid-area: argument;
  position: relative;
  padding: 22px clamp(14px, 2vw, 28px) 48px;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 32px 32px;
}

.rail-heading, .section-heading, .argument-header, .ask-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.rail-heading h2, .section-heading h2, .ask-card h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.rail-heading > span {
  color: var(--cyan);
  font: 700 14px/1 var(--mono);
}

.rail-intro { margin: 12px 0 18px; color: var(--muted); font-size: 16px; }

.source-list, .proposal-list, .history-list, .affected-list, .relation-preview, .drawer-claims, .drawer-relations, .claim-outline ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.source-card {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 8px;
  padding: 11px 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--ink-raised);
}

.source-card:hover { border-color: var(--line); background: var(--ink-soft); }
.source-index { padding-top: 2px; color: var(--muted-2); font: 650 14px/1 var(--mono); }
.source-card-body { min-width: 0; }
.source-card h3 { margin: 6px 0 1px; font-size: 16px; }
.source-card p { margin: 0 0 5px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.source-card small { display: block; color: var(--muted-2); font-size: 14px; line-height: 1.4; }

.source-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; color: var(--muted-2); font: 650 14px/1.3 var(--mono); }
.source-type { color: var(--cyan); text-transform: uppercase; }
.source-social { color: var(--violet); }
.source-benchmark { color: var(--green); }
.source-standards { color: var(--amber); }

.card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 7px; }
.card-actions a, .text-button { color: var(--paper); font-size: 14px; font-weight: 750; }
.card-actions a { display: inline-flex; align-items: center; }
.text-button { min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--cyan); }

.argument-header { margin: 2px 0 18px; }
.question-copy { max-width: 760px; }
.argument-header h1 { margin: 5px 0 7px; font-size: clamp(25px, 3.1vw, 42px); line-height: 1.06; letter-spacing: -0.045em; }
.question-thesis { margin-bottom: 0; color: var(--muted); font-size: 16px; }

.verdict-block { flex: 0 0 auto; display: grid; justify-items: end; gap: 6px; }
.verdict-block > span { color: var(--muted-2); font: 700 14px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }
#verdict-status { display: flex; align-items: center; gap: 8px; color: var(--amber); font: 700 14px/1.2 var(--mono); }
#verdict-status.is-resolved { color: var(--green); }
#verdict-status.is-resolved i { background: var(--green); }

.focus-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.focus-controls > span { margin-right: 3px; color: var(--muted-2); font: 700 14px/1 var(--mono); white-space: nowrap; text-transform: uppercase; }
.focus-controls button { min-height: 44px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--ink-raised); cursor: pointer; font-size: 14px; white-space: nowrap; }
.focus-controls button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--cyan) 54%, var(--line)); color: var(--paper); background: color-mix(in srgb, var(--cyan) 9%, var(--ink-raised)); }

.graph-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(16,19,18,0.92); box-shadow: 0 18px 55px rgba(0,0,0,0.18); }
.relation-legend { display: flex; gap: 12px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); color: var(--muted); font: 650 14px/1 var(--mono); white-space: nowrap; }
.relation-legend span { display: inline-flex; align-items: center; gap: 5px; }
.relation-legend b { color: var(--gray); }
.legend-evidence b { color: var(--cyan); }
.legend-supports b { color: var(--green); }
.legend-contradicts b { color: var(--red); }
.legend-qualifies b { color: var(--amber); }
.legend-staged b { color: var(--violet); }

.graph-scroller { overflow: auto; overscroll-behavior: contain; background: radial-gradient(circle at 50% 40%, rgba(98,217,208,0.035), transparent 50%); }
.argument-graph { display: block; width: max(100%, 1050px); height: auto; min-height: 610px; }
.graph-zero-state {
  min-height: 530px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 38px 20px;
  text-align: center;
}
.graph-zero-state > span { color: var(--cyan); font-size: 44px; line-height: 1; }
.graph-zero-state h2 { margin: 5px 0 7px; font-size: clamp(22px, 3vw, 32px); }
.graph-zero-state > p:not(.eyebrow) { max-width: 560px; margin-bottom: 18px; color: var(--muted); font-size: 17px; }
.graph-zero-state + .argument-graph { display: none; }

.lane-header text { fill: var(--muted-2); font: 700 14px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.lane-header line { stroke: var(--line); stroke-dasharray: 2 5; }

.edge-line { fill: none; stroke: var(--gray); stroke-width: 1.5; opacity: 0.66; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.relation-evidence .edge-line { stroke: var(--cyan); opacity: 0.28; }
.relation-supports .edge-line { stroke: var(--green); }
.relation-contradicts .edge-line { stroke: var(--red); }
.relation-qualifies .edge-line { stroke: var(--amber); }
.relation-amplifies .edge-line { stroke: var(--gray); stroke-dasharray: 5 4; }
.edge.is-staged .edge-line { stroke: var(--violet); stroke-width: 2; stroke-dasharray: 7 5; opacity: 0.9; }

#arrow-evidence path { fill: var(--cyan); }
#arrow-supports path { fill: var(--green); }
#arrow-contradicts path { fill: var(--red); }
#arrow-qualifies path { fill: var(--amber); }
#arrow-amplifies path { fill: var(--gray); }
#arrow-staged path { fill: var(--violet); }

.edge-label { cursor: pointer; }
.edge-label rect { fill: var(--ink); stroke: var(--line); }
.edge-label text { fill: var(--gray); font: 700 14px var(--mono); }
.edge-label.relation-evidence text { fill: var(--cyan); }
.edge-label.relation-supports text { fill: var(--green); }
.edge-label.relation-contradicts text { fill: var(--red); }
.edge-label.relation-qualifies text { fill: var(--amber); }
.edge-label.is-staged rect { stroke: var(--violet); }
.edge-label.is-staged text { fill: var(--violet); }

.group-hull { cursor: pointer; }
.group-hull > rect { fill: rgba(167,176,170,0.04); stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 4 4; }
.group-hull.is-staged > rect { fill: rgba(185,156,255,0.07); stroke: var(--violet); stroke-width: 1.6; stroke-dasharray: 7 5; }
.group-badge rect { fill: var(--ink-soft); stroke: var(--line-strong); }
.group-badge text { fill: var(--muted); font: 700 14px var(--mono); text-transform: uppercase; }
.group-hull.is-staged .group-badge rect { stroke: var(--violet); }
.group-hull.is-staged .group-badge text { fill: var(--violet); }

.graph-node { cursor: pointer; transition: opacity 120ms ease; }
.node-body { fill: #181d1a; stroke: var(--line-strong); stroke-width: 1; }
.node-source .node-body { fill: #13201e; stroke: color-mix(in srgb, var(--cyan) 45%, var(--line)); }
.graph-node:hover .node-body { stroke: var(--paper); }
.node-copy { fill: var(--paper); font: 600 16px var(--sans); pointer-events: none; }
.node-meta { fill: var(--muted-2); font: 700 14px var(--mono); text-transform: uppercase; pointer-events: none; }
.graph-node.is-staged .node-body { fill: rgba(185,156,255,0.08); stroke: var(--violet); stroke-width: 1.7; stroke-dasharray: 6 4; }
.graph-node.is-ghost .node-copy { fill: #ded4ff; }
.staged-chip rect { fill: var(--violet); }
.staged-chip text { fill: #171120; font: 800 14px var(--mono); }
.is-dimmed { opacity: 0.19; }

.claim-outline { padding: 16px; border-top: 1px solid var(--line); background: #121614; }
.section-heading { align-items: center; }
.section-heading > span, .section-heading output { color: var(--muted); font: 700 14px/1 var(--mono); }
.outline-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.outline-lane h3 { margin-bottom: 7px; color: var(--muted); font: 700 14px/1.2 var(--mono); text-transform: uppercase; }
.outline-lane ol { display: grid; gap: 5px; }
.outline-claim { width: 100%; min-height: 44px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; text-align: left; color: var(--paper); background: var(--ink-raised); cursor: pointer; }
.outline-claim span, .outline-claim small { display: block; }
.outline-claim span { font-size: 16px; line-height: 1.4; }
.outline-claim small { margin-top: 4px; color: var(--muted-2); font: 650 14px/1.2 var(--mono); text-transform: uppercase; }

.ask-card { padding: 15px; border: 1px solid color-mix(in srgb, var(--violet) 35%, var(--line)); border-radius: var(--radius); background: linear-gradient(145deg, rgba(185,156,255,0.075), transparent 55%), var(--ink-raised); }
.ask-card-heading { justify-content: flex-start; }
.agent-glyph { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: var(--violet); color: #19121f; font-size: 18px; }
.ask-status { margin: 13px 0 9px; color: var(--muted); font-size: 16px; }
.ask-card blockquote { margin: 0; padding: 12px; border-left: 2px solid var(--violet); border-radius: 0 8px 8px 0; background: rgba(10,12,11,0.48); color: #d8d5cc; font-size: 16px; line-height: 1.55; }
.ask-card code { color: var(--cyan); font: 700 1em var(--mono); }
.ask-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; margin-top: 11px; }
.secondary-button, .primary-button, .accept-button, .reject-button { padding: 8px 10px; font-size: 14px; }
.primary-button { border-color: var(--violet); background: var(--violet); color: #171120; }
.primary-button:hover { background: #c9b3ff; }
.preview-disclosure { margin: 9px 0 0; color: var(--muted-2); font-size: 16px; line-height: 1.5; }
.followup-prompts { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.followup-prompts summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.followup-prompts button { width: 100%; min-height: 44px; padding: 6px 0; border: 0; border-top: 1px solid var(--line); text-align: left; color: var(--cyan); background: transparent; cursor: pointer; font-size: 14px; }

.review-queue { margin-top: 18px; }
#review-count { min-width: 70px; padding: 6px 8px; border: 1px solid color-mix(in srgb, var(--violet) 44%, var(--line)); border-radius: 999px; text-align: center; color: var(--violet); font: 700 14px/1 var(--mono); }
#review-count[data-empty="true"] { border-color: var(--line); color: var(--muted-2); }
.proposal-list { display: grid; gap: 9px; margin-top: 11px; }
.empty-state { padding: 25px 18px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; background: rgba(255,255,255,0.012); }
.empty-mark { margin-bottom: 5px; color: var(--muted-2); font-size: 24px; }
.empty-state h3 { margin-bottom: 5px; font-size: 16px; }
.empty-state p { margin: 0; color: var(--muted-2); font-size: 16px; }
.source-empty .primary-button { margin-top: 14px; }
.source-location { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted-2); font-size: 14px; }

.proposal-card { padding: 12px; border: 1px solid color-mix(in srgb, var(--violet) 42%, var(--line)); border-radius: 12px; background: linear-gradient(120deg, rgba(185,156,255,0.06), transparent 50%), var(--ink-raised); }
.proposal-card > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.queue-number { margin-right: 6px; color: var(--violet); font: 800 14px/1 var(--mono); }
.operation-chip, .confidence { display: inline-flex; align-items: center; min-height: 23px; padding: 4px 7px; border-radius: 6px; background: rgba(255,255,255,0.045); color: var(--muted); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.confidence-high, .confidence-supported { color: var(--green); }
.confidence-low { color: var(--amber); }
.proposal-card h3 { margin: 10px 0 7px; font-size: 16px; line-height: 1.4; }
.proposal-card p { margin-bottom: 7px; color: var(--muted); font-size: 16px; }
.affected-list { display: flex; flex-wrap: wrap; gap: 5px; }
.affected-list li, .relation-preview li { color: var(--muted); font: 650 16px/1.45 var(--mono); overflow-wrap: anywhere; }
.affected-list li { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; }
.relation-preview { display: grid; gap: 5px; }
.relation-preview b { color: var(--violet); text-transform: uppercase; }
.proposal-origin { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 9px; color: var(--muted-2); font: 650 14px/1.2 var(--mono); }
.proposal-origin span { color: var(--violet); text-transform: uppercase; }
.proposal-actions { display: grid; grid-template-columns: 1fr .72fr; gap: 7px; margin-top: 10px; }
.accept-button { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); background: color-mix(in srgb, var(--green) 12%, var(--ink-soft)); color: var(--green); }
.reject-control { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.reject-control summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-size: 14px; }
.reject-control label { display: block; margin-bottom: 4px; color: var(--muted-2); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.reject-control textarea { width: 100%; padding: 8px; resize: vertical; border: 1px solid var(--line); border-radius: 7px; color: var(--paper); background: var(--ink); font-size: 16px; }
.reject-button { width: 100%; margin-top: 6px; border-color: color-mix(in srgb, var(--red) 50%, var(--line)); color: var(--red); background: transparent; }

.history-panel { margin-top: 15px; border-top: 1px solid var(--line); }
.history-panel summary { min-height: 46px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--muted); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.history-list { display: grid; gap: 6px; }
.history-event { display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 16px; }
.history-event q { grid-column: 1 / -1; color: var(--paper); }
.history-decision { color: var(--green); font: 750 14px/1.3 var(--mono); text-transform: uppercase; }
.history-rejected .history-decision { color: var(--red); }
.history-empty { color: var(--muted-2); font-size: 16px; }

.evidence-drawer {
  position: absolute;
  z-index: 12;
  top: 132px;
  right: clamp(14px, 2vw, 28px);
  width: min(390px, 48%);
  max-height: calc(100vh - 175px);
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--cyan) 42%, var(--line));
  border-radius: var(--radius);
  background: rgba(20, 25, 22, 0.985);
  box-shadow: 0 28px 80px rgba(0,0,0,0.55);
}
.evidence-drawer > header { position: sticky; z-index: 1; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); background: rgba(20,25,22,0.98); }
.evidence-drawer h2 { margin: 3px 0 0; font-size: 17px; line-height: 1.25; }
.icon-button { width: 44px; min-width: 44px; padding: 0; font-size: 23px; }
.evidence-content { padding: 14px; }
.evidence-content h4 { margin: 14px 0 7px; font-size: 16px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.drawer-verdict { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-verdict span { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--cyan); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.staged-evidence { margin-left: 7px; color: var(--violet); font: 800 14px/1.2 var(--mono); }
.staged-notice { padding: 10px 12px; border: 1px solid var(--violet); border-radius: 7px; background: rgba(185,156,255,0.08); color: var(--muted-2); }
.staged-notice b { display: block; margin-bottom: 5px; color: var(--violet); font: 800 14px/1.2 var(--mono); }
.drawer-claim-text { margin: 13px 0; font-size: 17px; line-height: 1.4; }
.transformation-note, .provenance-note { padding: 10px; border-left: 2px solid var(--amber); background: rgba(232,186,98,0.045); color: var(--muted); font-size: 16px; }
.transformation-note b, .provenance-note b { display: block; margin-bottom: 4px; color: var(--amber); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.drawer-source { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--ink); }
.drawer-source + .drawer-source { margin-top: 8px; }
.drawer-source h4 { margin: 8px 0 5px; color: var(--paper); text-transform: none; letter-spacing: 0; }
.drawer-source p, .drawer-source details { color: var(--muted); font-size: 16px; }
.drawer-source a { display: inline-flex; align-items: center; color: var(--cyan); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.metadata-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metadata-pair div { padding: 7px; border: 1px solid var(--line); border-radius: 7px; }
.metadata-pair dt { color: var(--muted-2); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.metadata-pair dd { margin: 4px 0 0; color: var(--amber); font: 700 16px/1.3 var(--mono); overflow-wrap: anywhere; }
.drawer-claims, .drawer-relations { display: grid; gap: 7px; }
.drawer-claims li, .drawer-relations li { display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; }
.drawer-claims b, .drawer-relations b { color: var(--green); font: 700 14px/1 var(--mono); text-transform: uppercase; }
.drawer-claims span, .drawer-relations span { font-size: 16px; overflow-wrap: anywhere; }
.drawer-claims small, .drawer-relations small { color: var(--muted-2); font-size: 16px; }
.proposal-payload { max-height: 380px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink); color: var(--muted); font: 16px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.muted-copy { color: var(--muted-2); font-size: 16px; }

.activity-panel { margin-top: 15px; border-top: 1px solid var(--line); }
.activity-panel > summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--muted);
  font: 700 14px/1 var(--mono);
  text-transform: uppercase;
}
.activity-export { padding: 10px 0 2px; }
.activity-export > header, .investigation-switcher > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.activity-export h2, .investigation-switcher h2, .source-intake h2, .new-investigation h2 { margin-bottom: 0; font-size: 20px; }
.persistence-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  font: 700 14px/1 var(--mono);
  text-transform: uppercase;
}
.persistence-memory { color: var(--amber); }
.activity-list, .investigation-list { list-style: none; margin: 12px 0 0; padding: 0; }
.activity-list { display: grid; gap: 7px; max-height: 320px; overflow: auto; }
.activity-item { padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink); }
.activity-item > div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted-2); font: 650 14px/1.3 var(--mono); }
.activity-item code { color: var(--cyan); }
.activity-item p { margin: 7px 0 3px; color: var(--paper); font-size: 14px; }
.activity-item small { display: block; color: var(--muted-2); font: 14px/1.35 var(--mono); }
.activity-error { border-color: color-mix(in srgb, var(--red) 42%, var(--line)); }
.activity-error code { color: var(--red); }
.export-actions, .switcher-actions, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.export-actions button, .switcher-actions button, .investigation-actions button, .form-actions button {
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  color: var(--paper);
  background: var(--ink-soft);
  font-weight: 700;
}
.storage-warning, .import-error, #source-intake-error {
  margin: 12px 0 0;
  padding: 10px 11px;
  border-left: 2px solid var(--amber);
  border-radius: 0 7px 7px 0;
  color: var(--paper);
  background: color-mix(in srgb, var(--amber) 8%, var(--ink));
  font-size: 14px;
}
.import-error, #source-intake-error { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--ink)); }

.app-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  padding: 0;
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--paper);
  background: var(--ink-raised);
  box-shadow: 0 30px 110px rgba(0, 0, 0, .68);
}
.app-dialog::backdrop { background: rgba(5, 7, 6, .78); backdrop-filter: blur(5px); }
.dialog-card { position: relative; max-height: min(820px, calc(100vh - 30px)); overflow: auto; padding: 24px; border-radius: inherit; }
.dialog-close { position: absolute; z-index: 2; top: 14px; right: 14px; }
.investigation-switcher > header, .source-intake > header, .new-investigation > header { padding-right: 52px; }
.investigation-switcher > header > span { color: var(--muted-2); font: 650 14px/1.3 var(--mono); }
.investigation-list { display: grid; gap: 9px; }
.investigation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--ink);
}
.investigation-item.is-active { border-color: color-mix(in srgb, var(--cyan) 56%, var(--line)); background: color-mix(in srgb, var(--cyan) 4%, var(--ink)); }
.investigation-open { min-width: 0; padding: 5px; border: 0; text-align: left; cursor: pointer; color: var(--paper); background: transparent; }
.investigation-open span { display: block; }
.investigation-title { font-size: 17px; font-weight: 750; }
.investigation-question { margin-top: 3px; color: var(--muted); font-size: 14px; }
.investigation-meta { margin-top: 7px; color: var(--muted-2); font: 14px/1.35 var(--mono); }
.investigation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 5px; }
.investigation-actions button { padding-inline: 9px; color: var(--muted); font-size: 14px; }
.investigation-actions button:last-child { color: var(--red); }
.switcher-actions button:disabled { cursor: not-allowed; opacity: .45; }
.capacity-reason { margin: 8px 0 0; color: var(--amber); font-size: 14px; }

.source-intake > p, .new-investigation > p { margin: 10px 0 15px; color: var(--muted); }
.source-intake form, .new-investigation form { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.source-intake label, .new-investigation label { margin-top: 4px; color: var(--muted); font: 700 14px/1.3 var(--mono); }
.source-intake input, .source-intake select, .source-intake textarea,
.new-investigation input, .new-investigation textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--paper);
  background: var(--ink);
  font-size: 16px;
}
.source-intake textarea, .new-investigation textarea { resize: vertical; }
.source-intake input:disabled { opacity: .55; }
.source-intake input:focus-visible, .source-intake select:focus-visible, .source-intake textarea:focus-visible,
.new-investigation input:focus-visible, .new-investigation textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.source-intake .form-help, .source-intake #source-intake-error,
.source-intake label, .source-intake input, .source-intake select, .source-intake textarea,
.new-investigation label, .new-investigation input, .new-investigation textarea,
.form-actions { grid-column: 1 / -1; }
.source-intake label[for="source-provenance-kind"], .source-intake #source-provenance-kind,
.source-intake label[for="source-publication-mode"], .source-intake #source-publication-mode,
.source-intake label[for="source-type"], .source-intake #source-type { grid-column: auto; }
.form-help { margin: 0 0 5px; color: var(--muted-2); font-size: 14px; }
.form-actions { justify-content: flex-end; }
.fatal-state { min-height: 420px; display: grid; place-content: center; padding: 30px; text-align: center; }
.fatal-state p { max-width: 560px; color: var(--muted); }

@media (min-width: 1100px) {
  .source-rail, .review-region { max-height: calc(100vh - var(--topbar-height)); overflow-y: auto; overscroll-behavior: contain; }
}

@media (max-width: 1099px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar-case { display: none; }
  .topbar-actions { width: 100%; margin-left: 0; justify-content: flex-start; }
  .workspace { display: flex; flex-direction: column; }
  .argument-region { order: 1; padding-top: 18px; }
  .review-region { order: 2; border-top: 1px solid var(--line); border-left: 0; }
  .source-rail { order: 3; border-top: 1px solid var(--line); border-right: 0; }
  .source-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-region { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
  .review-queue { margin-top: 0; }
  .history-panel { grid-column: 1 / -1; }
  .evidence-drawer { position: static; width: auto; max-height: none; margin-top: 12px; }
  .evidence-drawer > header { position: static; }
}

@media (max-width: 720px) {
  .snapshot-badge { display: none; }
  .tool-status { max-width: calc(100vw - 128px); }
  .argument-header { display: grid; }
  .verdict-block { justify-items: start; }
  .outline-grid, .review-region, .source-list { grid-template-columns: 1fr; }
  .review-region { display: grid; }
  .ask-actions { grid-template-columns: 1fr; }
  .relation-legend { gap: 9px; }
  .argument-graph { min-height: 570px; }
  .investigation-item { grid-template-columns: 1fr; }
  .investigation-actions { justify-content: flex-end; }
  .source-intake form, .new-investigation form { grid-template-columns: 1fr; }
  .source-intake label, .source-intake input, .source-intake select, .source-intake textarea,
  .new-investigation label, .new-investigation input, .new-investigation textarea,
  .source-intake label[for="source-provenance-kind"], .source-intake #source-provenance-kind,
  .source-intake label[for="source-publication-mode"], .source-intake #source-publication-mode,
  .source-intake label[for="source-type"], .source-intake #source-type { grid-column: 1; }
  .dialog-card { padding: 20px 14px; }
}

@media (max-width: 390px) {
  .topbar, .argument-region, .review-region, .source-rail { padding-left: 12px; padding-right: 12px; }
  .topbar-actions { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .tool-status, .reset-button { width: 100%; max-width: none; }
  .section-heading { flex-wrap: wrap; }
  .proposal-actions, .metadata-pair { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
