/* EGC design system
   Brand: the seal's navy (#03305E) on clean paper. Lora (serif) echoes the seal's lettering and is
   used for titles and headline figures; Inter carries the interface. Brass is used sparingly for
   marks of authenticity: the active nav marker, verified seals, the ID card ring. */

@font-face { font-family: "Inter"; src: url("../fonts/inter-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-600.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lora"; src: url("../fonts/lora-var.woff") format("woff"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light;
  --navy: #03305E;
  --navy-700: #022446;
  --navy-600: #0B3F75;
  --navy-100: #DCE6F2;
  --navy-50: #EEF3F9;
  --brass: #A87A2C;
  --brass-50: #F7F0E3;
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #EEF2F6;
  --line: #DCE2EA;
  --line-strong: #C7D0DB;
  --ink: #12202F;
  --ink-2: #4A596C;
  --ink-3: #758396;
  --primary: var(--navy);
  --primary-ink: #FFFFFF;
  --link: #0B4F97;
  --good: #1B7340; --good-bg: #E6F3EB; --good-line: #B9DEC7;
  --warn: #8F5B00; --warn-bg: #FCF2DB; --warn-line: #EFD49A;
  --bad: #B42318; --bad-bg: #FCEBE9; --bad-line: #F1C0BA;
  --info: #1D5CA6; --info-bg: #E8F0FA; --info-line: #BFD3EE;
  --chart-1: #03305E;
  --chart-1-soft: rgba(3, 48, 94, .12);
  --chart-2: #A87A2C;
  --grid: #E6EBF1;
  --focus: 0 0 0 3px rgba(11, 79, 151, .28);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-pop: 0 12px 32px rgba(10, 28, 52, .16), 0 2px 6px rgba(10, 28, 52, .08);
  --sidebar-w: 252px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --navy-100: #1C3655;
  --navy-50: #142A43;
  --brass: #D2A557;
  --brass-50: #2E2617;
  --bg: #0A1522;
  --surface: #0F1F31;
  --surface-2: #12263B;
  --surface-3: #183049;
  --line: #213A55;
  --line-strong: #2E4A68;
  --ink: #E5ECF4;
  --ink-2: #A8B6C7;
  --ink-3: #7F8FA3;
  --primary: #3D7CC4;
  --primary-ink: #FFFFFF;
  --link: #8DB9EC;
  --good: #5CC487; --good-bg: #12301F; --good-line: #1F5135;
  --warn: #E6B652; --warn-bg: #33270E; --warn-line: #5A4415;
  --bad: #F0857A; --bad-bg: #3A1714; --bad-line: #5E2621;
  --info: #8DB9EC; --info-bg: #13294A; --info-line: #24467A;
  --chart-1: #7DB0EA;
  --chart-1-soft: rgba(125, 176, 234, .16);
  --chart-2: #D2A557;
  --grid: #1B3149;
  --shadow-pop: 0 14px 36px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--bg);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.num, .money, td.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ shell */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; padding: 18px 12px 12px;
}
[data-theme="dark"] .sidebar { background: #061A30; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; color: #fff; text-decoration: none !important; }
.brand img { width: 44px; height: 44px; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 15.5px; line-height: 1.2; display: block; }
.brand span { font-size: 11.5px; opacity: .7; }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav .group { font-size: 11.5px; color: rgba(255,255,255,.5); padding: 14px 12px 5px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px;
  color: rgba(255,255,255,.78); font-weight: 500; font-size: 14px; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.11); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brass); }
