:root {
  color-scheme: light;
  font-family: Inter, Aptos, "Segoe UI", system-ui, sans-serif;
  color: #2a3439;
  background: #eef1f2;
  font-synthesis: none;
  --ink: #2a3439;
  --ink-soft: #556167;
  --muted: #7c878c;
  --paper: #fefefa;
  --surface: #ffffff;
  --soft: #f7f7f7;
  --canvas: #eef1f2;
  --line: #d9dfe2;
  --line-strong: #b9c3c8;
  --blue-100: #b9d9eb;
  --blue-200: #9eb9d4;
  --blue-500: #6699cc;
  --blue-700: #3d6f98;
  --signal: #d95745;
  --success: #426f62;
  --warning: #9a6b2f;
  --danger: #8d3f3f;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(42, 52, 57, 0.08);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 14% 12%, rgba(185,217,235,.24), transparent 34%), var(--canvas); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.loading-screen { min-height: 100vh; display: grid; place-items: center; color: var(--muted); letter-spacing: .08em; font-size: 12px; }
.eyebrow { color: var(--blue-700); letter-spacing: .14em; text-transform: uppercase; font: 700 10px/1.2 ui-monospace, monospace; }
.button { border: 1px solid var(--line-strong); background: var(--surface); min-height: 44px; padding: 10px 16px; cursor: pointer; font-size: 12px; transition: .2s ease; }
.button span { margin-left: 18px; }
.button:hover { border-color: var(--blue-700); transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button.primary { background: var(--ink); border-color: var(--ink); color: white; box-shadow: 0 9px 24px rgba(42,52,57,.14); }
.button.primary:hover { background: #182125; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid var(--line); background: var(--soft); text-transform: uppercase; letter-spacing: .08em; font: 700 8px/1.2 ui-monospace, monospace; white-space: nowrap; }
.status-pill[data-state="partial"], .status-pill[data-state="evidence review"], .status-pill[data-state="evidence_review"] { background: #fff8ea; border-color: #d6b879; color: #6f511f; }
.status-pill[data-state="ready"], .status-pill[data-state="pass"], .status-pill[data-state="complete"] { background: #edf5f1; border-color: #8bb1a5; color: #315b50; }
.status-pill[data-state="dry_run"] { background: #edf3f8; border-color: var(--blue-200); color: var(--blue-700); }
.error-card { border-left: 3px solid var(--danger); background: #fbf0f0; padding: 10px 12px; color: #6d3030; font-size: 12px; line-height: 1.5; }

/* Login */
.login-shell { min-height: 100vh; position: relative; display: grid; place-items: center; overflow: hidden; padding: 28px; }
.login-card { position: relative; z-index: 2; width: min(520px, 100%); background: rgba(254,254,250,.92); border: 1px solid rgba(42,52,57,.14); padding: clamp(30px, 5vw, 58px); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-mark { width: 48px; height: 44px; display: grid; place-items: center; border: 1px solid var(--ink); margin-bottom: 44px; font-family: Georgia, serif; }
.login-card h1 { margin: 12px 0 16px; font-size: clamp(38px, 6vw, 58px); line-height: .98; letter-spacing: -.04em; }
.login-card > p { color: var(--ink-soft); line-height: 1.65; font-size: 14px; }
.login-card form { display: grid; gap: 16px; margin-top: 30px; }
.login-card label, .project-form label, .provenance-grid label { display: grid; gap: 7px; color: var(--muted); letter-spacing: .04em; font-size: 10px; text-transform: uppercase; }
.login-card input, .project-form input, .project-form textarea, .provenance-grid input { width: 100%; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; padding: 10px 2px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.login-card small { display: block; margin-top: 20px; color: var(--muted); line-height: 1.5; }
.orbital-field { position: absolute; inset: 0; pointer-events: none; }
.orbital-field i { position: absolute; width: 66vw; height: 66vw; border: 1px solid rgba(102,153,204,.2); border-radius: 50%; right: -24vw; top: -18vw; }
.orbital-field i:nth-child(2) { width: 48vw; height: 48vw; right: -8vw; top: 16vw; border-style: dashed; }
.orbital-field i:nth-child(3) { width: 30vw; height: 30vw; left: -8vw; bottom: -10vw; }
.orbital-field b { position: absolute; right: 20%; top: 54%; width: 14px; height: 14px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 8px rgba(217,87,69,.12); }

/* Global */
.app-shell { min-height: 100vh; }
.topbar { height: 72px; position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 250px 1fr auto; align-items: center; gap: 24px; padding: 0 28px; background: rgba(254,254,250,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.wordmark { display: flex; align-items: center; gap: 11px; }
.wordmark > span { width: 38px; height: 34px; display: grid; place-items: center; border: 1px solid var(--ink); font-family: Georgia, serif; font-size: 13px; }
.wordmark strong, .wordmark small, .top-context span, .top-context strong, .user-chip small { display: block; }
.wordmark strong { font: 400 18px/1 Georgia, serif; }
.wordmark small { color: var(--muted); margin-top: 4px; font-size: 9px; }
.top-context { border-left: 1px solid var(--line); padding-left: 24px; }
.top-context span { color: var(--muted); letter-spacing: .12em; font: 700 8px/1 ui-monospace, monospace; }
.top-context strong { margin-top: 5px; font-size: 11px; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions button { border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); font-size: 10px; padding: 8px; }
.user-chip { padding-left: 12px; border-left: 1px solid var(--line); font-size: 10px; }
.user-chip small { color: var(--muted); margin-top: 3px; font: 700 8px/1 ui-monospace, monospace; }
.page-shell { width: min(1500px, calc(100% - 36px)); margin: 18px auto 60px; }
.surface { background: rgba(255,255,255,.96); border: 1px solid var(--line); padding: 22px; box-shadow: 0 4px 15px rgba(42,52,57,.025); }
.section-heading { display: grid; grid-template-columns: 28px 1fr auto; align-items: start; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.section-heading > span { color: var(--blue-700); font: 700 9px/1 ui-monospace, monospace; padding-top: 5px; }
.section-heading h2 { margin: 0; font-size: 21px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* Dashboard */
.hero-card { min-height: 330px; position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 30px; margin-bottom: 16px; padding: clamp(34px, 5vw, 72px); background: var(--paper); border: 1px solid var(--line); }
.hero-card > div:first-child { position: relative; z-index: 2; max-width: 760px; }
.hero-card h1 { margin: 12px 0 14px; font-size: clamp(48px, 6vw, 78px); line-height: .94; letter-spacing: -.045em; }
.hero-card p { max-width: 620px; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.hero-card > .button { position: relative; z-index: 2; }
.hero-orbit { position: absolute; right: -130px; top: -160px; width: 590px; height: 590px; border-radius: 50%; border: 1px solid rgba(102,153,204,.18); }
.hero-orbit i { position: absolute; inset: 75px; border-radius: 50%; border: 1px dashed rgba(102,153,204,.22); }
.hero-orbit i:nth-child(2) { inset: 160px; border-style: solid; }
.hero-orbit b { position: absolute; left: 80px; bottom: 120px; width: 13px; height: 13px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 7px rgba(217,87,69,.12); }
.form-surface { margin-bottom: 16px; }
.project-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project-form .full { grid-column: 1 / -1; }
.project-form textarea { resize: vertical; border: 1px solid var(--line); padding: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.project-card { min-height: 260px; position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr auto auto; text-align: left; border: 1px solid var(--line); background: var(--paper); padding: 20px; cursor: pointer; transition: .2s ease; }
.project-card:hover { transform: translateY(-3px); border-color: var(--blue-700); box-shadow: var(--shadow); }
.project-card > span:first-child { color: var(--muted); font: 700 9px/1 ui-monospace, monospace; }
.project-card h3 { grid-column: 1 / -1; margin: 36px 0 10px; font-size: 25px; line-height: 1.08; }
.project-card p { grid-column: 1 / -1; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.project-card small { color: var(--muted); align-self: end; }
.project-card em { align-self: end; justify-self: end; color: var(--blue-700); font-style: normal; font-size: 10px; }
.empty-state { grid-column: 1 / -1; padding: 45px; text-align: center; border: 1px dashed var(--line-strong); color: var(--muted); }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 6px 0 0; }
.empty-state.compact { padding: 24px; }

/* Workspace */
.workspace-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.workflow-rail, .assistant-panel { position: sticky; top: 90px; background: rgba(254,254,250,.96); border: 1px solid var(--line); padding: 20px; }
.rail-label { display: block; color: var(--muted); letter-spacing: .14em; margin-bottom: 20px; font: 700 8px/1 ui-monospace, monospace; }
.workflow-rail > div { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0 18px; }
.workflow-rail > div:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 39px; bottom: 0; width: 1px; background: var(--line); }
.workflow-rail > div > span { z-index: 1; width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--paper); color: var(--muted); font: 700 8px/1 ui-monospace, monospace; }
.workflow-rail > div[data-state="active"] > span { border-color: var(--blue-700); box-shadow: 0 0 0 5px rgba(102,153,204,.13); color: var(--blue-700); }
.workflow-rail > div[data-state="complete"] > span { background: #e8f2ee; border-color: #7fa99c; color: var(--success); }
.workflow-rail > div[data-state="locked"] { opacity: .52; }
.workflow-rail strong, .workflow-rail small { display: block; }
.workflow-rail strong { margin-top: 3px; font-size: 11px; }
.workflow-rail small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.workspace-main { min-width: 0; }
.back-link { border: 0; background: transparent; padding: 0 0 12px; color: var(--blue-700); cursor: pointer; font-size: 10px; }
.workspace-hero { min-height: 300px; position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: end; gap: 30px; padding: clamp(28px, 4vw, 52px); background: var(--paper); border: 1px solid var(--line); margin-bottom: 14px; }
.workspace-hero::after { content: ""; position: absolute; width: 480px; height: 480px; border: 1px solid rgba(102,153,204,.18); border-radius: 50%; right: -250px; top: -240px; }
.workspace-hero > div { position: relative; z-index: 1; }
.workspace-hero h1 { margin: 12px 0; font-size: clamp(40px, 5vw, 64px); line-height: .98; letter-spacing: -.04em; }
.workspace-hero p { max-width: 720px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 20px; }
.project-meta > span:not(.status-pill) { padding: 6px 9px; background: var(--soft); border: 1px solid var(--line); font-size: 9px; }
.completion-ring { --progress: 0deg; z-index: 1; width: 126px; height: 126px; border-radius: 50%; display: grid; place-items: center; align-content: center; background: conic-gradient(var(--blue-500) var(--progress), var(--soft) 0); position: relative; }
.completion-ring::before { content: ""; position: absolute; inset: 9px; background: var(--paper); border-radius: 50%; }
.completion-ring strong, .completion-ring span { position: relative; z-index: 1; display: block; text-align: center; }
.completion-ring strong { font: 400 25px/1 Georgia, serif; }
.completion-ring span { margin-top: 5px; color: var(--muted); font-size: 8px; }
.step-section { margin-bottom: 14px; }
.instruction-card ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.instruction-card li { border: 1px solid var(--line); min-height: 92px; padding: 13px; font-size: 10px; line-height: 1.45; }
.instruction-card li span { display: block; color: var(--blue-700); margin-bottom: 12px; font: 700 9px/1 ui-monospace, monospace; }
.upload-form { display: grid; gap: 18px; }
.drop-zone { min-height: 135px; display: grid; place-items: center; align-content: center; text-align: center; border: 1px dashed var(--blue-500); background: linear-gradient(135deg, rgba(185,217,235,.14), transparent); cursor: pointer; padding: 20px; }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone strong { font-family: Georgia, serif; font-size: 18px; font-weight: 400; }
.drop-zone span { display: block; max-width: 620px; margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.provenance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.document-list { display: grid; gap: 8px; }
.document-list article { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.document-list article:last-child { border-bottom: 0; }
.doc-icon { width: 42px; height: 42px; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--blue-700); font: 700 8px/1 ui-monospace, monospace; }
.document-list strong, .document-list small, .document-list code { display: block; }
.document-list strong { font-size: 11px; }
.document-list small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.document-list code { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); font-size: 8px; }
.document-list button { border: 0; background: transparent; color: var(--blue-700); cursor: pointer; font-size: 9px; }
.run-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }
.run-card .section-heading, .run-card .error-card { grid-column: 1 / -1; }
.run-card small { color: var(--muted); align-self: center; }
.gate-surface blockquote { margin: 0 0 18px; border-left: 3px solid var(--blue-500); padding: 13px 16px; background: var(--soft); font-family: Georgia, serif; line-height: 1.5; }
.gate-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); margin-bottom: 16px; }
.gate-metrics div { padding: 14px; }
.gate-metrics div + div { border-left: 1px solid var(--line); }
.gate-metrics span, .gate-metrics strong { display: block; }
.gate-metrics span { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 8px; }
.gate-metrics strong { margin-top: 7px; font-family: Georgia, serif; font-size: 18px; font-weight: 400; }
.check-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.check-list > div { display: grid; grid-template-columns: 22px 110px 1fr; gap: 8px; align-items: center; border: 1px solid var(--line); padding: 9px; }
.check-list > div > span { color: var(--success); }
.check-list > div[data-pass="false"] > span { color: var(--danger); }
.check-list strong { font: 700 8px/1 ui-monospace, monospace; }
.check-list small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handoff-card { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-top: 3px solid var(--ink); }
.handoff-card span, .handoff-card strong, .handoff-card code { display: block; }
.handoff-card span { color: var(--muted); letter-spacing: .1em; font: 700 8px/1 ui-monospace, monospace; }
.handoff-card strong { margin-top: 8px; font-family: Georgia, serif; font-size: 18px; font-weight: 400; }
.handoff-card p { margin: 10px 0; font-size: 11px; line-height: 1.5; }
.handoff-card code { color: var(--muted); font-size: 8px; overflow-wrap: anywhere; }
.assistant-panel h2 { margin: 12px 0 20px; font-size: 23px; }
.assistant-panel dl { margin: 0; }
.assistant-panel dl div { border-bottom: 1px solid var(--line); padding: 11px 0; }
.assistant-panel dt { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 8px; }
.assistant-panel dd { margin: 5px 0 0; font-size: 10px; line-height: 1.4; }
.assistant-note, .assistant-gaps { margin-top: 18px; padding: 13px; background: var(--soft); border-left: 3px solid var(--blue-500); }
.assistant-note strong, .assistant-gaps strong { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.assistant-note p, .assistant-gaps p { margin: 7px 0 0; font-size: 9px; line-height: 1.5; color: var(--ink-soft); }
.assistant-gaps p span { display: block; color: var(--blue-700); font: 700 8px/1 ui-monospace, monospace; margin-bottom: 4px; }

@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: 180px minmax(0, 1fr); }
  .assistant-panel { position: static; grid-column: 1 / -1; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 16px; }
  .top-context { display: none; }
  .user-chip { display: none; }
  .page-shell { width: min(100% - 20px, 1500px); margin-top: 10px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .workflow-rail { position: static; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; overflow-x: auto; }
  .workflow-rail .rail-label { grid-column: 1 / -1; }
  .workflow-rail > div { display: block; padding: 7px; border: 1px solid var(--line); }
  .workflow-rail > div::after { display: none; }
  .workflow-rail > div > span { width: 25px; height: 25px; margin-bottom: 8px; }
  .hero-card, .workspace-hero { grid-template-columns: 1fr; }
  .completion-ring { width: 100px; height: 100px; }
  .project-form, .provenance-grid { grid-template-columns: 1fr; }
  .project-form .full { grid-column: auto; }
  .instruction-card ol { grid-template-columns: repeat(2, 1fr); }
  .check-list { grid-template-columns: 1fr; }
  .document-list article { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .document-list article > button { grid-column: 2; justify-self: start; }
}
@media (max-width: 560px) {
  .top-actions .status-pill { display: none; }
  .page-shell { width: 100%; margin: 0; }
  .hero-card, .surface, .workspace-hero, .workflow-rail, .assistant-panel { border-left: 0; border-right: 0; }
  .hero-card { min-height: 430px; padding: 28px 20px; align-items: end; }
  .hero-card h1 { font-size: 50px; }
  .project-grid { grid-template-columns: 1fr; }
  .workspace-hero { padding: 28px 20px; }
  .workspace-hero h1 { font-size: 42px; }
  .instruction-card ol, .gate-metrics { grid-template-columns: 1fr; }
  .gate-metrics div + div { border-left: 0; border-top: 1px solid var(--line); }
  .run-card { grid-template-columns: 1fr; }
  .run-card .section-heading, .run-card .error-card { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
