/* =====================================================================
   Strivo - always-dark, mobile-only UI
   ===================================================================== */
:root {
  --bg: #0A0D12;
  --surface: #11161D;
  --surface-2: #18202A;
  --surface-3: #202A36;
  --line: #232D39;
  --text: #E9EEF4;
  --muted: #8B98A9;
  --faint: #5C6878;
  --accent: #C6FF3D;
  --accent-ink: #0B1200;
  --accent-2: #22D3EE;
  --danger: #FF5C7A;
  --warn: #FFB347;
  --accent-text: #C6FF3D;
  --danger-text: #ffd0d9;
  --glass: rgba(13,17,23,.92);
  --glass-2: rgba(17,22,29,.88);
  --fade: rgba(10,13,18,0);
  --fade-strong: rgba(10,13,18,.85);
  --map-bg: #14181d;
  --route: #C6FF3D;
  --ring-track: #202A36;
  --av-bg: 26%;
  --av-fg: 82%;
  --shadow: rgba(0,0,0,.4);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.accent { color: var(--accent-text); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- desktop gate */
.desktop-gate { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(198,255,61,.10), transparent 60%), var(--bg); }
.gate-card { max-width: 440px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.gate-card h1 { font-size: 26px; }
.gate-card p { color: var(--muted); }
.gate-qr { background: #fff; padding: 12px; border-radius: 14px; min-height: 40px; }
.gate-qr:empty { display: none; }
.gate-url { font-size: 13px; color: var(--accent-text); background: var(--surface); padding: 6px 10px; border-radius: 8px; word-break: break-all; }

/* Mouse + hover = desktop/laptop: show the gate, hide the app. */
@media (hover: hover) and (pointer: fine) {
  .desktop-gate { display: flex; }
  .app, .tabbar, .toast, .sheet, .sheet-backdrop { display: none !important; }
}

/* ---------------------------------------------------------------- app shell */
.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }
.page { padding: calc(8px + var(--safe-t)) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.app-bare .page { padding-bottom: calc(24px + var(--safe-b)); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px; background: linear-gradient(var(--bg) 70%, var(--fade)); }
.topbar h1 { font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar + .page { padding-top: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); }
.icon-btn:active { transform: scale(.96); }

.tabbar { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tab { display: grid; justify-items: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 500; padding: 8px 0; }
.tab.active { color: var(--accent-text); }
.tab-record { margin-top: -26px; }
.record-btn { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 24px rgba(198,255,61,.25), 0 0 0 5px var(--bg); }
.record-btn .ic { width: 26px; height: 26px; margin-left: 3px; }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card, .section + .section, .card + .section, .section + .card { margin-top: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.section-head h2 { font-size: 17px; }
.section-head a { color: var(--accent-text); font-size: 13px; font-weight: 600; }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 14px;
  font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 0; width: auto; transition: transform .1s; }
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: rgba(255,92,122,.12); color: var(--danger); border: 1px solid rgba(255,92,122,.3); }
.btn-sm { height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .5; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.active, .chip:has(input:checked) { background: rgba(198,255,61,.12); border-color: rgba(198,255,61,.45); color: var(--accent-text); }
.chip input { display: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.badge-live { background: rgba(198,255,61,.12); color: var(--accent-text); }
.badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(198,255,61,.6); } 70% { box-shadow: 0 0 0 7px rgba(198,255,61,0); } 100% { box-shadow: 0 0 0 0 rgba(198,255,61,0); } }

.avatar { --h: 200; position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none;
  background: hsl(var(--h) 45% var(--av-bg)); color: hsl(var(--h) 60% var(--av-fg)); font-weight: 700; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.avatar-lg { width: 84px; height: 84px; font-size: 28px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg a, .seg label { display: flex; align-items: center; justify-content: center; text-align: center; height: 36px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); position: relative; }
.seg a.active, .seg label:has(input:checked) { background: var(--surface-3); color: var(--text); }
.seg input { display: none; }
.seg .dot { position: absolute; top: 6px; right: 10px; width: 7px; height: 7px; background: var(--danger); border-radius: 50%; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; color: var(--faint); margin: 0 auto 10px; display: block; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 16px; outline: none; appearance: none; }
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus { border-color: rgba(198,255,61,.6); box-shadow: 0 0 0 3px rgba(198,255,61,.12); }
.input::-webkit-calendar-picker-indicator { filter: invert(.8); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form { display: grid; gap: 14px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #9AA6B6; transition: .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); background: var(--accent-ink); }

/* ---------------------------------------------------------------- toast & sheets */
.toast { position: fixed; z-index: 300; left: 50%; top: calc(14px + var(--safe-t)); transform: translate(-50%, -150%); max-width: calc(100% - 32px);
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text); padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px var(--shadow); transition: transform .3s ease; }
.toast.show { transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(198,255,61,.35); }
.toast.err { border-color: rgba(255,92,122,.5); color: var(--danger-text); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 210; left: 50%; bottom: 0; width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  transform: translate(-50%, 105%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); }
.sheet.show { transform: translate(-50%, 0); }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { font-size: 19px; }

/* ---------------------------------------------------------------- dashboard */
.hello { display: flex; align-items: center; gap: 12px; padding: calc(14px + var(--safe-t)) 16px 6px; }
.hello h1 { font-size: 22px; }
.brandmark { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 17px; }
.streak { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: rgba(255,179,71,.12); color: var(--warn); font-weight: 700; font-size: 13px; }
.streak .ic { width: 16px; height: 16px; }

.hero { background: radial-gradient(400px 200px at 100% 0, rgba(34,211,238,.14), transparent 70%),
  radial-gradient(400px 220px at 0 100%, rgba(198,255,61,.12), transparent 70%), var(--surface); }
.hero-top { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .ring-label b { font-family: var(--display); font-size: 22px; }
.big-num { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1; }
.big-num small { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 3px; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 92px; margin-top: 16px; }
.bar { display: grid; gap: 6px; justify-items: center; height: 100%; align-content: end; }
.bar i { width: 100%; max-width: 26px; border-radius: 8px; background: var(--surface-3); min-height: 6px; }
.bar.has i { background: linear-gradient(180deg, var(--accent), #8BD12E); }
.bar span { font-size: 11px; color: var(--faint); font-weight: 600; }
.bar.today span { color: var(--accent-text); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.tile-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); color: var(--c, var(--accent)); }
.tile-icon .ic { width: 17px; height: 17px; }
.tile .val { font-family: var(--display); font-size: 22px; font-weight: 700; }
.tile .val small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--accent)); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick a, .quick button { display: grid; justify-items: center; gap: 6px; padding: 12px 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.quick .tile-icon { width: 38px; height: 38px; border-radius: 12px; }

.act { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.act .route-thumb { width: 76px; height: 60px; flex: none; background: var(--surface-2); border-radius: 12px; }
.act h3 { font-size: 15px; font-family: var(--font); font-weight: 600; }
.act-stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.act-stats b { color: var(--text); font-weight: 600; }

.live-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: rgba(198,255,61,.07); border: 1px solid rgba(198,255,61,.25); }

/* ---------------------------------------------------------------- logs */
.date-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; scroll-snap-type: x proximity; }
.date-strip::-webkit-scrollbar { display: none; }
.day { flex: none; width: 48px; display: grid; justify-items: center; gap: 2px; padding: 8px 0; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); scroll-snap-align: center; position: relative; }
.day small { font-size: 11px; color: var(--faint); font-weight: 600; }
.day b { font-family: var(--display); font-size: 17px; }
.day.has::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); position: absolute; bottom: 5px; }
.day.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-text); }
.day.active small { color: var(--accent-ink); }
.day.active.has::after { background: var(--accent-ink); }