.nav a .count { margin-left: auto; background: var(--brass); color: #1B1405; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); margin-top: 10px; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 12px; opacity: .65; text-transform: capitalize; }
.side-user button { background: none; border: 0; color: rgba(255,255,255,.75); padding: 6px; border-radius: 8px; cursor: pointer; }
.side-user button:hover { background: rgba(255,255,255,.1); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .mlogo { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search input { width: 100%; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0 12px 0 36px; }
.search > svg { position: absolute; left: 11px; top: 10px; color: var(--ink-3); }
.search .results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; max-height: 60vh; overflow: auto; }
.search .results .grp { font-size: 11.5px; color: var(--ink-3); padding: 8px 10px 4px; }
.search .results a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.search .results a:hover, .search .results a.hl { background: var(--surface-3); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.content { padding: 8px 28px 48px; width: 100%; max-width: 1320px; }
.bottom-nav { display: none; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-btn { flex: none; color: var(--ink); }
.content .back { display: none; }   /* the top-bar arrow does this job on every page */
.auth-back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; margin: 0 0 14px -8px; padding: 6px 10px; border-radius: 8px; }
.auth-back:hover { background: var(--surface-3); color: var(--ink); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 13.5px; margin-bottom: 6px; }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card > .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card > .hd h2, .card > .hd h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card > .hd .sub { color: var(--ink-3); font-size: 12.5px; }
.card > .bd { padding: 14px 18px 18px; }
.card > .bd.flush { padding: 8px 0 4px; }
.card.pad { padding: 18px; }
.bd.flush > .bd { padding: 6px 18px 14px; }
.g-main > .card { align-self: start; }
.card.tint { background: var(--surface-2); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* stat figures: label, serif number, note */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stats .stat { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.stats .stat:first-child { border-left: 0; }
.stat .label { color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.2; margin-top: 4px; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .note { display: block; padding: 0; border: 0; background: none; border-radius: 0; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.stat a.value { color: var(--ink); text-decoration: none; display: block; }
.stat .note .up { color: var(--good); } .stat .note .down { color: var(--bad); }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 550; cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--navy-600); }
[data-theme="dark"] .btn.primary:hover { background: #4C8BD3; }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font-weight: 500; }
.linkbtn:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 550; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 12.5px; color: var(--bad); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, select.input {
  width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); padding: 0 12px;
}
.field textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--link); box-shadow: var(--focus); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); }
.field input[type=file] { padding: 8px; border: 1px dashed var(--line-strong); border-radius: 9px; width: 100%; background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--navy); flex: none; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input, .toolbar select { width: auto; min-width: 150px; height: 36px; }
.toolbar .grow { flex: 1; min-width: 200px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { background: none; border: 0; padding: 10px 12px; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.tabs a.on, .tabs button.on { color: var(--ink); border-bottom-color: var(--navy); }
[data-theme="dark"] .tabs a.on, [data-theme="dark"] .tabs button.on { border-bottom-color: var(--primary); }
.tabs .n { color: var(--ink-3); font-weight: 500; margin-left: 4px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 550; color: var(--ink-2); cursor: pointer; font-size: 13.5px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* status chips — always icon + label, never colour alone */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px; border-radius: 7px; font-size: 12.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip svg.i { width: 13px; height: 13px; stroke-width: 2.3; }
.chip.good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.chip.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.chip.neutral { background: var(--surface-3); color: var(--ink-2); border-color: var(--line); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--ink); }
.t th .arr { opacity: .55; font-size: 11px; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--surface-2); }
.t td.num, .t th.num { text-align: right; }
.t .person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t .person b { font-weight: 600; display: block; }
.t .person span { color: var(--ink-3); font-size: 12.5px; }
.card .t th:first-child, .card .t td:first-child { padding-left: 18px; }
.card .t th:last-child, .card .t td:last-child { padding-right: 18px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-100); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
[data-theme="dark"] .avatar { color: var(--ink); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl { width: 88px; height: 88px; font-size: 28px; }

/* list rows */
.list { display: flex; flex-direction: column; }
.list .li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list .li:first-child { border-top: 0; }
a.li:hover { background: var(--surface-2); text-decoration: none; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 12.5px; color: var(--ink-3); }
.li .when { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; text-align: right; }
.li .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.li .ico.good { background: var(--good-bg); color: var(--good); }
.li .ico.bad { background: var(--bad-bg); color: var(--bad); }
.li .ico.warn { background: var(--warn-bg); color: var(--warn); }
.li .ico.info { background: var(--info-bg); color: var(--info); }

/* key/value */
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 9px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* empty + skeleton */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty .ill { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 12px; color: var(--ink-3); }
.empty h3 { margin: 0 0 4px; font-size: 15.5px; color: var(--ink); }
.empty p { margin: 0 auto 14px; max-width: 46ch; font-size: 13.5px; }
.sk { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 13px; margin: 10px 0; }
.sk-block { height: 96px; }

/* alerts */
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; }
.note svg.i { margin-top: 1px; }
.note.info { background: var(--info-bg); border-color: var(--info-line); color: var(--ink); }
.note.info svg.i { color: var(--info); }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.note.warn svg.i { color: var(--warn); }
.note.good { background: var(--good-bg); border-color: var(--good-line); }
.note.good svg.i { color: var(--good); }
.note.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.note.bad svg.i { color: var(--bad); }

/* ------------------------------------------------------------------ overlays */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 11px; background: #13243A; color: #fff; box-shadow: var(--shadow-pop); font-size: 14px; animation: toastIn .18s ease-out; }
.toast.good svg.i { color: #7FD6A1; } .toast.bad svg.i { color: #FF9C91; } .toast.warn svg.i { color: #F2C66B; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(6, 18, 32, .45); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: pop .16s ease-out; }
.dialog.wide { width: min(860px, 100%); }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: .5; } }
.dialog .dh { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; }
.dialog .dh h2 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; }
.dialog .db { padding: 10px 20px 4px; overflow-y: auto; }
.dialog .df { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; }
.panel { position: fixed; z-index: 70; top: 60px; right: 18px; width: min(400px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.panel .ph { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel .ph b { font-size: 15px; }
.panel .pb { overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--navy-50); }
.notif .t1 { font-weight: 600; font-size: 13.5px; }
.notif .t2 { font-size: 13.5px; color: var(--ink-2); }
.notif .t3 { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .axis text { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); }
.chart .grid line { stroke: var(--grid); }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); border-radius: 9px; padding: 7px 10px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -10px; z-index: 5; }
.chart .tip b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; gap: 8px; }
.hbar .top span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hbar .track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--chart-1); border-radius: 4px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--chart-1); border-radius: 4px; }
.meter.good > i { background: var(--good); } .meter.warn > i { background: #D08B12; } .meter.bad > i { background: var(--bad); }

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 44%) 1fr; }
.auth-side { background: var(--navy); color: #fff; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side .seal-bg { position: absolute; width: 560px; height: 560px; right: -170px; bottom: -150px; opacity: .07; }
.auth-side .mark { display: flex; align-items: center; gap: 14px; position: relative; }
.auth-side .mark img { width: 64px; height: 64px; }
.auth-side .mark b { font-family: var(--serif); font-size: 19px; font-weight: 600; display: block; }
.auth-side .mark span { font-size: 13px; opacity: .7; }
.auth-side h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; margin: 0 0 14px; max-width: 15ch; position: relative; letter-spacing: -.01em; }
.auth-side p { opacity: .78; max-width: 40ch; margin: 0; position: relative; font-size: 15px; }
.auth-side .foot { font-size: 12.5px; opacity: .55; position: relative; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-box { width: min(440px, 100%); }
.auth-box.wide { width: min(640px, 100%); }
.auth-box h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 0 0 6px; }
.auth-box > p.lead { color: var(--ink-2); margin: 0 0 24px; }
.auth-links { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.auth-links a { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); text-decoration: none; }
.auth-links a:hover { background: var(--surface-2); border-color: var(--line-strong); }
.auth-links a .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--navy-50); color: var(--navy); display: grid; place-items: center; flex: none; }
[data-theme="dark"] .auth-links a .ico { color: var(--link); }
.auth-links a b { display: block; font-size: 14px; }
.auth-links a > span:last-child { flex: 1; min-width: 0; }
.auth-links a b { color: var(--ink); font-weight: 600; }
.auth-links a b + span { display: block; font-size: 12.5px; color: var(--ink-3); }
.auth-links a:hover { text-decoration: none; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps i { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.steps i.on { background: var(--navy); }
.success-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--good-bg); color: var(--good); margin-bottom: 16px; }
.success-mark svg.i { width: 30px; height: 30px; }
.codebox { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); margin: 8px 0; }
.codebox b { font-family: var(--serif); font-size: 21px; letter-spacing: .02em; }

