:root, :root[data-theme="dark"] {
  --bg: #0B0B0C; --surface: #161618; --surface2: #26262A; --line: #26262A;
  --text: #F4F4F5; --muted: #A1A1AA; --inverse: #F4F4F5; --inverse-text: #0B0B0C; --inverse-btn: rgba(0,0,0,.08); --accent: #FF4D3D;
}
:root[data-theme="light"] {
  --bg: #FFFFFF; --surface: #F3F3F4; --surface2: #E4E4E7; --line: #E4E4E7;
  --text: #0B0B0C; --muted: #5C5C66; --inverse: #0B0B0C; --inverse-text: #FFFFFF; --inverse-btn: rgba(255,255,255,.14); --accent: #E0352B;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 Inter, system-ui, sans-serif; }
body { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }
h1, .num { font-family: "Space Grotesk", Inter, sans-serif; }
#app { max-width: 560px; margin: 0 auto; padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 16px; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 2px 0 0; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn svg, .tab svg, .row svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi span:first-child { font-size: 11px; color: var(--muted); }
.kpi .num { font-size: 22px; font-weight: 600; white-space: nowrap; }

.alert { background: var(--inverse); color: var(--inverse-text); border-radius: 18px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.alert .dot { width: 10px; height: 10px; border-radius: 5px; background: var(--accent); flex: none; }
.alert b { display: block; font-size: 15px; }
.alert small { display: block; font-size: 13px; opacity: .7; }
.alert.ok .dot { background: var(--inverse-text); opacity: .4; }

.head-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 0 4px; }
.list { background: var(--surface); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; width: 100%; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface2); }
.row .d { width: 8px; height: 8px; border-radius: 4px; flex: none; border: 1.5px solid var(--text); }
.row .d.urgent { background: var(--accent); border-color: var(--accent); }
.row .d.ok { background: var(--text); }
.row .d.none { border-style: dashed; border-color: var(--muted); }
.row .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row .name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row .name span:first-child { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); flex: none; }
.bar { height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; }
.bar i { display: block; height: 4px; border-radius: 2px; background: var(--text); }
.bar i.urgent { background: var(--accent); }
.row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; min-width: 64px; }
.row .right b { font-size: 13px; }
.row .right b.urgent { color: var(--accent); }
.row .right small { font-size: 11px; color: var(--muted); }

.empty, .error { background: var(--surface); border-radius: 18px; padding: 24px 18px; text-align: center; color: var(--muted); }
.skeleton { height: 64px; border-radius: 16px; background: var(--surface); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.foot { font-size: 12px; color: var(--muted); text-align: center; }
.linkbtn { background: none; border: 0; padding: 8px; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--bg); border-top: 1px solid var(--line); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 5; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; min-height: 52px; background: none; border: 0; color: var(--muted); font-size: 11px; cursor: pointer; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--text); font-weight: 600; }
