:root {
  --bg: #f4f6fa; --card: #ffffff; --ink: #1b2330; --muted: #5d6878; --line: #dde3ec; --soft: #eef2f8;
  --brand: #1f4e8c; --brand-ink: #ffffff; --brand-soft: #e3ecf8; --accent: #ffb703;
  --green: #1e7d4f; --green-bg: #e2f4ea; --amber: #93600a; --amber-bg: #fff1d6; --red: #b42318; --red-bg: #fde7e5;
  --blue: #1f5fae; --blue-bg: #e1edfb; --purple: #6b3fa8; --purple-bg: #efe6fb; --grey: #5d6878; --grey-bg: #eceff3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --card: #1a2029; --ink: #e6eaf0; --muted: #9aa5b5; --line: #2c3542; --soft: #222a35;
    --brand: #5b8fd6; --brand-ink: #0d1117; --brand-soft: #1d2b40;
    --green: #6fd3a0; --green-bg: #173326; --amber: #f2c46b; --amber-bg: #3a2c10; --red: #ff8a80; --red-bg: #3d1a18;
    --blue: #8ab8f3; --blue-bg: #18283f; --purple: #c3a2f0; --purple-bg: #2c2140; --grey: #a9b2bf; --grey-bg: #262d38;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --card: #1a2029; --ink: #e6eaf0; --muted: #9aa5b5; --line: #2c3542; --soft: #222a35;
  --brand: #5b8fd6; --brand-ink: #0d1117; --brand-soft: #1d2b40;
  --green: #6fd3a0; --green-bg: #173326; --amber: #f2c46b; --amber-bg: #3a2c10; --red: #ff8a80; --red-bg: #3d1a18;
  --blue: #8ab8f3; --blue-bg: #18283f; --purple: #c3a2f0; --purple-bg: #2c2140; --grey: #a9b2bf; --grey-bg: #262d38;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--red); }
.neg { color: var(--red); }
.pos { color: var(--green); }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--brand); color: var(--brand-ink); min-height: 52px; }
.top .brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 700; font-size: 16px; min-width: 0; }
.top .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.top .who small { opacity: .8; }
.top .btn.ghost { color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); background: transparent; }
.menu-btn { display: none; }
.top .icon-btn { color: inherit; }
.top .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.layout { display: flex; min-height: calc(100vh - 52px); }
.side { width: 230px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 8px 0 24px; position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--ink); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.side a:hover { background: var(--soft); }
.side a.on { background: var(--brand-soft); border-left-color: var(--brand); font-weight: 600; }
.side .ico { width: 18px; text-align: center; color: var(--muted); }
.side-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 16px 4px; }
main { flex: 1; min-width: 0; padding: 20px 24px 60px; outline: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .top .who > span { display: none; }
  .side { position: fixed; top: 52px; left: 0; bottom: 0; z-index: 30; height: auto; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  body.menu-open .side { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  main { padding: 16px 16px 80px; }
}

/* ---------- page parts ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head .back { font-size: 13px; text-decoration: none; display: inline-block; margin-bottom: 4px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tools input[type=search] { width: 200px; }
.period { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.custom-dates { display: inline-flex; gap: 6px; align-items: center; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 460px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.note { border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
.note.warn { background: var(--amber-bg); color: var(--amber); }
.note ul { margin: 4px 0 0 18px; padding: 0; }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
a.stat[href]:hover { border-color: var(--brand); }
.stat small { color: var(--muted); font-size: 12.5px; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat.hi { border-left-color: var(--accent); }
.stat.warn { border-left-color: var(--amber); }
.stat.bad { border-left-color: var(--red); }
.stat.good { border-left-color: var(--green); }
.exam-line { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.exam-line:last-child { border-bottom: 0; }
.exam-line:hover { color: var(--brand); }
.todo { margin: 0; padding-left: 18px; }
.todo li { margin: 4px 0; }

.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.kv { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.panel .kv { background: var(--soft); border-color: transparent; }
.kv small { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; display: flex; flex-direction: column; }
.chip small { color: var(--muted); font-size: 12px; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; scrollbar-width: thin; }
.tabs a { white-space: nowrap; padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-size: 14px; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .count { background: var(--soft); color: var(--muted); border-radius: 10px; padding: 0 7px; font-size: 12px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: var(--soft); font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; position: sticky; top: 0; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid tr.click { cursor: pointer; }
.grid tr.click:hover td { background: var(--brand-soft); }
.grid tfoot td { font-weight: 700; background: var(--soft); border-bottom: 0; }
.empty { padding: 24px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.panel .table-wrap, .docs-panel .table-wrap { border-radius: 8px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--grey-bg); color: var(--grey); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.left { margin-right: auto; }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; line-height: 1; }
.icon-btn:hover { background: var(--soft); }
.icon-btn.small { font-size: 16px; padding: 0 6px; }
button.link { background: none; border: 0; color: var(--red); cursor: pointer; font-size: 12px; padding: 0; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px; max-width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); vertical-align: middle; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full, .form-h { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field.check { justify-content: flex-end; }
.field.check label { font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; min-height: 38px; }
.field input, .field select, .field textarea { width: 100%; }
.req { color: var(--red); }
.hint { color: var(--muted); font-size: 12px; }
.form-h { margin: 8px 0 -4px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--brand); }
.form-h:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 12px; width: 100%; max-width: 480px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 4px 16px 12px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); border-radius: 0 0 12px 12px; }
@media (max-width: 640px) { .modal-back { padding: 0; } .modal, .modal.wide { min-height: 100%; border-radius: 0; } }

.docs-panel { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.doc-row { padding: 4px 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs figure { margin: 0; width: 96px; }
.thumbs img { width: 96px; height: 128px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumbs figcaption { font-size: 12px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell { background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.blank { background: transparent; border: 0; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.cal-exam { display: block; font-size: 12px; padding: 2px 5px; border-radius: 4px; text-decoration: none; background: var(--blue-bg); color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-exam.st-COMPLETED { background: var(--green-bg); color: var(--green); }
.cal-exam.st-CANCELLED { background: var(--grey-bg); color: var(--grey); text-decoration: line-through; }
.cal-exam.st-POSTPONED { background: var(--amber-bg); color: var(--amber); }
.cal-exam.mock { border-left: 3px solid var(--purple); }
.cal-title { min-width: 130px; text-align: center; }
@media (max-width: 640px) { .cal-cell { min-height: 64px; } .cal-exam { font-size: 10px; padding: 1px 3px; } }

/* exam day */
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pick { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; align-items: flex-start; }
.pick.hi { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pick span { color: var(--muted); font-size: 13px; }
.tick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.tick { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.sticky-foot { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--line); }

.report-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.report-links a { padding: 8px 10px; border-radius: 8px; background: var(--soft); text-decoration: none; color: var(--ink); }
.report-links a:hover { background: var(--brand-soft); color: var(--brand); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); text-align: center; }
.login-box img { margin: 0 auto; }
.login-box .field { text-align: left; }
.login-box p { margin: 0; }

/* toasts */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { background: #1b2330; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); font-size: 14px; transition: opacity .4s; }
.toast.err { background: #b42318; }
.toast.info { background: #1f4e8c; }
.toast.hide { opacity: 0; }

/* phones: tables scroll sideways instead of squeezing every cell */
@media (max-width: 640px) {
  .grid td { white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
  .tools input[type=search] { width: 100%; }
  .tools { width: 100%; }
}

/* password with Show / Hide */
.pw-box { position: relative; display: flex; }
.pw-box input { width: 100%; padding-right: 86px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: var(--soft); color: var(--ink); border: 0; border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 13px; cursor: pointer; }
.pw-toggle:hover { background: var(--brand-soft); }
.login-box .forgot { font-size: 13px; background: none; border: 0; color: var(--brand); cursor: pointer; text-decoration: underline; padding: 0; }
.row-actions { display: inline-flex; gap: 2px; align-items: center; }
.icon-btn.del:hover { background: var(--red-bg); }
.doc-row .icon-btn.del { margin-left: 6px; vertical-align: middle; }

/* ---------- Home button (top bar, every screen) ---------- */
.home-btn { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 6px 12px; border-radius: 8px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); flex: none; }
.home-btn:hover { background: rgba(255, 255, 255, .24); }
.home-btn.on { background: #fff; color: #1f4e8c; border-color: #fff; }
@media (max-width: 480px) { .top .brand span { display: none; } .home-btn { padding: 6px 10px; } }

/* ---------- Dashboard ---------- */
.hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.hero h1 { font-size: 24px; letter-spacing: -.01em; }
.hero p { margin: 2px 0 0; }
.hero .btn svg, .btn svg { flex: none; }

.kpi-group { margin-bottom: 20px; }
.kpi-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.kpi { --tone: var(--blue); --tone-bg: var(--blue-bg);
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 14px; min-height: 96px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tone); opacity: .9; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 24, 40, .10); border-color: color-mix(in srgb, var(--tone) 45%, var(--line)); }
a.kpi:active { transform: translateY(0); }
.kpi-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--tone-bg); color: var(--tone); }
.kpi-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 750; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kpi-go { flex: none; color: var(--muted); opacity: .5; align-self: center; }
a.kpi:hover .kpi-go { opacity: 1; color: var(--tone); }
.tone-blue   { --tone: var(--blue);   --tone-bg: var(--blue-bg); }
.tone-green  { --tone: var(--green);  --tone-bg: var(--green-bg); }
.tone-amber  { --tone: var(--amber);  --tone-bg: var(--amber-bg); }
.tone-red    { --tone: var(--red);    --tone-bg: var(--red-bg); }
.tone-purple { --tone: var(--purple); --tone-bg: var(--purple-bg); }
.tone-grey   { --tone: var(--grey);   --tone-bg: var(--grey-bg); }
.tone-red .kpi-value { color: var(--red); }
.tone-amber .kpi-value { color: var(--amber); }

.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-title svg { color: var(--brand); }
.exam-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.exam-row:last-child { border-bottom: 0; }
.exam-row:hover { background: var(--soft); border-radius: 8px; }
.exam-when { flex: none; width: 58px; text-align: center; background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 6px 0; display: flex; flex-direction: column; line-height: 1.2; }
.exam-when b { font-size: 15px; }
.exam-when small { font-size: 11px; }
.exam-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.exam-what b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-what small { color: var(--muted); font-size: 12.5px; }
.exam-tags { flex: none; display: flex; gap: 4px; }
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); margin: 0; }
.todo li:last-child { border-bottom: 0; }
.todo li a { color: var(--ink); text-decoration: none; }
.todo li a::before { content: "•"; color: var(--amber); font-weight: 700; margin-right: 8px; }
.todo li:hover a { color: var(--brand); }
.todo li svg { color: var(--muted); flex: none; }

