/* ============================================================
   Job Search Command Center — Mission Control
   Dark, data-dense, utilitarian.
   ============================================================ */

:root {
  --base: oklch(0.12 0.01 250);
  --base-2: oklch(0.15 0.01 250);
  --surface: oklch(0.18 0.01 250);
  --surface-2: oklch(0.22 0.01 250);
  --border: oklch(0.28 0.01 250);
  --text: oklch(0.92 0.01 250);
  --muted: oklch(0.6 0.01 250);
  --accent: oklch(0.72 0.15 45);
  --success: oklch(0.65 0.12 150);
  --danger: oklch(0.65 0.12 25);
  --info: oklch(0.65 0.12 250);
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--base);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
}

.shell { display: flex; min-height: 100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--base-2);
  border-right: 1px solid var(--border);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 14px; border-bottom: 1px solid var(--border); }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-title { font-family: var(--mono); font-weight: 700; letter-spacing: 0.15em; font-size: 13px; }
.brand-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }

.sidebar-section { display: flex; flex-direction: column; gap: 4px; }
.section-head {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.15em;
  color: var(--muted); display: flex; justify-content: space-between;
  padding: 6px 8px 4px; cursor: pointer; user-select: none;
}

.pipeline-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text);
  font-family: var(--sans); font-size: 13px;
  padding: 7px 8px; border-radius: 4px; cursor: pointer;
}
.pipeline-item:hover { background: var(--surface); }
.pipeline-item.active { background: var(--surface-2); outline: 1px solid var(--border); }
.pipeline-item .count { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-all { background: var(--text); }
.dot-new { background: var(--muted); }
.dot-applied { background: var(--info); }
.dot-reviewed { background: var(--accent); }
.dot-interview { background: var(--success); }
.dot-offer { background: var(--success); }
.dot-declined { background: var(--danger); }
.dot-developer { background: var(--accent); }
.dot-sys { background: var(--success); }
.dot-bouldering { background: var(--info); }
.dot-bar { background: var(--danger); }
.dot-accent { background: var(--accent); }
.dot-success { background: var(--success); }
.dot-info { background: var(--info); }
.dot-danger { background: var(--danger); }
.dot { background: var(--accent); }

.field { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px; }
.field-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }

select, input[type="search"], input[type="text"] {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font-family: var(--sans);
  font-size: 13px;
}
select:focus, input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.toggle { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--border); }

/* ---------- BUTTONS ---------- */
.ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
  font-family: var(--mono); letter-spacing: 0.05em;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.ghost.small { padding: 2px 8px; font-size: 11px; }

/* ---------- MAIN ---------- */
.main { flex: 1; padding: 18px 22px 40px; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px;
}

.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 460px; }
.search-wrap input { width: 100%; padding-right: 36px; }
.search-glyph { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: 0.5; }

.topbar-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-left: auto; }

.search-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  background: var(--accent); color: var(--base-2);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.search-btn:hover { filter: brightness(1.1); }
.search-btn:disabled { opacity: 0.6; cursor: wait; }
.stat { display: flex; flex-direction: column; }
.stat-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; color: var(--muted); }
.stat-value { font-family: var(--mono); font-weight: 700; font-size: 16px; }

/* ---------- CARDS ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card.dupe { border-style: dashed; border-color: var(--border); opacity: 0.75; }

.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.pill {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 3px; text-transform: uppercase;
  background: var(--surface-2); border: 1px solid var(--border);
}
.pill-accent { color: var(--accent); border-color: var(--accent); }
.pill-success { color: var(--success); border-color: var(--success); }
.pill-info { color: var(--info); border-color: var(--info); }
.pill-danger { color: var(--danger); border-color: var(--danger); }

.status-select {
  font-family: var(--mono); font-size: 11px; padding: 3px 6px;
  border-radius: 3px; cursor: pointer; background: var(--surface-2);
}
.status-select.sel-0 { color: var(--muted); border-color: var(--muted)2; }
.status-select.sel-1 { color: var(--info); border-color: var(--info); }
.status-select.sel-2 { color: var(--accent); border-color: var(--accent); }
.status-select.sel-3 { color: var(--success); border-color: var(--success); }
.status-select.sel-4 { color: var(--success); border-color: var(--success); }
.status-select.sel-5 { color: var(--danger); border-color: var(--danger); }
.status-select.sel--1 { color: var(--muted); }

.card-title {
  font-family: var(--sans); font-weight: 600; font-size: 14.5px;
  color: var(--text); text-decoration: none; line-height: 1.3;
}
.card-title:hover { color: var(--accent); }

.card-sub { color: var(--muted); font-size: 12.5px; }

.card-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.meta.score b { color: var(--text); }
.meta.score { color: var(--accent); }

.card-flags { display: flex; gap: 8px; margin-top: 4px; }
.flag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 3px;
}
.flag:first-child {
  color: var(--danger); border: 1px solid var(--danger);
}
.flag:not(:first-child) {
  color: var(--success); border: 1px solid var(--success);
}
.flag:empty { display: none; }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 60px 0;
  color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.empty-icon { font-size: 30px; color: var(--border); }

.err { color: var(--danger); font-size: 12px; }

.candidate {
  padding: 10px; border: 1px solid var(--border); border-radius: 5px;
  display: flex; flex-direction: column; gap: 6px; background: var(--surface);
}
.candidate.dupe { border-style: dashed; opacity: 0.7; }
.cand-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cand-score { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-left: auto; }
.cand-score b { color: var(--text); }
.dupe-flag { color: var(--danger); border: 1px solid var(--danger) !important; }
.cand-why { color: var(--muted); line-height: 1.45; }
.add-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  background: var(--success); color: var(--base-2);
  border: 1px solid var(--success); border-radius: 3px;
  padding: 6px 10px; cursor: pointer;
}
.add-btn:hover { filter: brightness(1.1); }
.add-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.loading {
  font-family: var(--mono); color: var(--accent); letter-spacing: 0.2em;
  text-align: center; padding: 60px 0; animation: blink 0.8s step-start infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- DRAWER ---------- */
.drawer-scrim {
  position: fixed; inset: 0; background: oklch(0 0 0 / 0.55); z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 340px; max-width: 90vw;
  background: var(--base-2); border-left: 1px solid var(--border);
  padding: 20px; z-index: 50; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; }
.override-list { display: flex; flex-direction: column; gap: 8px; }
.override-row { display: flex; align-items: center; gap: 8px; }
.override-row .oid { flex: 1; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- MISC ---------- */
.menu-btn {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 4px; font-size: 18px; cursor: pointer;
}
.muted { color: var(--muted); }
.small { font-size: 11px; }
code { font-family: var(--mono); background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 11px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.closed { transform: translateX(0); }
  .menu-btn { display: block; }
  .main { padding-top: 60px; }
  .cards { grid-template-columns: 1fr; }
}