/* MARS — same design language as MITS (and MADE): Mater green/gold, cream page, dark-green
   icon sidebar, white top bar, Playfair Display headings + Inter body, 14px-radius cards,
   MITS-style stat tiles. Fonts are self-hosted (assets/fonts, SIL OFL) like MADE's Merriweather,
   so the kiosk never depends on Google Fonts being reachable from the school network. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/playfair-display-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/playfair-display-latin-700-normal.woff2') format('woff2'); }
:root {
  --green: #1B4D33; --green-dark: #123526; --gold: #E3B23C; --gold-dark: #B8891E;
  --page-bg: #FAF8F2; --surface: #FFFFFF; --input-bg: #FAF8F2;
  --ink: #22281F; --ink-soft: #5B6259; --line: #E4DFD0; --line-strong: #D9D3C2;
  --heading: var(--green-dark); --link: var(--green);
  --ok: #1B4D33; --ok-bg: #E3EEE7; --late: #8A6512; --late-bg: #FBF0D3;
  --bad: #B5432F; --bad-bg: #FBEAE6; --info: #2B5F8F; --info-bg: #DDE9F5; --pend: #5B6259; --pend-bg: #EFEDE6;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,.045);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --green: #2E8058; --green-dark: #153B27; --gold: #E8BC55; --gold-dark: #C79A38;
  --page-bg: #1A1C19; --surface: #24271F; --input-bg: #2B2E25;
  --ink: #EDEAE1; --ink-soft: #A9A697; --line: #3C3F35; --line-strong: #4A4D42;
  --heading: var(--gold); --link: var(--gold);
  --ok: #8FD8AE; --ok-bg: #1F3328; --late: #F0C766; --late-bg: #3A3018;
  --bad: #F0A08F; --bad-bg: #3A211C; --info: #8FC0E8; --info-bg: #22374A; --pend: #B8B5A6; --pend-bg: #2E3128;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #2E8058; --green-dark: #153B27; --gold: #E8BC55; --gold-dark: #C79A38;
    --page-bg: #1A1C19; --surface: #24271F; --input-bg: #2B2E25;
    --ink: #EDEAE1; --ink-soft: #A9A697; --line: #3C3F35; --line-strong: #4A4D42;
    --heading: var(--gold); --link: var(--gold);
    --ok: #8FD8AE; --ok-bg: #1F3328; --late: #F0C766; --late-bg: #3A3018;
    --bad: #F0A08F; --bad-bg: #3A211C; --info: #8FC0E8; --info-bg: #22374A; --pend: #B8B5A6; --pend-bg: #2E3128;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page-bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); color: var(--heading); font-weight: 700; }
h2 { font-size: 19px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 10px; }
code { background: var(--input-bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }
.grow { flex: 1 1 200px; }
.empty { color: var(--ink-soft); padding: 18px 0; text-align: center; }
.ico { width: 17px; height: 17px; stroke: currentColor; fill: none; flex: none; }

/* ---------- shell ---------- */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar { width: 232px; flex: 0 0 232px; background: var(--green-dark); color: #fff; display: flex; flex-direction: column; padding: 22px 0 16px; position: sticky; top: 0; height: 100vh; overflow: hidden; }
:root[data-theme="dark"] .sidebar { background: #0F1710; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidebar { background: #0F1710; } }
.sidebar .brand { display: block; padding: 0 20px 18px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.14); margin-bottom: 16px; color: #fff; text-decoration: none; }
.sidebar .brand .mark { display: block; margin: 0 auto 10px; border-radius: 11px; }
.sidebar .brand .name { font-family: var(--serif); font-size: 18px; font-weight: 700; letter-spacing: .04em; }
.sidebar .brand .sub { color: var(--gold); font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; margin-top: 4px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 0 12px; min-height: 0; }
.nav-group { margin-bottom: 20px; }
.nav-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.48); padding: 0 10px; margin-bottom: 7px; font-weight: 600; }
.sidebar a.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: rgba(255,255,255,.86); font-size: 13.5px; margin-bottom: 2px; border-left: 3px solid transparent; transition: background .1s ease; }
.sidebar a.nav-link:hover { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.sidebar .nav-icon { flex: 0 0 18px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.6); }
.sidebar a.nav-link:hover .nav-icon { color: #fff; }
.sidebar a.nav-link.active { background: var(--gold); color: #123526; font-weight: 700; border-left-color: var(--gold-dark); }
.sidebar a.nav-link.active .nav-icon { color: #123526; }
.nav-footer { padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.14); margin-top: 6px; }
.who { display: flex; align-items: center; gap: 9px; padding: 0 8px; margin-bottom: 10px; }
.who-avatar { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--gold); color: #123526; font-family: var(--serif); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.who-text { min-width: 0; }
.who-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 10.5px; color: rgba(255,255,255,.6); }
.sidebar a.nav-link-logout:hover { background: rgba(197,90,73,.18); color: #F2B8AC; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; margin: 0; line-height: 1.2; }
.topbar-sub { font-size: 10.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--gold); color: var(--ink); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 28px 48px; flex: 1; }
.wrap.narrow { max-width: 420px; padding-top: 28px; }
.foot { text-align: center; color: var(--ink-soft); font-size: 11.5px; padding: 0 0 18px; }
#sidebarToggle, #sidebarOverlay { display: none; }
@media (max-width: 900px) {
  #sidebarToggle { display: flex; position: fixed; top: 12px; left: 12px; z-index: 60; width: 42px; height: 42px; border-radius: 10px; border: 0; background: var(--green-dark); color: #fff; font-size: 20px; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 70; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open #sidebarOverlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 65; }
  .topbar { padding: 14px 16px 14px 66px; min-height: 66px; }
  .wrap { padding: 18px 16px 40px; }
}

/* ---------- cards, layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 640px; }
@media (max-width: 600px) { .card { padding: 18px 16px; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: '›'; font-size: 18px; color: var(--ink-soft); transition: transform .15s ease; width: 12px; }
details.card[open] > summary::before { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: 16px; }
.attention { border-color: #E9D29A; background: var(--late-bg); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.cols .card { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rule-line { color: var(--ink-soft); font-size: 13px; }
.rule-line strong { color: var(--ink); }

/* stat tiles (MITS) */
.stat-section { margin-bottom: 22px; }
.stat-section-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-family: var(--serif); color: var(--heading); font-size: 17px; font-weight: 700; }
.stat-section-head .ico { color: var(--gold-dark); }
.stat-section-head .muted { font-family: var(--sans); font-size: 12.5px; font-weight: 500; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 14px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: box-shadow .15s ease, transform .15s ease; }
.stat-tile:hover { box-shadow: 0 5px 16px rgba(0,0,0,.09); transform: translateY(-1px); }
.stat-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--page-bg); display: flex; align-items: center; justify-content: center; margin-bottom: 11px; color: var(--green); }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; font-size: 28px; color: var(--heading); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--ink-soft); margin-top: 6px; }
.stat-tile.ok .stat-icon { background: var(--ok-bg); color: var(--ok); }
.stat-tile.late .stat-icon { background: var(--late-bg); color: var(--late); }
.stat-tile.late .stat-value { color: var(--late); }
.stat-tile.bad .stat-icon { background: var(--bad-bg); color: var(--bad); }
.stat-tile.bad .stat-value { color: var(--bad); }
.stat-tile.pend .stat-icon { background: var(--pend-bg); color: var(--pend); }

