/* ══════════════════════════════════════════════════════════
   Spec Compare — BCS Technology
   ══════════════════════════════════════════════════════════ */

:root {
  /* Black canvas, BCS orange accent. */
  --bg: #0a0a0b;
  --bg-2: #0f0f11;
  --surface: #151517;
  --surface-2: #1b1b1e;
  --surface-3: #232327;
  --border: #27272b;
  --border-2: #37373d;

  --text: #f3f3f4;
  --text-2: #a1a1a9;
  --text-3: #6c6c75;

  --accent: #f0562a;        /* BCS orange */
  --accent-2: #f7941e;      /* BCS light orange */
  --accent-soft: #f0562a24;

  /* Severity stays clear of the brand orange: rose, gold, green, violet, sky. */
  --major: #ff4d63;
  --major-bg: #ff4d631a;
  --minor: #f5c518;
  --minor-bg: #f5c5181a;
  --match: #2fd07a;
  --match-bg: #2fd07a1a;
  --missing: #b98bff;
  --missing-bg: #b98bff1a;
  --extra: #4fb3f5;
  --extra-bg: #4fb3f51a;

  --r-lg: 18px;
  --r: 13px;
  --r-sm: 9px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 20px -4px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 24px 60px -18px rgba(0, 0, 0, 0.7);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI",
    system-ui, Roboto, "Helvetica Neue", sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-2: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --surface-3: #ededf0;
  --border: #e4e4e8;
  --border-2: #d3d3da;

  --text: #0c0c0d;
  --text-2: #55555e;
  --text-3: #88888f;

  --accent: #e04a1c;        /* BCS orange, darkened for contrast on white */
  --accent-2: #ef8b0d;
  --accent-soft: #e04a1c14;

  --major: #d6284a;
  --major-bg: #d6284a12;
  --minor: #a67c00;
  --minor-bg: #a67c0014;
  --match: #06895c;
  --match-bg: #06895c12;
  --missing: #7c3aed;
  --missing-bg: #7c3aed12;
  --extra: #0284c7;
  --extra-bg: #0284c712;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-2: 0 4px 16px -4px rgba(16, 24, 40, 0.1);
  --shadow-3: 0 24px 60px -20px rgba(16, 24, 40, 0.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.18; letter-spacing: -0.022em; font-weight: 640; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; display: block; }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

kbd {
  font: 500 11px/1 var(--mono);
  padding: 3px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text-2);
}

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Ambient light ─────────────────────────────────────────── */
.glow {
  /* Absolute, not fixed — it belongs to the top of the page and should scroll
     away, otherwise it smears behind the sticky header on the results view. */
  position: absolute;
  inset: -20% -20% auto -20%;
  height: 70vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(46% 52% at 28% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(40% 48% at 76% 4%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 70%);
  filter: blur(20px);
  opacity: 0.85;
}
:root[data-theme="light"] .glow { opacity: 0.5; }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-in {
  max-width: 1220px; margin: 0 auto;
  padding: 11px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }

/* Two variants, sitting directly on the page background. bcs-logo-dark.png has
   the "TECHNOLOGY" wordmark lifted to near-white so it reads on black; the
   original keeps it dark grey for the light theme. Source is 209x117 — at 30px
   tall it downscales ~4x and stays crisp on hi-dpi screens. */
.logo-mark { height: 30px; width: auto; display: block; }
.logo-mark.on-light { display: none; }
:root[data-theme="light"] .logo-mark.on-dark { display: none; }
:root[data-theme="light"] .logo-mark.on-light { display: block; }

.logo-rule { width: 1px; height: 20px; background: var(--border-2); flex: none; }

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text b { font-size: 14.5px; font-weight: 640; letter-spacing: -0.02em; white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.pill {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 13px;
  border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface);
  font-size: 12.5px; font-weight: 520; color: var(--text-2);
  letter-spacing: -0.005em;
}

.pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); flex: none;
}
.pulse.ok { background: var(--match); box-shadow: 0 0 0 3px color-mix(in srgb, var(--match) 22%, transparent); }
.pulse.bad { background: var(--major); box-shadow: 0 0 0 3px color-mix(in srgb, var(--major) 22%, transparent); }

