:root {
  --bg: #0e1116; --surface: #161b22; --raised: #1f2733; --border: #2a313c; --text: #e8eef4; --muted: #8b98a5;
  --accent: #2dd4bf; --accent-ink: #04201c; --danger: #ff6b63; --warn: #e3b341; --ok: #4ccf6a; --radius: 14px;
  --nav: 64px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f5f8; --surface: #ffffff; --raised: #eef1f5; --border: #d6dce4; --text: #16202b; --muted: #5b6978;
    --accent: #0f9d8c; --accent-ink: #ffffff; --danger: #c9302c; --warn: #956b00; --ok: #1a7f37; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark light; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.top .brand { font-weight: 700; }
.top select { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; }
.dot.on { background: var(--ok); }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--nav) + 90px + env(safe-area-inset-bottom)); outline: none; }
h2 { margin: 4px 0 12px; font-size: 21px; }
h3 { margin: 0 0 10px; font-size: 16px; }
h4 { margin: 12px 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--raised); border-inline-start: 4px solid var(--warn); font-size: 14px; margin: 10px 0; }
.note.bad { border-color: var(--danger); } .note.ok { border-color: var(--ok); }
button.btn { background: var(--raised); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; cursor: pointer; min-height: 44px; }
button.btn:active:not(:disabled) { transform: scale(.98); }
button.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.btn.small { min-height: 36px; padding: 5px 12px; font-size: 14px; }
button.btn.block { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=search], select, textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-height: 44px; min-width: 0; width: 100%; }
input[type=color] { width: 48px; height: 44px; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
label.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
label.check { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; background: var(--raised); color: var(--muted); border: 1px solid var(--border); }
.badge.warn { color: var(--warn); border-color: var(--warn); } .badge.bad { color: var(--danger); border-color: var(--danger); } .badge.ok { color: var(--ok); border-color: var(--ok); }
.list > * + * { border-top: 1px solid var(--border); }
.item { display: flex; gap: 12px; align-items: center; padding: 11px 2px; width: 100%; text-align: start; background: none; border: 0; cursor: pointer; }
.item .t { flex: 1; min-width: 0; }
.pkg { display: block; font: 12px ui-monospace, Menlo, monospace; color: var(--muted); direction: ltr; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.dock li > .grow { min-width: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
.bar { height: 8px; border-radius: 99px; background: var(--raised); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.warn > i { background: var(--warn); } .bar.over > i { background: var(--danger); }
.nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); display: flex; }
.nav button { flex: 1; background: none; border: 0; color: var(--muted); display: grid; place-items: center; gap: 2px; padding: 6px 2px; cursor: pointer; font-size: 12px; }
.nav button .ic { font-size: 22px; line-height: 1; }
.nav button[aria-current=page] { color: var(--accent); font-weight: 700; }
.savebar { position: fixed; inset-inline: 12px; bottom: calc(var(--nav) + 10px + env(safe-area-inset-bottom)); z-index: 19; background: var(--raised); border: 1px solid var(--accent);
  border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#toasts { position: fixed; inset-inline: 12px; bottom: calc(var(--nav) + 80px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--raised); border: 1px solid var(--border); border-inline-start: 4px solid var(--ok); padding: 11px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.err { border-inline-start-color: var(--danger); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: 20px 20px 0 0; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; } }
.auth { max-width: 420px; margin: 0 auto; padding: 56px 20px; }
.auth h1 { font-size: 26px; margin: 0 0 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-width: 44px; min-height: 40px; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--raised); cursor: pointer; }
.chip[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; max-width: 280px; margin: 0 auto; }
.pad button { min-height: 58px; font-size: 20px; }
.shot { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; object-fit: contain; border: 1px solid var(--border); display: block; }
.mock { direction: ltr; border: 1px solid var(--border); border-radius: 10px; padding: 12px; aspect-ratio: 16 / 9; display: flex; flex-direction: column; gap: 8px; overflow: hidden; font-size: 10px; color: #cfd6de; }
.mock .tiles { display: flex; gap: 6px; } .mock .tile { flex: 1; aspect-ratio: 16 / 9; border-radius: 5px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; overflow: hidden; }
.mock .dockrow { margin-top: auto; padding: 6px; border-radius: 10px; background: rgba(255,255,255,.08); }
.mock .tile.empty { background: rgba(255,255,255,.06) !important; }
ol.dock { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; counter-reset: d; }
ol.dock li { counter-increment: d; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); }
ol.dock li::before { content: counter(d); width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.opt { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.opt > .lbl { flex: 1; min-width: 160px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.thumbs figure { margin: 0; position: relative; } .thumbs img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--border); }
.thumbs figcaption { font-size: 11px; color: var(--muted); direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumbs button { position: absolute; top: 4px; inset-inline-end: 4px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; max-width: 260px; margin: 12px auto; }
.pinpad button { min-height: 52px; font-size: 20px; }
.pindots { direction: ltr; text-align: center; letter-spacing: 8px; font-size: 24px; min-height: 36px; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: pop .18s ease-out; } @keyframes pop { from { opacity: 0; transform: translateY(8px); } } }
