:root {
  --bg: #f2f2f7; --card: #fff; --fg: #000; --muted: #6e6e73; --line: #e5e5ea; --fill: #e9e9ee;
  --blue: #007aff; --green: #34c759; --orange: #ff9500; --red: #ff3b30; --purple: #af52de; --pink: #ff2d55; --gray: #8e8e93;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --fg: #fff; --muted: #98989f; --line: #38383a; --fill: #2c2c2e;
    --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --red: #ff453a; --purple: #bf5af2; --pink: #ff375f; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
main { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 96px); }
.loading { color: var(--muted); }

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.date { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; font-weight: 500; }
h1 { font-size: 32px; line-height: 38px; font-weight: 700; letter-spacing: -.5px; margin: 2px 0 4px; }
h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; font-weight: 600; margin: 22px 0 8px; }
h2 a, h2 button.link { font-size: 15px; font-weight: 400; }
.sub { color: var(--muted); font-size: 13px; }
a, .link { color: var(--blue); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }

.card { background: var(--card); border-radius: 14px; padding: 4px 14px; }
.card + .card { margin-top: 10px; }
.card.pad { padding: 12px 14px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 0; min-width: 0; }
.row + .row { border-top: .5px solid var(--line); }
.grow { flex: 1; min-width: 0; }
.t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m { color: var(--muted); font-size: 13px; }
.bar { width: 4px; align-self: stretch; border-radius: 2px; flex: none; margin: 2px 0; }
.num { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 14px 0; }

.av { width: 24px; height: 24px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; flex: none; }
.av.sanjay { background: var(--blue); } .av.mashal { background: var(--pink); } .av.other { background: var(--gray); }
.avs { display: inline-flex; flex: none; } .avs .av + .av { margin-left: -7px; box-shadow: 0 0 0 2px var(--card); }

.chk { width: 24px; height: 24px; border-radius: 12px; border: 1.5px solid var(--gray); background: none; flex: none; display: grid; place-items: center; cursor: pointer; padding: 0; }
.chk.on { background: var(--blue); border-color: var(--blue); }
.chk svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; }
.done .t { text-decoration: line-through; color: var(--muted); }
.del { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 2px; }

.note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; padding: 10px 0; }
.note .dot { width: 8px; height: 8px; border-radius: 4px; margin-top: 5px; flex: none; background: var(--gray); }
.note.error .dot { background: var(--orange); }

.gauge { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; margin-top: 8px; }
.gauge i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.gauge i.over { background: var(--orange); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.4px; line-height: 34px; }
.up { color: var(--green); } .down { color: var(--red); }

.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.pill { border: 0; border-radius: 16px; padding: 6px 14px; background: var(--fill); cursor: pointer; font-size: 14px; }
.pill.on { background: var(--fg); color: var(--bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 9px; padding: 2px; margin: 12px 0 4px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .12); font-weight: 500; }
.day { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .02em; }

.inline { display: flex; gap: 8px; margin: 12px 0 4px; }
input, select { font: inherit; color: var(--fg); background: var(--card); border: 0; border-radius: 10px; padding: 10px 12px; min-width: 0; }
.inline input { flex: 1; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; }
.btn.ghost { background: var(--fill); color: var(--fg); font-weight: 500; }
.btn:disabled { opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.tabs { position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: .5px solid var(--line); }
.tabs button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: 10px; color: var(--gray); cursor: pointer; padding: 4px 0; }
.tabs button.on { color: var(--blue); }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tabs .plus span { width: 46px; height: 46px; border-radius: 23px; background: var(--blue); display: grid; place-items: center; margin-top: -6px; }
.tabs .plus svg { stroke: #fff; stroke-width: 2.4; }

#sheet { position: fixed; inset: 0; background: rgb(0 0 0 / .35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
#sheet[hidden] { display: none; }
.panel { background: var(--bg); width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); display: grid; gap: 10px; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }
.panel h3 { margin: 0; font-size: 17px; display: flex; justify-content: space-between; align-items: center; }
.panel .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.check { display: flex !important; align-items: center; gap: 8px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; }

.devbar { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.devbar button { border: 0; border-radius: 12px; padding: 3px 10px; background: var(--fill); cursor: pointer; font-size: 12px; }
.devbar button.on { background: var(--fg); color: var(--bg); }
.refresh { border: 0; background: var(--fill); width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center; cursor: pointer; flex: none; margin-top: 4px; }
.refresh svg { width: 18px; height: 18px; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; }
.refresh.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
svg.chart { display: block; width: 100%; overflow: visible; }

.stack { display: grid; gap: 12px; }
.conn { display: grid; gap: 10px; }
.conn-head { display: flex; gap: 12px; align-items: flex-start; }
.conn-name { font-size: 17px; font-weight: 600; }
.conn label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.conn input { background: var(--bg); color: var(--fg); }
.conn-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill-status { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: var(--fill); color: var(--muted); white-space: nowrap; flex: none; }
.pill-status.ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.pill-status.error { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.okmsg { color: var(--green); font-size: 13px; }
a.refresh { color: inherit; }
