:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --line: #e4e0d6;
  --text: #1d2321;
  --muted: #69716d;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --warn: #b5651d;
  --warn-soft: #f8ebdc;
  --danger: #b3372f;
  --danger-soft: #f7e1df;
  --ok: #2d8a4e;
  --idle: #c49a2c;
  --off: #a7aba8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 2px 8px rgba(30, 30, 20, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141816;
    --surface: #1d2220;
    --surface-2: #232927;
    --line: #313835;
    --text: #e8ece9;
    --muted: #9aa39f;
    --accent: #4fb596;
    --accent-ink: #0d1a15;
    --accent-soft: #1f3b32;
    --warn: #e0a15e;
    --warn-soft: #3a2c1c;
    --danger: #e8776e;
    --danger-soft: #3d2220;
    --ok: #5cc483;
    --idle: #e0bc5a;
    --off: #5e6562;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141816;
  --surface: #1d2220;
  --surface-2: #232927;
  --line: #313835;
  --text: #e8ece9;
  --muted: #9aa39f;
  --accent: #4fb596;
  --accent-ink: #0d1a15;
  --accent-soft: #1f3b32;
  --warn: #e0a15e;
  --warn-soft: #3a2c1c;
  --danger: #e8776e;
  --danger-soft: #3d2220;
  --ok: #5cc483;
  --idle: #e0bc5a;
  --off: #5e6562;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--muted); }