/* ------------------------------------------------------------------ signature pieces */
/* Family hero: where is my child right now */
.presence { position: relative; overflow: hidden; border-radius: 16px; background: var(--navy); color: #fff; padding: 22px 24px; }
[data-theme="dark"] .presence { background: #0B2A4C; }
.presence .seal-bg { position: absolute; width: 260px; height: 260px; right: -60px; top: -50px; opacity: .08; }
.presence .who { display: flex; align-items: center; gap: 12px; position: relative; }
.presence .who .avatar { background: rgba(255,255,255,.14); color: #fff; }
.presence .who b { font-size: 15px; }
.presence .who span { font-size: 12.5px; opacity: .72; display: block; }
.presence .status { font-family: var(--serif); font-size: clamp(26px, 4.2vw, 34px); line-height: 1.15; margin: 18px 0 6px; position: relative; font-weight: 500; }
.presence .detail { opacity: .8; position: relative; font-size: 14.5px; }
.presence .times { display: flex; gap: 26px; margin-top: 16px; position: relative; flex-wrap: wrap; }
.presence .times div span { display: block; font-size: 12px; opacity: .65; }
.presence .times div b { font-size: 16px; font-variant-numeric: tabular-nums; }
.presence .switch { position: relative; margin-left: auto; }
.presence .switch select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 9px; height: 34px; padding: 0 10px; }
.presence .switch select option { color: #000; }

/* Digital student ID */
.idcard { width: min(380px, 100%); border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(3, 48, 94, .14); }
.idcard .top { background: var(--navy); color: #fff; padding: 16px 18px; display: flex; align-items: center; gap: 12px; }
.idcard .top img { width: 46px; height: 46px; }
.idcard .top b { font-family: var(--serif); font-size: 15.5px; font-weight: 600; display: block; line-height: 1.2; }
.idcard .top span { font-size: 11.5px; opacity: .7; }
.idcard .mid { padding: 18px; display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: center; }
.idcard .photo { width: 92px; height: 110px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; border: 2px solid var(--brass); }
.idcard .photo img { width: 100%; height: 100%; object-fit: cover; }
.idcard .photo .avatar { width: 100%; height: 100%; border-radius: 0; font-size: 30px; }
.idcard .name { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; }
.idcard .kv { grid-template-columns: auto 1fr; font-size: 13px; gap: 3px 10px; margin-top: 8px; }
.idcard .bot { border-top: 1px dashed var(--line-strong); padding: 14px 18px; display: flex; gap: 14px; align-items: center; }
.idcard .bot img { width: 112px; height: 112px; border-radius: 8px; background: #fff; }

.flipcard { width: min(380px, 100%); perspective: 1400px; cursor: pointer; }
.flip-inner { position: relative; display: grid; transition: transform .55s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.flipcard.flipped .flip-inner { transform: rotateY(180deg); }
.flipcard .face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; width: 100%; }
.flipcard .front { display: flex; flex-direction: column; }
.flipcard .front .mid { flex: 1; align-content: center; }
.flipcard .back { transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px 18px; gap: 14px; border-top: 6px solid var(--navy); }
.flipcard .qrwrap { background: #fff; padding: 8px; border-radius: 12px; border: 2px solid var(--brass); }
.flipcard .qrwrap img { width: 196px; height: 196px; }
.flipcard .backtext { text-align: center; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.flipcard .backtext b { font-family: var(--serif); font-size: 18px; }
.idcard .cardfoot { display: flex; justify-content: space-between; padding: 10px 18px; border-top: 1px dashed var(--line-strong); font-size: 12px; color: var(--ink-3); }
.idcard .cardfoot span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- student ID card, add-student steps ---- */
.idno { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); letter-spacing: .02em; white-space: nowrap; }
.idprev { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--brass-50); border: 1px dashed color-mix(in srgb, var(--brass) 45%, transparent); font-size: 14px; }
.idprev b { font-size: 20px; letter-spacing: .04em; color: var(--navy); font-variant-numeric: tabular-nums; animation: settle .3s var(--ease, ease); }
.review-id { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--navy-50); margin-bottom: 14px; }
.review-id img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.review-id b { display: block; font-size: 24px; letter-spacing: .04em; color: var(--navy); font-variant-numeric: tabular-nums; }
.saved-ok { display: grid; justify-items: center; gap: 4px; text-align: center; margin-bottom: 16px; color: var(--good); }
.saved-ok b { color: var(--ink); font-size: 18px; }
.saved-ok svg { width: 34px; height: 34px; }

.idc-wrap, .idc-stage { display: grid; justify-items: center; }
.idc { --w: 216px; position: relative; display: block; width: var(--w); aspect-ratio: 54 / 85.6; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: #fff; text-align: center; font: inherit; color: var(--ink);
  box-shadow: 0 1px 2px rgba(3,48,94,.12), 0 10px 26px -10px rgba(3,48,94,.35); transition: transform .25s var(--ease, ease), box-shadow .25s var(--ease, ease); }
button.idc { cursor: pointer; }
button.idc:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(3,48,94,.14), 0 18px 34px -12px rgba(3,48,94,.45); }
button.idc:active { transform: translateY(-1px) scale(.99); }
button.idc:focus-visible { outline: 3px solid color-mix(in srgb, var(--navy) 40%, transparent); outline-offset: 3px; }
.idc-top { position: absolute; inset: 0 0 auto 0; height: 38%; background: var(--navy); padding: 9% 7% 0; display: flex; gap: 8px; align-items: flex-start; color: #fff; text-align: left; clip-path: ellipse(135% 100% at 50% 0%); }
.idc-top img { width: 26px; height: 26px; flex: none; }
.idc-brand { display: grid; gap: 2px; min-width: 0; padding-top: 1px; }
.idc-brand b { font-family: Lora, Georgia, serif; font-size: 9.5px; line-height: 1.25; }
.idc-brand i { font-style: normal; font-size: 7.5px; opacity: .75; }
.idc::before { content: ""; position: absolute; left: -10%; right: -10%; top: 33%; height: 7%; background: var(--brass); transform: skewY(-4deg); }
.idc-photo { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); width: 36%; aspect-ratio: 1; border-radius: 50%; background: var(--navy-100); border: 3px solid var(--brass); display: grid; place-items: center; font: 700 20px Lora, Georgia, serif; color: var(--navy); overflow: hidden; z-index: 1; }
.idc-photo img { width: 100%; height: 100%; object-fit: cover; }
.idc-name { position: absolute; left: 6%; right: 6%; top: 52%; font: 700 15px/1.2 Lora, Georgia, serif; color: var(--navy); }
.idc-cls { position: absolute; left: 6%; right: 6%; top: 61%; font-size: 10px; font-weight: 700; color: var(--navy-600); }
.idc-rows { position: absolute; left: 10%; right: 8%; top: 68%; display: grid; gap: 4px; text-align: left; font-size: 9.5px; }
.idc-rows span { display: grid; grid-template-columns: 62px 1fr; gap: 4px; }
.idc-rows i { font-style: normal; color: var(--ink-3); }
.idc-rows b { color: var(--ink); overflow-wrap: anywhere; }
.idc-foot { position: absolute; inset: auto 0 0 0; height: 13%; background: var(--navy); clip-path: ellipse(135% 100% at 50% 100%); display: flex; align-items: center; justify-content: flex-end; padding: 3% 8% 0; }
.idc-foot img { width: 22px; height: 22px; }
.idc-stage .idc { --w: min(250px, 62vw); }
.dialog .df { flex-wrap: wrap; }
.slist .li { padding: 12px 16px; }
.slist .li:hover { background: var(--navy-50); }
.slist .li > svg { color: var(--ink-3); flex: none; }
.slist-ph { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.slist .t2 { overflow-wrap: anywhere; }
@media (max-width: 600px) { .dialog .df > * { flex: 1 1 auto; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { button.idc, .idprev b { transition: none; animation: none; } }

@media print { .flipcard .flip-inner { transform: none !important; display: flex; flex-direction: column; gap: 12px; } .flipcard .face { transform: none !important; backface-visibility: visible; } }

/* EGC lanyard ID card (fixed brand colours, same in light and dark mode) */
.egc-card { width: min(320px, 100%); margin: 6px 0 0; filter: drop-shadow(0 14px 26px rgba(3, 48, 94, .22)); }
.egc-card .face { position: relative; aspect-ratio: 320 / 508; border-radius: 18px; overflow: hidden; background: #fff; color: #12202F; border: 0; }
.egc-card .face::before { content: ""; position: absolute; z-index: 3; top: 10px; left: 50%; width: 54px; height: 9px; margin-left: -27px; border-radius: 6px; background: #E3E8EF; box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
.egc-card .egc-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.egc-card .brand { position: relative; display: flex; align-items: center; gap: 9px; padding: 30px 18px 0; color: #fff; }
.egc-card .brand img { width: 40px; height: 40px; }
.egc-card .brand b { display: block; font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.15; }
.egc-card .brand span { font-size: 10.5px; opacity: .75; letter-spacing: .02em; }
.egc-card .pic { position: relative; width: 33%; aspect-ratio: 1; margin: 9% auto 0; border-radius: 50%; padding: 4px; background: #fff; box-shadow: 0 0 0 3px #A87A2C, 0 6px 16px rgba(0,0,0,.18); overflow: hidden; display: grid; place-items: center; }
.egc-card .pic img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.egc-card .pic .ini { width: 100%; height: 100%; border-radius: 50%; background: #DCE6F2; color: #03305E; display: grid; place-items: center; font-family: var(--serif); font-size: 34px; font-weight: 600; }
.egc-card .who { position: relative; text-align: center; margin-top: 10px; padding: 0 14px; }
.egc-card .nm { font-family: var(--serif); font-weight: 700; font-size: 21px; color: #03305E; line-height: 1.15; }
.egc-card .role { color: #1D5CA6; font-size: 12px; font-weight: 600; margin-top: 2px; }
.egc-card .rows { position: relative; display: grid; grid-template-columns: 82px 1fr; gap: 3px 8px; margin: 12px 26px 0; font-size: 12px; }
.egc-card .rows dt { color: #5B6B7F; }
.egc-card .rows dt::after { content: ":"; float: right; }
.egc-card .rows dd { margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.egc-card .foot { position: absolute; left: 0; right: 0; bottom: 0; height: 13%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px 0 18px; color: #fff; font-size: 10.5px; }
.egc-card .foot > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.egc-card .foot span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.egc-card .foot svg.i { width: 12px; height: 12px; }
.egc-card .side-logo { width: 34px; height: 34px; flex: none; opacity: .95; }
.egc-card .back { transform: rotateY(180deg); display: block; padding: 0; }
.egc-card .corner-logo { position: absolute; top: 24px; right: 16px; width: 34px; height: 34px; opacity: .9; }
.egc-card .back h3 { position: relative; margin: 30px 18px 8px; font-family: var(--serif); color: #03305E; font-size: 17px; }
.egc-card .back ul { position: relative; list-style: none; margin: 0 18px; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; line-height: 1.4; color: #34465A; }
.egc-card .back li { position: relative; padding-left: 18px; }
.egc-card .back li::before { content: ""; position: absolute; left: 1px; top: 3px; width: 9px; height: 5px; border-left: 2px solid #A87A2C; border-bottom: 2px solid #A87A2C; transform: rotate(-45deg); }
.egc-card .sigqr { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 12px 18px 0; }
.egc-card .sig { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; color: #5B6B7F; padding-bottom: 18px; }
.egc-card .sig .line { width: 96px; border-top: 1px solid #8C99A8; }
.egc-card .qr { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; color: #03305E; }
.egc-card .qr img { width: 112px; height: 112px; border: 2px solid #A87A2C; border-radius: 8px; background: #fff; }
.egc-card .brand.bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 18px 16px; justify-content: center; }
@media print { .egc-card { filter: none; } }

/* Fee hero for families */
.due { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.due .amt { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }

/* payment method picker */
.methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.method { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; background: var(--surface); text-align: left; display: flex; flex-direction: column; gap: 6px; }
.method:hover { border-color: var(--line-strong); }
.method.on { border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-100); }
[data-theme="dark"] .method.on { border-color: var(--primary); }
.method b { font-size: 14.5px; }
.method span { font-size: 12.5px; color: var(--ink-3); }
.account-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.account-card .accno { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: .02em; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.check-row:first-child { border-top: 0; }
.check-row .d { color: var(--ink-3); font-size: 12.5px; }
.receipt-img { border: 1px solid var(--line); border-radius: 10px; max-height: 520px; width: auto; margin: 0 auto; background: var(--surface-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--navy); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li span { color: var(--ink-3); font-size: 12.5px; display: block; }

/* attendance marking */
.mark-list .mrow { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); }
.mark-list .mrow:first-child { border-top: 0; }
.mark-list .mrow .grow { flex: 1; min-width: 0; }
.pick { display: inline-flex; gap: 4px; }
.pick button { height: 34px; min-width: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 650; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.pick button.on[data-v=present] { background: var(--good); border-color: var(--good); color: #fff; }
.pick button.on[data-v=absent] { background: var(--bad); border-color: var(--bad); color: #fff; }
.pick button.on[data-v=late] { background: #C27D0E; border-color: #C27D0E; color: #fff; }
.pick button.on[data-v=leave], .pick button.on[data-v=excused] { background: var(--info); border-color: var(--info); color: #fff; }
.scanner { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan-result { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; border: 1px solid var(--good-line); background: var(--good-bg); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 11.5px; color: var(--ink-3); text-align: center; padding: 4px 0; }
.cal .day { aspect-ratio: 1 / 1; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; background: var(--surface-2); border: 1px solid transparent; gap: 2px; font-variant-numeric: tabular-nums; }
.cal .day.out { background: transparent; }
.cal .day.today { border-color: var(--navy); }
.cal .day i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.cal .day.present { background: var(--good-bg); color: var(--good); } .cal .day.present i { background: var(--good); }
.cal .day.late { background: var(--warn-bg); color: var(--warn); } .cal .day.late i { background: #C27D0E; }
.cal .day.absent { background: var(--bad-bg); color: var(--bad); } .cal .day.absent i { background: var(--bad); }
.cal .day.leave, .cal .day.excused { background: var(--info-bg); color: var(--info); } .cal .day.leave i, .cal .day.excused i { background: var(--info); }
.cal .day.holiday { background: var(--brass-50); color: var(--brass); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* timetable */
.tt { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 10px; overflow-x: auto; }
.tt .col h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.tt .slot { border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: 9px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface); font-size: 13px; }
[data-theme="dark"] .tt .slot { border-left-color: var(--primary); }
.tt .slot b { display: block; font-size: 13.5px; }
.tt .slot span { color: var(--ink-3); font-size: 12px; display: block; }

/* exam */
.exam-shell { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.exam-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: var(--navy); color: #fff; }
.exam-bar .title { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-bar .clock { font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; font-weight: 600; }
.exam-bar .clock.low { color: #FFB4AB; }
.exam-bar .cam { width: 64px; height: 48px; border-radius: 8px; overflow: hidden; background: #000; }
.exam-bar .cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.exam-body { flex: 1; width: min(820px, 100%); margin: 0 auto; padding: 22px 18px 120px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 14px; }
.q .qn { font-size: 12.5px; color: var(--ink-3); display: flex; justify-content: space-between; }
.q .qt { font-size: 16px; margin: 8px 0 14px; white-space: pre-wrap; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 11px; margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.opt:hover { border-color: var(--line-strong); }
.opt.on { border-color: var(--navy); background: var(--navy-50); }
[data-theme="dark"] .opt.on { border-color: var(--primary); }
.opt input { margin-top: 3px; accent-color: var(--navy); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 18px; display: flex; gap: 10px; align-items: center; z-index: 10; }
.qnav .dots { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.qnav .dots a { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); text-decoration: none; }
.qnav .dots a.done { background: var(--navy); color: #fff; }
.warnbar { background: var(--bad); color: #fff; padding: 9px 18px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.snapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.snapgrid figure { margin: 0; font-size: 11.5px; color: var(--ink-3); }
.snapgrid img { border-radius: 8px; border: 2px solid transparent; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.snapgrid img.flag { border-color: var(--bad); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; padding: 16px; max-height: 60vh; overflow-y: auto; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; background: var(--surface-3); font-size: 14px; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.bubble:not(.me) { border-bottom-left-radius: 4px; }
.bubble span { display: block; font-size: 11px; opacity: .65; margin-top: 3px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .g4, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:nth-child(3) { border-left: 0; }
  .stats .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 14px; gap: 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .mlogo { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; color: var(--ink); text-decoration: none; }
  .topbar .mlogo img { width: 34px; height: 34px; }
  .topbar .mlogo b { font-family: var(--serif); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .search { display: none; }
  .topbar .search.open { display: block; position: absolute; left: 10px; right: 10px; top: 8px; max-width: none; }
  .content { padding: 4px 14px 96px; }
  .page-head { margin: 12px 0 16px; }
  .page-head h1 { font-size: 24px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; font-size: 11px; font-weight: 550; color: var(--ink-3); text-decoration: none; background: none; border: 0; position: relative; }
  .bottom-nav a.active { color: var(--navy); }
  [data-theme="dark"] .bottom-nav a.active { color: var(--link); }
  .bottom-nav svg.i { width: 22px; height: 22px; }
  .bottom-nav .count { position: absolute; top: 0; left: 52%; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; line-height: 16px; }
  .overlay { align-items: end; padding: 0; }
  .dialog, .dialog.wide { width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .dialog .df { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 22px 20px 26px; }
  .auth-side h1 { font-size: 26px; margin-top: 18px; }
  .auth-side .foot, .auth-side p { display: none; }
  .auth-side .seal-bg { width: 300px; height: 300px; right: -90px; bottom: -110px; }
  .auth-main { align-items: flex-start; padding: 26px 18px 40px; }
  .methods { grid-template-columns: 1fr; }
  .t.stack-sm thead { display: none; }
  .t.stack-sm tr { display: block; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .t.stack-sm td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0 !important; text-align: right; }
  .t.stack-sm td::before { content: attr(data-l); color: var(--ink-3); font-size: 12.5px; text-align: left; }
  .t.stack-sm td.lead { display: block; text-align: left; padding-bottom: 6px !important; }
  .t.stack-sm td.lead::before { display: none; }
  .panel { top: 56px; right: 8px; left: 8px; width: auto; }
  .hide-sm { display: none !important; }
  .kv { grid-template-columns: 42% 1fr; }
}
@media (max-width: 520px) {
  .stats, .g4 { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 22px; }
  .stats .stat { padding: 13px 14px; }
  .pick button { min-width: 34px; padding: 0 8px; }
  .idcard .mid { grid-template-columns: 80px 1fr; }
  .idcard .photo { width: 80px; height: 96px; }
}
@media (min-width: 901px) { .show-sm { display: none !important; } }
/* ------------------------------------------------------------------ motion & polish
   One easing family for the whole app: quick, decelerating, never bouncy.
   Motion answers something: a page arriving, a figure settling, a mark being made. */
:root { --ease: cubic-bezier(.2, .8, .2, 1); --ease-in: cubic-bezier(.4, 0, 1, 1); }

/* progress bar: appears only when loading takes longer than a blink */
#progress { position: fixed; z-index: 120; top: 0; left: 0; right: 0; height: 2.5px; pointer-events: none; opacity: 0; transition: opacity .25s; }
#progress.on { opacity: 1; }
#progress.done { opacity: 0; transition: opacity .3s .12s; }
#progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #D6AE62); transform-origin: left; transform: scaleX(0); transition: transform .22s var(--ease); box-shadow: 0 0 8px rgba(168, 122, 44, .5); }

/* page arrival: top-level blocks settle in, lightly staggered */
.page-in > * { animation: settle .32s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes settle { from { opacity: 0; transform: translateY(6px); } }

/* sign-in: the one orchestrated moment */
.auth-side .seal-bg { animation: sealIn 1.6s var(--ease) both; }
@keyframes sealIn { from { opacity: 0; transform: rotate(-14deg) scale(1.08); } }
.auth-side .mark, .auth-side h1, .auth-side p { animation: settle .6s var(--ease) both; }
.auth-side h1 { animation-delay: .12s; } .auth-side p { animation-delay: .22s; }
.auth-box { animation: settle .5s var(--ease) .15s both; }
.auth-side h1::after { content: ""; display: block; width: 44px; height: 3px; border-radius: 2px; background: var(--brass); margin-top: 18px; transform-origin: left; animation: rule .7s var(--ease) .45s both; }
@keyframes rule { from { transform: scaleX(0); } }

/* headline figures */
.cur { font-family: var(--font); font-size: .56em; font-weight: 600; color: var(--ink-3); margin-right: .28em; letter-spacing: .02em; vertical-align: .12em; }
.presence .cur, .due .cur { color: inherit; opacity: .6; }
.fig { font-variant-numeric: lining-nums tabular-nums; }

/* charts draw themselves once, on arrival */
svg.reveal .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .6s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes grow { from { transform: scaleY(0); } }
svg.reveal .line { stroke-dasharray: 1; animation: draw .9s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
svg.reveal .area { animation: fade .7s ease-out .25s both; }
svg.reveal .dot { animation: fade .3s ease-out both; animation-delay: calc(.35s + var(--i) * 30ms); }
.hbar .fill, .meter > i { transform-origin: left; animation: growX .7s var(--ease) both; }
@keyframes growX { from { transform: scaleX(0); } }
.chart .tip { transition: left .12s var(--ease), top .12s var(--ease), opacity .12s; }

/* controls respond to touch */
.btn { transition: background .15s, border-color .15s, box-shadow .15s, transform .1s var(--ease); }
.btn:active:not([disabled]) { transform: translateY(1px) scale(.985); }
.btn.primary { box-shadow: 0 1px 2px rgba(3, 48, 94, .18), inset 0 1px 0 rgba(255,255,255,.08); }
.btn.primary:hover { box-shadow: 0 4px 12px rgba(3, 48, 94, .22); }
.icon-btn { transition: background .15s, color .15s, transform .1s var(--ease); }
.icon-btn:active { transform: scale(.92); }
.seg button { transition: background .18s, color .18s, box-shadow .18s; }
.tabs a, .tabs button { transition: color .15s, border-color .2s; }
.pick button { transition: background .15s, border-color .15s, color .15s, transform .1s var(--ease); }
.pick button.on { animation: press .22s var(--ease); }
@keyframes press { 40% { transform: scale(.9); } }
input, select, textarea { transition: border-color .15s, box-shadow .15s; }

/* things you can open */
.list .li { transition: background .15s; }
a.li:hover, button.li:hover { background: var(--surface-2); }
a.li > svg.i:last-child { transition: transform .18s var(--ease); color: var(--ink-3); }
a.li:hover > svg.i:last-child { transform: translateX(3px); color: var(--ink-2); }
.t td { transition: background .12s; }
a.card { transition: border-color .18s, box-shadow .18s, transform .18s var(--ease); }
a.card:hover { border-color: var(--line-strong); box-shadow: 0 6px 18px rgba(10, 28, 52, .07); transform: translateY(-1px); }
.auth-links a { transition: background .15s, border-color .15s, transform .15s var(--ease); }
.auth-links a:hover { transform: translateX(2px); }
.auth-links a .ico { transition: background .15s, color .15s; }
.auth-links a:hover .ico { background: var(--navy); color: #fff; }

/* navigation marker slides in on the page you're on */
.nav a { transition: background .15s, color .15s; }
.nav a.active::before { animation: marker .3s var(--ease) both; }
@keyframes marker { from { transform: scaleY(.2); opacity: 0; } }
@media (max-width: 900px) {
  .bottom-nav a::before { content: ""; position: absolute; top: 2px; left: 50%; width: 54px; height: 30px; margin-left: -27px; border-radius: 15px; background: var(--navy-50); opacity: 0; transform: scaleX(.5); }
  .bottom-nav a.active::before { opacity: 1; transform: none; animation: pill .32s var(--ease); }
  .bottom-nav a > svg, .bottom-nav a > span:not(.count) { position: relative; }
  .bottom-nav a, .bottom-nav button { transition: color .15s; }
  .bottom-nav a:active svg, .bottom-nav button:active svg { transform: scale(.9); }
  .bottom-nav svg.i { transition: transform .1s var(--ease); }
  .topbar { transition: box-shadow .2s; }
  .topbar.scrolled { box-shadow: 0 1px 10px rgba(10, 28, 52, .06); }
}
@keyframes pill { from { opacity: 0; transform: scaleX(.5); } }

/* dialogs and sheets: in from where they live, out a little faster */
.overlay { animation: fade .2s ease-out; }
.dialog { animation: pop .24s var(--ease); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.overlay.closing { animation: fadeOut .17s var(--ease-in) both; }
.overlay.closing .dialog { animation: popOut .17s var(--ease-in) both; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popOut { to { transform: translateY(6px) scale(.985); opacity: 0; } }
@media (max-width: 900px) {
  .dialog, .dialog.wide { animation: sheet .3s var(--ease); }
  .overlay.closing .dialog { animation: sheetOut .2s var(--ease-in) both; }
  .dialog::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto -4px; flex: none; }
}
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }

/* toasts */
.toast { animation: toastIn .28s var(--ease); }
@keyframes toastIn { from { transform: translateY(10px) scale(.97); opacity: 0; } }
.toast.out { animation: toastOut .2s var(--ease-in) both; }
@keyframes toastOut { to { transform: translateY(6px); opacity: 0; } }

/* skeleton → content */
.sk { animation-duration: 1.5s; }

/* live presence: a quiet pulse while the child is inside EGC */
.presence .live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: .01em; padding: 4px 10px 4px 8px; border-radius: 20px; background: rgba(92, 196, 135, .16); color: #9BE3B6; position: relative; margin-top: 14px; }
.presence .live i { width: 8px; height: 8px; border-radius: 50%; background: #5CC487; position: relative; }
.presence .live i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #5CC487; animation: ping 2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
.presence .status { animation: settle .5s var(--ease) .08s both; }

/* a row just marked by a scan */
.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { background: var(--good-bg); } }
.scan-result { animation: settle .3s var(--ease); }
.scan-result svg.i:last-child { color: var(--good); animation: tick .45s var(--ease); }
@keyframes tick { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } }

/* notification badge arrives with a small pop */
.icon-btn .dot:not(.hidden) { animation: badge .35s var(--ease); }
@keyframes badge { from { transform: scale(.3); } }

/* theme switch cross-fade */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after { transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease !important; }

/* app download */
.getapp { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); }
.getapp:hover { color: var(--ink); }
ol.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 14px; line-height: 1.55; }
ol.steps li::marker { color: var(--brass); font-weight: 700; }

/* ------------------------------------------------------------------ simple mode */
.toolbar input[type=date], .toolbar input[type=month], .toolbar input[type=search] { width: auto; height: 36px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.stat.tone-good .value { color: var(--good); }
.stat.tone-bad .value { color: var(--bad); }
.stat.tone-warn .value { color: var(--warn); }
.stat.tone-good, .stat.tone-bad, .stat.tone-warn { position: relative; }
.stat.tone-good::before, .stat.tone-bad::before, .stat.tone-warn::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.stat.tone-good::before { background: var(--good); } .stat.tone-bad::before { background: var(--bad); } .stat.tone-warn::before { background: var(--warn); }

/* P / A / L counts used inline */
.pal { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pal b { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.pal b.p { background: var(--good-bg); color: var(--good); }
.pal b.a { background: var(--bad-bg); color: var(--bad); }
.pal b.l { background: var(--warn-bg); color: var(--warn); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r, 12px); background: var(--brass-50, #F7EFDF); border: 1px solid rgba(168, 122, 44, .35); color: var(--ink); text-decoration: none; }
.banner > svg.i:first-child { color: var(--brass); }
.banner .grow { flex: 1; }
.banner b { display: block; } .banner span span { font-size: 13px; color: var(--ink-2); }
.banner:hover { text-decoration: none; border-color: var(--brass); }

/* roll call */
.roster { display: flex; flex-direction: column; }
.rrow { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.rrow:last-child { border-bottom: 0; }
.rrow .roll { width: 22px; text-align: right; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.rrow .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rrow .grow b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-pick { display: inline-flex; gap: 6px; flex: none; }
.pk { width: 44px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 15px; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .1s var(--ease, ease); }
.pk:active { transform: scale(.92); }
.pk.present.on { background: var(--good); border-color: var(--good); color: #fff; }
.pk.absent.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.pk.leave.on { background: var(--warn); border-color: var(--warn); color: #fff; }
.pk.on { animation: press .22s var(--ease, ease); }
.pk:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -4px 20px rgba(10, 28, 52, .06); }
@media (max-width: 900px) { .savebar .btn { flex: 1 1 100%; } .saved-card > .hd { flex-wrap: wrap; gap: 4px; } .savebar { bottom: calc(64px + env(safe-area-inset-bottom)); } .rrow { padding: 10px 12px; gap: 10px; } .rrow .avatar { display: none; } .pk { width: 42px; } }

/* after saving */
.saved-card { margin-top: 16px; border-color: var(--good-line); animation: settle .35s var(--ease, ease); }
.saved-card > .hd h2 { display: flex; align-items: center; gap: 8px; color: var(--good); }
.tri { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tri > div { border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 550; }
.tri b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.1; font-weight: 600; }
.tri .p { background: var(--good-bg); color: var(--good); } .tri .a { background: var(--bad-bg); color: var(--bad); } .tri .l { background: var(--warn-bg); color: var(--warn); }
.list .li.done { opacity: .6; }

/* month calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .wd { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-align: center; padding-bottom: 2px; }
.cal .day { aspect-ratio: 1 / .9; border-radius: 9px; border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 5px 7px; font-size: 12px; background: var(--surface); }
.cal .day b { font-weight: 600; color: var(--ink-2); }
.cal .day i { font-style: normal; font-weight: 700; font-size: 12px; align-self: flex-end; }
.cal .day.p { background: var(--good-bg); border-color: var(--good-line); } .cal .day.p i { color: var(--good); }
.cal .day.a { background: var(--bad-bg); border-color: var(--bad-line); } .cal .day.a i { color: var(--bad); }
.cal .day.l { background: var(--warn-bg); border-color: var(--warn-line); } .cal .day.l i { color: var(--warn); }
.cal .day.fut, .cal .day.none { color: var(--ink-3); } .cal .day.fut { border-style: dashed; background: transparent; }
@media (max-width: 560px) { .cal .day { aspect-ratio: 1; padding: 4px 5px; } .cal .day i { display: none; } }
.cal.sm { gap: 4px; } .cal.sm .day { aspect-ratio: 1; padding: 3px 5px; font-size: 11px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.legend i.p { background: var(--good); } .legend i.a { background: var(--bad); } .legend i.l { background: var(--warn); }

/* optional details folded away */
details.more { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
details.more > summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform .2s var(--ease, ease); margin-right: 4px; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more[open] { padding-bottom: 14px; }

/* radio options (WhatsApp mode) */
label.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; margin-bottom: 10px; }
label.opt.on { border-color: var(--navy); background: var(--navy-50); }
label.opt input { margin-top: 3px; width: auto; }
label.opt b { display: block; } label.opt .small { display: block; margin-top: 2px; }

/* WhatsApp buttons: the glyph carries WhatsApp's green; text stays in the interface ink */
.btn.wa svg.i { color: #1FA855; }
[data-theme="dark"] .btn.wa svg.i { color: #4CD57E; }

/* ID card flip feels physical */
.flip-inner { transition: transform .7s cubic-bezier(.3, .7, .2, 1); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .app { display: block; } .content { padding: 0; }
  body { background: #fff; }
}