.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  font-size: 17px; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface);
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-2); }

.i-sun { display: none; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }

/* ── Layout ──────────────────────────────────────────────── */
main { position: relative; z-index: 1; max-width: 1220px; margin: 0 auto; padding: 44px 26px 96px; }

.stage-head { text-align: center; max-width: 620px; margin: 0 auto 34px; }
.stage-head h1 { font-size: 34px; letter-spacing: -0.033em; font-weight: 660; }
.stage-head p { margin-top: 11px; color: var(--text-2); font-size: 15.5px; }

/* ── Input panes ─────────────────────────────────────────── */
.io {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

.io-divider {
  display: grid; place-items: center;
  width: 56px; position: relative;
}
.io-divider::before {
  content: ""; position: absolute; top: 46px; bottom: 46px; width: 1px;
  background: linear-gradient(180deg, transparent, var(--border) 22%, var(--border) 78%, transparent);
}
.io-divider span {
  position: relative;
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 11px; font-weight: 620; color: var(--text-3);
  letter-spacing: 0.04em; text-transform: uppercase;
}

.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-2);
  transition: border-color 0.2s;
}
.pane:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

.pane-head { display: flex; align-items: center; gap: 10px; }
.pane-head h2 { font-size: 14px; font-weight: 560; color: var(--text-2); flex: 1; letter-spacing: -0.01em; }

.pane-tag {
  font-size: 10.5px; font-weight: 680; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
}
.tag-ordered { color: var(--accent); background: var(--accent-soft); }
.tag-received { color: var(--text-2); background: color-mix(in srgb, var(--text) 9%, transparent); }

.link-btn {
  font-size: 12.5px; color: var(--text-3);
  padding: 3px 6px; border-radius: 6px;
  transition: color 0.16s, background 0.16s;
}
.link-btn:hover { color: var(--text); background: var(--surface-2); }

.field { position: relative; }

.field textarea {
  width: 100%; height: 268px; resize: vertical;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 12.8px; line-height: 1.72;
  letter-spacing: -0.005em;
  transition: border-color 0.18s, background 0.18s;
}
.field textarea::placeholder { color: var(--text-3); }
.field textarea:focus { outline: none; border-color: var(--border-2); background: var(--surface); }

.drop-veil {
  position: absolute; inset: 0;
  display: none; place-items: center;
  border-radius: var(--r);
  border: 1.5px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-2));
  backdrop-filter: blur(3px);
}
.drop-veil > div { display: grid; justify-items: center; gap: 8px; color: var(--accent); font-size: 13px; font-weight: 560; }
.drop-veil svg { width: 26px; height: 26px; }
.field.dragging .drop-veil { display: grid; }

/* Empty-state route into the assistant. */
.assist {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  background: linear-gradient(100deg, var(--accent-soft), transparent 78%);
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.18s var(--ease);
  animation: rise 0.32s var(--ease) both;
}
.assist:hover {
  border-color: var(--accent);
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 17%, transparent), transparent 78%);
  transform: translateY(-1px);
}
.assist:active { transform: translateY(0); }

.assist-ico {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 18px; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 12px -3px var(--accent);
}
.assist-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.assist-copy b { font-size: 13.4px; font-weight: 600; color: var(--text); letter-spacing: -0.012em; }
.assist-copy em { font-style: normal; font-size: 12px; color: var(--text-2); line-height: 1.45; }
.assist-go { width: 17px; height: 17px; flex: none; color: var(--accent); }

.pane-foot { display: flex; align-items: center; gap: 8px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 520; color: var(--text-2);
  transition: color 0.16s, background 0.16s, border-color 0.16s, transform 0.16s;
}
.chip-btn svg { width: 14px; height: 14px; }
.chip-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-2); }
.chip-btn:active { transform: scale(0.97); }

.glow-btn {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: var(--accent-soft);
}
.glow-btn:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); }

.micro { font-size: 11.5px; color: var(--text-3); }
.count { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Attachments ─────────────────────────────────────────── */
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }

