:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --border: #e2e6ee;
  --text: #1b2233;
  --muted: #5f6b7f;
  --accent: #2856d8;
  --accent-soft: #e8eefc;
  --good: #16794c;
  --good-soft: #e3f4ec;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b42335;
  --bad-soft: #fbe7ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131b;
    --surface: #171c26;
    --surface-2: #1f2532;
    --border: #2b3242;
    --text: #e6e9f0;
    --muted: #98a2b5;
    --accent: #7b9cff;
    --accent-soft: #1f2a4a;
    --good: #5fd39a;
    --good-soft: #15322a;
    --warn: #f2b45a;
    --warn-soft: #3a2c14;
    --bad: #ff8593;
    --bad-soft: #3b1d23;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 64px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.9rem; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.logo { background: var(--accent); color: #fff; border-radius: 8px; padding: 3px 7px; font-size: .8rem; letter-spacing: .05em; }

.hero { text-align: center; max-width: 640px; margin: 0 auto 24px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
#analyze-form { max-width: 640px; margin: 0 auto; }

/* form */
.field-label { display: block; font-weight: 600; margin: 18px 0 8px; }
.field-label:first-child { margin-top: 0; }
input[type=text], input[type=email], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
input[type=text]:focus, input[type=email]:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px;
  border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; text-align: center;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.dz-icon { font-size: 1.6rem; color: var(--accent); }

.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.chips-input:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.chips-input input { flex: 1; min-width: 180px; border: 0 !important; outline: none !important; padding: 6px; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .9rem; font-weight: 500; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }

.advanced { margin: 16px 0 6px; }
.advanced summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.advanced textarea { margin: 6px 0 8px; }
.check { display: flex; gap: 8px; align-items: center; margin: 14px 0; font-size: .92rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); width: 100%; padding: 12px; font-size: 1rem; }
.btn.primary:disabled { opacity: .6; cursor: wait; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.alert.error { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--warn-soft); color: var(--warn); }

/* progress */
#progress-view .card { max-width: 640px; margin: 0 auto; }
.steps { list-style: none; padding: 0; margin: 18px 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: 12px; padding: 9px 0; color: var(--muted); }
.steps li::before {
  content: counter(s); width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: var(--surface-2); border: 1px solid var(--border);
}
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.active::before { background: var(--accent); color: #fff; border-color: var(--accent); animation: pulse 1.4s infinite; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: "✓"; background: var(--good); color: #fff; border-color: var(--good); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
.log-box { margin-top: 12px; }
.log-box summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.log-box pre { background: var(--surface-2); padding: 10px; border-radius: 8px; font-size: .8rem; max-height: 220px; overflow: auto; white-space: pre-wrap; }

/* results */
.results-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.card > .badge { border-radius: 6px; margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.score-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 18px; }
.score-card { display: flex; gap: 14px; align-items: center; }
.ring {
  --v: 0; --c: var(--accent);
  width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-2) 0);
}
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* Role-fit highlight boxes: strengths = light green, critical gaps = light yellow, minor gaps = light blue */
.hl { border-radius: 10px; padding: 4px 14px 8px; margin: 12px 0; border-left: 4px solid; color: #1b2233; }
.hl .section-title { color: inherit; opacity: .75; margin-top: 10px; }
.hl-strengths { background: #e3f5e8; border-color: #34a853; }
.hl-critical { background: #fff6d1; border-color: #e0a800; }
.hl-minor { background: #e2effc; border-color: #3b82f6; }
@media (prefers-color-scheme: dark) {
  .hl { color: var(--text); }
  .hl-strengths { background: #183324; }
  .hl-critical { background: #3a3215; }
  .hl-minor { background: #172a42; }
}

ul.clean { padding-left: 18px; margin: 6px 0; }
ul.clean li { margin-bottom: 6px; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.kw span { padding: 2px 9px; border-radius: 6px; font-size: .82rem; background: var(--surface-2); }
.kw.have span { background: var(--good-soft); color: var(--good); }
.kw.miss span { background: var(--bad-soft); color: var(--bad); }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table-scroll { overflow-x: auto; }

.cv-preview { background: #fff; color: #1f2937; border-radius: 8px; padding: 28px 32px; border: 1px solid var(--border); max-height: 720px; overflow: auto; }
.cv-preview h1 { font-size: 1.6rem; }
.cv-preview h2 { font-size: .95rem; text-transform: uppercase; color: #1e40af; border-bottom: 1px solid #d1d5db; padding-bottom: 3px; margin-top: 18px; }
.cv-preview h3 { font-size: .95rem; margin-top: 12px; }
.cv-preview ul { padding-left: 18px; }
.cv-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtabs .btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* consent, feedback, privacy */
.check.consent { align-items: flex-start; font-size: .88rem; color: var(--muted); }
.check.consent input { margin-top: 3px; }
select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
.feedback { margin-top: 22px; }
.feedback form { max-width: 620px; }
.feedback .btn.primary { width: auto; padding: 10px 22px; margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star input, .pill input { position: absolute; opacity: 0; }
.star span[aria-hidden] { font-size: 2rem; line-height: 1; color: var(--border); cursor: pointer; transition: color .1s; }
.stars .star:hover span[aria-hidden], .stars .star:hover ~ .star span[aria-hidden],
.stars .star:has(input:checked) span[aria-hidden], .stars .star:has(input:checked) ~ .star span[aria-hidden] { color: #f5a524; }
.star input:focus-visible + span { outline: 2px solid var(--accent); border-radius: 4px; }
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill span { display: inline-block; padding: 7px 18px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 600; }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.alert.success { background: var(--good-soft); color: var(--good); }
.privacy-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.privacy-box p { margin: 4px 0 0; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.disclaimer { text-align: center; max-width: 760px; margin: 8px auto 0; }
.legal { max-width: 780px; margin: 0 auto; }
.legal h2 { font-size: 1.1rem; margin-top: 22px; }
.legal li { margin-bottom: 6px; }

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .card { padding: 16px; }
  .head-actions { align-items: stretch; width: 100%; }
  .cv-preview { padding: 18px; }
}

/* Private beta access page */
.access-card { max-width: 440px; margin: 48px auto; }
.access-card h1 { margin-top: 0; }
.access-card .btn.primary { margin-top: 16px; }
