:root {
  --navy: #102d50;
  --navy-2: #1d4675;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --ok: #157a52;
  --ok-soft: #e3f5ec;
  --warn: #a8640c;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #475467;
  --info-soft: #eef1f5;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #14213a;
  --muted: #5d6b82;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 45, 80, .06), 0 4px 16px rgba(16, 45, 80, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 460px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Päis */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .container { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: .8rem; letter-spacing: .02em; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a.active { background: var(--blue-soft); color: var(--navy); text-decoration: none; }
.topbar .spacer { flex: 1; }
.user-menu { display: flex; gap: 8px; align-items: center; font-size: .9rem; }

/* Nupud */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--navy); }
.btn-ghost:hover { border-color: #c5d0de; background: #fafbfd; }
.btn-danger { background: var(--surface); border-color: #f2c4bf; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 1.02rem; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }

/* Kaardid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-tight { padding: 16px; }
.page { padding: 28px 0 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Teated */
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid; margin-bottom: 16px; font-size: .95rem; }
.alert-success { background: var(--ok-soft); border-color: #b5e2cb; color: #0e5a3c; }
.alert-error { background: var(--bad-soft); border-color: #f4c3bd; color: #8a1c12; }
.alert-warn { background: var(--warn-soft); border-color: #f1d49c; color: #7a4a06; }
.alert-info { background: var(--blue-soft); border-color: #c9d9fb; color: #1e3a8a; }

/* Vormid */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--navy); }
.field { margin-bottom: 16px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cdd6e3; border-radius: 10px; font: inherit; font-size: .97rem; color: var(--text); background: #fff;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; }

.segmented { display: inline-flex; background: var(--info-soft); padding: 4px; border-radius: 12px; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.segmented label { margin: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

.dropzone { border: 2px dashed #c5d0de; border-radius: 12px; padding: 26px; text-align: center; background: #fafbfd; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--blue); background: var(--blue-soft); }
.dropzone input { display: none; }
.dropzone strong { display: block; color: var(--navy); margin-bottom: 4px; }
.step { display: flex; gap: 14px; }
.step-num { flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.step-body { flex: 1; min-width: 0; }

/* Märgid */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-blue { background: var(--blue-soft); color: var(--blue); }

/* Skoorid */
.score { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; --c: var(--blue); width: 104px; height: 104px; border-radius: 50%; flex: 0 0 104px; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e8edf4 0); }
.ring::before { content: ""; grid-area: 1 / 1; width: 82px; height: 82px; border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1 / 1; font-size: 1.7rem; font-weight: 800; color: var(--navy); z-index: 1; }
.ring.is-ok { --c: var(--ok); } .ring.is-warn { --c: #d08a1a; } .ring.is-bad { --c: var(--bad); }
.ring-sm { width: 46px; height: 46px; flex-basis: 46px; } .ring-sm::before { width: 36px; height: 36px; } .ring-sm span { font-size: .9rem; }
.score h3 { margin: 0 0 2px; }
.bars { display: grid; gap: 8px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 34px; gap: 10px; align-items: center; font-size: .86rem; }
.bar { height: 8px; border-radius: 99px; background: #e8edf4; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--blue); transition: width .6s ease; }
.bar i.is-ok { background: var(--ok); } .bar i.is-warn { background: #d08a1a; } .bar i.is-bad { background: var(--bad); }
.bar-row b { text-align: right; color: var(--navy); }

/* Vahekaardid */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 26px 0 20px; overflow-x: auto; scrollbar-width: thin; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; font-size: .93rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--navy); }
.tabs button[aria-selected=true] { color: var(--navy); border-bottom-color: var(--navy); }
.tabs .count { font-size: .75rem; background: var(--info-soft); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }

/* Tabelid ja loendid */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: #fafbfd; }
tr:last-child td { border-bottom: 0; }
td .quote { color: var(--muted); font-size: .85rem; font-style: italic; }
.issue { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.issue:last-child { border-bottom: 0; }
.issue-icon { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.issue h4 { margin: 0 0 3px; font-size: .97rem; color: var(--text); }
.issue p { margin: 0; font-size: .92rem; color: var(--muted); }
.issue .fix { color: var(--text); margin-top: 4px; }
.i-ok { background: var(--ok-soft); color: var(--ok); }
.i-warn { background: var(--warn-soft); color: var(--warn); }
.i-bad { background: var(--bad-soft); color: var(--bad); }
.i-info { background: var(--info-soft); color: var(--info); }
.fixlist { margin: 0; padding-left: 20px; }
.fixlist li { margin-bottom: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 10px; border-radius: 99px; background: var(--info-soft); font-size: .85rem; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.no { background: var(--bad-soft); color: var(--bad); }
.filter { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.filter button { border: 1px solid var(--border); background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--muted); }
.filter button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare > div { padding: 12px 14px; border-radius: 10px; font-size: .92rem; }
.compare .before { background: #f6f7f9; color: var(--muted); }
.compare .after { background: var(--ok-soft); color: #0e3d2a; }
.compare small { display: block; font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; margin-bottom: 4px; }
pre.ats-view { white-space: pre-wrap; word-break: break-word; background: #0f1b2d; color: #dbe5f3; padding: 18px; border-radius: 12px; font-family: var(--mono); font-size: .82rem; line-height: 1.55; max-height: 640px; overflow: auto; margin: 0; }

/* Dokumendi eelvaade */
.doc { background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 30px rgba(16, 45, 80, .1); padding: 42px 46px; max-width: 800px; margin: 0 auto; font-size: .93rem; color: #111; }
.doc h1 { color: #111; font-size: 1.6rem; margin: 0; }
.doc .headline { font-size: 1.05rem; color: #333; }
.doc .contact { font-size: .86rem; color: #444; margin: 4px 0 10px; }
.doc h2 { font-size: .95rem; letter-spacing: .06em; color: var(--navy); margin: 20px 0 6px; }
.doc .item { margin-top: 10px; }
.doc .meta { color: #666; font-size: .85rem; }
.doc ul { margin: 4px 0 0; padding-left: 18px; }
.doc li { margin-bottom: 3px; }
.doc p { margin: 0 0 6px; }
.doc.letter p { margin-bottom: 12px; line-height: 1.6; }

/* Edenemine */
.progress-card { display: flex; gap: 16px; align-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--blue-soft); border-top-color: var(--blue); animation: spin .9s linear infinite; flex: 0 0 34px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tühjad olekud ja statistika */
.empty { text-align: center; padding: 48px 20px; }
.empty .icon { font-size: 2.2rem; margin-bottom: 8px; }
.stat { padding: 18px; }
.stat b { display: block; font-size: 1.8rem; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }
.list-item { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 650; color: var(--navy); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { color: var(--muted); font-size: .86rem; }
.copybox { display: flex; gap: 8px; margin-top: 8px; }
.copybox input { font-family: var(--mono); font-size: .82rem; }

/* Maandumisleht */
.hero { padding: 64px 0 40px; background: radial-gradient(1200px 400px at 80% -10%, #dde8fb 0, transparent 60%), var(--bg); }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); background: var(--blue-soft); padding: 4px 10px; border-radius: 99px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.1; margin-bottom: 18px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; }
.hero-note { font-size: .88rem; color: var(--muted); margin-top: 10px; }
.mock { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px rgba(16, 45, 80, .14); padding: 22px; }
.mock .row { justify-content: space-between; }
.section { padding: 56px 0; }
.section h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); text-align: center; margin-bottom: 10px; }
.section .sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 32px; }
.feature { padding: 22px; }
.feature .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-soft); color: var(--navy); display: grid; place-items: center; margin-bottom: 12px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .95rem; margin: 0; }
.howto { counter-reset: s; }
.howto .card { position: relative; padding-top: 30px; }
.howto .card::before { counter-increment: s; content: counter(s); position: absolute; top: -16px; left: 22px; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; }
.band { background: var(--navy); color: #dfe8f5; border-radius: 20px; padding: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.band h3 { color: #fff; font-size: 1.2rem; }
.band p { margin: 0; }
.footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: .88rem; background: var(--surface); }
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 40px 0; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }

@media (max-width: 860px) {
  .hero .container, .band { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; }
  .compare { grid-template-columns: 1fr; }
  .doc { padding: 24px 20px; }
  .bar-row { grid-template-columns: 1fr 1.4fr 30px; }
}
@media (max-width: 560px) {
  .topbar .container { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .user-menu .who { display: none; }
  .card { padding: 16px; }
  .score { gap: 12px; }
}
@media print {
  .topbar, .footer, .tabs, .no-print { display: none !important; }
  body { background: #fff; }
}

/* Abiklassid */
.mt { margin-top: 20px; }
.mt-sm { margin-top: 12px; }
.w-full { width: 100%; }
.row .grow-input { flex: 1; min-width: 220px; width: auto; }
.test-result { font-size: .9rem; font-weight: 600; }
.test-result.is-ok { color: var(--ok); }
.test-result.is-err { color: var(--bad); }

/* Kandideerimiste tahvel */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: #eef2f8; border-radius: var(--radius); padding: 12px; min-height: 160px; }
.board-col h2 { font-size: .95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.board-card .title { font-weight: 650; color: var(--navy); display: block; }
.board-card .sub { color: var(--muted); font-size: .85rem; }
.board-card select { padding: 6px 8px; font-size: .85rem; }
.next-step { font-size: .82rem; margin-top: 8px; color: var(--muted); }
.next-step.is-overdue { color: var(--bad); font-weight: 600; }
.empty-col { font-size: .85rem; text-align: center; padding: 16px 0; }
details.tracking summary { cursor: pointer; list-style: none; }
details.tracking summary::-webkit-details-marker { display: none; }
.mb { margin-bottom: 14px; }

/* CV redaktor */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow-y: auto; }
.editor-side .issue { padding: 10px 0; }
.repeat-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fbfcfe; }
.repeat-item.row { padding: 8px; flex-wrap: nowrap; }
.repeat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.repeat-head .row { gap: 6px; }
.field label > input, .field label > textarea { margin-top: 6px; font-weight: 400; }
.span-all { grid-column: 1 / -1; }
.link-label { max-width: 160px; }
.editor-actions { position: sticky; bottom: 0; z-index: 5; }
.fact-text { white-space: normal; margin-top: 2px; }
@media (max-width: 960px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; max-height: none; }
}