.files li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px;
  animation: rise 0.3s var(--ease) both;
}
.files .fname { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .fstate { margin-left: auto; color: var(--text-3); flex: none; font-size: 11.5px; }
.files li.done { border-color: color-mix(in srgb, var(--match) 30%, transparent); }
.files li.done .fstate { color: var(--match); }
.files li.warn { border-color: color-mix(in srgb, var(--minor) 34%, transparent); background: var(--minor-bg); }
.files li.warn .fstate { color: var(--minor); text-align: right; }

.spin-dot {
  width: 11px; height: 11px; flex: none; border-radius: 50%;
  border: 1.6px solid var(--border-2); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

/* ── Launch ──────────────────────────────────────────────── */
.launch { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; }

.cta {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 8px 0 20px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 14.5px; font-weight: 600; letter-spacing: -0.012em;
  box-shadow: 0 6px 24px -8px var(--accent), inset 0 1px 0 rgba(255,255,255,0.24);
  transition: transform 0.18s var(--ease), box-shadow 0.18s, filter 0.18s;
}
.cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 30px -8px var(--accent), inset 0 1px 0 rgba(255,255,255,0.3); }
.cta:active:not(:disabled) { transform: translateY(0) scale(0.985); }
.cta:disabled {
  background: var(--surface-3); color: var(--text-3);
  box-shadow: none; cursor: not-allowed;
}
.cta:disabled .cta-kbd { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-3); }
.cta-in { display: inline-flex; align-items: center; gap: 9px; }
.cta-in svg { width: 17px; height: 17px; }
.cta-kbd {
  background: rgba(255, 255, 255, 0.18); color: #fff;
  padding: 5px 7px; border-radius: 7px; font-size: 11px;
}
.cta.full { width: 100%; justify-content: center; padding: 0 20px; }

.ghost-btn {
  height: 46px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface);
  font-size: 13.5px; font-weight: 540; color: var(--text-2);
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.ghost-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-2); }
.ghost-btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }

/* ── Working state ───────────────────────────────────────── */
.working { margin-top: 46px; animation: fade 0.3s var(--ease) both; }

.working-card {
  max-width: 420px; margin: 0 auto;
  display: grid; justify-items: center; gap: 14px;
  padding: 30px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-2);
}

.orbit { position: relative; width: 46px; height: 46px; }
.orbit i {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.8px solid transparent; border-top-color: var(--accent);
  animation: spin 1.3s linear infinite;
}
.orbit i:nth-child(2) { inset: 7px; border-top-color: var(--accent-2); animation-duration: 1.9s; animation-direction: reverse; }
.orbit i:nth-child(3) { inset: 14px; border-top-color: var(--match); animation-duration: 2.6s; }

.working-stage { font-size: 15px; font-weight: 580; letter-spacing: -0.015em; }
.working-note { font-size: 12.5px; color: var(--text-3); }

.track { width: 100%; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.track-fill {
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1.1s var(--ease);
}

.skeletons { max-width: 900px; margin: 22px auto 0; display: grid; gap: 10px; }
.sk {
  height: 74px; border-radius: var(--r);
  border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 240% 100%;
  animation: shimmer 1.5s linear infinite;
}
.sk:nth-child(2) { animation-delay: 0.16s; opacity: 0.75; }
.sk:nth-child(3) { animation-delay: 0.32s; opacity: 0.5; }

/* ── Verdict ─────────────────────────────────────────────── */
/* Clear the sticky top bar when we scroll results into view. */
#results { margin-top: 46px; scroll-margin-top: 72px; }

.verdict {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
  padding: 26px 28px 22px;
  box-shadow: var(--shadow-2);
  animation: rise 0.5s var(--ease) both;
}

.verdict-glow {
  position: absolute; top: -60%; left: -10%; width: 60%; height: 200%;
  pointer-events: none; filter: blur(46px); opacity: 0.5;
  background: radial-gradient(closest-side, var(--vc, var(--accent)), transparent);
}

.verdict-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 26px; }

.verdict-tag {
  display: inline-block;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; margin-bottom: 11px;
  color: var(--vc); background: color-mix(in srgb, var(--vc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--vc) 30%, transparent);
}
.verdict h2 { font-size: 21px; max-width: 44ch; letter-spacing: -0.026em; }
.verdict-sub { margin-top: 8px; font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 9px; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }

