:root {
  --brand: #2A64C5; --brand-dark: #1D4A98; --brand-tint: #E7EEFA; --accent: #d9822b;
  --bg: #F2F5FA; --panel: #ffffff; --ink: #1B2433; --muted: #637089; --line: #DAE1EC;
  --green: #1d7a4f; --green-bg: #e3f3ea; --amber: #9a5b0b; --amber-bg: #fbefd9; --red: #b4321f; --red-bg: #fbe5e0;
  --blue: #1f5fa8; --blue-bg: #e2edf9; --grey: #55617A; --grey-bg: #EAEEF5;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,40,80,.06), 0 4px 16px rgba(20,40,80,.05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #7FA8F0; --brand-dark: #4A82DB; --brand-tint: #172540; --bg: #0E1420; --panel: #161E2D; --ink: #E6ECF5;
    --muted: #93A0B5; --line: #2A3547; --green: #62d19a; --green-bg: #17382a; --amber: #f0b45a; --amber-bg: #3a2a10;
    --red: #ff8d79; --red-bg: #3d1d17; --blue: #7db4f2; --blue-bg: #152a44; --grey: #B3BDCE; --grey-bg: #232C3B;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 26px; letter-spacing: -.01em; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand); }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; }
.grow { flex: 1; } .stack > * + * { margin-top: 16px; }

/* shell */
.topbar { background: var(--brand-dark); color: #fff; }
@media (prefers-color-scheme: dark) { .topbar { background: #0F2347; } }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 700; letter-spacing: .01em; color: #fff; text-decoration: none; display: flex; gap: 10px; align-items: center; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: #fff; display: grid; place-items: center; }
.brand .mark svg { width: 16px; height: 16px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: #cfe7e0; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.1); } .nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.who { font-size: 13px; color: #cfe7e0; display: flex; gap: 12px; align-items: center; }
.who button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.page-head { margin-bottom: 22px; } .page-head p { margin: 4px 0 0; color: var(--muted); }

/* cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; } .grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { padding: 16px 18px; } .stat .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; } .stat .l { color: var(--muted); font-size: 13px; }
.stat.warn .n { color: var(--red); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; } tbody tr:hover td { background: color-mix(in srgb, var(--brand-tint) 55%, transparent); }
td .sub { color: var(--muted); font-size: 12.5px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.blue { background: var(--blue-bg); color: var(--blue); } .badge.grey { background: var(--grey-bg); color: var(--grey); } .badge.red { background: var(--red-bg); color: var(--red); }
.due { font-size: 13px; color: var(--muted); } .due.soon { color: var(--amber); font-weight: 600; } .due.late { color: var(--red); font-weight: 600; } .due.ok { color: var(--green); }

/* buttons & forms */
.btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 16px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--brand); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); } .btn.primary:hover { background: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0A1A38; } }
.btn.danger { color: var(--red); border-color: var(--red); } .btn.sm { padding: 4px 10px; font-size: 13px; } .btn.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; width: 100%; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: auto; }
.field { display: block; } .field + .field { margin-top: 14px; }
.field .label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; } .field .hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; } .form-grid .field { margin-top: 14px; } .form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--amber-bg); color: var(--amber); }
.alert.err { background: var(--red-bg); color: var(--red); } .alert.info { background: var(--blue-bg); color: var(--blue); } .alert.ok { background: var(--green-bg); color: var(--green); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand-dark), #2A64C5 60%, #4A82DB); }
.auth .card { width: 100%; max-width: 410px; padding: 32px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth .org { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 18px; }

/* review */
.stepper { display: flex; gap: 0; margin: 18px 0 8px; flex-wrap: wrap; }
.step { flex: 1; min-width: 130px; padding: 10px 14px; border-top: 4px solid var(--line); font-size: 13px; color: var(--muted); }
.step.done { border-color: var(--brand); color: var(--ink); } .step.now { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 20px; overflow-x: auto; }
.tab { padding: 10px 16px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--brand); border-color: var(--brand); }
.criterion { padding: 18px 20px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: center; }
.criterion:last-child { border-bottom: 0; } .criterion .t { font-weight: 650; } .criterion .d { color: var(--muted); font-size: 13.5px; margin-top: 2px; max-width: 62ch; }
.criterion .ref { font-size: 12.5px; color: var(--blue); margin-top: 4px; }
.rating { display: flex; align-items: center; gap: 6px; }
.rating .pip { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.rating .pip:hover { border-color: var(--brand); } .rating .pip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .rating .pip.on { color: #0A1A38; } }
.rating input { width: 78px; text-align: center; font-weight: 700; margin-left: 6px; }
.rating .lab { width: 118px; font-size: 12.5px; color: var(--muted); margin-left: 6px; }
.section-head { background: var(--brand-tint); color: var(--brand); padding: 10px 20px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.avg { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--brand-tint); font-weight: 650; }
.avg .big { font-size: 24px; color: var(--brand); font-weight: 700; }
.savebar { position: sticky; bottom: 0; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 20px; margin: 24px -20px -80px; display: flex; gap: 12px; align-items: center; justify-content: space-between; z-index: 5; }
.compare { width: 100%; } .compare td.num, .compare th.num { text-align: center; width: 110px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--brand); } .bar.self > i { background: #8FAADB; } .bar.low > i { background: var(--red); }
.score { font-weight: 700; font-size: 16px; } .score.low { color: var(--red); }
.levels { display: grid; gap: 8px; } .level { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.level.on { border-color: var(--brand); background: var(--brand-tint); } .level .r { font-weight: 700; min-width: 86px; } .level .sug { font-size: 11.5px; color: var(--accent); font-weight: 700; }
.overall { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.dial { width: 120px; height: 120px; border-radius: 50%; border: 7px solid var(--brand); display: grid; place-items: center; text-align: center; flex: none; }
.dial b { font-size: 30px; letter-spacing: -.02em; color: var(--brand); display: block; line-height: 1; } .dial span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.quote { border-left: 4px solid #A9C0E8; padding: 2px 0 2px 14px; white-space: pre-wrap; } .quote.mgr { border-color: var(--brand); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.sig { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; } .sig.done { border-style: solid; border-color: var(--brand); background: var(--brand-tint); }
.sig .name { font-style: italic; font-size: 18px; color: var(--brand); }
.pip-box { background: var(--amber-bg); color: var(--ink); border-radius: 10px; padding: 14px; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 90px; } .meter > i { display: block; height: 100%; background: var(--brand); }
.hbars { display: grid; gap: 10px; } .hbar { display: grid; grid-template-columns: 70px 1fr 30px; gap: 10px; align-items: center; font-size: 13px; }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(10,18,36,.55); display: grid; place-items: center; padding: 20px; z-index: 50; overflow: auto; }
.modal { background: var(--panel); border-radius: 14px; padding: 26px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.35); max-height: 92vh; overflow: auto; } .modal.wide { max-width: 680px; }
.modal h2 { margin-bottom: 14px; } .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--brand-dark); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 340px; transition: opacity .4s; } .toast.err { background: var(--red); } .toast.out { opacity: 0; }

@media (max-width: 760px) {
  .topbar-inner { gap: 10px; padding: 0 12px; } .who .nm { display: none; } .brand span.t { display: none; }
  main { padding: 18px 12px 80px; } .form-grid { grid-template-columns: 1fr; }
  .criterion { grid-template-columns: 1fr; } .rating { flex-wrap: wrap; } .rating .lab { display: none; }
  .savebar { margin: 24px -12px -80px; padding: 12px; } h1 { font-size: 22px; }
}
@media print { .topbar, .savebar, .btn { display: none !important; } }
