
:root{
  --bg:#0f1216;
  --surface:#191e25;
  --surface-2:#222932;
  --line:#2e3742;
  --ink:#eef2f6;
  --muted:#8d9aab;
  --signal:#ffd400;      /* stopky, primární akce */
  --boy:#5aa9ff;         /* chlapci */
  --girl:#ff7ab8;        /* dívky */
  --warn:#ffc233;        /* upozornění u poznámky */
  --go:#3ddc84;          /* start */
  --stop:#ff4d3d;        /* stop, mazání */
  --lane:#ffffff;
  --radius:14px;
  --tap:56px;
}
/* Světlý režim (volba v Nastavení): jen přebije barvy, tmavý zůstává výchozí. */
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f3f5f8;
  --surface:#ffffff;
  --surface-2:#e8ecf1;
  --line:#d2d9e2;
  --ink:#151a21;
  --muted:#5b6778;
  --signal:#f2c200;
  --boy:#1e6fd6;
  --girl:#d1347f;
  --warn:#a56a00;
  --go:#1f9d57;
  --stop:#d93025;
  --lane:#dfe5ec;
}
:root[data-theme="light"] .badge.g2{color:#fff}
:root[data-theme="light"] .btn.danger{border-color:#e8b4af}
:root[data-theme="light"] .gr1{color:#1b8a4c}
:root[data-theme="light"] .gr2{color:#5f8f12}
:root[data-theme="light"] .gr4{color:#d4501a}
:root[data-theme="light"] .alert{background:#fdecea;border-color:#f1b0a9;color:#7a1c14}
:root[data-theme="light"] .notice{background:#e6f6ec;border-color:#9fd3b2;color:#14532d}
:root[data-theme="light"] .item.mtz-off .name{color:#4f6f6d}
:root[data-theme="light"] .item.mtz-off .sub{color:#5f7f7d}
:root[data-theme="light"] #busy{background:rgba(243,245,248,.6)}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overscroll-behavior:none}
/* Mobil: stránka se nesmí kývat do stran ani „gumovat“ při tažení přes okraj. */
html{overflow-x:hidden}
body{overflow-x:hidden;touch-action:manipulation}
body.cb-open{overflow:hidden}
body{
  background:var(--bg);color:var(--ink);
  font:400 17px/1.45 -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,sans-serif;
  overscroll-behavior-y:none;
  -webkit-text-size-adjust:100%;
}
button,input,select,textarea{font:inherit;color:inherit}
button{border:0;background:none;cursor:pointer}
h1,h2,h3{margin:0;font-weight:640;letter-spacing:-.02em}

/* ---------- kostra ---------- */
#app{display:flex;flex-direction:column;height:100dvh}
#topbar{
  display:flex;align-items:center;gap:12px;
  padding:calc(max(env(safe-area-inset-top), 34px) + 26px) 16px 10px;   /* odskok shora: aspoň 60 px (iPhone se stavovým řádkem 47 px: 73 px), ať záhlaví nezasahuje do systémové lišty ani jejího rozmazání */
  border-bottom:1px solid var(--line);background:var(--bg);
  position:sticky;top:0;z-index:5;
}
#title-row{display:flex;align-items:center;gap:8px;flex:1;min-width:0}
#topbar h1{font-size:20px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#top-actions,.top-actions{display:flex;align-items:center;gap:6px}
.connection-dot{display:block;width:12px;height:12px;border-radius:50%;margin:0 6px;background:#ff4d3d;box-shadow:0 0 0 3px rgba(255,77,61,.14)}
.connection-dot.online{background:#b7ff3c;box-shadow:0 0 0 3px rgba(183,255,60,.16)}
#view{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:14px 16px 24px}
#busy{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:rgba(15,18,22,.58);opacity:0;pointer-events:none;transition:opacity .15s}
#busy.on{opacity:1;pointer-events:auto}
.busy-card{display:flex;align-items:center;gap:12px;min-width:190px;padding:18px 22px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:0 10px 35px rgba(0,0,0,.35);font-weight:600}
.busy-spinner{display:block;width:24px;height:24px;flex:0 0 24px;border:3px solid var(--line);border-top-color:var(--signal);border-radius:50%;animation:busy-spin .75s linear infinite}
@keyframes busy-spin{to{transform:rotate(360deg)}}
#tabs{
  display:grid;grid-template-columns:repeat(5,1fr);
  border-top:1px solid var(--line);background:var(--surface);
  padding-bottom:max(0px, calc(env(safe-area-inset-bottom) - 26px));   /* tlačítka níž, víc pracovní plochy */
}
#tabs button{
  padding:8px 2px 5px;display:flex;flex-direction:column;align-items:center;gap:3px;
  font-size:11px;color:var(--muted);letter-spacing:-.01em;min-width:0;overflow:hidden;
}
#tabs button span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
#tabs button svg{width:23px;height:23px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:0 0 23px}
#tabs button[aria-current="true"]{color:var(--signal)}

/* ---------- obecné prvky ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px;margin-bottom:12px}
.best-card{background:var(--surface)!important;border-color:var(--signal)!important}
.row{display:flex;align-items:center;gap:10px}
.spread{display:flex;align-items:center;justify-content:space-between;gap:10px}
.muted{color:var(--muted)}
.small{font-size:14px}
.tiny{font-size:12.5px}
.ath-search{margin-bottom:12px}
.hr{height:1px;background:var(--line);margin:14px 0;border:0}
.num{font-family:ui-monospace,"SF Mono",Menlo,monospace;font-variant-numeric:tabular-nums}

label.field{display:block;margin-bottom:12px}
label.field>span{display:block;font-size:13.5px;color:var(--muted);margin-bottom:5px}
input[type=text],input[type=number],input[type=date],input[type=password],input[type=email],select,textarea{
  width:100%;background:var(--surface-2);border:1px solid var(--line);
  border-radius:11px;padding:12px 13px;min-height:48px;appearance:none;
}
/* Bez tohohle input[type=password] nespadal do pravidla výš (chyběl v seznamu
   selektorů) — dostával tak výchozí bílé pozadí prohlížeče, na kterém byly
   tečky hesla (zděděná skoro bílá --ink barva textu) prakticky neviditelné. */
input[type=password]{color:var(--muted);letter-spacing:2px}
select{background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9'><path d='M1 1l6 6 6-6' stroke='%238d9aab' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat:no-repeat;background-position:right 14px center;padding-right:38px}
input:focus,select:focus,textarea:focus,button:focus-visible{outline:2px solid var(--signal);outline-offset:2px}
textarea{min-height:90px;resize:vertical}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:var(--tap);padding:0 18px;border-radius:13px;font-weight:600;
  background:var(--surface-2);border:1px solid var(--line);width:100%}
.btn.primary{background:var(--signal);color:#151006;border-color:transparent}
.btn.go{background:var(--go);color:#04220f;border-color:transparent}
.btn.danger{background:transparent;color:var(--stop);border-color:#4a2622}
.btn.ghost{background:transparent}
.btn.slim{min-height:44px;font-size:15px;padding:0 14px;width:auto}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.4}
.btn-row{display:flex;gap:10px}
.btn-row>.btn{flex:1}
.settings-view .btn-row{gap:12px}
.settings-view .btn{margin-bottom:10px}
.data-management{display:flex;flex-direction:column;gap:10px}
.settings-view .data-management .btn{margin-bottom:0}

.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;margin:0 -16px 12px;padding-left:16px;padding-right:16px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{white-space:nowrap;padding:8px 14px;border-radius:999px;background:var(--surface-2);
  border:1px solid var(--line);font-size:14.5px;color:var(--muted);min-height:40px;display:flex;align-items:center}
.chip[aria-pressed="true"]{background:var(--signal);color:#151006;border-color:transparent;font-weight:600}
.chip.chip-all{background:#b9e3ff;color:#17415d;border-color:#83c7ec}
.chip.chip-all[aria-pressed="true"]{background:#8dcef2;color:#0b2d43;border-color:#68b5e2;font-weight:700}

.badge{display:inline-block;padding:2px 7px;border-radius:6px;font-size:11.5px;font-weight:700;background:var(--surface-2);color:var(--muted)}
.badge.pb{background:var(--signal);color:#151006}
.badge.g1{background:#1e7a4d;color:#eafff3}
.badge.g2{background:#2f6b46}
.badge.g3{background:#6b5c1f;color:#fff6d0}
.badge.g4{background:#7a4a22;color:#ffe9d6}
.badge.g5{background:#7a2b24;color:#ffdfdb}
.grade-summary{display:inline-flex;align-items:center;gap:4px}
.grade-summary .badge{min-width:22px;text-align:center;padding:2px 5px}
.activity-slider{margin:12px 4px 8px}
.activity-range{display:block;width:100%;min-height:32px;margin:0;accent-color:var(--signal);cursor:pointer}
.activity-range:disabled{opacity:1;cursor:default}
.activity-bar{position:relative;height:12px;border-radius:6px;background:var(--surface-2);border:1px solid var(--line);overflow:hidden}
.activity-bar i{display:block;height:100%;background:var(--go);border-radius:6px}
.activity-scale-labels{display:flex;justify-content:space-between;margin-top:6px;color:var(--muted);font-size:12px;text-align:center}

.empty{text-align:center;padding:38px 16px;color:var(--muted)}
.empty h3{color:var(--ink);margin-bottom:6px;font-size:18px}

/* seznamy – dráhové linky */
.list{border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface)}
.item{display:flex;align-items:center;gap:12px;padding:13px 14px;border-bottom:1px solid var(--line);min-height:60px;width:100%;text-align:left}
.item:last-child{border-bottom:0}
.item:active{background:var(--surface-2)}
.item .grow{flex:1;min-width:0}
.item .name{font-weight:560;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item .sub{font-size:13px;color:var(--muted)}
.item .who{display:flex;align-items:center;gap:9px;min-width:0}
.item.mtz-done .badge{background:#2f6b33;color:#e6f6e7}
.item.mtz-next .badge{background:#3b82f6;color:#fff}
.item.mtz-off{background:rgba(120,175,170,.10)}
.item.mtz-off .badge{background:rgba(120,175,170,.18);color:#8fb5b3}
.item.mtz-off .name{color:#9cbcba;font-weight:450}
.item.mtz-off .sub{color:#7a9896}
.item.notmine{opacity:.48}
.item.notmine .name{font-weight:450}
.disc-row.dragging{background:var(--surface-2);box-shadow:0 4px 10px rgba(0,0,0,.15)}
.disc-row.inactive{background:var(--surface-2)}
.disc-row.inactive .name,.disc-row.inactive .sub{color:var(--muted);opacity:.7}
.disc-row.inactive .drag-handle{opacity:.5}
.disc-row.inactive .disc-sex-icon.is-set{opacity:.4}
.teacher-kind{font-weight:450;color:var(--muted)}

/* ikona pohlaví */
.sexico{width:21px;height:21px;flex:0 0 21px;fill:currentColor;color:var(--muted)}
.sexico.m{color:var(--boy)}
.sexico.f{color:var(--girl)}
.disc-name{display:flex;align-items:center;gap:8px}
.discipline-label{display:flex;align-items:center;gap:8px}
.disc-sex{display:inline-flex;align-items:center;gap:2px}
.disc-sex-icon{display:inline-flex;opacity:.25}
.disc-sex-icon.is-set{opacity:1}
.disc-sex-icon .sexico{width:17px;height:17px;flex-basis:17px}

/* poznámka u závodníka */
.warn{flex:0 0 auto;width:34px;height:34px;display:flex;align-items:center;justify-content:center;margin:-6px 0}
.warn svg{width:21px;height:21px}
.warn .tri{fill:var(--warn)}
.warn .mark{fill:#241c00}

/* řádka známek pod jménem */
.gr{font-weight:700;font-variant-numeric:tabular-nums}
.gr1{color:#3ddc84}
.gr2{color:#a9e06a}
.gr3{color:var(--signal)}
.gr4{color:#ff8a5c}
.rank{width:30px;text-align:right;color:var(--muted);font-weight:700}
.rank.m1{color:var(--signal)}
.val{font-weight:700;font-size:18px}

/* ---------- stopky ---------- */
.clock{
  font-family:ui-monospace,"SF Mono",Menlo,monospace;font-variant-numeric:tabular-nums;
  font-size:clamp(52px,17vw,74px);font-weight:700;letter-spacing:-.03em;
  text-align:center;line-height:1;padding:18px 0 6px;color:var(--signal);
}
.clock.idle{color:var(--muted)}
.clock .ms{font-size:.55em;opacity:.85}
.bigbtn{
  width:100%;min-height:132px;border-radius:20px;font-size:26px;font-weight:700;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;letter-spacing:-.02em;
}
.bigbtn .hint{font-size:13.5px;font-weight:500;opacity:.75}
.bigbtn.go{background:var(--go);color:#04220f}
.bigbtn.mark{background:var(--lane);color:#0f1216}
.bigbtn.cb-fin{flex-direction:row;justify-content:space-between;gap:10px;min-height:96px;padding:0 14px;background:var(--surface-2);border:1px solid var(--line);color:var(--ink)}
.cb-fin .cb-mid{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;line-height:1.1}
.cb-fin .cb-n{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:12px;font-size:26px;font-variant-numeric:tabular-nums}
.cb-fin .cb-n.run{background:rgba(74,222,128,.14);color:#4ade80}
.cb-fin .cb-n.out{background:rgba(248,113,113,.14);color:#f87171}
.countdown{font-size:96px;font-weight:800;text-align:center;color:var(--signal);line-height:1.1;padding:24px 0}
.splitline{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.splitline:last-child{border-bottom:0}
.splitline .no{width:26px;color:var(--muted);font-weight:700;text-align:right}
.splitline .t{font-family:ui-monospace,Menlo,monospace;font-variant-numeric:tabular-nums;font-weight:700;font-size:19px;min-width:92px}
.splitline select{min-height:44px;padding:8px 32px 8px 10px;font-size:15px}
.iconbtn{width:44px;min-width:44px;height:44px;display:flex;align-items:center;justify-content:center;
  border-radius:11px;background:var(--surface-2);border:1px solid var(--line);color:var(--muted)}
/* přepínač slunce / měsíc */
.theme-sw{position:relative;display:flex;align-items:center;justify-content:space-between;width:68px;height:36px;padding:0 7px;
  border-radius:18px;background:var(--surface-2);border:1px solid var(--line);box-shadow:inset 0 1px 3px rgba(0,0,0,.25)}
.theme-sw .ts-ico svg,.theme-sw .ts-knob svg{display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.theme-sw .ts-ico{color:var(--muted);opacity:.55;width:18px;height:18px}
.theme-sw .ts-knob{position:absolute;top:3px;left:3px;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:var(--surface);border:1px solid var(--line);box-shadow:0 2px 5px rgba(0,0,0,.3);transition:transform .2s ease}
.theme-sw.dark .ts-knob{transform:translateX(32px);color:var(--signal)}
.theme-sw.light .ts-knob{color:#e08a00}
.theme-sw.dark .ts-knob svg,.theme-sw.light .ts-knob svg{fill:currentColor;fill-opacity:.25}
.iconbtn svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sex-filter{opacity:.35}
.sex-filter.active{opacity:1;border-color:currentColor}
.sex-filter-f{color:var(--girl)}
.sex-filter-m{color:var(--boy)}
/* Aktivní pohlaví = celé tlačítko vyplněné barvou (dívky růžová / chlapci
   modrá), panáček uvnitř bílý pro kontrast — ne jen obarvená ikonka na
   šedém pozadí. */
.sex-filter-f.active{background:var(--girl)}
.sex-filter-m.active{background:var(--boy)}
.sex-filter.active .sexico{color:#fff}
.iconbtn.danger{color:var(--stop)}

/* docházka */
.status-ico{width:32px;height:32px;min-width:32px;border-radius:9px;display:flex;align-items:center;justify-content:center;border:1px solid var(--line);flex:0 0 32px}
.status-ico svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.status-ok{background:rgba(61,220,132,.13);border-color:rgba(61,220,132,.4);color:var(--go)}
.status-absent{background:rgba(255,77,61,.13);border-color:rgba(255,77,61,.4);color:var(--stop)}
.status-sick{background:rgba(90,169,255,.13);border-color:rgba(90,169,255,.4);color:var(--boy)}
.status-unwell{background:rgba(255,194,51,.13);border-color:rgba(255,194,51,.4);color:var(--warn)}
.status-kit{background:var(--surface-2);border-color:var(--line);color:var(--muted)}
.att-row{border-bottom:1px solid var(--line)}
.att-row:last-child{border-bottom:0}
.att-row .item{border-bottom:0;min-height:52px}
.att-picker{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:2px 12px 14px;background:var(--surface-2)}
.att-pick{display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 4px;border-radius:12px;border:1px solid var(--line);background:var(--surface)}
.att-pick.active{border-color:var(--signal);background:rgba(255,212,0,.1)}
.att-pick span{font-size:10.5px;text-align:center;line-height:1.2;color:var(--muted)}
.att-matrix{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;max-width:220px}

/* pokusy */
.attempts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.attempt{position:relative}
.attempt input{text-align:center;padding-right:13px}
.attempt .lbl{font-size:11.5px;color:var(--muted);text-align:center;margin-bottom:4px}

/* ---------- sheet ---------- */
#scrim{position:fixed;inset:0;background:rgba(0,0,0,.55);opacity:0;pointer-events:none;transition:opacity .18s;z-index:20}
#scrim.on{opacity:1;pointer-events:auto}
#sheet{position:fixed;left:0;right:0;bottom:0;z-index:21;background:var(--surface);
  border-radius:20px 20px 0 0;border-top:1px solid var(--line);
  transform:translateY(100%);transition:transform .22s cubic-bezier(.2,.8,.3,1);
  max-height:92dvh;display:flex;flex-direction:column}
#sheet.on{transform:translateY(0)}
#sheet header{display:flex;align-items:center;gap:10px;padding:14px 16px 10px;border-bottom:1px solid var(--line)}
#sheet header h2{font-size:18px;flex:1}
#sheet .body{overflow-y:auto;padding:16px;padding-bottom:calc(env(safe-area-inset-bottom) + 20px)}
.grabber{width:38px;height:4px;background:var(--line);border-radius:2px;margin:8px auto 0}

/* ---------- přihlášení ---------- */
.gate-head{text-align:center;margin-bottom:26px}
.gate-head .mark{width:56px;height:56px;margin:0 auto 14px;border-radius:16px;
  background:var(--surface-2);border:1px solid var(--line);display:flex;align-items:center;justify-content:center}
.gate-head .mark svg{width:30px;height:30px;stroke:var(--signal);fill:none;stroke-width:1.9;stroke-linecap:round}
.gate-head h2{font-size:21px;margin-bottom:5px}
.gate-head p{margin:0;color:var(--muted);font-size:14.5px}
.avatar{width:40px;height:40px;flex:0 0 40px;border-radius:50%;background:var(--surface-2);
  border:1px solid var(--line);display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:15px;color:var(--signal)}

#toast{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom) + 84px);transform:translate(-50%,14px);
  background:var(--surface-2);border:1px solid var(--line);color:var(--ink);
  padding:11px 16px;border-radius:12px;font-size:15px;z-index:40;opacity:0;
  transition:opacity .2s,transform .2s;pointer-events:none;max-width:88vw;text-align:center}
#toast.on{opacity:1;transform:translate(-50%,0)}

@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* ============================================================
   Přihlašovací a servisní obrazovky (serverové šablony)
   ============================================================ */
.gate-body{display:flex;align-items:center;justify-content:center;min-height:100dvh;padding:24px 18px}
.gate{width:100%;max-width:380px}
.gate h1{font-size:24px;margin-bottom:6px}
.gate .gate-head p{margin:0;color:var(--muted);font-size:14.5px}
.gate form{margin-top:22px}
.gate .btn{width:100%;margin-top:6px}
.gate-note{color:var(--muted);font-size:12.5px;line-height:1.6;margin-top:18px;text-align:center}
.gate-note a{color:var(--signal)}
.link-btn{background:none;border:0;padding:0;margin:0;font:inherit;font-size:inherit;
  color:var(--signal);text-decoration:underline;cursor:pointer}
.alert{background:#3a1d1a;border:1px solid #7a2b24;color:#ffd9d4;
  padding:12px 14px;border-radius:12px;font-size:14.5px;margin-top:18px}

/* oko u hesla */
.pw{position:relative}
.pw input{padding-right:48px}
.pw-eye{position:absolute;right:2px;top:0;bottom:0;width:46px;background:none;border:0;
  color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center}
.pw-eye svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.pw-eye .eye-off{display:none}
.pw-eye.on{color:var(--signal)}
.pw-eye.on .eye-on{display:none}
.pw-eye.on .eye-off{display:block}
.notice{background:#14301f;border:1px solid #2b6b45;color:#d4f5e1;
  padding:12px 14px;border-radius:12px;font-size:14.5px;margin-top:18px}

/* procento výkonu */
.pctwrap{display:flex;align-items:center;gap:8px;min-width:96px;justify-content:flex-end}
.pctbar{width:44px;height:6px;border-radius:3px;background:var(--surface-2);overflow:hidden;flex:0 0 44px}
.pctbar i{display:block;height:100%;background:var(--signal);border-radius:3px}
.pctval{font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums;min-width:38px;text-align:right}

/* označení vlastnictví záznamu */
.mine{color:var(--go)}
.notmine{opacity:.55}
.owner-tag{font-size:11.5px;color:var(--muted)}

/* jen pro správce */
.admin-only{border-left:2px solid var(--signal);padding-left:12px}
.role-pill{font-size:11px;padding:2px 7px;border-radius:6px;background:var(--surface-2);color:var(--muted)}
.role-pill.admin{background:var(--signal);color:#151006;font-weight:700}

/* ============================================================
   Statistiky
   ============================================================ */
.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
.stat-box{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:13px 14px}
.stat-box .val{font-size:22px;font-weight:700;font-variant-numeric:tabular-nums}
.stat-box .lbl{font-size:12px;color:var(--muted);margin-top:3px}
.stat-box .unit{font-size:13px;color:var(--muted);font-weight:400}
.grade-bar{display:flex;gap:6px;align-items:flex-end;height:60px;margin:8px 0}
.grade-bar .col{flex:1;border-radius:5px 5px 0 0;min-height:4px;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;position:relative}
.grade-bar .col span{font-size:11px;font-weight:700;position:absolute;top:-18px;white-space:nowrap}
.grade-bar .col.g1{background:#1e7a4d}
.grade-bar .col.g2{background:#3a7a25}
.grade-bar .col.g3{background:#6b5c1f}
.grade-bar .col.g4{background:#7a4a22}
.done-bar{height:8px;background:var(--surface-2);border-radius:4px;overflow:hidden;margin:6px 0}
.done-bar i{display:block;height:100%;background:var(--go);border-radius:4px}
.comp-table{width:100%;border-collapse:collapse;font-size:14px}
.comp-table th{text-align:left;color:var(--muted);font-weight:600;font-size:12px;padding:5px 8px;border-bottom:1px solid var(--line)}
.comp-table td{padding:9px 8px;border-bottom:1px solid var(--line)}
.comp-table tr:last-child td{border-bottom:0}

/* ============================================================
   Graf vývoje výkonu (SVG)
   ============================================================ */
.perf-chart{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:10px}
.perf-chart svg{width:100%;overflow:visible}
.perf-chart .axis{stroke:var(--line);stroke-width:1;fill:none}
.perf-chart .line{stroke:var(--signal);stroke-width:2.5;fill:none;stroke-linecap:round;stroke-linejoin:round}
.perf-chart .dot{fill:var(--signal)}
.perf-chart .dot.best{fill:var(--go)}
.perf-chart .lbl{fill:var(--muted);font-size:11px;font-family:ui-monospace,monospace}
.perf-chart .val-lbl{fill:var(--ink);font-size:11px;font-weight:700;font-family:ui-monospace,monospace}
.trend-up{color:var(--go)}
.trend-dn{color:var(--stop)}

/* ============================================================
   Tisk
   ============================================================ */
@media print {
  body{background:#fff;color:#000;font-size:12px}
  #app{display:block}
  #topbar,#tabs,#sheet,#scrim,#toast,.btn,.chips,.iconbtn,
  [data-act],[data-tab],.warn,.pctwrap{display:none!important}
  #view{overflow:visible;padding:0}
  .card{border:1px solid #ccc;break-inside:avoid;margin-bottom:8px}
  .list{border:1px solid #ccc}
  .item{border-bottom:1px solid #eee;min-height:auto;padding:6px 10px}
  .badge,.badge.pb,.badge.g1,.badge.g2,.badge.g3,.badge.g4{border:1px solid #ccc;background:#fff!important;color:#000!important;print-color-adjust:exact}
  .val{font-weight:700}
  #print-header{display:block!important}
}
#print-header{display:none}

/* ============================================================
   Hromadné akce (posun ročníků)
   ============================================================ */
.promote-grid{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;margin:14px 0}
.promote-arrow{font-size:20px;color:var(--muted);text-align:center}

/* Pastelově zelené chipy — moje skupiny */
.chip-mine{background:#e8f5e9;border-color:#81c784;color:#2e7d32}
.chip-mine[aria-pressed="true"]{background:#2e7d32;border-color:#2e7d32;color:#fff}

/* ============================================================
   Tablet / desktop
   Appka je navržená mobile-first (spodní tab bar, jeden sloupec).
   Od 760px se spodní lišta překlopí na levý postranní panel a obsah
   se vycentruje do čitelného sloupce, ať se na širokém displeji
   neroztahuje přes celou šířku. Od 1100px je sloupec ještě o něco
   širší a dlaždice statistik přejdou ze 2 na 3 sloupce. Žádná změna
   v HTML/JS — jen CSS, appka na mobilu vypadá úplně stejně jako dřív.
   ============================================================ */
@media (min-width: 760px) {
  #app{padding-left:216px}
  #tabs{
    position:fixed;left:0;top:0;bottom:0;width:216px;
    display:flex;flex-direction:column;align-items:stretch;
    grid-template-columns:none;gap:2px;
    padding:calc(env(safe-area-inset-top) + 18px) 10px 14px;
    border-top:0;border-right:1px solid var(--line);
  }
  #tabs button{
    flex-direction:row;justify-content:flex-start;align-items:center;gap:11px;
    padding:11px 12px;border-radius:11px;font-size:14px;
  }
  #tabs button svg{width:21px;height:21px;flex:0 0 21px}
  #tabs button[aria-current="true"]{background:var(--surface-2);color:var(--signal)}
  #topbar{padding:14px 24px 10px}
  #topbar,#view{max-width:720px;margin:0 auto;width:100%}
  #view{padding-left:24px;padding-right:24px}
  /* Toast/sheet počítaly s prostorem pro spodní tab bar — ten už tu není. */
  #toast{bottom:28px}
  #sheet{left:50%;right:auto;transform:translate(-50%,100%);width:100%;max-width:560px;border-radius:20px}
  #sheet.on{transform:translate(-50%,0)}
}
@media (min-width: 1100px) {
  #topbar,#view{max-width:900px}
  .stat-grid{grid-template-columns:repeat(3,1fr)}
}

/* Čas ve dvou polích: minuty : vteřiny */
.timein{display:flex;align-items:center;gap:8px}
.timein input{min-width:0;flex:1;text-align:center}
.timein .tm-min{flex:0 0 36%}
.timein>span{color:var(--muted);font-weight:700}
.ver-badge{text-align:center}
.ver-badge span{display:inline-block;font-size:13px;font-weight:700;letter-spacing:.3px;padding:5px 14px;border-radius:999px;background:rgba(61,220,132,.13);border:1px solid rgba(61,220,132,.4);color:var(--go)}

/* Člunkový běh (MTZ): číslo přes celou obrazovku (overlay v <body>, nic se neposouvá kromě seznamu doběhů) */
.cb-full { overscroll-behavior: contain; touch-action: manipulation; position: fixed; inset: 0; z-index: 100; background: var(--bg, #0e1116); color: var(--ink, #fff);
  display: flex; flex-direction: column; align-items: center; gap: 10px; overflow: hidden;
  padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 12px); text-align: center; }
.cb-top { position: relative; flex: 0 0 auto; width: 100%; height: min(40vh, 62vw); display: flex; align-items: center; justify-content: center; }
.cb-num { font-size: min(44vw, 32vh); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cb-info { flex: 0 0 auto; font-size: 20px; opacity: .85; }
.cb-btns { flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; width: min(100%, 420px); }
.cb-queue { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.cb-row { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px 14px;
  border: 1px solid var(--line, #2a2f37); border-radius: 10px; font-size: 16px; text-align: left; }
.cb-lv { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; }
.cb-lv-l { left: 0; }
.cb-lv-r { right: 0; }
.cb-lv span { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; line-height: 1; color: rgba(0, 0, 0, .78); background: rgba(176, 182, 194, .58); }
.cb-pace { font-size: 16px; opacity: .7; margin-top: -6px; }

/* MTZ ČŠI: v záhlaví domek a vedle něj žlutý blok s názvem přes zbytek šířky */
#topbar.mtz-bar #title-row { gap: 10px; }
#topbar.mtz-bar #titleicon { order: -1; flex: 0 0 auto; }
#topbar.mtz-bar #title { flex: 1; background: var(--signal); color: #151006; font-weight: 800; font-size: 16px; text-align: center;
  padding: 11px 12px; border-radius: 12px; }

/* Nastavení: dvě stavové dlaždice vedle sebe (verze + spojení se serverem) */
.status-row { display: flex; gap: 10px; }
.status-tile { flex: 1 1 0; min-width: 0; min-height: 124px; border-radius: 16px; padding: 12px 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; text-align: center; background: var(--surface); border: 1px solid var(--line); color: inherit; font: inherit; }
.status-tile.ok { background: rgba(61,220,132,.13); border-color: rgba(61,220,132,.45); }
.status-tile.bad { background: rgba(255,92,80,.13); border-color: rgba(255,92,80,.5); }
.status-tile .st-ico { font-size: 22px; font-weight: 800; line-height: 1; }
.status-tile.ok .st-ico, .status-tile.ok .st-main { color: var(--go); }
.status-tile.bad .st-ico, .status-tile.bad .st-main { color: var(--stop); }
.status-tile .st-main { font-size: 15px; font-weight: 800; }
.status-tile .st-sub { font-size: 12px; opacity: .8; }

/* Známka za docházku (aktivita 0–4) v seznamu Žáci — jiná zelená než známky disciplín */
.badge.act-badge{background:#5a9e1f;color:#f4ffe8;margin-left:6px}
.mtz-cross{color:#e53935;font-weight:900;font-size:1.05em;flex:0 0 auto;margin:0 4px}
.warn .mtz-cross{margin:0;font-size:21px;line-height:1}
