/* ─────────────────────────────────────────────────────────────────────────────
   laslogs job desk — operations command center
   Hand-written CSS on purpose: no Tailwind CDN, no webfonts, no external
   requests at all. That is what lets the Content-Security-Policy stay at
   default-src 'none' with only 'self' allowed, and it means an authenticated
   session never leaks a request to a third party.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --bg: #080b12;
  --bg-raised: #0e1420;
  --bg-panel: #111a28;
  --bg-hover: #16202f;
  --line: #1e2a3d;
  --line-soft: #172231;
  --text: #e7eef8;
  --text-dim: #94a5be;
  --text-faint: #64748b;
  --accent: #4d7cff;
  --accent-soft: rgba(77, 124, 255, 0.14);
  --good: #16c79a;
  --good-soft: rgba(22, 199, 154, 0.14);
  --warn: #f7a531;
  --warn-soft: rgba(247, 165, 49, 0.14);
  --bad: #f2555a;
  --bad-soft: rgba(242, 85, 90, 0.14);
  --purple: #a97bff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Light theme is a full re-declaration rather than a filter: an inverted
   dashboard reads as washed-out, and status colours must stay legible. */
html[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg-raised: #ffffff;
  --bg-panel: #ffffff;
  --bg-hover: #eef2f8;
  --line: #dde4ee;
  --line-soft: #e8edf5;
  --text: #101827;
  --text-dim: #4d5b73;
  --text-faint: #7b8798;
  --accent: #2b5fe3;
  --accent-soft: rgba(43, 95, 227, 0.1);
  --good: #0f9d78;
  --good-soft: rgba(15, 157, 120, 0.12);
  --warn: #b9740a;
  --warn-soft: rgba(185, 116, 10, 0.12);
  --bad: #d33a3f;
  --bad-soft: rgba(211, 58, 63, 0.12);
  --purple: #7b4fd6;
  --shadow: 0 6px 20px rgba(16, 24, 39, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-soft); }

/* ── Layout ───────────────────────────────────────────────────────────────── */

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

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-raised);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; color: #fff; letter-spacing: -0.5px;
}
.brand-text { line-height: 1.15; }
.brand-text strong { display: block; font-size: 13px; letter-spacing: -0.2px; }
.brand-text span { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer; border: 0; background: none;
  width: 100%; text-align: left; font-size: 13px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item[aria-current='true'] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums;
  background: var(--line); padding: 1px 6px; border-radius: 20px; color: var(--text-dim);
}
.nav-item .count.alert { background: var(--bad); color: #fff; font-weight: 700; }
.nav-sep { height: 1px; background: var(--line); margin: 12px 6px; }
.sidebar-foot { margin-top: auto; padding: 10px 8px 0; font-size: 11px; color: var(--text-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 22px; border-bottom: 1px solid var(--line);
  background: var(--bg-raised); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.2px; }
.topbar .spacer { flex: 1; }

.content { padding: 22px; max-width: 1500px; width: 100%; }

/* ── Cards & panels ───────────────────────────────────────────────────────── */

.panel {
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: 0.01em; }
.panel-head .spacer { flex: 1; }
.panel-sub { font-size: 12px; color: var(--text-faint); margin: -8px 0 14px; }

.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); font-weight: 600; }
.stat .value { font-size: 27px; font-weight: 680; letter-spacing: -0.8px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.stat.accent { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.stat.good  .value { color: var(--good); }
.stat.warn  .value { color: var(--warn); }
.stat.bad   .value { color: var(--bad); }

/* ── Funnel ───────────────────────────────────────────────────────────────── */

.funnel { display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; }
.funnel-step {
  flex: 1 1 96px; min-width: 96px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 11px; background: var(--bg-raised);
  position: relative; overflow: hidden;
}
.funnel-step .n { font-size: 20px; font-weight: 680; font-variant-numeric: tabular-nums; }
.funnel-step .s { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); font-weight: 600; }
.funnel-step .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); }

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 20px;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.5;
}
.badge.remote { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.badge.hybrid { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.onsite { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.badge.unknown { background: var(--line); color: var(--text-dim); }

.badge.strong  { background: var(--good-soft); color: var(--good); }
.badge.good    { background: var(--accent-soft); color: var(--accent); }
.badge.stretch { background: var(--warn-soft); color: var(--warn); }
.badge.weak    { background: var(--line); color: var(--text-dim); }
.badge.veto    { background: var(--bad-soft); color: var(--bad); }

.badge.st-scraped   { background: var(--line); color: var(--text-dim); }
.badge.st-ranked    { background: var(--accent-soft); color: var(--accent); }
.badge.st-drafted   { background: rgba(169, 123, 255, 0.16); color: var(--purple); }
.badge.st-applied   { background: var(--accent-soft); color: var(--accent); }
.badge.st-interview { background: var(--good-soft); color: var(--good); }
.badge.st-offer     { background: var(--good); color: #04150f; }
.badge.st-rejected  { background: var(--bad-soft); color: var(--bad); }
.badge.st-withdrawn { background: var(--line); color: var(--text-faint); }
.badge.st-follow_up { background: var(--warn-soft); color: var(--warn); }
.badge.st-none      { background: transparent; color: var(--text-faint); border-color: var(--line); }

/* ── Buttons & controls ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-raised);
  color: var(--text); cursor: pointer; font-size: 13px; font-weight: 550;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--text-faint); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.icon { padding: 6px 8px; }

input[type='text'], input[type='password'], input[type='search'], input[type='url'],
input[type='number'], input[type='email'], input[type='datetime-local'], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 10px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 74px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 11.5px; color: var(--text-dim); margin-bottom: 5px; font-weight: 550; }
.hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 240px; min-width: 180px; }

.chips { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 3px; }
.chip {
  border: 0; background: none; color: var(--text-dim); cursor: pointer;
  padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.chip[aria-pressed='true'] { background: var(--accent); color: #fff; }
.chip.remote[aria-pressed='true'] { background: var(--good); color: #04150f; }
.chip.hybrid[aria-pressed='true'] { background: var(--warn); color: #1a1206; }
.chip.onsite[aria-pressed='true'] { background: var(--bad); color: #fff; }

/* ── Table ────────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 9px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-faint); font-weight: 650;
  border-bottom: 1px solid var(--line); background: var(--bg-raised);
  position: sticky; top: 0; white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr.blocked { opacity: 0.62; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
.role-cell { display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.role-cell .title { font-weight: 600; }
.role-cell .company { font-size: 12px; color: var(--text-dim); }

.score {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-variant-numeric: tabular-nums; font-weight: 680;
}
.score .pct { font-size: 15px; }
.score-bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 3px; min-width: 54px; }
.score-bar > i { display: block; height: 100%; background: var(--accent); }

/* ── Charts (inline SVG, no library) ─────────────────────────────────────── */

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-dim); font-size: 10.5px; font-family: var(--sans); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--accent); }
.chart .bar.remote { fill: var(--good); }
.chart .bar.hybrid { fill: var(--warn); }
.chart .bar.onsite { fill: var(--bad); }
.chart .bar.unknown { fill: var(--text-faint); }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 2 3; }

