/* ---------- tokens ----------
   Warm editorial palette: paper, ink, forest green, terracotta. */
:root {
  --bg: #f4efe6;
  --surface: #fffdf8;
  --surface-2: #f0e9dd;
  --surface-3: #e6ddcd;
  --border: #e2d8c6;
  --text: #1f1a14;
  --text-2: #4b4237;
  --muted: #7d7263;
  --accent: #1f5c46;
  --accent-2: #c2562f;
  --accent-soft: #e3ece4;
  --accent-text: #fdfaf3;
  --good: #2f7a4f;
  --good-soft: #e1eee2;
  --warn: #a8660f;
  --warn-soft: #f6ead3;
  --bad: #b23a2a;
  --bad-soft: #f6e1dc;
  --shadow: 0 1px 0 rgba(60, 40, 10, .04), 0 2px 10px rgba(60, 40, 10, .04);
  --radius: 10px;
  --radius-sm: 6px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #16140f;
  --surface: #1e1b15;
  --surface-2: #26221b;
  --surface-3: #312c23;
  --border: #353026;
  --text: #f1eadc;
  --text-2: #d3c9b6;
  --muted: #9b907d;
  --accent: #7fbf9c;
  --accent-2: #e2865c;
  --accent-soft: #1f3129;
  --accent-text: #11100c;
  --good: #7fbf9c;
  --good-soft: #1b2c22;
  --warn: #e0a84e;
  --warn-soft: #2e2415;
  --bad: #ec7b66;
  --bad-soft: #33201a;
  --shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 2px 10px rgba(0, 0, 0, .2);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #16140f;
    --surface: #1e1b15;
    --surface-2: #26221b;
    --surface-3: #312c23;
    --border: #353026;
    --text: #f1eadc;
    --text-2: #d3c9b6;
    --muted: #9b907d;
    --accent: #7fbf9c;
    --accent-2: #e2865c;
    --accent-soft: #1f3129;
    --accent-text: #11100c;
    --good: #7fbf9c;
    --good-soft: #1b2c22;
    --warn: #e0a84e;
    --warn-soft: #2e2415;
    --bad: #ec7b66;
    --bad-soft: #33201a;
    --shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 2px 10px rgba(0, 0, 0, .2);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.015em; }
h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.end { align-items: flex-end; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }

