/* Cobalt: blue on black. Phone first; a side rail from 900px. */
:root {
  --bg: #04060b; --bg2: #070b14; --card: #0b1220; --card2: #0f1829; --line: #18253d; --line2: #22365a;
  --ink: #eef3fb; --ink2: #b9c7dd; --mute: #7d8fac; --blue: #2f7bff; --blue2: #5aa2ff; --blue3: #9cc6ff; --blue-bg: rgba(47,123,255,.12);
  --good: #3fcf8e; --warn: #f5b546; --bad: #ff5f6d; --bad-bg: rgba(255,95,109,.12); --warn-bg: rgba(245,181,70,.12);
  --r: 14px; --r2: 10px; --pad: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --num: "SF Pro Display", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
a { color: var(--blue2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.mute { color: var(--mute); } .ink2 { color: var(--ink2); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.up { color: var(--good); } .dn { color: var(--ink); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.hide { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; }
a.card { display: block; color: inherit; }
.tiles > .card.tile { margin-top: 0; }
.btn.small svg.i { width: 18px; height: 18px; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .gap { height: 12px; } .gap2 { height: 22px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue2); outline-offset: 2px; }

/* brand */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.logo svg { width: 28px; height: 28px; }

/* buttons + fields */
.btn { appearance: none; border: 1px solid var(--line2); background: var(--card2); color: var(--ink); padding: 11px 16px; border-radius: var(--r2);
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #4a8dff; }
.btn.danger { color: var(--bad); border-color: rgba(255,95,109,.4); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue2); padding-left: 8px; padding-right: 8px; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 6px; font-weight: 550; }
.input, select.input, textarea.input { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r2); padding: 12px 13px; min-height: 46px; outline: none; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--blue); width: 18px; height: 18px; }
.err { background: var(--bad-bg); color: #ffc2c8; border: 1px solid rgba(255,95,109,.35); padding: 10px 12px; border-radius: var(--r2); margin: 0 0 14px; font-size: 14px; }
.note { background: var(--blue-bg); border: 1px solid rgba(47,123,255,.3); color: var(--blue3); padding: 10px 12px; border-radius: var(--r2); font-size: 14px; }
.note.warn { background: var(--warn-bg); border-color: rgba(245,181,70,.35); color: #ffdca0; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line2); border-radius: 20px; transition: .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--blue); } .switch input:checked + i::after { left: 21px; }

/* auth screens */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(47,123,255,.20), transparent 60%), var(--bg); }
.auth .box { width: 100%; max-width: 420px; }
.auth .card { padding: 24px 20px; }
.auth h1 { margin: 18px 0 6px; } .auth .lead { color: var(--ink2); margin: 0 0 20px; }
.auth .foot { text-align: center; margin-top: 16px; color: var(--mute); font-size: 14px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; letter-spacing: 1.5px; background: var(--bg2); border: 1px dashed var(--blue);
  padding: 14px; border-radius: var(--r2); text-align: center; word-break: break-all; user-select: all; color: var(--blue3); }

/* shell */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.rail { display: none; }
.main { flex: 1; min-width: 0; padding: 0 0 calc(76px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; background: rgba(4,6,11,.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: calc(10px + env(safe-area-inset-top)) var(--pad) 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 20px; flex: 1; }
.page { padding: 16px var(--pad) 24px; max-width: 860px; margin: 0 auto; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: rgba(7,11,20,.96); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--mute); font-size: 11px; font-weight: 600; padding: 5px 0; position: relative; }
.tabs a svg.i { width: 23px; height: 23px; }
.tabs a.on { color: var(--blue2); }
.badge { position: absolute; top: 0; left: 55%; background: var(--bad); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; display: grid; place-items: center; }
@media (min-width: 900px) {
  .rail { display: flex; flex-direction: column; gap: 4px; width: 232px; flex: none; padding: 20px 12px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; background: var(--bg2); }
  .rail .logo { padding: 4px 10px 18px; }
  .rail a { display: flex; align-items: center; gap: 12px; color: var(--ink2); padding: 10px 12px; border-radius: var(--r2); font-weight: 550; position: relative; }
  .rail a svg { width: 20px; height: 20px; }
  .rail a.on { background: var(--blue-bg); color: var(--blue3); }
  .rail a:hover { background: var(--card); }
  .rail .badge { position: static; margin-left: auto; }
  .rail .spacer { flex: 1; }
  .tabs { display: none; }
  .main { padding-bottom: 32px; }
  .top { padding-top: 14px; }
}

/* cards + lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card + .card, .card + .sect, .sect + .card { margin-top: 14px; }
.card .hd { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; gap: 10px; }
.card .bd { padding: 8px 16px 16px; }
.sect { margin: 22px 2px 8px; font-size: 13px; font-weight: 650; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); min-height: 56px; }
.li:first-child { border-top: 0; }
button.li, a.li { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; color: inherit; }
button.li:first-child, a.li:first-child { border-top: 0; }
.li:hover { background: rgba(255,255,255,.015); }
.li .main2 { flex: 1; min-width: 0; } .li .t { font-weight: 560; } .li .s { color: var(--mute); font-size: 13px; }
.li .amt { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.ico { width: 36px; height: 36px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--blue2); font-weight: 700; font-size: 14px; }
.ico svg { width: 18px; height: 18px; }
.ico.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.ico.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.day { padding: 14px 16px 6px; font-size: 12px; color: var(--mute); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line2); background: var(--card); font-size: 13px; color: var(--ink2); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--blue-bg); border-color: var(--blue); color: var(--blue3); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.tag { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 6px; background: var(--card2); color: var(--ink2); border: 1px solid var(--line); }
.tag.blue { background: var(--blue-bg); color: var(--blue3); border-color: transparent; }
.tag.bad { background: var(--bad-bg); color: #ffb3bb; border-color: transparent; }

/* hero */
.hero { padding: 20px 16px 14px; }
.hero .k { color: var(--ink2); font-size: 13px; font-weight: 600; }
.hero .v { font-size: 38px; font-weight: 700; font-family: var(--num); letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.hero .d { font-size: 14px; }
.spark { width: 100%; height: 120px; display: block; margin-top: 8px; }
.spark-wrap { position: relative; }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--card2); border: 1px solid var(--line2); border-radius: 8px; padding: 5px 8px; font-size: 12px; white-space: nowrap; transform: translateX(-50%); }
.ranges { display: flex; gap: 6px; margin-top: 8px; }
.ranges button { flex: 1; background: none; border: 0; color: var(--mute); font-weight: 650; font-size: 12px; padding: 6px 0; border-radius: 8px; cursor: pointer; }
.ranges button.on { background: var(--blue-bg); color: var(--blue3); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile { padding: 14px; }
.tile .k { font-size: 12px; color: var(--mute); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 22px; font-weight: 700; font-family: var(--num); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--mute); margin-top: 2px; }

/* progress */
.bar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.bar.over i { background: var(--bad); } .bar.pace i { background: var(--warn); }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .12s; }
.sheet { background: var(--card); border: 1px solid var(--line2); border-bottom: 0; border-radius: 18px 18px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .16s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 3px; background: var(--line2); margin: -6px auto 14px; }
.sheet h2 { margin-bottom: 12px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 18px; border-bottom: 1px solid var(--line2); } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } } @keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line2); padding: 10px 16px;
  border-radius: 12px; z-index: 30; max-width: calc(100% - 32px); font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.bad { border-color: rgba(255,95,109,.5); }
.spin { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; min-height: 60vh; }
.empty { text-align: center; padding: 34px 20px; }
.empty svg.big { width: 56px; height: 56px; margin: 0 auto 12px; color: var(--blue2); }
.sandbox { background: repeating-linear-gradient(135deg, rgba(245,181,70,.12) 0 8px, transparent 8px 16px); border-bottom: 1px solid rgba(245,181,70,.3); color: #ffdca0; font-size: 12px; text-align: center; padding: 5px 10px; font-weight: 600; }
.qr { background: #fff; padding: 10px; border-radius: 12px; width: 200px; margin: 6px auto 12px; } .qr img, .qr svg { display: block; width: 100%; height: auto; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; } table.plain td { padding: 6px 0; border-top: 1px solid var(--line); }