.day-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.day-totals div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.day-totals b { display: block; font-family: var(--display); font-size: 19px; }
.day-totals span { font-size: 11.5px; color: var(--muted); }

.timeline { position: relative; display: grid; gap: 10px; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.entry { position: relative; display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; }
.entry .dot { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; z-index: 1;
  background: color-mix(in srgb, var(--c) 16%, var(--bg)); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.entry .body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.entry .body h3 { font-family: var(--font); font-size: 14.5px; font-weight: 600; }
.entry .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.entry .details { font-size: 13.5px; color: var(--muted); margin-top: 4px; white-space: pre-line; }
.kcal { font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--warn); }
.kcal.burn { color: var(--accent-text); }

.fab { position: fixed; z-index: 40; right: max(16px, calc(50% - 260px + 16px)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px rgba(198,255,61,.25); }
.fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-grid label { display: grid; justify-items: center; gap: 6px; padding: 10px 2px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.cat-grid label:has(input:checked) { border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 12%, var(--surface-2)); }
.cat-grid input { display: none; }
.cat-grid .ic { color: var(--c); }
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.moods label { display: grid; place-items: center; height: 54px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 24px; }
.moods label:has(input:checked) { border-color: #F472B6; background: rgba(244,114,182,.12); }
.moods input { display: none; }

/* ---------------------------------------------------------------- record */
body.page-record { overflow: hidden; }
.rec { position: fixed; inset: 0; max-width: 520px; margin: 0 auto; }
.rec-map, .rec .rec-map.maplibregl-map { position: absolute; inset: 0; background: var(--map-bg); }
.rec-top { position: absolute; z-index: 5; top: 0; left: 0; right: 0; padding: calc(12px + var(--safe-t)) 12px 0; display: grid; gap: 10px;
  background: linear-gradient(var(--fade-strong), var(--fade)); padding-bottom: 24px; }
.rec-top .chips .chip { background: var(--glass-2); backdrop-filter: blur(10px); }
.map-tools { position: absolute; z-index: 5; right: 12px; top: calc(116px + var(--safe-t)); display: grid; gap: 8px; }
.map-tools button { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--line); backdrop-filter: blur(10px); font-size: 12px; font-weight: 700; }
.map-tools button.on { color: var(--accent-text); border-color: rgba(198,255,61,.45); }
.gps-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.gps-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.gps-status.good i { background: var(--accent); }
.gps-status.bad i { background: var(--danger); }

.rec-panel { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(16px + var(--safe-b));
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; }
.rec-stats { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 6px; }
.rec-stats b { display: block; font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rec-stats span { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.rec-time b { font-size: 44px; }
.rec-controls { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 14px; }
.ctl { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--line); }
.ctl .ic { width: 26px; height: 26px; }
.ctl-main { width: 82px; height: 82px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border: 0; box-shadow: 0 10px 30px rgba(198,255,61,.25); }
.ctl-main .ic { width: 34px; height: 34px; }
.ctl-stop { color: var(--danger); }
.ctl small { position: absolute; }
.rec-back { position: absolute; z-index: 7; left: 12px; top: calc(12px + var(--safe-t)); }
.live-strip { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; color: var(--muted); }
.live-strip .avatars { display: flex; }
.live-strip .avatars .avatar { margin-left: -8px; border: 2px solid var(--surface-2); }
.live-strip .avatars .avatar:first-child { margin-left: 0; }

/* map markers */
.me-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-2); border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(34,211,238,.25), 0 2px 8px rgba(0,0,0,.5); }
.person-marker { display: grid; justify-items: center; gap: 3px; }
.person-marker .avatar { border: 2px solid var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.person-marker.approx .avatar { border-style: dashed; }
.person-marker em { font-style: normal; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--glass); color: var(--text); white-space: nowrap; }
.maplibregl-ctrl-attrib { font-size: 10px !important; background: var(--glass-2) !important; color: var(--muted) !important; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }

/* ---------------------------------------------------------------- activity detail */
.act-map { position: relative; height: 46dvh; min-height: 300px; margin: 0 -16px; background: var(--map-bg); }
.act-map .map-tools { top: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.stat-grid div { background: var(--surface); padding: 12px; }
.stat-grid b { display: block; font-family: var(--display); font-size: 20px; font-weight: 700; }
.stat-grid span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.splits { width: 100%; border-collapse: collapse; font-size: 14px; }
.splits td { padding: 8px 0; border-top: 1px solid var(--line); }
.splits td:last-child { width: 50%; }
.splits .bar-h { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.elev { width: 100%; height: 90px; display: block; }

/* ---------------------------------------------------------------- people */
.person { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.person h3 { font-family: var(--font); font-size: 15px; font-weight: 600; }
.person p { font-size: 12.5px; color: var(--muted); }
.profile-head { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 8px 0 4px; }
.profile-head h1 { font-size: 24px; }
.search { position: relative; }
.search .ic { position: absolute; left: 14px; top: 13px; color: var(--muted); }
.search .input { padding-left: 44px; }

/* ---------------------------------------------------------------- settings */
.settings-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.settings-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.settings-link + .settings-link { border-top: 1px solid var(--line); }
.settings-link .tile-icon { width: 34px; height: 34px; }
.settings-link > .ic:last-child { color: var(--faint); }
.logo-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.logo-pick label { display: grid; justify-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.logo-pick label:has(input:checked) { border-color: var(--accent-text); color: var(--text); }
.logo-pick input { display: none; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; align-content: space-between; padding: calc(40px + var(--safe-t)) 24px calc(28px + var(--safe-b));
  background: radial-gradient(500px 360px at 85% 10%, rgba(34,211,238,.16), transparent 70%), radial-gradient(520px 380px at 0% 60%, rgba(198,255,61,.12), transparent 70%), var(--bg); }
.login-hero { display: grid; gap: 18px; margin-top: 8vh; }
.login-hero h1 { font-size: 40px; line-height: 1.05; }
.login-hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-feats { display: grid; gap: 10px; margin-top: 8px; }
.login-feats div { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.login-feats .ic { color: var(--accent-text); width: 18px; height: 18px; }
.login-actions { display: grid; gap: 12px; }
.gbtn-wrap { min-height: 48px; display: grid; justify-items: center; }
.btn-google { background: #fff; color: #1f1f1f; }
.note { font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); padding: 10px 12px; border-radius: 12px; }
.note code { color: var(--accent-text); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* collapsible settings sections */
details.settings-group > summary { list-style: none; cursor: pointer; }
details.settings-group > summary::-webkit-details-marker { display: none; }
details.settings-group .chev { color: var(--faint); transition: transform .2s; }
details.settings-group[open] .chev { transform: rotate(90deg); }
details.settings-group[open] > summary { border-bottom: 1px solid var(--line); }
.pad { padding: 16px; }

/* location help */
button.gps-status { padding: 6px 10px; border-radius: 999px; }
.gps-status.bad { background: rgba(255,92,122,.12); color: var(--danger-text); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 14px; color: var(--muted); }
.steps b { color: var(--text); }

/* route thumbnails (dashboard / lists) */
.route-thumb .r-line { stroke: var(--route); }
.route-thumb .r-start { fill: var(--accent-2); }
.route-thumb .r-end { fill: var(--text); }

/* ================================================================ light theme
   html[data-theme] is resolved to "light" or "dark" by the inline script in
   layouts/app.php ("system" follows the phone). */
:root[data-theme="light"] {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #F0F3F7;
  --surface-3: #E3E8EF;
  --line: #DCE2EA;
  --text: #0E141B;
  --muted: #586374;
  --faint: #8792A2;
  --accent-text: #4D7C0F;
  --accent-2: #06B6D4;
  --danger: #E11D48;
  --warn: #D97706;
  --danger-text: #9F1239;
  --glass: rgba(255,255,255,.94);
  --glass-2: rgba(255,255,255,.92);
  --fade: rgba(243,245,248,0);
  --fade-strong: rgba(243,245,248,.9);
  --map-bg: #E8ECEF;
  --route: #4D9A0F;
  --ring-track: #E3E8EF;
  --av-bg: 88%;
  --av-fg: 30%;
  --shadow: rgba(15,23,42,.14);
  color-scheme: light;
}
[data-theme="light"] .tile-icon,
[data-theme="light"] .entry .dot,
[data-theme="light"] .cat-grid .ic { color: color-mix(in srgb, var(--c, var(--accent)) 62%, #000); }
[data-theme="light"] .input::-webkit-calendar-picker-indicator { filter: none; }
[data-theme="light"] .maplibregl-ctrl-attrib-button { filter: none; }
[data-theme="light"] .login-hero h1 span { background-image: linear-gradient(90deg, #4D7C0F, #0E7490); }
[data-theme="light"] .badge-live, [data-theme="light"] .chip.active, [data-theme="light"] .chip:has(input:checked) { background: rgba(132,204,22,.16); }
[data-theme="light"] .tabbar { box-shadow: 0 -6px 20px rgba(15,23,42,.06); }
[data-theme="light"] .card, [data-theme="light"] .tile, [data-theme="light"] .act,
[data-theme="light"] .person, [data-theme="light"] .settings-group { box-shadow: 0 1px 2px rgba(15,23,42,.05); }
[data-theme="light"] .streak { background: rgba(217,119,6,.12); }
[data-theme="light"] .bar.has i { background: linear-gradient(180deg, #A3E635, #65A30D); }

/* theme picker */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-pick label { display: grid; justify-items: center; gap: 8px; padding: 12px 6px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.theme-pick label:has(input:checked) { border-color: var(--accent-text); color: var(--text); }
.theme-pick input { display: none; }
.theme-pick .swatch { width: 54px; height: 38px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; }
.theme-pick .swatch i:nth-child(1) { background: #0A0D12; }
.theme-pick .swatch i:nth-child(2) { background: #F3F5F8; }
.theme-pick .swatch.dark i { background: #0A0D12; }
.theme-pick .swatch.light i { background: #F3F5F8; }