/* ---------- controls ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 11px; min-width: 0; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
input[type="range"] { accent-color: var(--accent); padding: 0; border: 0; background: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea { resize: vertical; }
label.field, div.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; color: var(--text-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }

.btn {
  font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer;
  background: var(--surface); color: var(--text); white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.btn.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; position: relative; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; font-weight: 500;
}
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center;
}

/* toggle chips (multi-select) */
.pick-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.pick {
  font: inherit; font-size: 13px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.pick[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 500; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background: #173d2f;
}
.auth-hero h1 { font-size: 52px; line-height: 1.04; max-width: 520px; letter-spacing: -.025em; color: #f4efe6; font-weight: 500; }
.auth-hero h1 em { font-style: italic; color: #e9a27e; }
.auth-hero p { color: #c9d6cc; font-size: 16px; max-width: 460px; margin-top: 18px; }
.auth-hero .brand { color: #f4efe6; }
.auth-points { display: grid; gap: 12px; margin-top: 32px; max-width: 460px; }
.auth-points div { display: flex; gap: 14px; align-items: baseline; color: #c9d6cc; border-top: 1px solid rgba(244, 239, 230, .14); padding-top: 12px; }
.auth-points .num { font-family: var(--serif); font-style: italic; color: #e9a27e; font-size: 15px; min-width: 22px; }
.auth-points b { color: #f4efe6; font-weight: 600; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 30px; margin-bottom: 6px; }
.auth-card form { margin-top: 22px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--muted); }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.form-ok { color: var(--good); background: var(--good-soft); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 24px; }
.nav { display: flex; gap: 2px; }
.nav a {
  color: var(--text-2); padding: 8px 12px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); border-bottom-color: var(--accent-2); }
.nav .count { font-size: 11px; background: var(--accent); color: var(--accent-text); border-radius: 9px; padding: 0 6px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: var(--accent); color: var(--accent-text); border: 0; cursor: pointer; font-family: var(--serif);
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu button, .menu a {
  display: flex; width: 100%; text-align: left; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 0;
  background: none; color: var(--text); font: inherit; cursor: pointer;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.pop { position: relative; }
.notif-item { padding: 10px; border-radius: 8px; }
.notif-item + .notif-item { border-top: 1px solid var(--border); }

main.page { max-width: 1320px; margin: 0 auto; padding: 22px 24px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.narrow { max-width: 860px; }
.callout {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); margin-bottom: 16px;
}
.callout .spacer { min-width: 10px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12.5px; }
button.stat { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: border-color .15s, background .15s; }
button.stat:hover { border-color: var(--text-2); }
button.stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.stat[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px;
}
.filters input[type="search"] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }
.filters .num { width: 70px; }

/* jobs split view */
.split { display: grid; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); gap: 16px; margin-top: 14px; align-items: start; }
.job-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100vh - 270px); overflow-y: auto; padding-right: 2px; }
.job-item {
  display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; padding: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .12s;
}
.job-item:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.job-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.job-title { font-weight: 600; overflow-wrap: anywhere; }
.job-item.unread .job-title::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  margin-right: 7px; vertical-align: middle;
}
.job-meta { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.score {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 17px; font-family: var(--serif);
  background: var(--surface-2); color: var(--muted);
}
.score.high { background: var(--good-soft); color: var(--good); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.score.low { background: var(--bad-soft); color: var(--bad); }
.detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  max-height: calc(100vh - 270px); overflow-y: auto; box-shadow: var(--shadow); }
.detail.empty { display: grid; place-items: center; min-height: 260px; color: var(--muted); text-align: center; }
.detail-head { display: flex; gap: 14px; align-items: flex-start; }
.detail-head h2 { font-size: 24px; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
.facts b { color: var(--text-2); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.section > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols ul { margin: 6px 0 0; padding-left: 18px; }
.description { overflow-wrap: anywhere; color: var(--text-2); line-height: 1.65; max-width: 72ch; }
.description p { margin: 0 0 10px; }
.description h4 { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--text); margin: 18px 0 6px; }
.description h4:first-child { margin-top: 0; }
.description ul { margin: 0 0 12px; padding-left: 20px; }
.description li { margin: 3px 0; }
.description.collapsed { max-height: 280px; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent); mask-image: linear-gradient(to bottom, #000 65%, transparent); }
#desc-toggle { margin-top: 8px; }

.lede { margin: 12px 0 0; font-size: 15px; color: var(--text); max-width: 72ch; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 14px;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.glance h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.glance ul { margin: 0; padding-left: 18px; }
.glance li { margin: 4px 0; color: var(--text-2); line-height: 1.45; }
.apply-box { margin-top: 14px; padding: 16px; border-radius: var(--radius); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); display: flex; flex-direction: column; gap: 12px; }
.apply-box > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.apply-way { display: flex; flex-direction: column; gap: 4px; }
.apply-way a { overflow-wrap: anywhere; }
.compose { display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); padding: 14px; border-radius: var(--radius); }
.compose textarea { min-height: 260px; }
.back { display: none; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table select { width: auto; padding: 4px 8px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* resume dropzone */
.dropzone {
  display: block; border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { color: var(--accent); }

.progress-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--accent); transition: width .4s; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500;
}
.toast.error { background: var(--bad); color: #fff; }

.theme-switch { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.theme-switch button { border: 0; background: none; color: var(--text-2); font: inherit; padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav a span.lbl { display: none; }
}
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 16px; }
  .auth-hero h1 { font-size: 34px; }
  .auth-points { display: none; }
  .topbar-inner { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a span.lbl { display: inline; }
  main.page { padding: 16px 16px 48px; }
  .split { grid-template-columns: 1fr; }
  .job-list, .detail { max-height: none; }
  .split.showing .job-list { display: none; }
  .split:not(.showing) .detail { display: none; }
  .back { display: inline-flex; margin-bottom: 12px; }
  /* On phones a job's detail replaces the whole list view, not just the list. */
  body.detail-open #tab-jobs-head, body.detail-open .page-head, body.detail-open #run-callout,
  body.detail-open #stats, body.detail-open #filters, body.detail-open .callout { display: none; }
  body.detail-open .split { margin-top: 0; }
  .cols, .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
