@font-face { font-family: Italiana; src: url('/fonts/Italiana-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Work Sans'; src: url('/fonts/WorkSans-Variable.ttf') format('truetype'); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/IBMPlexMono-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/IBMPlexMono-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Crimson Pro'; src: url('/fonts/CrimsonPro-Italic-Variable.ttf') format('truetype'); font-style: italic; font-weight: 200 900; font-display: swap; }

:root {
  color-scheme: light;
  --ink-950: #191330;
  --ink-800: #383149;
  --ink-600: #62576e;
  --ink-500: #6e6379;
  --canvas: #ede7db;
  --surface: #f6f2e9;
  --surface-alt: #f2ede3;
  --border: #c8bdc6;
  --border-strong: #756683;
  --teal-800: #45365b;
  --teal-700: #453769;
  --teal-100: #e9e3ec;
  --amber-800: #624111;
  --amber-700: #8d641b;
  --amber-100: #f4e7c8;
  --red-800: #7b2521;
  --red-700: #a3312c;
  --red-100: #fbe3e1;
  --green-700: #365f4b;
  --green-100: #e5eee5;
  --blue-100: #ebe5ed;
  --shadow: 0 10px 30px rgba(39, 32, 54, .11);
  --focus: 0 0 0 3px rgba(177, 130, 43, .38);
  --radius-sm: 0px;
  --radius: 0px;
  --radius-lg: 0px;
  --nav-width: 230px;
  font-family: 'Work Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); color: var(--ink-800); }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, select, input, textarea { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--teal-700); }
:focus-visible { outline: 3px solid var(--teal-700); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; color: var(--ink-950); font-family: Italiana, Georgia, serif; font-size: clamp(2.35rem, 4.2vw, 4.1rem); font-weight: 400; line-height: 1.03; letter-spacing: -.02em; }
h2 { color: var(--ink-950); font-size: 1.18rem; letter-spacing: -.01em; }
h3 { color: var(--ink-950); font-size: 1rem; }
small, .muted { color: var(--ink-600); }
code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .86em; }

.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink-950); color: white; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.topbar { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 10px 24px; border-bottom: 1px solid var(--border-strong); background: rgba(238,233,223,.97); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink-950); }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-family: Italiana, Georgia, serif; font-size: 1.7rem; font-weight: 400; line-height: 1; letter-spacing: .055em; }
.brand small { font-family: 'IBM Plex Mono', monospace; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--amber-700); background: var(--ink-950); color: #ead3a0; font-family: Italiana, Georgia, serif; font-size: 1.45rem; font-weight: 400; }
.topbar-controls { display: flex; align-items: center; gap: 12px; }
.role-picker { display: grid; gap: 3px; color: var(--ink-600); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.role-picker select { min-width: 210px; padding: 8px 36px 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: white; color: var(--ink-950); font-size: .9rem; font-weight: 650; text-transform: none; letter-spacing: normal; }
.trust-strip { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 24px; border-bottom: 1px solid #c8aa69; background: #e9dcc0; color: var(--amber-800); font-size: .78rem; }
.trust-strip strong { padding-right: 10px; border-right: 1px solid #d5b775; text-transform: uppercase; letter-spacing: .05em; }
.trust-role { margin-left: auto; font-weight: 700; }

.app-shell { display: grid; min-height: calc(100vh - 110px); grid-template-columns: var(--nav-width) minmax(0, 1fr); }
.workflow-nav { position: sticky; top: 110px; display: flex; height: calc(100vh - 110px); flex-direction: column; gap: 4px; padding: 23px 12px; border-right: 1px solid var(--border-strong); background: #e5dfd3; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-800); font-weight: 650; text-align: left; transition: background-color 180ms ease, color 180ms ease; }
.nav-item:hover { background: rgba(255,255,255,.7); }
.nav-item.is-active { background: var(--ink-950); color: #f8f5ee; box-shadow: inset 3px 0 0 #c39031; }
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-count { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 999px; background: var(--surface); color: var(--ink-600); font-size: .72rem; text-align: center; }
.nav-item.is-active .nav-count { background: #544864; color: #f8f5ee; }
.nav-footnote { margin-top: auto; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255,255,255,.72); }
.nav-footnote span, .nav-footnote strong, .nav-footnote small { display: block; }
.nav-footnote span { margin-bottom: 4px; color: var(--ink-600); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.nav-footnote strong { margin-bottom: 4px; color: var(--red-700); font-size: .86rem; }
.nav-footnote small { line-height: 1.35; }

.workspace { min-width: 0; padding: 34px clamp(18px, 3vw, 42px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 23px; padding-bottom: 24px; border-bottom: 1px solid var(--border-strong); }
.page-head p { max-width: 720px; margin-bottom: 0; color: var(--ink-600); line-height: 1.55; }
.eyebrow { display: block; margin-bottom: 11px; color: var(--amber-700); font-family: 'IBM Plex Mono', monospace; font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease; }
.button-primary { border-color: #8d641b; background: #b48631; color: #241a2d; }
.button-primary:hover { background: #c99b45; }
.button-secondary { border-color: var(--border-strong); background: white; color: var(--ink-950); }
.button-secondary:hover { border-color: var(--teal-700); color: var(--teal-800); }
.button-warning { border-color: #d5a14a; background: var(--amber-100); color: var(--amber-800); }
.button-danger { border-color: #ddaaa7; background: var(--red-100); color: var(--red-800); }
.button-quiet { border-color: transparent; background: transparent; color: var(--ink-600); }
.button-sm { min-height: 36px; padding: 6px 10px; font-size: .82rem; }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--ink-600); }
.icon-button:hover { background: var(--surface-alt); color: var(--ink-950); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.metrics-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.metric { min-height: 134px; padding: 18px; border: 1px solid var(--border-strong); background: var(--surface); }
.metric span { display: block; color: var(--ink-600); font-family: 'IBM Plex Mono', monospace; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.metric strong { display: block; margin: 10px 0 4px; color: var(--ink-950); font-family: Italiana, Georgia, serif; font-size: 2.5rem; font-weight: 400; line-height: 1; }
.metric small { line-height: 1.35; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .8fr); gap: 16px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card { border: 1px solid var(--border-strong); background: var(--surface); box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin-bottom: 3px; }
.card-body { padding: 18px; }
.card + .card { margin-top: 16px; }
.compact-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.list-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.list-row-main { min-width: 0; flex: 1; }
.list-row-main strong { display: block; color: var(--ink-950); }
.list-row-main p { margin: 4px 0 0; color: var(--ink-600); font-size: .88rem; line-height: 1.45; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.status-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.status-pill::before { width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-neutral { background: #edf1f3; color: var(--ink-600); }
.status-good { background: var(--green-100); color: var(--green-700); }
.status-info { background: var(--teal-100); color: var(--teal-800); }
.status-warning { background: var(--amber-100); color: var(--amber-800); }
.status-blocking { background: var(--red-100); color: var(--red-800); }
.callout { margin: 0 0 14px; padding: 12px 14px; border-left: 4px solid; border-radius: var(--radius-sm); line-height: 1.5; }
.callout-info { border-color: var(--teal-700); background: var(--teal-100); color: var(--ink-800); }
.callout-warning { border-color: var(--amber-700); background: var(--amber-100); color: var(--amber-800); }
.callout-danger { border-color: var(--red-700); background: var(--red-100); color: var(--red-800); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--ink-600); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
td { font-size: .86rem; }
tbody tr:hover { background: var(--surface-alt); }
.field-value { color: var(--ink-950); font-weight: 700; }
.source-link { border: 0; background: none; color: var(--teal-700); font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.source-card { display: flex; min-height: 116px; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.source-card h3 { margin: 0; }
.source-card .button { margin-top: auto; align-self: flex-start; }
.metadata { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--ink-600); font-size: .76rem; }
.finding-options { display: grid; gap: 8px; margin: 12px 0; }
.radio-row { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; }
.radio-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal-700); }
.radio-row span { display: block; }
.radio-row small { display: block; margin-top: 3px; }
label { display: block; margin: 0 0 6px; color: var(--ink-950); font-size: .86rem; font-weight: 700; }
input[type="text"], textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: white; color: var(--ink-950); }
textarea { resize: vertical; line-height: 1.5; }
.optional { color: var(--ink-600); font-size: .76rem; font-weight: 500; }
.form-row { margin-top: 12px; }
.inline-error { margin-top: 8px; color: var(--red-800); font-size: .84rem; font-weight: 700; }
.claims { display: grid; gap: 10px; }
.claim { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.claim p { margin-bottom: 9px; line-height: 1.55; }
.claim-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.evidence-chip { border: 1px solid #aed4cf; border-radius: 999px; background: var(--teal-100); color: var(--teal-800); font-size: .72rem; font-weight: 750; }
.evidence-chip button { min-height: 36px; padding: 4px 8px; border: 0; background: none; color: inherit; font-weight: inherit; }
.section-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.section-tag { padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; background: white; color: var(--ink-600); font-size: .72rem; }
.task-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.task-card { min-height: 220px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.task-card.is-assigned { border-color: var(--teal-700); box-shadow: var(--focus); }
.task-card h3 { margin: 10px 0 6px; }
.task-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.audit-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.audit-event { position: relative; display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 12px; padding-bottom: 18px; }
.audit-event:not(:last-child)::before { position: absolute; top: 30px; bottom: 0; left: 15px; width: 1px; background: var(--border); content: ""; }
.audit-sequence { display: grid; z-index: 1; width: 31px; height: 31px; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; background: white; color: var(--ink-600); font-size: .72rem; font-weight: 800; }
.audit-detail { padding: 0 0 2px; }
.audit-detail strong { color: var(--ink-950); }
.audit-detail p { margin: 3px 0; color: var(--ink-600); font-size: .84rem; }
.hash { display: block; max-width: 100%; overflow: hidden; color: var(--ink-500); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
details { margin-top: 8px; }
summary { color: var(--teal-700); cursor: pointer; font-size: .8rem; font-weight: 700; }
pre { overflow: auto; max-height: 360px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #eef3f4; color: var(--ink-950); font-size: .76rem; line-height: 1.55; white-space: pre-wrap; }

.dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.source-dialog { margin-right: 16px; width: min(560px, calc(100vw - 32px)); height: calc(100vh - 32px); max-height: none; }
.dialog::backdrop { background: rgba(16,36,58,.52); }
.dialog-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); background: white; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 20px; }
.dialog-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: white; }
.source-content { padding: 14px; border: 1px solid var(--border); background: var(--surface-alt); font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .78rem; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.source-content mark { padding: 2px 1px; background: #efd398; color: #272036; box-shadow: 0 0 0 2px #efd398; }
.draft-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 18px; align-items: start; }
.draft-card .card-body > details { margin-top: 18px; }
.claim { border-color: var(--border); background: #faf8f2; }
.claim-sentence { display: block; width: 100%; min-height: 0; margin: 0 0 10px; padding: 0; border: 0; background: transparent; color: var(--ink-950); font: inherit; line-height: 1.55; text-align: left; }
.claim-sentence:hover { text-decoration: underline; text-decoration-color: #b48631; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.source-preview { position: sticky; top: 124px; min-width: 0; padding: 18px; border: 1px solid var(--border-strong); background: #f5f0e5; }
.source-preview h3 { margin-bottom: 10px; font-size: 1.05rem; }
.source-preview .metadata { margin-bottom: 14px; font-family: 'IBM Plex Mono', monospace; font-size: .67rem; }
.source-boundary { margin: 12px 0 0; color: var(--ink-600); font-family: 'Crimson Pro', Georgia, serif; font-size: 1.03rem; font-style: italic; }
.evidence-chip { border-color: #ad8a46; border-radius: 0; background: #f4e7c8; color: #644513; }
.evidence-chip:has(button[aria-pressed="true"]) { background: #b48631; color: #241a2d; }
.toast { position: fixed; z-index: 60; right: 20px; bottom: 20px; max-width: 420px; padding: 13px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--ink-950); color: white; box-shadow: var(--shadow); font-size: .86rem; }
.loading-state { display: flex; align-items: center; gap: 10px; padding: 20px; color: var(--ink-600); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--teal-700); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .task-board { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .topbar { padding-inline: 16px; }
  .brand small, .status-pill.status-neutral { display: none; }
  .trust-strip { flex-wrap: wrap; padding-inline: 16px; }
  .trust-role { width: 100%; margin-left: 0; }
  .app-shell { grid-template-columns: 1fr; }
  .workflow-nav { position: sticky; z-index: 20; top: 110px; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-item { width: auto; min-width: max-content; }
  .nav-count { display: none; }
  .nav-footnote { display: none; }
  .workspace { padding-top: 22px; }
  .grid-2, .grid-equal { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: 1fr; }
  .draft-layout { grid-template-columns: 1fr; }
  .source-preview { position: static; }
}

@media (max-width: 640px) {
  .evidence-chip button { min-height: 44px; }
  .topbar { align-items: flex-start; gap: 10px; }
  .brand > span:last-child { display: block; }
  .brand strong { font-size: 1.3rem; }
  .brand small { display: none; }
  .brand-mark { width: 34px; height: 34px; font-size: 1.2rem; }
  .topbar-controls { width: 100%; justify-content: flex-end; }
  .role-picker { min-width: 0; }
  .role-picker select { min-width: 0; max-width: 160px; }
  .trust-strip > span:not(.trust-role) { display: none; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 104px; padding: 13px; }
  .metric strong { font-size: 1.5rem; }
  .page-head { display: block; }
  .page-head h1 { overflow-wrap: anywhere; }
  .page-head .button-row { margin-top: 14px; }
  .workspace { padding-inline: 14px; }
  .source-dialog { margin: auto; width: calc(100vw - 16px); height: calc(100vh - 16px); }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table-wrap td { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 10px; padding: 5px 10px; border: 0; }
  .table-wrap td::before { color: var(--ink-600); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; content: attr(data-label); }
}

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