:root {
  --bg0: #0c1736; --bg1: #070b1a; --bg2: #03050d;
  --card: rgba(26, 40, 82, 0.62); --card2: rgba(20, 31, 66, 0.8); --line: rgba(255, 255, 255, 0.07);
  --text: #eef2ff; --muted: #8a94b4; --muted2: #5d6788;
  --green: #3ee08f; --red: #ff5a6a; --orange: #ff9f43; --blue: #7cc4ff;
  --r: 20px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: #03050d; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); font-size: 16px; line-height: 1.35;
  background: radial-gradient(120% 60% at 50% -10%, #17295c 0%, rgba(12, 23, 54, 0) 60%), linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 45%, var(--bg2) 100%);
  background-attachment: fixed; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 110px) calc(var(--safe-l) + 16px); }
.hidden, [hidden] { display: none !important; }

/* header */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 6px 2px 18px; }
.greet { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.date { color: var(--muted); font-size: 14px; margin-top: 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 18px 4px 10px; }
.top .eyebrow { margin: 10px 0 0; }
.bolt { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #5cf5a9, #17b86a 70%); box-shadow: 0 0 0 4px rgba(62, 224, 143, 0.14), 0 6px 20px rgba(23, 184, 106, 0.35); }
.bolt.off { background: radial-gradient(circle at 35% 30%, #ffc27a, #e07a18 70%); box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.14); }
.bolt svg { width: 22px; height: 22px; fill: #04210f; }
h1.title { font-size: 28px; margin: 6px 2px 4px; letter-spacing: -0.02em; }
.sub { color: var(--muted); font-size: 14px; margin: 0 2px 14px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; margin-bottom: 10px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.dose { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); }
.dose .name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.dose .state { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.dose .state.overdue { color: var(--red); }
.dose .state.due { color: var(--green); }
.dose .line { color: #c7cee6; font-size: 15px; }
.dose .line .u { color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #4b5578; background: transparent; padding: 0; justify-self: end; display: grid; place-items: center; }
.check:active, .check.on { border-color: var(--green); background: rgba(62, 224, 143, 0.2); }
.check svg { width: 14px; height: 14px; stroke: var(--green); fill: none; stroke-width: 3; opacity: 0; }
.check.on svg { opacity: 1; }
.dose.overdue { box-shadow: inset 3px 0 0 var(--red); }
.dose.due { box-shadow: inset 3px 0 0 var(--green); }

.done-head { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 0; text-align: left; }
.tick { width: 30px; height: 30px; border-radius: 50%; background: rgba(62, 224, 143, 0.16); display: grid; place-items: center; flex: none; }
.tick svg { width: 16px; height: 16px; stroke: var(--green); fill: none; stroke-width: 3; }
.done-head .t { font-weight: 700; font-size: 17px; }
.done-head .s { color: var(--muted); font-size: 14px; }
.chev { margin-left: auto; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2.4; transition: transform 0.2s; }
.open .chev { transform: rotate(90deg); }
.done-list { margin-top: 10px; border-top: 1px solid var(--line); }
.done-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.done-row:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.done-row .meta { color: var(--muted); font-size: 13.5px; }
.done-row .when { margin-left: auto; color: var(--muted); font-size: 13.5px; text-align: right; }

.pill { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1.5px solid var(--green); color: var(--green); background: rgba(62, 224, 143, 0.06);
  border-radius: 999px; padding: 13px 18px; font-weight: 650; font-size: 16px; margin: 14px 0; }
.pill.ghost { border-color: rgba(255, 255, 255, 0.16); color: var(--text); background: rgba(255, 255, 255, 0.03); }

.missed { position: relative; border-color: rgba(255, 159, 67, 0.28); background: linear-gradient(135deg, rgba(255, 159, 67, 0.14), rgba(26, 40, 82, 0.6) 55%); box-shadow: inset 3px 0 0 var(--orange); }
.missed .t { font-weight: 700; font-size: 17px; color: #ffd2a3; padding-right: 30px; }
.missed .names { margin: 8px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); border-radius: 999px; padding: 6px 11px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip.sel { border-color: var(--green); background: rgba(62, 224, 143, 0.14); }
.missed .hint { color: var(--muted); font-size: 13.5px; }
.x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.07); display: grid; place-items: center; }
.x svg { width: 14px; height: 14px; stroke: var(--muted); stroke-width: 2.4; fill: none; }

.empty { text-align: center; color: var(--muted); padding: 22px 10px; }

/* lists */
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 0; }
.row .grow { flex: 1; min-width: 0; }
.card.row { background: var(--card); border: 1px solid var(--line); padding: 15px 16px; }
.row .nm { font-weight: 700; font-size: 17px; }
.small { font-size: 13.5px; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: rgba(124, 196, 255, 0.14); color: var(--blue); vertical-align: middle; margin-left: 6px; }
.tag.warn { background: rgba(255, 159, 67, 0.16); color: var(--orange); }
.tag.mute { background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.day-h { margin: 18px 4px 8px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.log-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { white-space: nowrap; }

/* insights */
.ins-row { display: grid; grid-template-columns: 1fr 70px 70px; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ins-row:last-child { border-bottom: 0; }
.ins-row.h { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; padding-top: 0; }
.pct { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 5px; }
.meter i { display: block; height: 100%; border-radius: 6px; }
.big { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; }
svg.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }

/* forms / sheets */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 4, 12, 0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: calc(100vh - var(--safe-t) - 24px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, #16234a, #0b1330); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 10px calc(var(--safe-r) + 18px) calc(var(--safe-b) + 22px) calc(var(--safe-l) + 18px); animation: up 0.22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0.3; } to { transform: none; opacity: 1; } }
.grab { width: 40px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.18); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.field { margin: 12px 0; }
.field > label, .lab { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.in { width: 100%; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 11px 12px; font-size: 16px; outline: none; }
.in:focus { border-color: var(--blue); }
select.in { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 8px 11px; font-size: 14px; }
.seg button.on { border-color: var(--green); background: rgba(62, 224, 143, 0.15); color: #c9ffe3; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; }
.swatches button.on { border-color: #fff; }
.calc { background: rgba(124, 196, 255, 0.08); border: 1px solid rgba(124, 196, 255, 0.2); color: #cfe7ff; border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
.btns { display: flex; gap: 10px; margin-top: 16px; }
.btn { flex: 1; border-radius: 14px; padding: 13px 14px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.06); font-weight: 650; font-size: 16px; }
.btn.go { background: var(--green); color: #05230f; border-color: var(--green); }
.btn.warn { color: #ffb3ba; border-color: rgba(255, 90, 106, 0.4); background: rgba(255, 90, 106, 0.08); }
.btn.sm { flex: none; padding: 9px 12px; font-size: 14px; border-radius: 11px; }
.sites { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.site { border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); border-radius: 12px; padding: 9px 10px; text-align: left; position: relative; }
.site b { display: block; font-size: 14.5px; font-weight: 650; padding-right: 32px; }
.site span { font-size: 12px; color: var(--muted); }
.site.on { border-color: var(--green); background: rgba(62, 224, 143, 0.14); }
.site .nx { position: absolute; top: 7px; right: 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: var(--green); }
.times { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.times .in { width: auto; }
.note { color: var(--muted); font-size: 13.5px; margin: 8px 0; }
.set-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.status-line { font-size: 14.5px; color: #cfd6ee; }

.banner { background: rgba(124, 196, 255, 0.12); border: 1px solid rgba(124, 196, 255, 0.3); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; font-size: 14.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner .btn { flex: none; }
.flash { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 96px); z-index: 60; background: rgba(20, 30, 62, 0.96); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; font-size: 14.5px; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); max-width: calc(100vw - 32px); }
.flash button { background: none; border: 0; color: var(--green); font-weight: 700; padding: 0; }

/* frosted floating tab bar */
.tabbar { position: fixed; z-index: 40; left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px); bottom: calc(var(--safe-b) + 10px); max-width: 536px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 6px; border-radius: 28px;
  background: rgba(38, 50, 88, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 6px 0; border-radius: 20px; }
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: #fff; background: rgba(255, 255, 255, 0.09); }
.tabbar button.on svg { stroke: var(--green); }
