:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --text: #15161d;
  --muted: #646778;
  --border: #e3e4ec;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --danger: #c2261d;
  --ok: #157a46;
  --warn: #9a5b00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 8px 24px rgba(20, 20, 40, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f14;
    --surface: #171821;
    --surface-2: #1f2130;
    --text: #ececf3;
    --muted: #9a9db0;
    --border: #2a2c3c;
    --accent: #8b84ff;
    --accent-ink: #0e0f14;
    --accent-soft: #23234a;
    --danger: #ff7a70;
    --ok: #5ad69a;
    --warn: #f2b45c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.02em; }
h2 { font-size: 1.25rem; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Layout */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); }
.brand img { width: 28px; height: 28px; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
nav.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
nav.tabs a:hover { background: var(--surface-2); color: var(--text); }
nav.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.user { display: flex; align-items: center; gap: 10px; }
main { padding: 28px 0 64px; }

/* Landing */
.landing { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; min-height: calc(100vh - 60px); padding: 40px 0; }
.landing .lede { font-size: 1.1rem; color: var(--muted); max-width: 34rem; }
.points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.points li { display: flex; gap: 12px; align-items: flex-start; }
.points .dot { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
@media (max-width: 860px) { .landing { grid-template-columns: 1fr; gap: 28px; min-height: auto; } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* Forms */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; user-select: none; background: var(--surface); font-weight: 500; font-size: .9rem; }
.chip input { accent-color: var(--accent); margin: 0; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); }
button:hover { filter: brightness(1.05); }
button[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: .85rem; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.segmented button { background: transparent; color: var(--muted); }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.error { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: 0 0 10px; }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stage .n { font-size: 1.6rem; font-weight: 700; }
.stage .l { color: var(--muted); font-size: .82rem; }
@media (max-width: 760px) { .pipeline { grid-template-columns: repeat(2, 1fr); } }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.applied, .badge.confirmation_received { background: var(--accent-soft); color: var(--accent); }
.badge.interview_booked, .badge.offer_received, .badge.active, .badge.state_updated { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.rejected, .badge.revoked, .badge.error, .badge.failed { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.badge.unmatched, .badge.paused { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .9rem; }

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

/* Jobs */
.job .job-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.job-title { font-size: 1.05rem; margin: 0 0 2px; }
.score { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--border); }
.score.hi { border-color: var(--ok); color: var(--ok); }
.score.mid { border-color: var(--accent); color: var(--accent); }
.score.lo { color: var(--muted); }
.job-prep, .job-details { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.desc { white-space: pre-line; color: var(--muted); max-height: 420px; overflow: auto; font-size: .92rem; }
textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; line-height: 1.55; resize: vertical; }
.card-head .segmented { grid-template-columns: 1fr 1fr; }
input[type=file] { font: inherit; color: var(--muted); }
.row select { width: auto; min-width: 150px; }
