:root {
  --bg: oklch(1 0 0);
  --surface: oklch(0.968 0.004 250);
  --surface-2: oklch(0.945 0.006 250);
  --ink: oklch(0.24 0.012 250);
  --muted: oklch(0.46 0.014 250);
  --line: oklch(0.9 0.006 250);
  --primary: oklch(0.48 0.14 255);
  --primary-strong: oklch(0.41 0.13 255);
  --primary-soft: oklch(0.94 0.03 255);
  --accent: oklch(0.62 0.14 70);
  --accent-soft: oklch(0.95 0.035 75);
  --danger: oklch(0.52 0.16 25);
  --danger-soft: oklch(0.95 0.025 25);
  --src-zip: oklch(0.5 0.12 130);
  --src-indeed: oklch(0.52 0.15 265);
  --radius: 8px;
  --shadow: 0 1px 2px oklch(0.2 0.01 250 / 0.06), 0 4px 12px oklch(0.2 0.01 250 / 0.07);
  --z-drawer-backdrop: 40;
  --z-drawer: 50;
  --z-toast: 60;
  --z-tooltip: 70;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--primary-strong); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--primary);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.tabs { display: flex; gap: 2px; background: var(--surface); border-radius: var(--radius); padding: 3px; }
.tab {
  border: 0; background: none; color: var(--muted);
  padding: 5px 14px; border-radius: 6px; font-weight: 550;
  transition: color 150ms var(--ease), background 150ms var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.01 250 / 0.08); }
.topbar .spacer { flex: 1; }
.topbar select, .topbar input[type="search"] {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg);
}
.topbar input[type="search"] { width: 200px; }
.topbar select:focus-visible, .topbar input:focus-visible, .tab:focus-visible, button:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.user-chip { color: var(--muted); font-size: 13px; }
.linklike { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; white-space: nowrap; }
.linklike:hover { color: var(--ink); }

/* ---------- board ---------- */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(248px, 1fr);
  gap: 12px;
  padding: 16px 20px 24px;
  overflow-x: auto;
  min-height: calc(100vh - 56px);
  align-items: start;
}
.col { background: var(--surface); border-radius: 10px; padding: 8px; min-height: 120px; }
.col-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 8px 10px;
  font-weight: 600; font-size: 13px;
}
.col-count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.col.dragover { outline: 2px dashed var(--primary); outline-offset: -2px; background: var(--primary-soft); }
.col-empty { color: var(--muted); font-size: 12.5px; padding: 10px 8px 14px; }

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 160ms var(--ease), transform 160ms var(--ease), border-color 160ms var(--ease);
}
.card:hover { box-shadow: var(--shadow); border-color: var(--surface-2); transform: translateY(-1px); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.5; }
.card-name { font-weight: 600; margin-bottom: 2px; }
.card-role { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.src-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.src-dot.ziprecruiter { background: var(--src-zip); }
.src-dot.indeed { background: var(--src-indeed); }
.card-meta .has { margin-left: auto; display: flex; gap: 6px; }
.chip {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px;
  background: var(--surface); color: var(--muted);
}
.chip.resume { background: var(--primary-soft); color: var(--primary-strong); }
.chip.contact { background: var(--accent-soft); color: oklch(0.42 0.1 70); }

/* ---------- drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: oklch(0.2 0.01 250 / 0.32);
  z-index: var(--z-drawer-backdrop);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 94vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: var(--z-drawer);
  transform: translateX(102%);
  transition: transform 240ms var(--ease);
  display: flex; flex-direction: column;
}
body.drawer-open .drawer { transform: translateX(0); }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0 0 2px; font-size: 18px; letter-spacing: -0.01em; text-wrap: balance; }
.drawer-sub { color: var(--muted); font-size: 13px; }
.drawer-close {
  position: absolute; top: 14px; right: 14px;
  border: 0; background: none; color: var(--muted);
  font-size: 18px; line-height: 1; padding: 6px; border-radius: 6px;
}
.drawer-close:hover { background: var(--surface); color: var(--ink); }
.drawer-body { padding: 16px 20px 24px; overflow-y: auto; flex: 1; }
.field-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.field-row label { width: 64px; color: var(--muted); font-size: 12.5px; flex: none; }
.field-row input, .field-row select {
  flex: 1; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  min-width: 0;
}
.section-title { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 0 8px; }
.exp-list { margin: 0; padding: 0 0 0 0; list-style: none; }
.exp-list li { padding: 6px 0; border-bottom: 1px solid var(--surface); font-size: 13px; }
.exp-list li:last-child { border-bottom: 0; }
.drawer-links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-weight: 550; text-decoration: none; font-size: 13px;
  transition: background 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-strong); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.note-input { display: flex; gap: 8px; }
.note-input input { flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.note { padding: 8px 10px; background: var(--surface); border-radius: var(--radius); margin-top: 8px; font-size: 13px; }
.note time { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.hist { color: var(--muted); font-size: 12.5px; padding: 3px 0; }

/* ---------- dashboard ---------- */
.dash { padding: 20px; max-width: 1080px; margin: 0 auto; }
.dash h1 { font-size: 20px; letter-spacing: -0.015em; margin: 4px 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 14px; }
.panel .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.charts-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .charts-2 { grid-template-columns: 1fr; } }
.chart-wrap { overflow-x: auto; }
.bar-rect { transition: opacity 120ms var(--ease); }
svg text { font-family: inherit; }

.tooltip {
  position: fixed; z-index: var(--z-tooltip);
  background: oklch(0.24 0.012 250); color: oklch(0.97 0 0);
  font-size: 12px; padding: 6px 9px; border-radius: 6px;
  pointer-events: none; opacity: 0; transition: opacity 120ms var(--ease);
  max-width: 260px;
}
.tooltip.show { opacity: 1; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--surface); }
.login {
  width: min(360px, 92vw);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 28px; box-shadow: var(--shadow);
}
.login .brand { margin-bottom: 18px; }
.login label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.login input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.login button { width: 100%; margin-top: 16px; height: 36px; border-radius: var(--radius); border: 0; background: var(--primary); color: #fff; font-weight: 600; }
.login button:hover { background: var(--primary-strong); }
.login .err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 1.2em; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: oklch(0.24 0.012 250); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
  z-index: var(--z-toast); opacity: 0; pointer-events: none;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; row-gap: 8px; }
  .topbar input[type="search"] { width: 130px; }
  .board { grid-auto-columns: 82vw; padding: 12px; }
}

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