:root {
  --bg: #070a0d;
  --panel: #0c1116;
  --panel2: #111820;
  --line: #24303b;
  --text: #f2f5f7;
  --muted: #9aa7b2;
  --orange: #f47b36;
  --green: #51d88a;
  --red: #ff6b66;
  --blue: #70a5ff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(circle at 78% 0, rgba(48, 86, 122, .18), transparent 34%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(112, 165, 255, .88);
  outline-offset: 3px;
}

.ic-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 108px 0 96px; }
.ic-hero { display: flex; justify-content: space-between; gap: 40px; align-items: flex-end; margin-bottom: 44px; }
.ic-eyebrow, .ic-kicker { display: block; margin: 0 0 10px; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.ic-hero h1 { margin: 0; font-size: clamp(40px, 6vw, 74px); line-height: .98; letter-spacing: -.055em; }
.ic-lede { margin: 16px 0 0; color: var(--muted); font-size: 18px; }
.ic-loop { display: flex; align-items: center; gap: 9px; color: #72808b; font-size: 11px; font-weight: 700; white-space: nowrap; }
.ic-loop span { transition: color .2s ease; }
.ic-loop .active { color: var(--text); }
.ic-loop i { width: 22px; height: 1px; background: var(--line); }

.ic-intake, .ic-progress, .ic-packet { border: 1px solid var(--line); border-radius: 20px; background: rgba(12, 17, 22, .92); box-shadow: 0 26px 80px rgba(0, 0, 0, .28); padding: 30px; }
.ic-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.ic-section-head h2 { margin: 0; font-size: 26px; letter-spacing: -.025em; }
.ic-section-head > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; text-align: right; }

#ic-form { display: grid; grid-template-columns: 180px 1fr; gap: 20px; margin-top: 26px; }
.ic-field { display: flex; flex-direction: column; gap: 8px; }
.ic-field > span { font-size: 12px; font-weight: 700; color: #c7d0d7; }
.ic-field input, .ic-field textarea, .ic-field select { width: 100%; border: 1px solid #33414d; border-radius: 10px; background: #080c10; color: var(--text); font: inherit; font-size: 15px; outline: none; padding: 13px 14px; transition: border .2s, box-shadow .2s; }
.ic-field textarea { resize: vertical; min-height: 112px; line-height: 1.55; }
.ic-field input:focus, .ic-field textarea:focus, .ic-field select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244, 123, 54, .12); }
.ic-field small { color: #82909b; font-size: 11px; }
.ic-wide { grid-column: 1 / -1; }
.ic-submit-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; margin-top: 6px; }

.ic-submit-row button, .ic-actions button, .ic-actions a, .ic-progress-tools button, .ic-error-actions button { min-height: 44px; border: 1px solid #465561; border-radius: 10px; background: #121920; color: var(--text); font: inherit; font-weight: 800; font-size: 13px; padding: 12px 17px; text-decoration: none; cursor: pointer; }
.ic-submit-row button, #ic-save { display: flex; align-items: center; justify-content: space-between; gap: 60px; border-color: var(--orange); background: var(--orange); color: #0a0d10; min-width: 250px; }
button:disabled { opacity: .58; cursor: not-allowed; }
.ic-submit-row button:disabled { cursor: wait; }
.ic-submit-row p { margin: 0; color: var(--muted); font-size: 12px; }

.ic-error { margin-top: 18px; padding: 13px 15px; border: 1px solid rgba(255, 107, 102, .5); border-radius: 10px; background: rgba(255, 107, 102, .08); color: #ffc1be; font-size: 13px; }
.ic-error-actions { display: flex; gap: 8px; margin-top: 10px; }
.ic-error-actions button { border-color: rgba(255, 107, 102, .5); }
.ic-error-actions button.secondary { border-color: #465561; }

.ic-grounded-banner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 22px; margin-top: 24px; border: 1px solid rgba(244, 123, 54, .48); border-radius: 13px; background: rgba(244, 123, 54, .07); padding: 18px; }
.ic-grounded-banner strong { display: block; font-size: 16px; line-height: 1.4; }
.ic-grounded-banner p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.ic-grounded-banner dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0; }
.ic-grounded-banner dl div { border: 1px solid rgba(244, 123, 54, .25); border-radius: 9px; background: rgba(7, 10, 13, .6); padding: 10px; }
.ic-grounded-banner dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.ic-grounded-banner dd { margin: 4px 0 0; font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.ic-grounded-result { border-color: rgba(244, 123, 54, .52); background: rgba(244, 123, 54, .06); }
.ic-grounded-result h4 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.ic-grounded-delta { font-size: 15px !important; color: var(--text) !important; }

.ic-progress, .ic-packet { margin-top: 24px; }
.ic-progress-line { height: 4px; background: #1b252e; border-radius: 4px; overflow: hidden; margin: 20px 0 12px; }
.ic-progress-line span { display: block; width: 3%; height: 100%; background: linear-gradient(90deg, var(--orange), #ffc076); transition: width .45s ease; }
.ic-progress-tools { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 16px; }
.ic-progress-tools p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.ic-progress-tools button { min-height: 36px; padding: 8px 12px; font-size: 11px; }
.ic-agents { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ic-agent { min-height: 106px; border: 1px solid var(--line); border-radius: 11px; background: #090e12; padding: 12px; }
.ic-agent span { display: block; width: 8px; height: 8px; border-radius: 50%; background: #52616d; margin-bottom: 20px; }
.ic-agent.running { border-color: rgba(244, 123, 54, .5); }
.ic-agent.running span { background: var(--orange); box-shadow: 0 0 14px var(--orange); animation: pulse 1.2s infinite; }
.ic-agent.done span { background: var(--green); }
.ic-agent b { display: block; font-size: 12px; }
.ic-agent small { display: block; color: var(--muted); font-size: 10px; margin-top: 6px; }
.ic-disclaimer { margin: 18px 0 0; color: #75828d; font-size: 10px; line-height: 1.5; }

/* ── Live evidence layer: filed reports readable DURING the run ── */
.ic-agent.done { cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.ic-agent.done:hover, .ic-agent.done:focus-visible { border-color: var(--orange); transform: translateY(-2px); outline: none; }
.ic-agent.done small { color: var(--orange); }
.ic-lean { border: 1px solid var(--line); border-radius: 11px; background: #090e12; padding: 14px 16px; margin-top: 14px; }
.ic-lean-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.ic-lean-head b { font-size: 12px; }
.ic-lean-head span { color: var(--orange); font-size: 11px; font-weight: 700; }
.ic-lean-track { position: relative; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(233, 87, 74, .55), #38404b 45%, #38404b 55%, rgba(63, 185, 80, .55)); }
.ic-lean-track i { position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; border-radius: 50%;
  background: var(--orange); border: 2px solid #090e12; transform: translate(-50%, -50%);
  transition: left .5s cubic-bezier(.22,.61,.36,1); }
.ic-lean-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.ic-lean-note { margin: 10px 0 0; color: #75828d; font-size: 10px; line-height: 1.5; }
.ic-tape { border: 1px solid var(--line); border-radius: 11px; background: #090e12; padding: 12px 14px; margin-top: 10px; }
.ic-tape-head { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.ic-tape-head span { color: var(--muted); font-size: 10px; font-weight: 400; margin-left: 6px; }
.ic-tape-row { display: grid; grid-template-columns: 62px 110px 1fr; gap: 10px; align-items: baseline; width: 100%;
  text-align: left; background: none; border: 0; border-top: 1px solid rgba(255,255,255,.04); padding: 7px 2px;
  color: var(--muted); font: inherit; cursor: pointer; animation: icTapeIn .35s ease; }
.ic-tape-row:hover span, .ic-tape-row:focus-visible span { color: #d6dde4; }
.ic-tape-row time { color: #5b6771; font-size: 10px; font-family: ui-monospace, Menlo, monospace; }
.ic-tape-row b { color: var(--orange); font-size: 11px; }
.ic-tape-row span { font-size: 11px; line-height: 1.5; }
.ic-tape-row.chair { cursor: default; border-top-color: rgba(244,123,54,.35); }
.ic-tape-row.chair b { color: var(--green); }
.ic-tape-row.chair span { color: #d6dde4; }
@keyframes icTapeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.ic-report-view { border: 1px solid rgba(244,123,54,.4); border-radius: 11px; background: #0b1015; padding: 16px 18px; margin-top: 10px; }
.ic-report-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ic-report-head b { font-size: 13px; }
.ic-report-head button { background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 11px; padding: 4px 9px; cursor: pointer; }
.ic-report-head button:hover { border-color: var(--orange); color: var(--orange); }
.ic-report-view p { margin: 0 0 10px; color: #c3ccd4; font-size: 12px; line-height: 1.65; }

/* ── Rendered report markdown (viewer + docket) ─────────────────────────── */
.ic-report-view .ic-md-h, .ic-md .ic-md-h { margin: 14px 0 6px; color: var(--orange); font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .09em; }
.ic-report-view .ic-md-h:first-child, .ic-md .ic-md-h:first-child { margin-top: 0; }
.ic-report-view ul, .ic-report-view ol, .ic-md ul, .ic-md ol { margin: 0 0 10px; padding-left: 20px; color: #c3ccd4; font-size: 12px; line-height: 1.65; }
.ic-report-view li, .ic-md li { margin: 0 0 5px; }
.ic-report-view strong, .ic-md strong { color: #e8edf2; font-weight: 700; }
.ic-report-view code, .ic-md code { background: rgba(255,255,255,.06); border-radius: 4px; padding: 1px 5px;
  font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: #d6dde4; }
.ic-report-view a, .ic-md a { color: var(--blue); text-decoration: none; }
.ic-report-view a:hover, .ic-md a:hover { text-decoration: underline; }
.ic-md-tablewrap { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 9px; }
.ic-md-table { width: 100%; border-collapse: collapse; font-size: 11px; line-height: 1.5; }
.ic-md-table th { text-align: left; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; background: rgba(255,255,255,.03); padding: 7px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ic-md-table td { color: #c3ccd4; padding: 6px 11px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: top; }
.ic-md-table tbody tr:last-child td { border-bottom: 0; }
.ic-md-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.015); }
.ic-md-table tbody tr:hover td { background: rgba(244,123,54,.05); }
.ic-md-table th.num, .ic-md-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ic-md-table td:first-child { color: #e8edf2; font-weight: 600; }
.ic-md p { margin: 0 0 10px; color: #c3ccd4; font-size: 12px; line-height: 1.65; }

@media (max-width: 720px) { .ic-tape-row { grid-template-columns: 54px 1fr; } .ic-tape-row span { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: reduce) {
  .ic-agent.done, .ic-lean-track i { transition: none; }
  .ic-agent.done:hover { transform: none; }
  .ic-tape-row { animation: none; }
}

.ic-packet { background: transparent; border: none; box-shadow: none; padding: 0; }
.ic-packet:focus { outline: none; }
.ic-packet-hero { display: grid; grid-template-columns: 150px 1fr 130px; gap: 30px; align-items: center; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(135deg, #111921, #0b1015); padding: 30px; }
.ic-verdict { display: inline-block; border: 1px solid var(--blue); border-radius: 999px; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .15em; padding: 7px 11px; }
.ic-packet-hero h2 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -.035em; }
.ic-packet-hero p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.ic-confidence { text-align: right; }
.ic-confidence span { display: block; font-size: 39px; font-weight: 800; letter-spacing: -.05em; }
.ic-confidence small { color: var(--muted); }

.ic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.ic-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 21px; }
.ic-span-2 { grid-column: 1 / -1; }
.ic-card h3 { margin: 0 0 10px; font-size: 17px; }
.ic-card p, .ic-card li { color: #b3bdc5; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.ic-card ul { margin: 0; padding-left: 18px; }
.ic-card li + li { margin-top: 7px; }
.ic-card a { color: var(--orange); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.ic-kicker.good { color: var(--green); }
.ic-kicker.bad { color: var(--red); }
.ic-governance { border-color: rgba(112, 165, 255, .44); background: rgba(112, 165, 255, .06); }
.ic-governance .ic-kicker { color: var(--blue); }
.ic-scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ic-scenarios > div { border: 1px solid #2a3741; border-radius: 10px; background: #090e12; padding: 14px; }
.ic-scenarios b { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.ic-scenarios p { margin-bottom: 0; }
.ic-card dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.ic-card dt { color: var(--muted); font-size: 11px; }
.ic-card dd { margin: 2px 0 0; font-size: 14px; font-weight: 700; }
.ic-risk { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.ic-sources { columns: 2; }
.ic-sources a { word-break: break-all; }

.ic-quality { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ic-quality > div { border: 1px solid #2a3741; border-radius: 10px; background: #090e12; padding: 14px; }
.ic-quality b { display: block; font-size: 20px; }
.ic-quality span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.ic-docket { padding: 0; overflow: hidden; }
.ic-docket > summary { cursor: pointer; padding: 21px; font-size: 15px; font-weight: 800; }
.ic-docket > p { margin: -8px 21px 18px; }
#ic-docket { display: grid; gap: 8px; padding: 0 21px 21px; }
.ic-docket-report { border: 1px solid #2a3741; border-radius: 10px; background: #090e12; padding: 14px; }
.ic-docket-report h4 { margin: 0 0 8px; font-size: 12px; }
.ic-docket-report > p { margin: 0; white-space: pre-wrap; } /* legacy raw-text path only; rendered reports live in .ic-md */
.ic-docket-report .ic-md p:last-child, .ic-docket-report .ic-md ul:last-child, .ic-docket-report .ic-md ol:last-child { margin-bottom: 0; }

.ic-actions { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.ic-actions-primary, .ic-actions-secondary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ic-actions button, .ic-actions a { display: inline-flex; align-items: center; justify-content: center; }
.ic-receipt { margin-top: 12px; border: 1px solid rgba(81, 216, 138, .46); border-radius: 11px; background: rgba(81, 216, 138, .07); padding: 14px; color: #b7f2ce; font-size: 13px; }

@keyframes pulse { 50% { opacity: .45; } }

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

@media (max-width: 900px) {
  .ic-shell { width: min(calc(100% - 24px), 1180px); padding-top: 34px; }
  .ic-hero { display: block; }
  .ic-loop { margin-top: 24px; overflow: auto; padding-bottom: 4px; }
  .ic-agents { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ic-packet-hero { grid-template-columns: 1fr; }
  .ic-confidence { text-align: left; }
  .ic-grid { grid-template-columns: 1fr; }
  .ic-span-2 { grid-column: auto; }
  .ic-scenarios { grid-template-columns: 1fr; }
  .ic-quality { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ic-section-head { display: block; }
  .ic-section-head > p { text-align: left; margin-top: 10px; }
  .ic-sources { columns: 1; }
  .ic-grounded-banner { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .ic-intake, .ic-progress { padding: 20px; }
  #ic-form { grid-template-columns: 1fr; }
  .ic-wide, .ic-submit-row { grid-column: auto; }
  .ic-submit-row { align-items: stretch; flex-direction: column; }
  .ic-submit-row button { width: 100%; min-width: 0; }
  .ic-progress-tools { align-items: flex-start; flex-direction: column; }
  .ic-progress-tools button { width: 100%; }
  .ic-actions, .ic-actions-primary, .ic-actions-secondary { align-items: stretch; flex-direction: column; width: 100%; }
  .ic-actions * { width: 100%; text-align: center; }
  .ic-agents { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ic-card dl { grid-template-columns: 1fr; }
  .ic-grounded-banner dl { grid-template-columns: 1fr; }
}

/* ── Packet exports (QL Notes / QL Slides / PDF) ── */
.ic-export-msg { font-size: 11px; color: #8b949e; }
.ic-export-msg a { color: #58a6ff; }
#ic-export-channel { background: #10151c; border: 1px solid #2a3240; color: #e6edf3; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
/* PDF export = the browser's print pipeline over ONLY the packet, so
   "Download PDF" yields a clean IC memo, not a screenshot of app chrome. */
@media print {
  body * { visibility: hidden !important; }
  #ic-packet, #ic-packet * { visibility: visible !important; }
  #ic-packet { position: absolute; left: 0; top: 0; width: 100%; }
  #ic-packet .ic-actions, #ic-packet .ic-docket { display: none !important; }
  #ic-packet, #ic-packet .ic-card { background: #fff !important; color: #111 !important; border-color: #bbb !important; }
  #ic-packet h2, #ic-packet h3, #ic-packet b, #ic-packet strong, #ic-packet .ic-verdict { color: #000 !important; }
}

/* ── Packet cards: platform hover language + chart figures ── */
.ic-card { transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.ic-card:hover { border-color: rgba(244, 123, 54, .55); transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0, 0, 0, .4); }
.ic-ladder { margin-top: 12px; }
.ic-ladder svg, #ic-engine-factors svg { margin-top: 8px; }
/* Scenario columns read as three distinct paths, not one grey block. */
.ic-scenarios > div { border-top: 3px solid transparent; border-radius: 8px; padding-top: 8px; transition: background .15s ease; }
.ic-scenarios > div:nth-child(1) { border-top-color: #51d88a; }
.ic-scenarios > div:nth-child(2) { border-top-color: #70a5ff; }
.ic-scenarios > div:nth-child(3) { border-top-color: #ff6b66; }
.ic-scenarios > div:hover { background: rgba(255, 255, 255, .025); }
@media (prefers-reduced-motion: reduce) {
  .ic-card { transition: none; }
  .ic-card:hover { transform: none; }
}
