@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #090b0e;
  --panel: #11151a;
  --panel-2: #151a20;
  --panel-3: #1a2027;
  --line: #252c34;
  --line-soft: #1d232a;
  --text: #f0f3f5;
  --muted: #919ba6;
  --faint: #69737d;
  --green: #7ee2a8;
  --green-dim: #173b2a;
  --amber: #efbd69;
  --amber-dim: #46351b;
  --red: #f18787;
  --red-dim: #472326;
  --blue: #8bb9ff;
  --blue-dim: #1d3454;
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0,0,0,.38);
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 6px; color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; overflow: hidden; }
.login-shell::before { content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%; left: -170px; top: -210px; background: radial-gradient(circle, rgba(126,226,168,.12), transparent 67%); }
.login-shell::after { content: ""; position: absolute; width: 520px; height: 520px; right: -140px; bottom: -250px; background: radial-gradient(circle, rgba(239,189,105,.11), transparent 67%); }
.login-mark { position: fixed; top: 30px; left: 34px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--text); color: var(--bg); font: 700 21px Manrope; }
.login-card { position: relative; z-index: 1; width: min(440px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 20px; background: rgba(17,21,26,.92); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card h1 { margin: 0; font: 700 34px/1.15 Manrope; letter-spacing: -.04em; }
.login-card .lede { margin: 12px 0 28px; color: var(--muted); line-height: 1.6; }
label { display: grid; gap: 8px; color: #c7ced5; font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; color: var(--text); background: #0c1014; border: 1px solid var(--line); border-radius: 9px; outline: none; padding: 11px 12px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: #596672; box-shadow: 0 0 0 3px rgba(139,185,255,.09); }
.login-card .button { margin-top: 16px; width: 100%; }
.security-note { margin: 20px 0 0; text-align: center; color: var(--faint); font-size: 11px; }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 12px; }

.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; font-weight: 700; font-size: 12px; transition: transform .12s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: #0a110d; background: var(--green); }
.button.primary.danger { color: #fff; background: #b74d55; }
.button.quiet { color: #d7dde2; background: var(--panel-2); border-color: var(--line); }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--panel-2); font-size: 17px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 238px; padding: 24px 15px 18px; display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); background: #0c0f13; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 9px 38px; color: var(--text); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--text); color: var(--bg); font: 700 18px Manrope; }
.brand b, .brand small { display: block; }
.brand b { font: 700 14px Manrope; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--faint); font-size: 10px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { width: 100%; display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 10px 11px; border: 1px solid transparent; border-radius: 9px; text-align: left; color: var(--muted); background: transparent; font-size: 12px; font-weight: 600; }
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.nav-item span { color: var(--faint); font-size: 15px; }
.nav-item em { min-width: 21px; padding: 2px 6px; border-radius: 999px; color: var(--amber); background: var(--amber-dim); text-align: center; font-size: 9px; font-style: normal; }
.sidebar-foot { margin-top: auto; display: flex; gap: 9px; align-items: center; padding: 13px 10px; border-top: 1px solid var(--line-soft); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(126,226,168,.55); }
.sidebar-foot b, .sidebar-foot small { display: block; }
.sidebar-foot b { font-size: 10px; }
.sidebar-foot small { margin-top: 2px; color: var(--faint); font-size: 9px; }

.workspace { grid-column: 2; min-width: 0; padding: 28px 32px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 0; font: 700 27px/1.2 Manrope; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.top-actions select { width: 178px; padding: 9px 10px; font-size: 11px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.summary-strip article { min-height: 112px; padding: 18px 20px; border-right: 1px solid var(--line); }
.summary-strip article:last-child { border: 0; }
.summary-strip span, .summary-strip small { display: block; color: var(--faint); font-size: 10px; }
.summary-strip b { display: block; margin: 10px 0 5px; font: 700 25px Manrope; letter-spacing: -.03em; }

.view-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.queue-toolbar { min-height: 60px; display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0c1014; }
.segmented button { border: 0; padding: 7px 10px; border-radius: 6px; color: var(--faint); background: transparent; font-size: 10px; font-weight: 700; }
.segmented button.active { color: var(--text); background: var(--panel-3); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.search { max-width: 230px; padding: 8px 10px; font-size: 11px; }
.review-layout { min-height: 610px; display: grid; grid-template-columns: minmax(270px, 33%) 1fr; }
.candidate-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 75vh; }
.candidate-row { width: 100%; padding: 17px; display: block; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; color: var(--text); background: transparent; }
.candidate-row:hover, .candidate-row.active { background: var(--panel-2); }
.candidate-row.active { box-shadow: inset 3px 0 var(--green); }
.candidate-row-top { display: flex; justify-content: space-between; gap: 9px; align-items: center; }
.candidate-row h3 { margin: 10px 0 7px; font: 600 13px/1.4 Manrope; }
.candidate-row p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.candidate-meta { display: flex; gap: 8px; color: var(--faint); font-size: 9px; }
.track-label { text-transform: capitalize; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 7px; font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.badge.proposed { color: var(--amber); background: var(--amber-dim); }
.badge.approved, .badge.approved_no_change, .badge.complete { color: var(--green); background: var(--green-dim); }
.badge.rejected, .badge.failed { color: var(--red); background: var(--red-dim); }
.badge.running { color: var(--blue); background: var(--blue-dim); }

.candidate-detail { padding: 25px 27px 40px; max-height: 75vh; overflow-y: auto; }
.empty-state { display: grid; place-content: center; text-align: center; color: var(--faint); }
.empty-state .empty-icon { margin: 0 auto 14px; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 22px; }
.empty-state h2 { margin: 0 0 7px; color: var(--muted); font: 600 16px Manrope; }
.empty-state p { max-width: 320px; margin: 0; font-size: 11px; line-height: 1.6; }
.detail-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-head h2 { max-width: 720px; margin: 8px 0; font: 700 23px/1.25 Manrope; letter-spacing: -.03em; }
.detail-head p { max-width: 700px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.confidence-ring { flex: 0 0 76px; width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) var(--confidence), var(--line) 0); position: relative; }
.confidence-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel); }
.confidence-ring span { position: relative; font: 700 15px Manrope; }
.fact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 17px 0; }
.fact-grid div { padding: 11px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0e1216; }
.fact-grid span, .fact-grid b { display: block; }
.fact-grid span { color: var(--faint); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }
.fact-grid b { margin-top: 6px; font-size: 11px; overflow-wrap: anywhere; }
.detail-section { margin-top: 24px; }
.section-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-label h3 { margin: 0; font: 700 13px Manrope; }
.section-label span { color: var(--faint); font-size: 9px; }
.risk-banner { display: flex; gap: 11px; padding: 12px 13px; border: 1px solid var(--amber-dim); border-radius: 9px; background: rgba(239,189,105,.06); color: #d9c59f; font-size: 11px; line-height: 1.5; }
.operation-list, .evidence-list { display: grid; gap: 8px; }
.operation-card, .evidence-card { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.operation-title, .evidence-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.operation-title b, .evidence-title b { font-size: 11px; overflow-wrap: anywhere; }
.op-kind { color: var(--blue); font: 800 9px monospace; text-transform: uppercase; }
.operation-card p, .evidence-card p { margin: 8px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.payload-table { margin-top: 10px; display: grid; grid-template-columns: 130px 1fr; border: 1px solid var(--line-soft); border-radius: 7px; overflow: hidden; }
.payload-table span { padding: 7px 9px; border-bottom: 1px solid var(--line-soft); font-size: 9px; overflow-wrap: anywhere; }
.payload-table span:nth-child(odd) { color: var(--faint); background: #0d1115; }
.payload-table span:nth-last-child(-n+2) { border-bottom: 0; }
.evidence-title a { color: var(--blue); text-decoration: none; font-size: 9px; }
.evidence-meta { margin-top: 4px; color: var(--faint); font-size: 9px; }
.evidence-excerpt { max-height: 130px; overflow: auto; white-space: pre-wrap; }
.impact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.impact-grid div { padding: 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); }
.impact-grid b, .impact-grid span { display: block; }
.impact-grid b { font: 700 18px Manrope; }
.impact-grid span { margin-top: 3px; color: var(--faint); font-size: 9px; }
.review-actions { position: sticky; bottom: -40px; display: flex; justify-content: flex-end; gap: 8px; margin: 28px -27px -40px; padding: 14px 27px; border-top: 1px solid var(--line); background: rgba(17,21,26,.96); backdrop-filter: blur(10px); }

.section-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font: 700 17px Manrope; }
.section-heading p { margin: 5px 0 0; color: var(--faint); font-size: 10px; }
.data-table { width: 100%; }
.table-row { display: grid; grid-template-columns: 1.25fr 1fr .8fr 1.2fr 1.2fr; gap: 12px; align-items: center; min-height: 52px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); font-size: 10px; }
.table-row.header { min-height: 38px; color: var(--faint); background: #0e1216; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.versions-grid, .sources-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.version-column h3 { margin: 0 0 10px; text-transform: capitalize; font: 700 13px Manrope; }
.version-card, .source-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.version-card + .version-card { margin-top: 8px; }
.version-card b, .source-card b { display: block; font-size: 11px; }
.version-card p, .source-card p { margin: 7px 0 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.source-card-top { display: flex; justify-content: space-between; gap: 8px; }
.source-card code { display: block; margin-top: 9px; color: var(--faint); font-size: 8px; overflow-wrap: anywhere; }

.review-dialog { width: min(560px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.review-dialog::backdrop { background: rgba(3,5,7,.78); backdrop-filter: blur(4px); }
.review-dialog form { padding: 24px; display: grid; gap: 16px; }
.dialog-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.dialog-head h2 { margin: 0; font: 700 20px Manrope; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 3px; }
.confirm-check { display: flex; grid-template-columns: 18px 1fr; align-items: flex-start; gap: 9px; color: var(--muted); line-height: 1.45; }
.confirm-check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--green); }
.compact-dialog { max-width: 460px; }
.dialog-copy { margin: -4px 0 0; color: var(--faint); font-size: 10px; line-height: 1.55; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 22px; max-width: 360px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--panel-3); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; font-size: 11px; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip article:nth-child(2) { border-right: 0; }
  .summary-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .fact-grid { grid-template-columns: repeat(2, 1fr); }
  .versions-grid, .sources-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 14px; }
  .sidebar nav { grid-template-columns: repeat(4, 1fr); }
  .nav-item { display: flex; justify-content: center; padding: 9px 5px; font-size: 0; }
  .nav-item span { font-size: 15px; }
  .nav-item em, .sidebar-foot { display: none; }
  .workspace { padding: 20px 14px 42px; }
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .review-layout { grid-template-columns: 1fr; }
  .candidate-list { max-height: 310px; border-right: 0; border-bottom: 1px solid var(--line); }
  .candidate-detail { max-height: none; }
  .versions-grid, .sources-grid { grid-template-columns: 1fr; }
  .table-row { grid-template-columns: 1fr 1fr; }
  .table-row span:nth-child(n+3) { display: none; }
}
@media (max-width: 520px) {
  .login-card { padding: 28px 22px; }
  .login-mark { top: 18px; left: 18px; }
  .topbar { display: block; }
  .top-actions { margin-top: 14px; justify-content: flex-start; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip article { min-height: 95px; padding: 14px; }
  .queue-toolbar { align-items: stretch; flex-direction: column; }
  .segmented { overflow-x: auto; }
  .search { max-width: none; }
  .candidate-detail { padding: 20px 16px 34px; }
  .detail-head { display: block; }
  .confidence-ring { margin-top: 16px; }
  .fact-grid, .impact-grid { grid-template-columns: 1fr 1fr; }
  .review-actions { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}
