:root { --accent:#0f766e; --accent-2:#0d9488; --bg:#f1f5f9; --card:#fff; --fg:#0f172a; --muted:#64748b; --line:#e2e8f0; --ok:#16a34a; --busy:#dc2626; --away:#d97706; --off:#94a3b8; --r:14px; }
* { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body { background:var(--bg); color:var(--fg); font-family:'Heebo','Assistant',system-ui,-apple-system,'Segoe UI',Arial,sans-serif; font-size:16px; line-height:1.45; min-height:100vh; }
[hidden] { display:none !important; }
a { color:var(--accent); }
button, input, select, textarea { font:inherit; color:inherit; }
input, select, textarea { width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; min-height:44px; }
textarea { min-height:96px; resize:vertical; }
input:focus, select:focus, textarea:focus { outline:2px solid var(--accent); outline-offset:0; border-color:transparent; }
input[type="color"] { padding:4px; height:44px; }
input[type="time"], input[type="date"], input[type="number"], input[type="url"], input[type="email"] { direction:ltr; text-align:left; }
input[type="checkbox"] { width:auto; min-height:0; margin-inline-end:6px; }
label { display:block; font-size:14px; font-weight:500; color:var(--muted); margin-bottom:4px; }
.field { margin-bottom:12px; }
.row { display:flex; gap:10px; align-items:end; flex-wrap:wrap; }
.row > * { flex:1; min-width:120px; }
.row > .auto { flex:0 0 auto; min-width:0; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:44px; padding:10px 16px; border:0; border-radius:10px; background:var(--accent); color:#fff; font-weight:700; cursor:pointer; white-space:nowrap; text-decoration:none; }
.btn:active { transform:translateY(1px); }
.btn.ghost { background:#fff; color:var(--fg); border:1px solid var(--line); }
.btn.danger { background:#fff; color:var(--busy); border:1px solid #fecaca; }
.btn.warn { background:var(--away); }
.btn.sm { min-height:36px; padding:6px 12px; font-size:14px; }
.btn.block { width:100%; }
.btn[disabled] { opacity:.5; cursor:default; }

.login { max-width:380px; margin:12vh auto; padding:24px; background:var(--card); border-radius:var(--r); box-shadow:0 8px 30px rgba(15,23,42,.08); }
.login h1 { font-size:24px; margin-bottom:4px; color:var(--accent); }
.login p { color:var(--muted); margin-bottom:20px; font-size:14px; }
.err { color:var(--busy); font-size:14px; min-height:20px; margin:6px 0; }

.shell { max-width:960px; margin:0 auto; padding:0 14px 90px; }
.topbar { position:sticky; top:0; z-index:5; background:var(--accent); color:#fff; margin:0 -14px 14px; padding:10px 16px; display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.topbar h1 { font-size:18px; font-weight:700; }
.topbar .sub { font-size:12px; opacity:.85; }
.topbar select { width:auto; min-height:36px; padding:6px 10px; border-radius:8px; background:#fff; color:var(--fg); font-size:14px; }
.topbar .pub { display:flex; align-items:center; gap:8px; }
.topbar .pub .btn { background:#fff; color:var(--accent); min-height:38px; }
.topbar .pub .btn.dirty { background:#fbbf24; color:#78350f; }
.topbar .pub .btn.dirty::before { content:''; width:8px; height:8px; border-radius:50%; background:#b45309; display:inline-block; }
.nav { position:fixed; bottom:0; right:0; left:0; z-index:5; background:#fff; border-top:1px solid var(--line); display:flex; justify-content:space-around; padding:6px 0 max(6px, env(safe-area-inset-bottom)); }
.nav button { flex:1; background:none; border:0; padding:6px 0; font-size:12px; color:var(--muted); display:flex; flex-direction:column; align-items:center; gap:2px; min-height:48px; }
.nav button .ic { font-size:20px; line-height:1; }
.nav button.on { color:var(--accent); font-weight:700; }
@media (min-width:720px) { .nav { position:sticky; top:58px; bottom:auto; border-top:0; border-bottom:1px solid var(--line); margin:0 -14px 16px; } .shell { padding-bottom:30px; } }

.card { background:var(--card); border-radius:var(--r); padding:14px 16px; margin-bottom:12px; box-shadow:0 1px 2px rgba(15,23,42,.05); }
.card h2 { font-size:17px; margin-bottom:10px; }
.card h3 { font-size:15px; margin:14px 0 8px; color:var(--muted); font-weight:700; }
.card.tap { cursor:pointer; }
.card.tap:active { background:#f8fafc; }
.list-head { display:flex; justify-content:space-between; align-items:center; margin:6px 0 12px; gap:8px; flex-wrap:wrap; }
.list-head h2 { font-size:20px; }
.list-head .btns { display:flex; gap:6px; }
.empty-state { text-align:center; color:var(--muted); padding:30px 10px; }
.group-head { display:flex; justify-content:space-between; align-items:center; margin:16px 0 8px; }
.group-head h3 { font-size:16px; }

.screen-card { display:flex; gap:12px; align-items:center; }
.shot { flex:0 0 96px; width:96px; height:60px; border-radius:8px; background:#0f172a; object-fit:cover; display:flex; align-items:center; justify-content:center; color:#64748b; font-size:22px; overflow:hidden; }
.shot img { width:100%; height:100%; object-fit:cover; }
.shot.portrait { width:60px; flex-basis:60px; height:96px; }
.screen-body { flex:1; min-width:0; }
.screen-body .who { font-size:17px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.screen-body .what { font-size:14px; color:var(--muted); }
.chips { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.chip { font-size:12px; padding:2px 9px; border-radius:99px; background:#e2e8f0; color:var(--fg); font-weight:500; }
.chip.ok { background:#dcfce7; color:#166534; } .chip.bad { background:#fee2e2; color:#991b1b; } .chip.warn { background:#fef3c7; color:#92400e; } .chip.src { background:#f1f5f9; color:var(--muted); }
.dot { display:inline-block; width:10px; height:10px; border-radius:50%; background:var(--off); vertical-align:middle; margin-inline-end:4px; }
.dot.on { background:var(--ok); box-shadow:0 0 0 3px rgba(22,163,74,.2); }

.pills { display:flex; gap:6px; flex-wrap:wrap; }
.pills button { flex:1; min-height:44px; border:1px solid var(--line); background:#fff; border-radius:10px; font-weight:500; padding:0 8px; }
.pills button.on { border-color:var(--accent); background:#ecfdf5; color:var(--accent); font-weight:700; }
.pills.sm button { min-height:34px; font-size:14px; flex:0 0 auto; }

.pv-wrap { background:#0f172a; border-radius:12px; padding:8px; display:flex; justify-content:center; }
.pv { border:0; background:#000; width:100%; aspect-ratio:16/9; border-radius:6px; }
.pv.portrait { width:auto; height:56vh; max-height:520px; aspect-ratio:9/16; }
.code-box { font-size:32px; font-weight:900; letter-spacing:.2em; direction:ltr; text-align:center; background:#ecfdf5; color:var(--accent); border-radius:10px; padding:8px; margin:8px 0; }
.meta { font-size:13px; color:var(--muted); }
.actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.actions .btn { flex:1; }
.zone-row { display:flex; gap:8px; align-items:center; padding:6px 0; border-top:1px solid var(--line); }
.zone-row .zn { flex:0 0 96px; font-weight:700; font-size:14px; }
.zone-row select { flex:1; }

.media-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:10px; }
.media-item { background:#fff; border-radius:12px; overflow:hidden; border:1px solid var(--line); cursor:pointer; }
.media-item.sel { outline:3px solid var(--accent); }
.media-item .th { height:100px; background:#0f172a; display:flex; align-items:center; justify-content:center; color:#64748b; font-size:28px; overflow:hidden; }
.media-item .th img { width:100%; height:100%; object-fit:cover; }
.media-item .nm { font-size:12px; padding:6px 8px 2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; direction:ltr; text-align:right; }
.media-item .in { font-size:11px; color:var(--muted); padding:0 8px 6px; display:flex; justify-content:space-between; }
.bar { height:8px; background:var(--line); border-radius:99px; overflow:hidden; margin:6px 0; }
.bar > i { display:block; height:100%; background:var(--accent); }
.bar.warn > i { background:var(--away); }
.upl { display:flex; align-items:center; gap:10px; font-size:14px; padding:4px 0; }
.upl .bar { flex:1; margin:0; }

.item-row { display:flex; gap:10px; align-items:center; padding:8px 0; border-top:1px solid var(--line); flex-wrap:wrap; }
.item-row .th { flex:0 0 64px; width:64px; height:40px; border-radius:6px; background:#0f172a; overflow:hidden; display:flex; align-items:center; justify-content:center; color:#64748b; }
.item-row .th img { width:100%; height:100%; object-fit:cover; }
.item-row .nm { flex:1; min-width:120px; font-size:14px; }
.item-row .nm small { display:block; color:var(--muted); }
.item-row input[type="number"] { width:80px; min-height:36px; padding:4px 8px; }
.item-row .ib { background:none; border:1px solid var(--line); border-radius:8px; min-width:36px; min-height:36px; }
.item-row .adv { flex-basis:100%; display:flex; gap:8px; flex-wrap:wrap; align-items:end; padding:6px 0 2px; }
.item-row .adv > * { flex:1; min-width:100px; }
.item-row .adv .pills { flex-basis:100%; }

.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:10px; margin-bottom:12px; }
.stat { background:#fff; border-radius:12px; padding:12px; text-align:center; border:1px solid var(--line); }
.stat b { display:block; font-size:24px; color:var(--accent); }
.stat span { font-size:13px; color:var(--muted); }

.sheet-bg { position:fixed; inset:0; background:rgba(15,23,42,.45); z-index:20; display:flex; align-items:flex-end; justify-content:center; }
.sheet { background:var(--bg); width:100%; max-width:760px; max-height:94vh; overflow:auto; border-radius:18px 18px 0 0; padding:14px 14px 30px; }
.sheet-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.sheet-head h2 { font-size:20px; }
.sheet-head button { background:none; border:0; font-size:26px; min-width:44px; min-height:44px; color:var(--muted); }
@media (min-width:720px) { .sheet-bg { align-items:center; } .sheet { border-radius:18px; } }

.toast { position:fixed; bottom:80px; left:50%; transform:translateX(-50%); background:var(--fg); color:#fff; padding:10px 18px; border-radius:99px; font-size:14px; z-index:50; box-shadow:0 6px 20px rgba(0,0,0,.2); max-width:90vw; }
.toast.err { background:var(--busy); }
table { width:100%; border-collapse:collapse; font-size:14px; }
td, th { padding:8px 6px; border-bottom:1px solid var(--line); text-align:right; vertical-align:middle; }
tr.tap { cursor:pointer; } tr.tap:hover { background:#f8fafc; }
.num { direction:ltr; text-align:left; font-variant-numeric:tabular-nums; }
.help { font-size:13px; color:var(--muted); background:#f8fafc; border:1px dashed var(--line); border-radius:10px; padding:8px 10px; margin:6px 0 10px; }
