/* =====================================================================
   WorkForce Tenders — design system
   Aesthetic: "precise control-room calm" — refined light dashboard in the
   Linear/Stripe/Vercel family. Neutral canvas, one indigo accent, status
   colour reserved for confidence. Geist Sans (UI) + Geist Mono (data).
   ===================================================================== */

/* ── Tokens ────────────────────────────────────────────────────────── */
:root {
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Neutral canvas */
  --bg: #f7f8fa;
  --bg-grid: rgba(15, 23, 42, 0.035);
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-inset: #fafbfc;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.14);

  --text: #0b1220;
  --text-2: #51607a;
  --text-3: #8a97ad;

  /* One accent */
  --accent: #1863DC;
  --accent-600: #1b4597;
  --accent-50: #e9f0fc;
  --accent-ring: rgba(24, 99, 220, 0.18);
  /* Workforce Staffing brand: blue primary, orange accent */
  --brand-orange: #ec8922;
  --brand-grad: linear-gradient(135deg, #1b4597 0%, #1863DC 100%);
  --brand-grad-muted: linear-gradient(135deg, #2d3748 0%, #586069 100%);

  /* Status (confidence only) */
  --green: #15a35a;   --green-bg: #e7f8ee;  --green-bd: rgba(21, 163, 90, 0.28);
  --amber: #c2790a;   --amber-bg: #fdf4e3;  --amber-bd: rgba(194, 121, 10, 0.28);
  --red:   #dc2b3d;   --red-bg:   #fdecec;  --red-bd:   rgba(220, 43, 61, 0.26);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 14px -4px rgba(15, 23, 42, 0.10), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.20), 0 8px 16px -8px rgba(15, 23, 42, 0.10);

  --r-xs: 7px; --r-sm: 10px; --r: 13px; --r-lg: 17px; --r-xl: 22px;
  --sidebar-w: 248px;
  --topbar-h: 62px;
}

[data-theme="dark"] {
  --bg: #0a0d13;
  --bg-grid: rgba(255, 255, 255, 0.04);
  --surface: #11151d;
  --surface-2: #171c26;
  --surface-inset: #0e121a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #e8ecf3;
  --text-2: #9aa6b8;
  --text-3: #5f6b7e;

  --accent: #5b9bff;
  --accent-600: #3b82f6;
  --accent-50: rgba(91, 155, 255, 0.12);
  --accent-ring: rgba(91, 155, 255, 0.25);

  --green: #34d27f; --green-bg: rgba(52, 210, 127, 0.12); --green-bd: rgba(52, 210, 127, 0.30);
  --amber: #f0b23f; --amber-bg: rgba(240, 178, 63, 0.12); --amber-bd: rgba(240, 178, 63, 0.30);
  --red:   #f76d7c; --red-bg:   rgba(247, 109, 124, 0.12); --red-bd: rgba(247, 109, 124, 0.30);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 50px -14px rgba(0, 0, 0, 0.7);
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--accent-ring); }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

/* ── App shell ─────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  z-index: 30;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 18px;
}
.brand-logo {
  width: 100%; max-width: 178px; height: auto; display: block;
  border-radius: 6px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand-grad);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px -2px var(--accent-ring);
  flex: none;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-name small { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-3); font-weight: 600; padding: 16px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  position: relative; transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-50); color: var(--accent-600); }
[data-theme="dark"] .nav-item.active { color: var(--accent); }
.nav-item.active svg { opacity: 1; }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-3);
  padding: 1px 7px; border-radius: 999px; font-family: var(--font-mono);
}
.nav-item.active .count { background: var(--surface); color: var(--accent-600); }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

/* ── Topbar ────────────────────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; height: var(--topbar-h); z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.search {
  flex: 1; max-width: 460px; position: relative;
}
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search input {
  width: 100%; padding: 9px 12px 9px 36px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); outline: none; transition: border .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; background: var(--surface-2);
}
.topbar-spacer { flex: 1; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: grid; place-items: center; background: transparent;
  border: 1px solid transparent; color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.usermenu { position: relative; }
.user-pill {
  display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text);
  transition: border .15s, box-shadow .15s;
}
.user-pill:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 600;
  background: linear-gradient(150deg, #4f46e5, #8b5cf6); font-family: var(--font-mono);
}
.user-pill .uname { font-size: 13px; font-weight: 550; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
  display: none;
}
.menu.open { display: block; animation: fade-up .16s ease; }
.menu .mhead { padding: 9px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu .mhead b { font-size: 13.5px; }
.menu .mhead span { display: block; font-size: 12px; color: var(--text-3); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--r-xs); color: var(--text-2);
  background: transparent; border: 0; font-size: 13px; font-weight: 500;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }
.menu a svg, .menu button svg { width: 15px; height: 15px; }

/* ── Page canvas ───────────────────────────────────────────────────── */
.canvas {
  flex: 1; padding: 26px;
  background-image: radial-gradient(var(--bg-grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { min-width: 0; }
.page-head h1 { font-size: 23px; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.eyebrow { font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-600); font-weight: 600; }
[data-theme="dark"] .eyebrow { color: var(--accent); }

/* ── Cards & grid ──────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── VCIT Insight card headers: single purple→cyan gradient (grey when No-Go) ── */
.card-head--accent {
  border-bottom: none;
  border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg);
  background: var(--brand-grad);
}
.card-head--accent.nogo { background: var(--brand-grad-muted); }
.card-head--accent h3, .card-head--accent .badge { color: #fff; }
.card-head--accent svg { color: #fff; }
.card-head--accent .badge { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.32); }
/* legacy aliases (kept so older markup still themes correctly) */
.card-head--teal, .card-head--blue, .card-head--amber, .card-head--cyan { background: var(--brand-grad); }

/* Legacy-style eligibility rows (Matching / Unmatched detail per category) */
.elig-cat { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent-600); margin: 14px 0 6px; }
.elig-cat:first-child { margin-top: 4px; }
.elig-list { list-style: none; margin: 0; padding: 0; }
.elig-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.45; }
.elig-row:last-child { border-bottom: 0; }
.elig-row .elig-item { color: var(--text); }
.elig-row .badge { flex: none; }

/* Raw email body (Inbox detail) — fidelity to the source digest */
.email-body {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6;
  color: var(--text-2); max-height: 460px; overflow: auto;
}
.grid { display: grid; gap: 16px; }
/* Grid children default to min-width:auto and refuse to shrink below their
   content, which blows the page out horizontally. Let them shrink. */
.grid > * { min-width: 0; }
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1.6fr 1fr; }
.cols-2-even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .cols-2, .cols-2-even { grid-template-columns: 1fr; } }

