/* AOC-4 Assistant — shared design tokens and components */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f6; --ink: #14181f; --ink-2: #3c4452; --mute: #667085; --line: #e2e5eb; --line-2: #d0d5dd;
  --brand: #2748d7; --brand-ink: #ffffff; --brand-soft: #e9eeff; --brand-2: #0d8f6b;
  --ok: #0f7a5a; --ok-soft: #e3f6ef; --warn: #9a5b06; --warn-soft: #fff3d6; --err: #b42318; --err-soft: #fde8e6;
  --b-extracted: #e6eeff; --b-prefilled: #eceff4; --b-derived: #e2f5ec; --b-default: #fff1cc; --b-answer: #ebe6ff; --b-edited: #ffe5de;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #171b22; --surface-2: #1f242d; --ink: #eceff4; --ink-2: #c3cad5; --mute: #98a2b3; --line: #2a303a; --line-2: #3a424f;
    --brand: #7b9bff; --brand-ink: #0b1020; --brand-soft: #1c2745; --brand-2: #3ccf9f;
    --ok: #4cc9a0; --ok-soft: #123329; --warn: #f0b24a; --warn-soft: #3a2f14; --err: #ff8f80; --err-soft: #43201c;
    --b-extracted: #1d2a47; --b-prefilled: #262c36; --b-derived: #15342a; --b-default: #3a3016; --b-answer: #2a2550; --b-edited: #442a22;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.mute { color: var(--mute); } .small { font-size: 13px; } .tiny { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .err { color: var(--err); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .stack > * + * { margin-top: 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* buttons & forms */
.btn { font: inherit; font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); } .btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.danger { color: var(--err); } .btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; } .btn.lg { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: block; } .field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input, textarea.input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); }
.input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea.input { min-height: 110px; resize: vertical; }
.form-error { color: var(--err); background: var(--err-soft); border-radius: 10px; padding: 9px 12px; font-size: 14px; } .form-ok { color: var(--ok); background: var(--ok-soft); border-radius: 10px; padding: 9px 12px; font-size: 14px; }

/* layout */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav .in { max-width: 1480px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 22px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none !important; }
.logo i { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; font-style: normal; font-size: 13px; font-weight: 800; }
.nav a.link { color: var(--ink-2); font-weight: 500; font-size: 14px; } .nav a.link:hover, .nav a.link.on { color: var(--ink); text-decoration: none; }
.container { max-width: 1480px; margin: 0 auto; padding: 24px; } .narrow { max-width: 880px; margin: 0 auto; padding: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child, .card > .row:first-child > h2 { font-size: 17px; margin-bottom: 12px; }
.chip-credit { background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; padding: 5px 11px; border-radius: 99px; }
.menu { position: relative; } .menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.menu-pop button, .menu-pop a { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; font: inherit; color: var(--ink); border-radius: 8px; cursor: pointer; } .menu-pop button:hover, .menu-pop a:hover { background: var(--surface-2); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; border: 0; cursor: pointer; }

/* tables */
table.t { border-collapse: collapse; width: 100%; } .t th, .t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); font-weight: 600; } .t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); } .t tr.sec td { background: var(--surface-2); font-weight: 700; font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.t tr.sel td { background: var(--brand-soft); }
.tablewrap { overflow-x: auto; }

/* badges, chips, tiles */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.b-extracted { background: var(--b-extracted); } .b-prefilled { background: var(--b-prefilled); } .b-derived { background: var(--b-derived); } .b-default { background: var(--b-default); } .b-answer { background: var(--b-answer); } .b-edited { background: var(--b-edited); }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-warn { background: var(--warn-soft); color: var(--warn); } .b-err { background: var(--err-soft); color: var(--err); } .b-brand { background: var(--brand-soft); color: var(--brand); }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); border: 1px solid transparent; cursor: pointer; font-weight: 600; } .chip.on { border-color: var(--brand); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; } .tile .k { font-size: 12px; color: var(--mute); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; } .tile .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; } .tile .s { font-size: 12px; color: var(--mute); }
.steps { display: flex; gap: 8px; margin: 0 0 18px; flex-wrap: wrap; } .step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); font-weight: 600; } .step b { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 12px; }
.step.on { color: var(--ink); } .step.on b { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); } .step.done b { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); } .step + .step::before { content: ""; width: 28px; height: 1.5px; background: var(--line-2); margin-right: 4px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; } .tabs button { font: inherit; font-weight: 600; font-size: 14px; background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; color: var(--mute); cursor: pointer; white-space: nowrap; margin-bottom: -1px; } .tabs button:hover { color: var(--ink); } .tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 20, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; max-width: 520px; width: 100%; padding: 22px; box-shadow: 0 24px 64px rgba(0,0,0,.35); max-height: 90vh; overflow: auto; } .modal h2 { font-size: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; box-shadow: var(--shadow); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; font-size: 16px; letter-spacing: .02em; user-select: all; word-break: break-all; }

/* dropzones */
.drop { display: block; border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 16px; background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; position: relative; }
.drop:hover, .drop.has { border-color: var(--brand); background: var(--brand-soft); } .drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop .t1 { font-weight: 700; font-size: 14px; } .drop .t2 { font-size: 12.5px; color: var(--mute); margin-top: 2px; } .drop .fn { font-size: 13px; color: var(--brand); font-weight: 600; margin-top: 6px; word-break: break-all; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
@media print { .nav, .btn { display: none; } }