@media (max-width: 640px) {
  .hero h1 { font-size: 20px; }
  .hero .tools { width: 100%; }
  .hero .tools .btn { flex: 1; padding: 7px 8px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { flex-direction: column; gap: 8px; padding: 12px; min-height: 0; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-icon svg { width: 19px; height: 19px; }
  .kpi-value { font-size: 21px; }
  .kpi-go { display: none; }
  .kpi-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .exam-tags { display: none; }
}

/* ---------- notification bell (top bar, every screen) ---------- */
.bell-wrap { position: relative; display: inline-flex; }
.bell-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 36px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12); color: inherit; cursor: pointer; }
.bell-btn:hover { background: rgba(255, 255, 255, .24); }
.bell-btn.has svg { animation: bell-ring 2.4s ease-in-out 1; transform-origin: 50% 2px; }
@keyframes bell-ring { 0%, 60%, 100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-12deg); } 30% { transform: rotate(9deg); } 40% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .bell-btn.has svg { animation: none; } }
.bell-count { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #e5383b; color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--brand); font-variant-numeric: tabular-nums; }
.bell-count[hidden] { display: none; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 10px); width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow-y: auto; z-index: 60;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(0, 0, 0, .22); text-align: left; }
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.bell-list { list-style: none; margin: 0; padding: 4px 0; }
.bell-list li a { display: block; padding: 10px 14px 10px 30px; color: var(--ink); text-decoration: none; font-size: 14px; position: relative; border-bottom: 1px solid var(--line); }
.bell-list li:last-child a { border-bottom: 0; }
.bell-list li a::before { content: ""; position: absolute; left: 14px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.bell-list li a:hover { background: var(--soft); color: var(--brand); }
.bell-empty { padding: 16px 14px; margin: 0; color: var(--muted); }
.bell-foot { display: block; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; text-align: center; text-decoration: none; position: sticky; bottom: 0; background: var(--card); }
@media (max-width: 640px) {
  .bell-wrap { position: static; }
  .bell-panel { position: fixed; left: 12px; right: 12px; top: 58px; width: auto; }
}

/* ---------- lab map ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
button.sys { min-height: 44px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.sys.ok { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.sys.bad { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.sys.rep { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.sys.spare { background: var(--grey-bg); color: var(--grey); }
button.sys:hover { filter: brightness(.95); transform: translateY(-1px); }
.legend i.sys { min-height: 0; }

/* ---------- notes ---------- */
.note { background: var(--soft); border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
.note.ok { background: var(--green-bg); color: var(--green); }

/* ---------- exam-day checklist ---------- */
.check-list { display: flex; flex-direction: column; }
.check-row { display: grid; grid-template-columns: 22px 92px 1fr; align-items: start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.check-row .when { font-size: 12.5px; font-weight: 700; color: var(--brand); padding-top: 2px; }
.check-row .what { display: flex; flex-direction: column; }
.check-row .what small { color: var(--green); font-size: 12px; }
.check-row.done .what { color: var(--muted); }
.check-row input { margin-top: 2px; }
@media (max-width: 640px) { .check-row { grid-template-columns: 22px 70px 1fr; } }

/* ---------- charts ---------- */
.chart-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; overflow-x: auto; }
.chart { width: 100%; min-width: 320px; height: auto; max-height: 260px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }

/* ---------- day summary ---------- */
.summary-text pre { white-space: pre-wrap; font: inherit; margin: 0; line-height: 1.6; }

/* ---------- offline bar ---------- */
.net-bar { position: sticky; top: 52px; z-index: 19; padding: 8px 16px; font-size: 14px; font-weight: 600; text-align: center; }
.net-bar[hidden] { display: none; }
.net-bar.off { background: #7a2e0e; color: #fff; }
.net-bar.up { background: var(--blue-bg); color: var(--blue); }

.check-inline { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); font-weight: 600; }
