/* apply-agent — "honest instrument". Warm near-black, cool cyan = action,
   honesty spectrum = meaningful data palette. See DESIGN.md. */
:root {
  --canvas: oklch(0.17 0.012 65);
  --surface: oklch(0.205 0.012 65);
  --surface-2: oklch(0.245 0.012 65);
  --rail: oklch(0.15 0.012 65);
  --line: oklch(0.31 0.012 65);
  --ink: oklch(0.94 0.008 75);
  --muted: oklch(0.70 0.015 75);
  --accent: oklch(0.80 0.13 200);
  --accent-ink: oklch(0.20 0.05 220);
  --explicit: oklch(0.76 0.16 145);
  --related: oklch(0.82 0.14 85);
  --analogous: oklch(0.75 0.15 55);
  --none: oklch(0.68 0.21 25);
  --safe: var(--explicit);
  --target: var(--accent);
  --reach: var(--related);
  --drop: var(--none);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
.muted { color: var(--muted); }
.display { font-family: var(--display); letter-spacing: -0.01em; }
code { font-family: var(--mono); font-size: .82em; color: var(--accent); }
input, select, textarea, button { font-family: inherit; }

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* Rail */
.rail { background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; gap: 4px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; margin: 2px 8px 20px; }
.brand .mark { width: 13px; height: 13px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 16px -2px var(--accent); }
.brand-dim { color: var(--accent); }
#nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav button, .rail-foot button { all: unset; cursor: pointer; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 9px; transition: background .15s, color .15s; }
.rail nav button::before, .rail-foot button::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .35; }
.rail nav button:hover, .rail-foot button:hover { color: var(--ink); background: var(--surface); }
.rail nav button.active, .rail-foot button.active { color: var(--accent); background: color-mix(in oklch, var(--accent) 12%, transparent); }
.rail nav button.active::before { opacity: 1; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.honesty-key { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 10px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
.honesty-key span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.explicit { background: var(--explicit); } .dot.related { background: var(--related); }
.dot.analogous { background: var(--analogous); } .dot.none { background: var(--none); }

/* Main + topbar */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 600; }
.status { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--explicit); box-shadow: 0 0 0 0 color-mix(in oklch, var(--explicit) 60%, transparent); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--explicit) 50%, transparent); } 70%,100% { box-shadow: 0 0 0 7px transparent; } }

.view { display: none; padding: 28px 32px 56px; }
.view.active { display: block; }

/* Evaluate */
.evaluate-grid { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
@media (max-width: 920px) { .app { grid-template-columns: 1fr; } .rail { flex-direction: row; overflow:auto; } .evaluate-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.panel-label, .section-label { font-family: var(--display); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 14px; }
.section-label { margin: 26px 0 10px; }
.job-input label { display: block; margin: 14px 0; font-size: 12px; color: var(--muted); }
.job-input input, .job-input select, .job-input textarea { width: 100%; margin-top: 6px; background: var(--canvas); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; font-size: 14px; }
.job-input input:focus, .job-input select:focus, .job-input textarea:focus { outline: none; border-color: var(--accent); }
.job-input textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; resize: vertical; }
.job-input .row { display: flex; gap: 10px; align-items: flex-end; }
.job-input .grow { flex: 1; }
.job-input .check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.job-input .check input { width: auto; margin: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.presets button { all: unset; cursor: pointer; font-size: 12px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); padding: 5px 11px; border-radius: 20px; }
.presets button:hover { border-color: var(--accent); color: var(--accent); }
button.primary { all: unset; cursor: pointer; text-align: center; width: 100%; margin-top: 6px; padding: 12px; font-weight: 600; font-family: var(--display); letter-spacing: .01em; background: var(--accent); color: var(--accent-ink); border-radius: 9px; transition: filter .15s; }
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: .6; cursor: default; }

.empty { color: var(--muted); padding: 48px 8px; max-width: 60ch; line-height: 1.7; }