.verdict-score { position: relative; flex: none; width: 96px; height: 96px; display: grid; place-items: center; }
.ring { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg {
  stroke: var(--vc);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.1s var(--ease) 0.25s;
}
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; }
.ring-label b { font-size: 22px; font-weight: 640; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; }

.bar { position: relative; display: flex; height: 7px; border-radius: 99px; overflow: hidden; margin-top: 22px; background: var(--surface-3); }
.bar i { display: block; height: 100%; width: 0; transition: width 0.9s var(--ease) 0.3s; }

.legend { position: relative; display: flex; flex-wrap: wrap; gap: 16px; margin-top: 13px; }
.legend button {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2);
  transition: color 0.16s;
}
.legend button:hover { color: var(--text); }
.legend .swatch { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.legend b { font-variant-numeric: tabular-nums; font-weight: 620; color: var(--text); }

.prose {
  margin: 22px 0 26px;
  padding: 16px 20px;
  border-left: 2px solid var(--border-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: linear-gradient(90deg, var(--surface), transparent 70%);
  font-size: 14.6px; line-height: 1.68; color: var(--text-2);
  animation: rise 0.5s var(--ease) 0.08s both;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 14px;
  animation: rise 0.5s var(--ease) 0.12s both;
}

.segments {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px;
}
.segments button {
  padding: 5px 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 540; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.16s, background 0.16s;
  text-transform: capitalize;
}
.segments button:hover { color: var(--text); }
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.segments .n { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--text-3); }
.segments button[aria-pressed="true"] .n { color: var(--text-2); }

.toolbar-right { display: flex; align-items: center; gap: 8px; }

.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.search input {
  height: 32px; width: 180px; padding: 0 11px 0 30px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); font-size: 12.5px;
  transition: width 0.2s var(--ease), border-color 0.16s;
}
.search input:focus { outline: none; width: 220px; border-color: var(--border-2); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Result cards ────────────────────────────────────────── */
.cards { display: grid; gap: 9px; }

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  padding: 15px 18px 15px 20px;
  overflow: hidden;
  animation: rise 0.42s var(--ease) both;
  animation-delay: var(--d, 0ms);
  transition: border-color 0.18s, transform 0.18s var(--ease), box-shadow 0.18s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c);
}
.card:hover { border-color: var(--border-2); transform: translateX(2px); box-shadow: var(--shadow-2); }
.card.is-major { background: linear-gradient(90deg, var(--major-bg), transparent 40%); }

.card-top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 11px; }
.card-field { font-size: 14.5px; font-weight: 600; letter-spacing: -0.016em; flex: 1; }

.status {
  font-size: 10px; font-weight: 720; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 3.5px 8px; border-radius: 5px; flex: none;
  color: var(--c); background: var(--cbg);
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
}

.diff {
  display: grid;
  grid-template-columns: 1fr 26px 1fr;
  align-items: center;
  gap: 4px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  margin-bottom: 11px;
}
.side { min-width: 0; }
.side small {
  display: block; font-size: 9.5px; font-weight: 640; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 3px;
}
.side span {
  display: block; font-family: var(--mono); font-size: 12.6px; line-height: 1.5;
  word-break: break-word; letter-spacing: -0.01em;
}
.side.to span { color: var(--c); font-weight: 560; }
.side.eq span { color: var(--text); }
.side span.nil { font-family: var(--sans); color: var(--text-3); font-style: italic; }
.arrow { display: grid; place-items: center; color: var(--text-3); font-size: 15px; }
.arrow svg { width: 16px; height: 16px; }

.card-note { font-size: 13.4px; line-height: 1.6; color: var(--text-2); }
.card-rec {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 9px; font-size: 13.2px; font-weight: 540; color: var(--text);
}
.card-rec svg { width: 15px; height: 15px; flex: none; margin-top: 2.5px; color: var(--c); }

.empty-note { text-align: center; color: var(--text-3); font-size: 13.5px; padding: 40px 0; }

/* ── Follow-ups ──────────────────────────────────────────── */
.followups {
  margin-top: 26px; padding: 20px 22px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
}
.followups h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }
.followups h3 svg { width: 17px; height: 17px; color: var(--minor); }
.followups ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.followups li {
  position: relative; padding-left: 20px;
  font-size: 13.6px; line-height: 1.55; color: var(--text-2);
}
.followups li::before {
  content: ""; position: absolute; left: 6px; top: 9px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--minor);
}

