:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --border: #e2e0da;
  --accent: #3b5bdb;
  --accent-soft: #e8edff;
  --good: #2b8a3e;
  --good-soft: #e6f4ea;
  --warn: #b35c00;
  --warn-soft: #fff1e0;
  --bad: #c92a2a;
  --bad-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #1f1f1d;
    --surface-2: #2a2a27;
    --text: #ecebe7;
    --muted: #a3a29c;
    --border: #363632;
    --accent: #7c95ff;
    --accent-soft: #263055;
    --good: #69db7c;
    --good-soft: #1f3324;
    --warn: #ffb057;
    --warn-soft: #3a2a17;
    --bad: #ff8787;
    --bad-soft: #3d1f1f;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.loading { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 14px; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }

/* Layout */
.shell { max-width: 1040px; margin: 0 auto; padding: 20px 16px 80px; }
.wizard { max-width: 720px; margin: 0 auto; padding: 24px 16px 120px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card.tight { padding: 14px 16px; }

/* Wizard chrome */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 22px; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.3s; }
.stepmeta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.footer { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.footer .inner { max-width: 720px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 10px; align-items: center; }

/* Controls */
.btn { border: 1px solid var(--border); background: var(--surface); padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label.field > span em { font-weight: 400; color: var(--muted); font-style: normal; }
input[type=text], input[type=tel], input[type=email], input[type=url], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invalid input, input.invalid { border-color: var(--bad); }
.err { color: var(--bad); font-size: 13px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.prefix { display: flex; align-items: stretch; }
.prefix > span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.prefix > input { border-radius: 0 10px 10px 0; }
.ok-check { color: var(--good); margin-left: 6px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; margin-left: 6px; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.gray { background: var(--surface-2); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.removable { padding-right: 8px; background: var(--accent-soft); border-color: transparent; color: var(--accent); cursor: default; }
.chip.removable button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px 0 6px; font-size: 14px; }
.chipinput { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface); }
.chipinput input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 120px; padding: 4px 6px; }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: 0.2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: 0.5; cursor: default; }

/* Autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow: auto; }
.ac-list div { padding: 8px 12px; cursor: pointer; }
.ac-list div.sel, .ac-list div:hover { background: var(--accent-soft); }
.ac-list small { color: var(--muted); margin-left: 6px; }

/* Repeaters */
.item { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--surface); position: relative; }
.item + .item { margin-top: 12px; }
.item .x { position: absolute; top: 10px; right: 10px; }
.monthyear { display: flex; gap: 8px; }
.monthyear select:first-child { flex: 1.3; }
.monthyear select:last-child { flex: 1; }
.warnline { color: var(--warn); font-size: 13px; margin-top: 8px; }

/* Resume drop */
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 44px 20px; text-align: center; cursor: pointer; background: var(--surface); transition: 0.15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-size: 40px; }
.ticks { list-style: none; padding: 0; margin: 14px 0 0; }
.ticks li { padding: 4px 0; color: var(--muted); }
.ticks li.done { color: var(--text); }
.ticks li::before { content: "○ "; }
.ticks li.done::before { content: "✓ "; color: var(--good); }

/* Roles */
.role { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.role + .role { margin-top: 10px; }
.role .count { font-size: 14px; }
.role .count b { color: var(--accent); }
.suggest { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--border); border-radius: 12px; padding: 10px 14px; }
.suggest + .suggest { margin-top: 8px; }
.preview { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; }
.bubble.bot { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble.me { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; cursor: pointer; }
.bubble.me:hover { filter: brightness(1.08); }
.bubble .why { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.section-line { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin: 10px 0 2px; }
.answerbox { align-self: stretch; background: var(--surface-2); border-radius: 14px; padding: 14px; }
.salary-value { font-size: 28px; font-weight: 700; border: 0; background: none; width: 200px; padding: 0; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.recap { width: 100%; border-collapse: collapse; font-size: 14px; }
.recap td { padding: 7px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.recap td:first-child { color: var(--muted); width: 55%; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }
.check { list-style: none; padding: 0; margin: 0; }
.check li { padding: 8px 0; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); }
.check li:last-child { border-bottom: 0; }
.check li .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex: none; }
.check li.done .dot { background: var(--good); border-color: var(--good); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.score { display: inline-block; min-width: 38px; text-align: center; font-weight: 700; border-radius: 8px; padding: 2px 6px; background: var(--surface-2); }
.score.hi { background: var(--good-soft); color: var(--good); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.log { font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; max-height: 260px; overflow: auto; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; color: var(--muted); }
.banner { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.banner.warn { background: var(--warn-soft); }
.banner.bad { background: var(--bad-soft); }

#toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: 0.2s; pointer-events: none; max-width: 90vw; z-index: 50; }
#toast.show { opacity: 1; }