.radar-poly { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.radar-web { stroke: var(--line); fill: none; }

/* ── Timeline ─────────────────────────────────────────────────────────────── */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: 0 0 auto; }
.timeline .when { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline .what { flex: 1; min-width: 0; font-size: 12.5px; }
.timeline .what strong { font-weight: 620; }

/* ── Drawer ───────────────────────────────────────────────────────────────── */

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(2, 5, 10, 0.62);
  opacity: 0; pointer-events: none; transition: opacity 0.16s; z-index: 40;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(620px, 94vw);
  background: var(--bg-raised); border-left: 1px solid var(--line);
  box-shadow: var(--shadow); transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1);
  z-index: 41; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer-head h2 { margin: 0 0 3px; font-size: 15px; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tailored-CV readiness. Sits next to the status buttons because it is the
   precondition for "Mark applied…", which is disabled until it reads ready. */
.cv-ready, .cv-missing {
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.cv-ready   { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.cv-missing { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.drawer-foot .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.kv { display: grid; grid-template-columns: 116px 1fr; gap: 7px 12px; font-size: 12.5px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; }

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); font-weight: 650; margin: 20px 0 9px;
}
.section-title:first-child { margin-top: 0; }

.rationale { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.rationale b { color: var(--text); }

.pill-list { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--line); color: var(--text-dim); font-family: var(--mono); }
.pill.miss { background: var(--bad-soft); color: var(--bad); }

/* ── Toasts ───────────────────────────────────────────────────────────────── */

.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--bg-panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow);
  max-width: 380px; font-size: 13px; animation: slide-in 0.18s ease-out;
}
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast .t-title { font-weight: 650; margin-bottom: 2px; }
.toast .t-body { color: var(--text-dim); font-size: 12px; }
@keyframes slide-in { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Login / reset pages ──────────────────────────────────────────────────── */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 388px; background: var(--bg-panel);
  border: 1px solid var(--line); border-radius: 14px; padding: 30px; box-shadow: var(--shadow);
}
.auth-card .brand { justify-content: flex-start; padding: 0 0 22px; }
.auth-card h1 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.3px; }
.auth-card .lede { margin: 0 0 22px; color: var(--text-dim); font-size: 13px; }
.auth-note {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-faint); line-height: 1.6;
}
.alert {
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert.err { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.alert.ok { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert[hidden] { display: none; }

.pw-strength { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.pw-strength > i { display: block; height: 100%; width: 0; background: var(--bad); transition: width 0.2s, background 0.2s; }

/* ── Utility ──────────────────────────────────────────────────────────────── */

.empty { padding: 34px 18px; text-align: center; color: var(--text-faint); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
[hidden] { display: none !important; }
.spinner {
  width: 13px; height: 13px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  /* Mobile-first collapse: the sidebar becomes a horizontal scroller pinned to
     the top so the whole nav stays reachable with a thumb. */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 10px;
    align-items: center; gap: 6px;
  }
  .brand { padding: 0 10px 0 4px; }
  .brand-text { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .nav-sep, .sidebar-foot { display: none; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 11px 14px; }
  .topbar h1 { font-size: 15px; }
  .kv { grid-template-columns: 96px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