/* ---------- forms & buttons ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); font-weight: 500; }
input, select, textarea { font: 14px var(--sans); color: var(--ink); background: var(--input-bg); border: 1px solid var(--line-strong); border-radius: 7px; padding: 9px 11px; min-height: 40px; max-width: 100%; width: 100%; }
select { -webkit-appearance: none; appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-dark); outline-offset: 1px; background: var(--surface); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); padding: 0; flex: none; }
input[type=file] { padding: 7px; }
.filters input, .filters select, .row-form input, .row-form select { width: auto; }
.filters .grow input, .filters input.grow, .row-form .grow input, .row-form .grow select { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
fieldset.days { flex-direction: row; flex-wrap: wrap; gap: 14px; }
fieldset.days legend { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; margin-bottom: 8px; padding: 0; }
.row-form, .filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters { margin-bottom: 16px; }
.quick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 14px; color: var(--ink-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 16px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 13.5px var(--sans); text-decoration: none !important; cursor: pointer; white-space: nowrap; transition: background .12s ease, border-color .12s ease; }
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #123526; }
.btn.gold:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }
.btn.big { font-size: 18px; padding: 16px 30px; min-height: 60px; border-radius: 12px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--bad); }
.seg { display: inline-flex; background: var(--input-bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--ink-soft); padding: 7px 13px; font: 600 13px var(--sans); cursor: pointer; border-radius: 7px; min-height: 34px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--heading); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.day-nav { display: flex; gap: 6px; align-items: center; }
.day-nav input { width: auto; }
.day-nav .btn { min-width: 40px; padding: 9px 12px; }
form.inline { display: inline; }
.x { border: 0; background: none; color: var(--ink-soft); font-size: 16px; line-height: 1; cursor: pointer; padding: 3px 6px; border-radius: 6px; opacity: .55; }
tr:hover .x { opacity: 1; }
.x:hover { background: var(--bad-bg); color: var(--bad); opacity: 1; }

/* flashes, pills */
.flash { padding: 11px 14px; border-radius: 9px; margin: 0 0 18px; font-size: 13.5px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash.info { background: var(--info-bg); color: var(--info); }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.pill.on_time { background: var(--ok-bg); color: var(--ok); }
.pill.late { background: var(--late-bg); color: var(--late); }
.pill.absent { background: var(--bad-bg); color: var(--bad); }
.pill.pending { background: var(--pend-bg); color: var(--pend); }
.pill.closed { background: var(--info-bg); color: var(--info); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--input-bg); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 5px; padding: 0 6px; cursor: help; }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; border-bottom: 1px solid var(--line); padding: 10px 12px; white-space: nowrap; }
.tbl th.grp { text-align: center; }
.tbl td { border-bottom: 1px solid var(--line); padding: 11px 12px; vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--input-bg); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.n { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl td.late { color: var(--late); }
.tbl td.absent { color: var(--bad); }
.tbl .t { font-variant-numeric: tabular-nums; font-weight: 500; margin-right: 4px; }
.tbl .name { font-weight: 600; color: var(--heading); }
.tbl.small td, .tbl.small th { padding: 7px 8px; font-size: 13px; }
.tbl tr.voided td { opacity: .5; text-decoration: line-through; }
.tbl tr.hide { display: none; }
.attention .tbl td { border-color: rgba(0,0,0,.07); }
@media (max-width: 600px) { .hide-sm { display: none; } .tbl td, .tbl th { padding: 9px 6px; } }

/* login / plain pages (MITS login look) */
body.plain { min-height: 100vh; }
.app-header { background: var(--green); color: #fff; padding: 28px 20px 24px; border-bottom: 5px solid var(--gold); text-align: center; }
.app-header .seal { display: block; margin: 0 auto 14px; border-radius: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.app-header h1 { font-family: var(--serif); color: #fff; margin: 0; font-size: 23px; }
.app-header .sub { color: var(--gold); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; margin-top: 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* ---------- kiosk (iPad) — scan only, no buttons ---------- */
body.kiosk { height: 100vh; height: 100dvh; overflow: hidden; background: var(--page-bg); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.kz { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.kz-cam { position: relative; border-radius: 28px; overflow: hidden; background: #0c110e; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(18,53,38,.18); }
.kz-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kz-cam video.mirror { transform: scaleX(-1); }
.kz-frame { position: relative; width: min(58%, 420px); aspect-ratio: 1; border-radius: 30px; box-shadow: 0 0 0 9999px rgba(8,14,10,.42); pointer-events: none; }
.kz-frame i { position: absolute; width: 22%; height: 22%; border: 6px solid var(--gold); }
.kz-frame i:nth-child(1) { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 30px; }
.kz-frame i:nth-child(2) { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 30px; }
.kz-frame i:nth-child(3) { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 30px; }
.kz-frame i:nth-child(4) { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 30px; }
.kz-laser { position: absolute; left: 8%; right: 8%; height: 3px; top: 10%; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); box-shadow: 0 0 14px var(--gold); animation: kzscan 2.4s ease-in-out infinite; }
@keyframes kzscan { 0%, 100% { top: 10%; } 50% { top: 88%; } }
.kz-chip { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.94); color: #123526; padding: 11px 22px; border-radius: 999px; font-weight: 600; font-size: 17px; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.kz-camoff { position: absolute; inset: 0; z-index: 3; background: #123526; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; }
.kz-camoff[hidden] { display: none; }
.kz-camoff-ico { width: 84px; height: 84px; border-radius: 24px; background: rgba(255,255,255,.1); color: var(--gold); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.kz-camoff-ico .ico { width: 44px; height: 44px; }
.kz-camoff strong { font-family: var(--serif); font-size: 30px; }
.kz-camoff span { font-size: 17px; opacity: .8; max-width: 440px; }
.kz-side { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.kz-brand { display: flex; align-items: center; gap: 12px; }
.kz-logo { display: inline-flex; border-radius: 14px; transition: transform .2s ease; }
.kz-logo.holding { transform: scale(.88); }
.kz-brand strong { display: block; font-family: var(--serif); font-size: 20px; color: var(--heading); line-height: 1.15; }
.kz-brand span { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.kz-clock { display: flex; flex-direction: column; }
.kz-clock span { font-family: var(--serif); font-size: 64px; font-weight: 700; color: var(--heading); line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.kz-clock small { font-size: 15px; color: var(--ink-soft); margin-top: 6px; }
.kz-mode { display: flex; gap: 16px; align-items: center; background: var(--green); color: #fff; border-radius: 20px; padding: 20px 22px; border-bottom: 5px solid var(--gold); }
body.kiosk[data-dir="out"] .kz-mode { background: #24527A; }
.kz-mode-ico { width: 60px; height: 60px; border-radius: 16px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; flex: none; }
.kz-mode-ico .ico { width: 34px; height: 34px; }
.kz-mode-k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.kz-dir { font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1.1; }
.kz-rule { font-size: 14.5px; opacity: .88; margin-top: 3px; }
.kz-rule.late { color: var(--gold); opacity: 1; font-weight: 700; }
.kz-note { background: var(--info-bg); color: var(--info); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.kz-steps { display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.kz-steps div { display: flex; align-items: center; gap: 12px; font-size: 15.5px; font-weight: 500; }
.kz-steps b { width: 28px; height: 28px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.kz-recent-wrap { flex: 1; min-height: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; }
.kz-recent-wrap h2 { font-size: 16px; margin: 0 0 6px; }
.kz-recent { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.kz-recent li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kz-recent li:last-child { border-bottom: 0; }
.kz-recent li.kz-empty { color: var(--ink-soft); font-size: 14px; justify-content: center; padding: 18px 0; }
.kz-rph { width: 40px; height: 52px; border-radius: 8px; overflow: hidden; background: var(--input-bg); display: flex; align-items: center; justify-content: center; flex: none; font-family: var(--serif); font-weight: 700; color: var(--green); }
.kz-rph img { width: 100%; height: 100%; object-fit: cover; }
.kz-rtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kz-rtxt strong { font-size: 15px; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kz-rtxt span { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
@media (orientation: portrait), (max-width: 900px) {
  .kz { display: flex; flex-direction: column; gap: 16px; }
  .kz-cam { flex: 1; min-height: 0; }
  .kz-side { display: contents; }
  .kz-brand { order: 1; }
  .kz-cam { order: 3; }
  .kz-clock { display: none; }
  .kz-mode { order: 2; }
  .kz-note { order: 2; }
  .kz-steps { display: none; }
  .kz-recent-wrap { order: 4; max-height: 22vh; }
}
.k-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; background: rgba(12,20,15,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.k-overlay[hidden] { display: none; }
.kz-result { display: flex; align-items: stretch; width: min(760px, 100%); background: var(--surface); border-radius: 30px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.35); animation: kpop .22s ease-out; border: 6px solid var(--ok); }
.k-overlay.late .kz-result { border-color: var(--gold); }
.k-overlay.dup .kz-result { border-color: #2B5F8F; }
.k-overlay.bad .kz-result { border-color: var(--bad); }
.kz-res-photo { width: 42%; aspect-ratio: 3 / 4; background: var(--input-bg); display: flex; align-items: center; justify-content: center; flex: none; font-family: var(--serif); font-size: 84px; font-weight: 700; color: var(--green); }
.kz-res-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kz-res-photo .ico { width: 110px; height: 110px; stroke-width: 1.6; }
.k-overlay.bad .kz-res-photo { color: var(--bad); background: var(--bad-bg); }
.kz-res-body { flex: 1; padding: 34px 34px 30px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-width: 0; }
.kz-res-ico { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ok-bg); color: var(--ok); margin-bottom: 16px; }
.kz-res-ico .ico { width: 38px; height: 38px; stroke-width: 2.2; }
.k-overlay.late .kz-res-ico { background: var(--late-bg); color: var(--late); }
.k-overlay.dup .kz-res-ico { background: var(--info-bg); color: var(--info); }
.k-overlay.bad .kz-res-ico { background: var(--bad-bg); color: var(--bad); }
.k-ov-name { font-family: var(--serif); font-size: clamp(28px, 4.4vw, 42px); font-weight: 700; color: var(--heading); line-height: 1.1; }
.k-ov-msg { font-size: clamp(16px, 2.2vw, 20px); color: var(--ink-soft); margin-top: 8px; font-weight: 500; }
.k-ov-status { display: inline-block; margin-top: 20px; padding: 10px 24px; border-radius: 999px; font-weight: 800; font-size: 20px; letter-spacing: .05em; text-transform: uppercase; background: var(--ok-bg); color: var(--ok); }
.k-ov-status:empty { display: none; }
.k-overlay.late .k-ov-status { background: var(--late-bg); color: var(--late); }
.k-overlay.dup .k-ov-status { background: var(--info-bg); color: var(--info); }
.k-overlay.bad .k-ov-status { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 640px) { .kz-result { flex-direction: column; } .kz-res-photo { width: 100%; max-height: 40vh; aspect-ratio: auto; height: 40vh; } }
@keyframes kpop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* student photo box, bulk photo upload */
.photo-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.photo-frame { width: 150px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--input-bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 46px; font-weight: 700; color: var(--green); flex: none; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-row .stack { flex: 1; min-width: 180px; }
.file-btn { position: relative; overflow: hidden; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); flex-direction: row; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb { width: 30px; height: 40px; border-radius: 5px; object-fit: cover; display: block; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 34px 20px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--input-bg); text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 15px; cursor: pointer; text-align: center; transition: border-color .15s ease, background .15s ease; }
.drop.over, .drop:hover { border-color: var(--gold-dark); background: var(--late-bg); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); color: var(--green); display: flex; align-items: center; justify-content: center; }
.drop-ico .ico { width: 26px; height: 26px; }
.photo-results { list-style: none; margin: 10px 0 0; padding: 0; max-height: 420px; overflow: auto; }
.photo-results li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.photo-results li img { width: 30px; height: 40px; object-fit: cover; border-radius: 5px; }
.photo-results li.bad { color: var(--bad); }

/* dashboard: two stat sections side by side */
.dual { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 24px; }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-grid.four .stat-tile { padding: 14px 16px; }
@media (max-width: 520px) { .dual { grid-template-columns: 1fr; } .stat-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.page-intro { margin: 0 0 18px; }

/* combined import */
.imp-pick { margin-top: 12px; align-items: center; }
.imp-pick .file-btn { flex: none; }
.imp-staged { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.imp-staged > div { background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.imp-staged b { color: var(--heading); font-size: 14px; word-break: break-all; }
.imp-bar { height: 8px; border-radius: 8px; background: var(--input-bg); border: 1px solid var(--line); overflow: hidden; }
.imp-bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s ease; }
.photo-results li.ok span { color: var(--ink); }
details.small summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