/* layout */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 10px;
}
.top h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; flex: 1; }
.wrap { max-width: 760px; margin: 0 auto; padding: 4px 16px 24px; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  border: 0; background: none; padding: 9px 0 10px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; cursor: pointer;
}
.tabs button svg { width: 22px; height: 22px; }
.tabs button.on { color: var(--accent); font-weight: 600; }
.tabs .badge { position: absolute; top: 5px; left: calc(50% + 6px); }
.badge {
  background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center;
}

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin: 0 0 14px;
}
.card h2 { font-size: 17px; margin: 0; }
.card h3 { font-size: 14px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 2px 8px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* child card */
.child-head { display: flex; align-items: baseline; gap: 10px; }
.child-head .name { font-size: 19px; font-weight: 700; flex: 1; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 10px 0 4px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress.full > i { background: var(--danger); }
.progress.near > i { background: var(--warn); }

.acc { border-top: 1px solid var(--line); padding: 12px 0 2px; margin-top: 12px; }
.acc:first-of-type { margin-top: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--off); flex: none; }
.dot.active { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.idle { background: var(--idle); }
.dot.locked { background: var(--danger); }
.acc .title { font-weight: 600; }
.now { background: var(--surface-2); border-radius: 10px; padding: 7px 10px; margin: 8px 0; font-size: 13px; }
.now b { font-weight: 600; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.lock { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* buttons */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px;
  cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger-fill { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding: 11px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.disabled { opacity: .5; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.topright { display: flex; align-items: center; gap: 6px; }
.icon-btn { padding: 0; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 19px; height: 19px; }
.actrow { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.actrow .btn { flex: 1 1 auto; text-align: center; justify-content: center; }

/* requests */
.req { border-left: 4px solid var(--warn); }
.req .who { font-weight: 700; }

/* forms */
label.f, div.f { display: block; margin: 10px 0; }
label.f > span, div.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=time], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0; }
.hint { font-size: 13px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-weight: 600; font-size: 14px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--accent); opacity: .85; margin-top: 5px; }
.yt-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; width: 42px; flex: none; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 92px; margin-top: 10px; }
.week .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.week .col i { display: block; width: 100%; max-width: 30px; background: var(--accent-soft); border-radius: 6px 6px 3px 3px; min-height: 3px; }
.week .col.sel i { background: var(--accent); }
.week .col span { font-size: 11px; color: var(--muted); }

.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav input { flex: 1; }

/* auth */
.auth { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.auth .logo { width: 56px; height: 56px; margin-bottom: 12px; }
.auth h1 { margin: 0 0 4px; font-size: 24px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.code { font-size: 40px; font-weight: 800; letter-spacing: .18em; text-align: center; padding: 12px; background: var(--surface-2); border-radius: 12px; font-variant-numeric: tabular-nums; margin: 12px 0; }
ol.steps { padding-left: 20px; margin: 8px 0; }
ol.steps li { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 40; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px);
}
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.alert-item { display: flex; gap: 10px; }
.alert-item .ic { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--off); }
.alert-item.unread .ic { background: var(--danger); }
.alert-item.tamper .ic, .alert-item.uninstall .ic { background: var(--danger); }

/* pole pro dobu */
.dur { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.dur-in { display: flex; align-items: center; gap: 6px; }
.dur-in span { color: var(--muted); font-size: 14px; }
.dur-in input { width: 68px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); text-align: center; font-variant-numeric: tabular-nums; }
.dur-in input:disabled { opacity: .45; }
.dur-unl { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }

/* YouTube: videa vs. shorts */
.yt-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.yt-tile { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; text-align: left;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.yt-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.yt-tile-label { font-weight: 600; font-size: 13px; color: var(--muted); }
.yt-tile-num { grid-row: span 2; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.yt-tile-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.yt-tile.on .yt-tile-label { color: var(--accent); }
.yt-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.yt-link:hover { border-bottom-color: var(--accent); }
input[type=file] { width: 100%; font-size: 14px; }

/* přehrávač YouTube */
.modal.wide { max-width: min(1040px, 100%); }
.player { background: #000; border-radius: 12px; overflow: hidden; margin-top: 8px; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; }
.player.video { width: 100%; aspect-ratio: 16 / 9; }
.player.short { aspect-ratio: 9 / 16; height: min(72vh, 720px); max-width: 100%; margin-left: auto; margin-right: auto; }
.player-demo { color: #fff; display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 20px; font-size: 15px; }
.modal h2 { overflow-wrap: anywhere; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }

.sched { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px;
  background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 4px 4px 4px 10px; font-size: 13px; font-weight: 600; }
.sched .btn { color: var(--warn); }
.row input[type=time] { width: auto; flex: 1; min-width: 0; }

.week.long { gap: 2px; }
.week.long .col i { border-radius: 3px 3px 1px 1px; }
.week.long .col span { font-size: 10px; min-height: 13px; }
.row select { width: auto; flex: 1; min-width: 0; }

.tabs button { font-size: 11px; }
.req-banner { display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 0 0 14px;
  border: 0; border-radius: var(--radius); padding: 12px 14px; background: var(--warn-soft); color: var(--warn);
  font-weight: 700; font-size: 15px; cursor: pointer; }
.shot { display: block; margin-top: 8px; max-width: 220px; width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.shot-big { display: block; width: 100%; border-radius: 10px; margin-top: 8px; }
.alert-item.admin .ic, .alert-item.new_user .ic, .alert-item.blocked .ic { background: var(--danger); }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.danger.ghost { color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .switch span, .switch span::after { transition: none; } }

.x-btn { flex: none; align-self: flex-start; width: 32px; height: 32px; margin: -4px -6px 0 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.x-btn:hover, .x-btn:focus-visible { background: var(--danger-soft); color: var(--danger); }

/* Rozbalovací sekce Aktualizace */
.upd-card > summary { cursor: pointer; list-style: none; user-select: none; }
.upd-card > summary::-webkit-details-marker { display: none; }
.upd-card > summary h2 { margin: 0; }
.upd-card > summary::after { content: "▸"; float: right; opacity: .6; transition: transform .15s; }
.upd-card[open] > summary::after { transform: rotate(90deg); }
.upd-sub { padding: 12px 0; border-top: 1px solid var(--line, rgba(128,128,128,.25)); margin-top: 12px; }
.upd-sub:first-of-type { border-top: none; margin-top: 8px; }
.upd-sub h3 { margin: 0 0 6px; font-size: 1.02rem; }

/* ---------- rozbalovací sekce (Nastavení) ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 2px 8px; }
.section-head .section-title { margin: 0; }
details.fold { padding: 0; overflow: hidden; }
details.fold > summary { cursor: pointer; list-style: none; user-select: none; padding: 14px 16px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary:hover { background: var(--surface-2); }
.fold-sum { align-items: center; gap: 10px; }
.fold-sum::after { content: "›"; font-size: 22px; line-height: 1; color: var(--muted); transition: transform .15s; flex: none; }
details.fold[open] > summary .fold-sum::after { transform: rotate(90deg); }
.fold-title { font-weight: 700; font-size: 16px; }
.fold-child .fold-title { font-size: 18px; }
.fold-body { padding: 0 16px 14px; border-top: 1px solid var(--line); }
.fold-warn { border-color: var(--warn); }
.fold-warn .fold-title { color: var(--warn); }
.sub { padding: 12px 0 4px; border-top: 1px solid var(--line); }
.sub:first-child { border-top: 0; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sub-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dev { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.dev > .row { align-items: center; gap: 8px; }
.dev-ico { width: 20px; height: 20px; color: var(--muted); flex: none; display: inline-flex; }
.dev-ico svg { width: 20px; height: 20px; }
.dev-accs { margin-left: 38px; }
.dev .list li { border-top-color: var(--line); }
.dev .actions { margin-bottom: 0; }
@media (max-width: 480px) { .dev-accs { margin-left: 0; } }
.acc-state { font-size: 12px; color: var(--muted); font-weight: 500; }
details.more { width: 100%; margin-top: 2px; }
details.more > summary { cursor: pointer; list-style: none; font-size: 13px; color: var(--muted); padding: 6px 2px; user-select: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }
details.more > .actrow { margin-top: 6px; }
.acc > .row { align-items: center; gap: 8px; }

/* ---------- celá obrazovka: screenshot / video ---------- */
body.fs-open { overflow: hidden; }
.fs { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; }
.fs-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.fs-stage:active { cursor: grabbing; }
.fs-img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; max-width: none; }
.fs-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: linear-gradient(rgba(0,0,0,.75), rgba(0,0,0,0)); z-index: 2; }
.fs-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: #fff; }
.fs-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff;
  font-size: 20px; line-height: 1; cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.fs-btn:hover { background: rgba(255,255,255,.28); }
.fs-zoom { font-size: 12px; min-width: 44px; text-align: center; color: #ddd; font-variant-numeric: tabular-nums; }
.fs-hint { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: #ddd; font-size: 12px; padding: 5px 12px; border-radius: 99px; pointer-events: none;
  animation: fs-hint 3.5s forwards; white-space: nowrap; }
@keyframes fs-hint { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.shot-big.zoomable { cursor: zoom-in; }

.player { position: relative; }
.player-zoom { width: 100%; height: 100%; transform-origin: 50% 50%; transition: transform .15s; }
.player-bar { display: none; }
.player.fs-on { position: fixed; inset: 0; z-index: 100; width: 100vw; height: 100vh; height: 100dvh; max-width: none;
  aspect-ratio: auto; margin: 0; border-radius: 0; overflow: hidden; }
.player.fs-on .player-bar { display: flex; }
.player.fs-on .player-zoom { padding-top: calc(56px + env(safe-area-inset-top)); box-sizing: border-box; }
.msg-text { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  font: inherit; background: var(--surface-2); color: var(--text); resize: vertical; }
.noti-kinds { display: flex; flex-direction: column; gap: 2px; }
.noti-kinds .check { padding: 7px 0; }
.check input:disabled + * , .check input:disabled { opacity: .5; }