/* Verdict gauge (instrument readout, not hero-metric) */
.verdict { display: flex; gap: 24px; align-items: center; }
.gauge { --val: 0; --col: var(--target); width: 112px; height: 112px; flex: none; border-radius: 50%; background: conic-gradient(var(--col) calc(var(--val) * 1%), var(--line) 0); display: grid; place-content: center; position: relative; }
.gauge::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.gauge b { position: relative; font-family: var(--mono); font-size: 30px; font-weight: 600; line-height: 1; text-align: center; }
.gauge span { position: relative; display: block; text-align: center; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.verdict-line { display: flex; align-items: center; gap: 10px; }
.tier { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; padding: 4px 11px; border-radius: 6px; }
.tier.safe { background: color-mix(in oklch, var(--safe) 16%, transparent); color: var(--safe); }
.tier.target { background: color-mix(in oklch, var(--target) 16%, transparent); color: var(--target); }
.tier.reach { background: color-mix(in oklch, var(--reach) 16%, transparent); color: var(--reach); }
.tier.drop { background: color-mix(in oklch, var(--drop) 16%, transparent); color: var(--drop); }
.decision { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.reason { margin-top: 7px; font-size: 12.5px; }
.callouts { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.callouts .gap { color: var(--none); } .callouts .flag { color: var(--analogous); }

table.reqs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.reqs th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.reqs td { padding: 9px 8px; border-bottom: 1px solid var(--surface-2); }
.rel { font-weight: 600; font-family: var(--mono); font-size: 12px; }
.rel.explicit { color: var(--explicit); } .rel.related { color: var(--related); }
.rel.analogous { color: var(--analogous); } .rel.none { color: var(--none); }
td.conf { font-family: var(--mono); color: var(--muted); }
.where { font-size: 11px; color: var(--muted); } .where.withheld { color: var(--analogous); }

.tabs { display: flex; gap: 3px; margin-top: 26px; }
.tabs button { all: unset; cursor: pointer; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 9px 15px; font-size: 12.5px; }
.tabs button.active { background: var(--canvas); color: var(--ink); }
.doc { margin: 0; background: var(--canvas); border: 1px solid var(--line); border-radius: 0 8px 8px 8px; padding: 18px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; max-height: 440px; overflow: auto; }
.polishnote { margin-top: 10px; font-size: 11px; }

/* Tracker board */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, 1fr); } }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-height: 120px; }
.col h3 { margin: 0 0 12px; font-family: var(--display); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; display: flex; justify-content: space-between; }
.col h3 .n { font-family: var(--mono); color: var(--muted); }
.col.safe h3 { color: var(--safe); } .col.target h3 { color: var(--target); } .col.reach h3 { color: var(--reach); } .col.drop h3 { color: var(--drop); }
.appcard { background: var(--canvas); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; margin-bottom: 8px; }
.appcard .t { font-weight: 600; font-size: 13px; }
.appcard .c { color: var(--muted); font-size: 12px; margin-top: 2px; }
.appcard .s { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; }
.board-empty { grid-column: 1 / -1; }

/* Placeholder views */
.view.soon::before { content: attr(data-soon); display: block; max-width: 56ch; color: var(--muted); line-height: 1.7; }
.view.soon { padding-top: 40px; }

/* Sign-in gate */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 90% at 50% -10%, color-mix(in oklch, var(--accent) 9%, var(--canvas)), var(--canvas)); }
.gate-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px 24px; }
.gate-card .brand { font-size: 17px; margin: 0 0 22px; }
.gate-h { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.gate-sub { margin: 0 0 22px; font-size: 13px; line-height: 1.6; }
.gate .google { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 500; font-size: 13.5px; transition: border-color .15s, background .15s; }
.gate .google:hover { border-color: var(--accent); background: var(--canvas); }
.gate-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gate-field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.gate-field input { width: 100%; margin-top: 6px; background: var(--canvas); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 11px; font-size: 14px; }
.gate-field input:focus { outline: none; border-color: var(--accent); }
.gate .primary { margin-top: 0; }
.gate-msg { margin-top: 14px; font-size: 12.5px; line-height: 1.55; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--canvas); }
.gate-msg.ok { border-color: color-mix(in oklch, var(--explicit) 50%, var(--line)); color: var(--explicit); }
.gate-msg.err { border-color: color-mix(in oklch, var(--none) 50%, var(--line)); color: var(--none); }
.gate-msg a { color: var(--accent); }
.gate-foot { margin: 22px 0 0; font-size: 11px; line-height: 1.55; }
.signout { font-size: 12.5px; }
.signout:hover { color: var(--none) !important; }
/* all:unset strips the native focus ring — restore a visible one for keyboard users. */
.gate .google:focus-visible, .gate .primary:focus-visible, .signout:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* Boot/gate visibility — avoid a flash of either surface before the session resolves */
body.booting .app, body.booting .gate { display: none; }
body.signed-out .app { display: none; }
body:not(.signed-out):not(.booting) .gate { display: none; }