.fineprint { margin-top: 20px; font-size: 11.8px; line-height: 1.6; color: var(--text-3); }

/* ── Drawer ──────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(3px);
  animation: fade 0.24s var(--ease) both;
}

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(440px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  animation: slide-in 0.34s var(--ease) both;
}

.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 16px; border-bottom: 1px solid var(--border);
}
.drawer-title { display: flex; align-items: center; gap: 11px; }
.drawer-title b { display: block; font-size: 14px; font-weight: 620; }
.drawer-title em { font-style: normal; font-size: 11.5px; color: var(--text-3); }

.avatar {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px; font-size: 17px; color: #fff;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24);
}

.thread { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }

.msg {
  max-width: 86%; padding: 10px 13px;
  font-size: 13.6px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  animation: rise 0.32s var(--ease) both;
}
.msg.bot {
  align-self: flex-start;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
}
.msg.me {
  align-self: flex-end; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-radius: 14px 14px 4px 14px;
}
.msg.typing { color: var(--text-3); display: flex; gap: 4px; align-items: center; }
.msg.typing i {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  animation: blink 1.2s infinite both;
}
.msg.typing i:nth-child(2) { animation-delay: 0.2s; }
.msg.typing i:nth-child(3) { animation-delay: 0.4s; }

.collected {
  padding: 10px 16px; border-top: 1px solid var(--border);
  background: var(--surface-2); font-size: 11.8px; color: var(--text-3);
}
.collected b { color: var(--text); font-variant-numeric: tabular-nums; }

.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.composer input {
  flex: 1; height: 38px; padding: 0 13px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-2); font-size: 13.5px;
  transition: border-color 0.16s;
}
.composer input:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

.send {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  transition: transform 0.16s, filter 0.16s;
}
.send:hover { transform: scale(1.05); }
.send:disabled { filter: grayscale(0.6) brightness(0.75); cursor: not-allowed; transform: none; }

.drawer-foot { padding: 0 16px 16px; }

/* ── Toasts ──────────────────────────────────────────────── */
.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; border-radius: 11px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  box-shadow: var(--shadow-3);
  font-size: 13.2px; font-weight: 520;
  animation: toast-in 0.3s var(--ease) both;
  max-width: 90vw;
}
.toast.err { border-color: color-mix(in srgb, var(--major) 46%, transparent); }
.toast.err .tdot { background: var(--major); }
.toast.ok .tdot { background: var(--match); }
.tdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.out { animation: toast-out 0.24s var(--ease) both; }

/* ── Motion ──────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes shimmer { to { background-position: -240% 0; } }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

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

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 940px) {
  .io { grid-template-columns: 1fr; gap: 12px; }
  .io-divider { width: auto; height: 30px; }
  .io-divider::before { top: 0; bottom: 0; left: 50%; width: 1px; height: auto; }
  .stage-head h1 { font-size: 27px; }
  main { padding: 30px 18px 70px; }
  .verdict-top { flex-direction: column; align-items: flex-start; gap: 18px; }
  .toolbar { align-items: stretch; }
  .search input, .search input:focus { width: 100%; }
  .toolbar-right { flex: 1; }
  .segments { overflow-x: auto; }
}

@media (max-width: 640px) {
  .topbar-in { padding: 10px 16px; }
  .logo { gap: 9px; }
  .logo-mark { height: 25px; }
  .pill { padding: 0 10px; }
  .pill #statusText { display: none; }
}

@media (max-width: 560px) {
  .diff { grid-template-columns: 1fr; gap: 10px; }
  .arrow { transform: rotate(90deg); justify-self: start; }
  .launch { flex-direction: column; align-items: stretch; }
  .cta { justify-content: center; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .topbar, .stage, .toolbar, .drawer, .scrim, .toasts, .working, .glow,
  .verdict-glow { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  #results { margin: 0; }
  .card, .verdict, .followups { break-inside: avoid; border: 1px solid #bbb; box-shadow: none; animation: none; }
  .card { margin-bottom: 8px; }
}