/* ── KPI card ──────────────────────────────────────────────────────── */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 116px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kpi .klabel { font-size: 12px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.kpi .klabel .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.kpi .kval { font-size: 30px; font-weight: 600; font-family: var(--font-mono); letter-spacing: -0.03em; line-height: 1; }
.kpi-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi .kfoot { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); }
.kpi .spark { flex: none; opacity: .9; }
.trend-up { color: var(--green); font-weight: 600; font-family: var(--font-mono); }

/* ── Today focus strip ─────────────────────────────────────────────── */
.today-strip {
  display: flex; align-items: center; gap: 15px; padding: 15px 18px;
  border-radius: var(--r-lg); color: #fff; box-shadow: var(--shadow-md);
  background: linear-gradient(110deg, var(--accent-600) 0%, var(--accent) 45%, #7c75ff 100%);
  position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.today-strip::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.13) 1px, transparent 1px); background-size: 18px 18px; mask-image: radial-gradient(120% 120% at 90% 0%, #000, transparent 70%); }
.today-strip:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.today-ic { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; position: relative; backdrop-filter: blur(3px); }
.today-main { flex: 1; position: relative; min-width: 0; }
.today-h { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.today-sub { font-size: 12.5px; color: rgba(255,255,255,.82); margin-top: 2px; }
.today-strip .btn { position: relative; background: rgba(255,255,255,.16); border-color: transparent; color: #fff; backdrop-filter: blur(3px); }
.today-strip .btn:hover { background: rgba(255,255,255,.26); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 14px; border-radius: var(--r-sm); font-weight: 550; font-size: 13.5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px -2px var(--accent-ring); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ── Badges / pills / chips ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2);
  letter-spacing: -0.01em;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.go { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.badge.nogo { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.badge.high { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.badge.mid { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.badge.low { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.badge.accent { color: var(--accent-600); background: var(--accent-50); border-color: var(--accent-ring); }
[data-theme="dark"] .badge.accent { color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.chip.ok { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.chip.miss { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* ── Confidence ring & bar ─────────────────────────────────────────── */
.ring { position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--surface-2); }
.ring .meter { stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1); }
.ring.high .meter { stroke: var(--green); }
.ring.mid  .meter { stroke: var(--amber); }
.ring.low  .meter { stroke: var(--red); }
.ring .ringval {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 13px; letter-spacing: -0.04em;
}
.ring.lg .ringval { font-size: 17px; }

.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.4,0,.2,1); }
.bar.high > span { background: var(--green); }
.bar.mid > span { background: var(--amber); }
.bar.low > span { background: var(--red); }

/* ── Tables / lists ────────────────────────────────────────────────── */
.tlist { display: flex; flex-direction: column; }
.trow {
  display: flex; align-items: center; gap: 14px; padding: 13px 18px;
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-inset); }
.trow .grow { flex: 1; min-width: 0; }
.trow .t-title { font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .t-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.trow .t-meta .mono { color: var(--text-2); }
.t-meta .sep::before { content: "·"; margin-right: 10px; color: var(--text-3); }

.ref { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }

/* ── Section labels ────────────────────────────────────────────────── */
.section-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--text-3); margin-bottom: 8px;
}

/* ── Expandable match cards (tender detail) ────────────────────────── */
.mcard {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.mcard:hover { border-color: var(--border-strong); }
.mcard.best { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-50); }
.mcard[open] { box-shadow: var(--shadow-md); }
.msum {
  display: flex; align-items: center; gap: 15px; padding: 15px 18px;
  cursor: pointer; list-style: none; user-select: none;
}
.msum::-webkit-details-marker { display: none; }
.msum:hover { background: var(--surface-inset); }
.msum .cname { font-weight: 600; font-size: 15px; }
.mcard[open] .chev { transform: rotate(180deg); }
.chev { transition: transform .2s; }
.mdetail { padding: 4px 18px 18px; border-top: 1px solid var(--border); }
.mdetail .grid { padding-top: 14px; }
@media (max-width: 760px) { .mdetail .cols-2-even { grid-template-columns: 1fr; } }

/* ── Status cards (confidence / go-no-go) ──────────────────────────── */
.statcard {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface-2);
}
.statcard.high { background: var(--green-bg); border-color: var(--green-bd); }
.statcard.mid  { background: var(--amber-bg); border-color: var(--amber-bd); }
.statcard.low  { background: var(--red-bg);   border-color: var(--red-bd); }
.statlabel { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.statpill {
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  padding: 4px 12px; border-radius: 999px; color: #fff; letter-spacing: -0.02em;
}
.statpill.high { background: var(--green); } .statpill.mid { background: var(--amber); } .statpill.low { background: var(--red); }

/* ── Additional-info table ─────────────────────────────────────────── */
.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table th, .info-table td { text-align: left; vertical-align: top; padding: 9px 10px; border: 1px solid var(--border); }
.info-table th { width: 34%; background: var(--surface-inset); font-weight: 600; color: var(--text-2); }
.info-table td { color: var(--text); }
.info-table .meta-list { gap: 3px; }

/* ── Requirement lists ─────────────────────────────────────────────── */
.req-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.req-list > li { background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 11px; }
.req-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.req-k { font-weight: 600; font-size: 13px; }
.req-body { margin-top: 5px; }
.meta-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.meta-list ul { margin-top: 3px; padding-left: 12px; }

.callout { padding: 12px 14px; border-radius: var(--r-sm); font-size: 13px; }
.callout.err { background: var(--red-bg); border: 1px solid var(--red-bd); color: var(--red); }

/* ── Match cards (legacy flat variant) ─────────────────────────────── */
.match {
  display: flex; gap: 16px; padding: 16px 18px; border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.match:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.match.best { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-50); }
.match .mbody { flex: 1; min-width: 0; }
.match .mtop { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.match .cname { font-weight: 600; font-size: 15px; }
.match .crank { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }
.rankbadge {
  width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.rankbadge.gold { background: linear-gradient(150deg,#fde68a,#f59e0b); color:#5a3a00; border-color: transparent; }

/* ── Dropzone ──────────────────────────────────────────────────────── */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 30px 20px; text-align: center; background: var(--surface-inset);
  transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-50); }
.dropzone .dz-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); }
.dropzone h4 { font-size: 14px; margin-bottom: 3px; }
.dropzone p { font-size: 12.5px; color: var(--text-3); }
.dropzone .fname { margin-top: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--accent-600); }
.dropzone.uploading { pointer-events: none; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--accent-50); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status dot for doc ingestion ──────────────────────────────────── */
.sdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sdot.embedded { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.sdot.pending  { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.sdot.parsing  { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.sdot.failed   { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }

/* ── Toolbar / filters ─────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.field { position: relative; }
.field svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.field input, .select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); outline: none; transition: border .15s, box-shadow .15s;
}
.field input { padding-left: 33px; min-width: 240px; }
.field input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.segmented a { padding: 6px 12px; border-radius: var(--r-xs); font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.segmented a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Empty state ───────────────────────────────────────────────────── */
.empty { text-align: center; padding: 54px 20px; color: var(--text-3); }
.empty .eic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface-2); color: var(--text-3); }
.empty h3 { color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ── Definition list (profile) ─────────────────────────────────────── */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 0; }
.dl dt { padding: 10px 0; font-size: 12.5px; color: var(--text-3); border-bottom: 1px solid var(--border); font-weight: 550; }
.dl dd { padding: 10px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }

/* ── Toasts (Django messages) ──────────────────────────────────────── */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px 15px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r); box-shadow: var(--shadow-lg); font-size: 13px;
  animation: slide-in .35s cubic-bezier(.2,.8,.2,1);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--green); } .toast.error svg { color: var(--red); } .toast.warning svg { color: var(--amber); }

/* ── Login ─────────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.auth-aside {
  position: relative; overflow: hidden; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 100% at 0% 0%, #1863DC 0%, #1b4597 45%, #0a2a5e 100%);
  color: #fff;
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 26px 26px; mask-image: radial-gradient(120% 90% at 60% 30%, #000, transparent 75%);
}
.auth-aside .a-top, .auth-aside .a-bottom, .auth-aside .a-mid { position: relative; }
.auth-aside .a-brand { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: 16px; }
.auth-aside .a-mark { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,0.16); display: grid; place-items: center; backdrop-filter: blur(4px); }
.auth-aside h2 { font-size: 30px; line-height: 1.15; letter-spacing: -0.03em; max-width: 460px; }
.auth-aside .a-sub { color: rgba(255,255,255,0.8); margin-top: 14px; max-width: 400px; font-size: 14px; }
.auth-stats { display: flex; gap: 28px; margin-top: 26px; }
.auth-stats b { font-family: var(--font-mono); font-size: 22px; display: block; letter-spacing: -0.03em; }
.auth-stats span { font-size: 12px; color: rgba(255,255,255,0.7); }
.auth-aside .a-bottom { font-size: 12.5px; color: rgba(255,255,255,0.6); }

.auth-main { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 372px; }
.auth-card h1 { font-size: 25px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 26px; font-size: 14px; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-row input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); outline: none; transition: border .15s, box-shadow .15s;
}
.form-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.auth-card .btn-primary { width: 100%; padding: 11px; margin-top: 6px; }
.auth-err { background: var(--red-bg); border: 1px solid var(--red-bd); color: var(--red); padding: 10px 13px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.auth-hint { margin-top: 20px; padding: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 12.5px; color: var(--text-2); }
.auth-hint code { font-family: var(--font-mono); color: var(--text); }
@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ── Animation ─────────────────────────────────────────────────────── */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: fade-up .5s cubic-bezier(.2,.8,.2,1) forwards; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; opacity: 1; } .ring .meter, .bar > span { transition: none; } }

/* ── Mobile shell ──────────────────────────────────────────────────── */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: grid; }
  .search { max-width: none; }
  .canvas { padding: 18px; }
}
.scrim { display: none; }
.scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.muted { color: var(--text-3); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 7px; }
.mt-sm { margin-top: 8px; } .mt { margin-top: 16px; } .mt-lg { margin-top: 24px; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
