:root {
  --bg: #0f0e15; --panel: #1c1a29; --card: #232033; --line: #2f2b40;
  --btn: #2f2b40; --tab: #272437; --text: #f3f1fa; --soft: #c9c5db; --hint: #a9a6ba;
  --accent: #7c3aed; --accent-soft: #a78bfa; --track: #3a364d;
  --ok-bg: #12301f; --ok: #6ee7a0; --warn-bg: #3b2a12; --warn: #fbbf24;
  --off-bg: #2a2231; --off: #d8b4fe; --bad: #f87171; --go: #15803d;
}
:root[data-theme="light"] {
  --bg: #f4f3f8; --panel: #ffffff; --card: #ffffff; --line: #e3e0ee;
  --btn: #ece9f5; --tab: #ece9f5; --text: #1b1928; --soft: #4a4660; --hint: #77738a;
  --accent: #7c3aed; --accent-soft: #7c3aed; --track: #dcd8e8;
  --ok-bg: #dcf5e6; --ok: #1d7a45; --warn-bg: #fdf0d3; --warn: #a15c00;
  --off-bg: #f1e8fc; --off: #6b30c4; --bad: #c62828; --go: #15803d;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; padding: 12px 16px 10px; background: var(--bg); }
.tab { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: var(--tab); color: var(--soft); font-weight: 600; font-size: 13px; padding: 0 4px; }
.tab.on { background: var(--accent); color: #fff; }
main { padding: 0 16px 28px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--tab); color: var(--soft); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.off { background: var(--off-bg); color: var(--off); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.card { background: var(--card); border: 1px solid transparent; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
button.card { text-align: left; width: 100%; }
.card.open { border-color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.time { font-size: 20px; font-weight: 700; }
.st { font-size: 13px; color: var(--soft); text-align: right; }
.bar { display: flex; gap: 4px; }
.bar i { flex: 1; height: 4px; border-radius: 2px; background: var(--track); }
.bar i.d { background: var(--accent-soft); }
.lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--hint); }
.btn { min-height: 44px; border: 0; border-radius: 10px; background: var(--btn); font-weight: 600; font-size: 14px; flex: 1 1 40%; padding: 0 10px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.success { background: var(--go); color: #fff; }
.btn.danger { background: #b42318; color: #fff; }
.btn:disabled { opacity: .55; }
.note { font-size: 13px; color: var(--hint); margin: 0; }
.note.bad { color: var(--bad); }
.sec { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-soft); margin-top: 6px; }
.cap { background: var(--card); border-radius: 12px; padding: 12px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
.kv span { color: var(--soft); }
.kv b { text-align: right; overflow-wrap: anywhere; }
.photo { width: 100%; aspect-ratio: 1; border-radius: 14px; background: var(--card); object-fit: cover; display: block; }
.photo.empty { display: flex; align-items: center; justify-content: center; color: var(--hint); font-size: 13px; }
.sw { width: 46px; height: 26px; border-radius: 13px; background: var(--track); position: relative; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); }
.sw.on { background: var(--accent); }
.sw.on::after { left: 23px; background: #fff; }
.meter { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--warn); }
.h { font-size: 18px; font-weight: 700; margin: 4px 0 0; }
.foot { font-size: 12px; color: var(--hint); text-align: center; margin-top: 4px; }
.link { background: none; border: 0; padding: 0; color: var(--accent-soft); font-weight: 600; text-align: left; }
