/* ==========================================================================
   Wherebee — UI styles
   ========================================================================== */

:root {
  --brand: #6d4aff;
  --brand-2: #9a6bff;
  --brand-ink: #ffffff;
  --brand-soft: #efeaff;
  --brand-grad: linear-gradient(135deg, #7b5cff 0%, #5b3df5 55%, #3f2bd1 100%);

  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eef0f6;
  --line: #e6e8f0;
  --text: #121528;
  --muted: #646a82;
  --faint: #9ba1b8;

  --ok: #16a34a;
  --ok-soft: #e5f7ec;
  --warn: #d97706;
  --warn-soft: #fff4e0;
  --bad: #e5384f;
  --bad-soft: #fde8eb;
  --info: #2f7bf5;
  --info-soft: #e7f0ff;

  --shadow-sm: 0 1px 2px rgba(18, 21, 40, .06);
  --shadow: 0 1px 2px rgba(18, 21, 40, .05), 0 8px 24px rgba(18, 21, 40, .08);
  --shadow-lg: 0 24px 64px rgba(18, 21, 40, .20);

  --r: 16px;
  --r-sm: 11px;
  --r-xs: 8px;
  --side-w: 400px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-soft: #2a2350;
    --bg: #0c0e16;
    --surface: #151826;
    --surface-2: #1b1f30;
    --surface-3: #232840;
    --line: #2a2f45;
    --text: #eef0fa;
    --muted: #a3a9c2;
    --faint: #6f7592;
    --ok-soft: #12321f;
    --warn-soft: #3a2a10;
    --bad-soft: #3d1820;
    --info-soft: #14284a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-soft: #2a2350;
  --bg: #0c0e16;
  --surface: #151826;
  --surface-2: #1b1f30;
  --surface-3: #232840;
  --line: #2a2f45;
  --text: #eef0fa;
  --muted: #a3a9c2;
  --faint: #6f7592;
  --ok-soft: #12321f;
  --warn-soft: #3a2a10;
  --bad-soft: #3d1820;
  --info-soft: #14284a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
svg.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  background: var(--surface-3); color: var(--text);
  transition: transform .08s ease, background .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--line); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 18px rgba(93, 61, 245, .32); }
.btn-primary:hover { background: var(--brand-grad); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(1.07); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 0; display: inline-grid; place-items: center;
  background: transparent; color: var(--muted); position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg.i { width: 20px; height: 20px; }
.badge-dot {
  position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
}

/* ---------------------------------------------------------------- Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; padding: 10px 14px; resize: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); background: var(--surface); }
input[type="range"] { width: 100%; accent-color: var(--brand); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 20px; background: var(--line); transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- Auth */
.auth {
  height: 100dvh; overflow: auto; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -10%, #8f74ff 0%, transparent 60%), var(--brand-grad);
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0); background-size: 22px 22px;
}
.auth-hero h1 { font-size: 46px; line-height: 1.05; letter-spacing: -0.03em; margin: 28px 0 16px; max-width: 520px; }
.auth-hero p.lead { font-size: 17px; opacity: .88; max-width: 460px; margin: 0; }
.auth-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 540px; margin-top: 40px; position: relative; z-index: 1; }
.auth-feat { background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: 14px; backdrop-filter: blur(6px); }
.auth-feat b { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.auth-feat span { font-size: 12.5px; opacity: .82; }
.auth-radar { position: absolute; right: -140px; bottom: -140px; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); }
.auth-radar::before, .auth-radar::after { content: ""; position: absolute; inset: 70px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); }
.auth-radar::after { inset: 150px; background: rgba(255,255,255,.06); }
.auth-side { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-tabs { margin: 22px 0 20px; width: 100%; display: flex; }
.auth-tabs button { flex: 1; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-err { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; font-weight: 500; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-grad); color: #fff; box-shadow: 0 4px 12px rgba(93,61,245,.35); }
.auth-hero .brand-mark { background: var(--brand-grad); box-shadow: 0 0 0 2px rgba(255,255,255,.4), 0 6px 18px rgba(0,0,0,.18); }
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark .logo-img { width: 78%; height: 78%; object-fit: contain; display: block; }
.loading-screen .brand-mark, .auth .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
.demo-note { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ---------------------------------------------------------------- Shell */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; background: var(--surface);
  border-right: 1px solid var(--line); z-index: 800; position: relative;
}
.side-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 10px 18px; }
.circle-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: var(--surface-2); padding: 7px 10px 7px 12px;
  border-radius: 12px; font-weight: 700; font-size: 14.5px; min-width: 0; max-width: 200px;
}
.circle-btn:hover { background: var(--surface-3); }
.tabs { display: flex; gap: 2px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; position: relative;
}
.tab svg.i { width: 20px; height: 20px; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.on { color: var(--brand); background: var(--brand-soft); }
.tab .badge-dot { top: 2px; right: calc(50% - 22px); }
.panel { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; overscroll-behavior: contain; }
.panel-inner { padding: 14px 14px 28px; }
.sheet-handle { display: none; }

.map-wrap { position: relative; min-width: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--surface-3); }

/* Section header in panel */
.ph { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.ph h2 { font-size: 19px; margin: 0; letter-spacing: -0.02em; flex: 1; min-width: 0; }
.ph .back { margin-left: -8px; }
.sub-h { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 20px 4px 8px; }

/* ---------------------------------------------------------------- Avatars */
.avatar {
  --c: var(--brand); width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
  background: var(--c); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent);
}
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; box-shadow: 0 0 0 2px var(--surface); }
.avatar.xs { width: 22px; height: 22px; font-size: 9px; box-shadow: 0 0 0 2px var(--surface); }
.avatar.xl { width: 76px; height: 76px; font-size: 26px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px color-mix(in srgb, var(--c) 35%, transparent); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--surface); background: var(--faint); }
.avatar .dot.live { background: var(--ok); }
.avatar .dot.moving { background: var(--info); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- Member list */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.list { display: grid; gap: 6px; }
.member-row {
  display: flex; align-items: center; gap: 13px; padding: 11px 12px; border-radius: 14px; border: 1px solid transparent;
  background: transparent; text-align: left; width: 100%; transition: background .15s, border-color .15s;
}
.member-row:hover { background: var(--surface-2); }
.member-row.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.mr-name { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.mr-sub { color: var(--muted); font-size: 13px; }
.mr-meta { color: var(--faint); font-size: 12px; margin-top: 1px; }
.mr-side { display: grid; justify-items: end; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 8px;
  font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.chip svg.i { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.you-tag { font-size: 10.5px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; }

/* Battery */
.batt { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; color: var(--muted); }
.batt-body { width: 22px; height: 11px; border: 1.6px solid currentColor; border-radius: 3px; position: relative; padding: 1px; }
.batt-body::after { content: ""; position: absolute; right: -4px; top: 2.5px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }
.batt-fill { height: 100%; border-radius: 1px; background: currentColor; }
.batt.low { color: var(--bad); }
.batt.mid { color: var(--warn); }
.batt.ok { color: var(--ok); }

/* Banner inside panel */
.share-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px;
  background: var(--brand-soft); color: var(--text);
}
.share-card .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.share-card b { display: block; font-size: 13.5px; }
.share-card span { font-size: 12.5px; color: var(--muted); }

/* Summary tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles.two { grid-template-columns: repeat(2, 1fr); }
.tiles.four { grid-template-columns: repeat(4, 1fr); }
.tile { background: var(--surface-2); border-radius: 13px; padding: 11px 12px; min-width: 0; }
.tile .k { font-size: 11.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.tile .k svg.i { width: 13px; height: 13px; }
.tile .v { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; margin-top: 2px; white-space: nowrap; }
.tile .v small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.tile.bad .v { color: var(--bad); }
.tile.warn .v { color: var(--warn); }

/* Member detail */
.profile { text-align: center; padding: 6px 0 4px; }
.profile .avatar { margin: 4px auto 12px; }
.profile h3 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.profile .status { color: var(--muted); margin-top: 3px; }
.profile .addr { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 6px; }
.action {
  display: grid; justify-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; border: 0;
  background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text); text-decoration: none;
}
.action:hover { background: var(--surface-3); }
.action .ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.action .ic svg.i { width: 18px; height: 18px; }

/* Timeline */
.timeline { position: relative; padding-left: 6px; }
.tl-item { display: flex; gap: 12px; position: relative; padding: 4px 0 4px; cursor: pointer; border-radius: 12px; }
.tl-item:hover .tl-body { background: var(--surface-2); }
.tl-rail { width: 34px; display: flex; flex-direction: column; align-items: center; flex: none; }
.tl-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); z-index: 1; flex: none; }
.tl-ic svg.i { width: 16px; height: 16px; }
.tl-item.stay .tl-ic { background: var(--brand-soft); color: var(--brand); }
.tl-item.trip .tl-ic { background: var(--info-soft); color: var(--info); }
.tl-line { flex: 1; width: 2px; background: var(--line); margin: 2px 0 -6px; min-height: 14px; }
.tl-item.trip .tl-line { background: repeating-linear-gradient(to bottom, var(--info) 0 4px, transparent 4px 8px); opacity: .55; }
.tl-item:last-child .tl-line { display: none; }
.tl-body { flex: 1; min-width: 0; padding: 6px 10px 10px; border-radius: 12px; transition: background .15s; }
.tl-title { font-weight: 650; }
.tl-sub { color: var(--muted); font-size: 12.5px; }
.tl-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.tl-item.on .tl-body { background: var(--brand-soft); }

/* History controls */
.date-nav { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 13px; padding: 4px; margin-bottom: 12px; }
.date-nav .lbl { flex: 1; text-align: center; font-weight: 650; }
.date-nav input[type="date"] { border: 0; background: transparent; font-weight: 650; text-align: center; width: 100%; outline: none; cursor: pointer; }
.chart-box { background: var(--surface-2); border-radius: 14px; padding: 10px 10px 6px; margin: 12px 0; position: relative; }
.chart-box canvas { width: 100%; height: 120px; display: block; cursor: crosshair; touch-action: none; }
.chart-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 2px 6px; }
.player { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.play-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand-grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px rgba(93,61,245,.35); }
.play-btn svg.i { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.player .time { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13px; min-width: 104px; }
.player select { height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); padding: 0 6px; font-size: 12.5px; font-weight: 600; }

/* Driving */
.score-card { display: flex; align-items: center; gap: 18px; padding: 16px; border-radius: var(--r); background: var(--surface-2); margin-bottom: 12px; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 28px; letter-spacing: -0.03em; line-height: 1; display: block; }
.ring .val span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.ring.sm { width: 54px; height: 54px; }
.ring.sm .val b { font-size: 16px; }
.score-label { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding: 10px 6px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar i { width: 100%; max-width: 28px; border-radius: 7px 7px 4px 4px; background: var(--brand-grad); min-height: 3px; opacity: .9; }
.bar span { font-size: 11px; color: var(--faint); font-weight: 600; }
.bar.today i { background: var(--brand); }
.leader { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 0; width: 100%; text-align: left; }
.leader:hover { background: var(--surface-3); }
.leader .rank { width: 22px; font-weight: 800; color: var(--faint); text-align: center; }
.trip-card { padding: 12px 13px; border-radius: 14px; background: var(--surface-2); cursor: pointer; border: 1px solid transparent; }
.trip-card:hover { border-color: var(--line); }
.trip-card.on { border-color: var(--brand); background: var(--brand-soft); }
.trip-card .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; }
.trip-card .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* Places */
.place-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; background: transparent; border: 0; width: 100%; text-align: left; }
.place-row:hover { background: var(--surface-2); }
.place-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.place-ic svg.i { width: 19px; height: 19px; }
.icon-pick { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.icon-pick button { width: 100%; aspect-ratio: 1; max-width: 40px; min-height: 28px; border-radius: 10px; padding: 0; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.icon-pick button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.search-results { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: -8px; margin-bottom: 14px; background: var(--surface); }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover { background: var(--surface-2); }
.hint { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }

/* Activity */
.day-h { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin: 16px 4px 6px; }
.event { display: flex; gap: 12px; padding: 10px 10px; border-radius: 13px; align-items: flex-start; }
.event:hover { background: var(--surface-2); }
.ev-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.ev-ic svg.i { width: 17px; height: 17px; }
.ev-ic.arrive { background: var(--ok-soft); color: var(--ok); }
.ev-ic.leave { background: var(--warn-soft); color: var(--warn); }
.ev-ic.sos, .ev-ic.crash { background: var(--bad-soft); color: var(--bad); }
.ev-ic.battery { background: var(--bad-soft); color: var(--bad); }
.ev-ic.checkin, .ev-ic.safe { background: var(--info-soft); color: var(--info); }
.ev-ic.place, .ev-ic.join { background: var(--brand-soft); color: var(--brand); }
.ev-title { font-weight: 600; }
.ev-sub { font-size: 12.5px; color: var(--muted); }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.filters button.on { background: var(--text); color: var(--surface); border-color: var(--text); }

/* Chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: var(--surface-3); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--brand-grad); color: #fff; border-radius: 18px 18px 6px 18px; }
.msg .who { font-size: 11.5px; color: var(--muted); margin: 8px 0 2px 38px; font-weight: 600; }
.msg-time { font-size: 10.5px; color: var(--faint); margin: 0 4px 2px; white-space: nowrap; }
.chat-compose { padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.quick { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 8px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 20px; padding: 5px 11px; font-size: 12.5px; white-space: nowrap; }
.compose-row { display: flex; gap: 8px; }
.compose-row .input { height: 44px; }
.send-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--brand-grad); color: #fff; display: grid; place-items: center; flex: none; }

/* Empty states / loaders */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ic { width: 54px; height: 54px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--faint); }
.empty .ic svg.i { width: 24px; height: 24px; }
.empty b { display: block; color: var(--text); margin-bottom: 3px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 9999; }
.loading-screen .box { text-align: center; color: var(--muted); }
.loading-screen .spinner { margin: 18px auto 12px; width: 30px; height: 30px; }

/* ---------------------------------------------------------------- Map overlays */
.map-top {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 600; display: flex; gap: 10px; align-items: flex-start; pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  box-shadow: var(--shadow); border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--text);
}
.pill .led { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.pill .led.on { background: var(--ok); box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: pulse-led 2s infinite; }
@keyframes pulse-led { 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.map-ctrls { position: absolute; right: 14px; top: 70px; z-index: 600; display: grid; gap: 8px; }
.map-ctrl {
  width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line); display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow); color: var(--text);
}
.map-ctrl:hover { background: var(--surface); color: var(--brand); }
.map-ctrl svg.i { width: 19px; height: 19px; }
.ctrl-group { display: grid; border-radius: 13px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.ctrl-group .map-ctrl { border: 0; border-radius: 0; box-shadow: none; }
.ctrl-group .map-ctrl + .map-ctrl { border-top: 1px solid var(--line); }
.layer-menu { position: absolute; right: 52px; top: 0; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 6px; width: 170px; display: grid; gap: 2px; }
.layer-menu button { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.layer-menu button:hover { background: var(--surface-2); }
.layer-menu button.on { color: var(--brand); background: var(--brand-soft); }

.fabs { position: absolute; right: 16px; bottom: 26px; z-index: 600; display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.fab {
  height: 52px; padding: 0 20px 0 16px; border-radius: 26px; border: 0; display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text);
}
.fab svg.i { width: 20px; height: 20px; }
.fab.sos { background: linear-gradient(135deg, #ff4d63, #d61f3b); color: #fff; position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.fab.sos .prog { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.28); }
.fab.sos.holding .prog { width: 100%; transition: width 2s linear; }
.fab.sos span { position: relative; }

.legend {
  position: absolute; left: 14px; bottom: 26px; z-index: 600; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 9px 12px; font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.legend .sw { display: flex; gap: 10px; margin-top: 5px; flex-wrap: wrap; }
.legend .sw span { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw i { width: 14px; height: 5px; border-radius: 3px; display: inline-block; }

/* SOS banner */
.alert-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3000; width: min(560px, calc(100vw - 24px));
  background: linear-gradient(135deg, #ff4d63, #c8102e); color: #fff; border-radius: 18px; padding: 14px 16px; box-shadow: 0 20px 50px rgba(200,16,46,.45);
  display: flex; gap: 12px; align-items: center; animation: shake .5s;
}
.alert-banner .ic { width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; animation: blink 1s infinite; }
.alert-banner b { display: block; font-size: 15px; }
.alert-banner span { font-size: 12.5px; opacity: .9; }
.alert-banner .btn { height: 34px; padding: 0 12px; background: #fff; color: #c8102e; }
.alert-banner .btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
@keyframes blink { 50% { background: rgba(255,255,255,.4); } }
@keyframes shake { 20%, 60% { transform: translateX(calc(-50% - 6px)); } 40%, 80% { transform: translateX(calc(-50% + 6px)); } }

/* Toasts */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 4000; display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  display: flex; gap: 11px; align-items: center; padding: 11px 14px; border-radius: 15px; background: var(--text); color: var(--surface);
  box-shadow: var(--shadow-lg); font-weight: 500; font-size: 13.5px; pointer-events: auto; animation: toast-in .25s ease;
}
.toast .avatar { box-shadow: none; }
.toast.out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* Modals */
.modal-bg { position: fixed; inset: 0; z-index: 5000; background: rgba(10, 12, 25, .5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .22s ease; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 18px 18px 6px 22px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 19px; flex: 1; letter-spacing: -0.02em; }
.modal-body { padding: 8px 22px 22px; }
.set-group { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; margin-bottom: 14px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .lbl { flex: 1; min-width: 0; }
.set-row .lbl b { display: block; font-weight: 600; font-size: 13.5px; }
.set-row .lbl span { font-size: 12px; color: var(--muted); }
.code-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); border-radius: 13px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; }
.code-box.big { font-size: 26px; font-weight: 700; letter-spacing: .25em; justify-content: center; color: var(--brand); }
.color-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.color-pick button.on { box-shadow: 0 0 0 2px var(--text); }
.crash-modal { text-align: center; padding: 28px 24px 24px; }
.crash-modal .count { width: 110px; height: 110px; border-radius: 50%; margin: 6px auto 18px; display: grid; place-items: center; font-size: 42px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff4d63, #c8102e); box-shadow: 0 0 0 10px var(--bad-soft); }
.crash-modal h3 { margin: 0 0 6px; font-size: 21px; }

/* ---------------------------------------------------------------- Leaflet pins */
.leaflet-container { font-family: var(--font); background: var(--surface-3); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
.pin-wrap { background: none; border: 0; }
.pin { --c: #7c5cff; position: relative; width: 52px; height: 62px; transition: transform .2s; transform-origin: 50% 100%; }
.pin:hover, .pin.is-selected { transform: scale(1.12); z-index: 10; }
.pin-bubble {
  position: absolute; left: 4px; top: 2px; width: 44px; height: 44px; border-radius: 50%; background: var(--c);
  border: 3px solid #fff; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
}
.pin-tail { position: absolute; left: 50%; bottom: 4px; width: 14px; height: 14px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 3px 0; box-shadow: 3px 3px 6px rgba(0,0,0,.15); }
.pin-tail::after { content: ""; position: absolute; inset: 3px; background: var(--c); border-radius: 0 0 2px 0; }
.pin-heading { position: absolute; left: 0; top: -2px; width: 52px; height: 52px; pointer-events: none; }
.pin-heading::before { content: ""; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); border: 7px solid transparent; border-bottom: 10px solid var(--c); border-top: 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.pin-speed {
  position: absolute; right: -14px; top: -4px; background: #121528; color: #fff; border-radius: 9px; font-size: 10.5px; font-weight: 700;
  padding: 2px 6px; white-space: nowrap; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.pin-speed.fast { background: #e5384f; }
.pin-batt { position: absolute; left: -6px; top: -4px; background: #e5384f; color: #fff; border-radius: 8px; font-size: 9.5px; font-weight: 800; padding: 1px 5px; border: 2px solid #fff; }
.pin.is-moving .pin-bubble::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--c); opacity: 0; animation: ripple 1.8s infinite; }
@keyframes ripple { 0% { transform: scale(.75); opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }
.pin.is-stale .pin-bubble { filter: grayscale(.7); opacity: .75; }
.pin.is-sos .pin-bubble { box-shadow: 0 0 0 6px rgba(229,56,79,.45), 0 6px 16px rgba(0,0,0,.28); animation: sos-pulse 1s infinite; }
@keyframes sos-pulse { 50% { box-shadow: 0 0 0 14px rgba(229,56,79,.15), 0 6px 16px rgba(0,0,0,.28); } }
.place-pin { width: 30px; height: 30px; border-radius: 10px; background: #fff; color: var(--brand); display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0,0,0,.2); border: 2px solid var(--brand); }
.place-pin svg.i { width: 15px; height: 15px; }
.place-label { background: var(--surface); color: var(--text); border: 0; border-radius: 8px; box-shadow: var(--shadow); font-weight: 650; font-size: 11.5px; padding: 3px 8px; }
.place-label::before { display: none; }
.ev-pin { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); font-size: 11px; font-weight: 800; }
.ev-pin.speeding { background: #e5384f; }
.ev-pin.hard_brake { background: #f59e0b; }
.ev-pin.rapid_accel { background: #8b5cf6; }
.end-pin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.leaflet-popup-content-wrapper { border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1100px) { :root { --side-w: 360px; } }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 22px 26px; }
  .auth-hero h1 { font-size: 32px; margin: 18px 0 10px; }
  .auth-hero p.lead { font-size: 15px; }
  .auth-feats { display: none; }
  .auth-radar { width: 300px; height: 300px; right: -100px; bottom: -120px; }

  .shell { display: block; }
  .map-wrap { position: fixed; inset: 0; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; height: var(--sheet-h, 46dvh);
    border-right: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.18);
    transition: height .28s cubic-bezier(.2,.8,.2,1); padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }
  .sidebar[data-sheet="peek"], .sidebar[data-sheet="down"] { --sheet-h: calc(28px + 52px + 66px + env(safe-area-inset-bottom)); }
  .sidebar[data-sheet="half"] { --sheet-h: 48dvh; }
  .sidebar[data-sheet="full"] { --sheet-h: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .sidebar.dragging { transition: none; }
  .sidebar[data-sheet="down"] .panel { visibility: hidden; }
  .sheet-handle { display: block; width: 100%; height: 28px; border: 0; background: transparent; position: relative; flex: none; touch-action: none; cursor: grab; }
  .sheet-handle::after { content: ""; position: absolute; left: 50%; top: 11px; width: 44px; height: 5px; border-radius: 3px; background: var(--faint); opacity: .7; transform: translateX(-50%); }
  .side-head { touch-action: none; }
  /* pop-ups use the whole screen height and show a grab bar */
  .modal { max-height: 100dvh; }
  .modal-head { touch-action: none; padding-top: 22px; }
  .modal-head::before { content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; border-radius: 3px; background: var(--faint); opacity: .6; transform: translateX(-50%); }
  .side-head { padding-top: 0; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; background: var(--surface); border-top: 1px solid var(--line);
    border-bottom: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .map-top { top: 10px; left: 10px; right: 64px; }
  .map-ctrls { top: 10px; right: 10px; }
  .map-ctrls .ctrl-group { display: none; } /* pinch to zoom on phones */
  body.placing .map-wrap { bottom: 48dvh; }
  body.placing .fabs, body.placing .map-top, body.placing .map-ctrls { display: none; }
  body.placing .sidebar { height: 48dvh; }
  .fabs { top: calc(10px + 3 * 42px + 2 * 8px + 16px); bottom: auto; right: 10px; gap: 10px; }
  .fab { height: 44px; padding: 0 14px 0 12px; font-size: 13px; }
  .fab .lbl-long { display: none; }
  .legend { display: none; }
  .alert-banner { top: 8px; }
  .toasts { bottom: auto; top: 64px; }
  .modal-bg { align-items: end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 100dvh; }
}
@media (max-width: 400px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .actions { grid-template-columns: repeat(4, 1fr); gap: 6px; }
}

/* ---------------------------------------------------------------- Pro features */
.set-line { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: transparent; text-align: left; color: inherit; }
.set-line + .set-line, .set-line + .set-row, .set-row + .set-line { border-top: 1px solid var(--line); }
.set-line:hover:not(:disabled) { background: var(--surface-2); }
.set-line:disabled { cursor: default; }
.set-line .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.set-line .grow b { display: block; font-weight: 600; font-size: 13.5px; }
.set-line .grow span { font-size: 12px; color: var(--muted); }
.set-line > svg.i { color: var(--faint); }
.panel-inner > .set-line { border: 1px solid var(--line); border-radius: 14px; margin-top: 14px; }

.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.opt-grid button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 11px 8px; font-weight: 600; font-size: 13px; }
.opt-grid button:hover { border-color: var(--brand); }
.opt-grid button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg.seg-wide { display: flex; width: 100%; }
.seg.seg-wide button { flex: 1; }

.chk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chk-chips label { cursor: pointer; }
.chk-chips input { position: absolute; opacity: 0; pointer-events: none; }
.chk-chips span { display: inline-block; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chk-chips input:checked + span { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.chk-chips input:focus-visible + span { outline: 2px solid var(--brand); }

.priv-status { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 6px; }
.priv-status.on { background: var(--brand-soft); border-color: transparent; }
.priv-status .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--brand); flex: none; }
.priv-status b { display: block; font-size: 14px; }
.priv-status span { font-size: 12.5px; color: var(--muted); }
.sub-h svg.i { vertical-align: -0.15em; margin-right: 4px; }
.pill.private { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.contact-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.contact-row b { display: block; font-size: 13.5px; }
.contact-row span.ellipsis { display: block; font-size: 12px; color: var(--muted); }
.contact-row .icon-btn { width: 32px; height: 32px; }
.contact-row .icon-btn svg.i { width: 16px; height: 16px; }

.steps { padding-left: 20px; margin: 4px 0 14px; display: grid; gap: 12px; font-size: 13.5px; }
.steps li::marker { font-weight: 800; color: var(--brand); }
.qr-box { margin-top: 10px; width: 220px; max-width: 100%; aspect-ratio: 1; border-radius: 14px; background: #fff; padding: 8px; display: grid; place-items: center; border: 1px solid var(--line); }
.qr-box svg { width: 100%; height: 100%; }
details.manual { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 4px; }
details.manual summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
details.manual[open] summary { margin-bottom: 8px; }

/* ---------------------------------------------------------------- Sign-in extras */
.auth-link { font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.field > span.row { display: flex; }
.sent-card { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--brand-soft); color: var(--text); }
.sent-card > svg.i { width: 22px; height: 22px; color: var(--brand); flex: none; margin-top: 2px; }
.sent-card b { display: block; word-break: break-all; }
.sent-card span { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- Two-step / Turnstile */
.otp-input { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recovery-grid code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 14px; letter-spacing: .06em; }
.ts-box { margin: 2px 0 14px; min-height: 65px; }

/* Live-status dot on map pins (matches the dot on avatars) */
.pin-dot { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #fff; background: #9ba1b8; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.pin-dot.live { background: var(--ok); }
.pin-dot.moving { background: var(--info); }
.pin-dot.paused { background: var(--warn); }
.pin-dot.live::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: pin-live 2.4s ease-out infinite; }
@keyframes pin-live { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin-dot.live::after { animation: none; } }

/* ---------------------------------------------------------------- Profile photos */
.avatar.has-img { background: var(--surface-3); padding: 0; }
.avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; flex: none; }
.pin-bubble.has-img { overflow: visible; background: #fff; }
.pin-bubble.has-img > img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-row .grow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.photo-pick { cursor: pointer; }

/* ---------------------------------------------------------------- ETA, smart alerts, reports */
.mr-trip { font-size: 12px; font-weight: 600; color: var(--brand); margin-top: 2px; display: flex; gap: 4px; align-items: center; }
.mr-trip svg.i { width: 13px; height: 13px; }
.trip-row { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); margin-top: 14px; }
.trip-row .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--brand); flex: none; }
.trip-row b { display: block; font-size: 13.5px; }
.trip-row span { font-size: 12px; color: var(--muted); }
.trip-flag { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--c); border: 3px solid var(--c); box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.trip-flag svg.i { width: 15px; height: 15px; }
.days-pick span { padding: 5px 9px; }
.ev-ic.smart { background: var(--warn-soft); color: var(--warn); }
.ev-ic.eta, .ev-ic.eta_arrived, .ev-ic.eta_late { background: var(--brand-soft); color: var(--brand); }
.mode-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.mode-bar span { display: block; height: 100%; }
.mb-walk { background: #22c3a6; } .mb-bike { background: #ff9f1c; } .mb-drive { background: var(--brand); }
.mode-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.mode-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.day-bars { display: flex; align-items: flex-end; gap: 2px; height: 70px; padding: 4px 0; }
.day-bars span { flex: 1; background: var(--brand); opacity: .75; border-radius: 3px 3px 0 0; min-width: 2px; }
.place-time { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; }
.place-time:hover { background: var(--surface-2); }
.place-time b { display: block; font-size: 13.5px; }
.place-time span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- Emergency screen */
.emg-head h3 { color: #e5384f; display: flex; align-items: center; gap: 8px; }
.sos-hold { position: relative; overflow: hidden; width: 100%; border: 0; border-radius: 18px; background: #e5384f; color: #fff; padding: 18px 16px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 8px 22px rgba(229,56,79,.32); }
.sos-hold .fill { position: absolute; inset: 0; background: #a3132a; transform: scaleX(0); transform-origin: left; }
.sos-hold.holding .fill { transform: scaleX(1); transition: transform 2s linear; }
.sos-hold .lbl { position: relative; display: grid; justify-items: center; gap: 2px; }
.sos-hold .lbl .i { width: 30px; height: 30px; }
.sos-hold b { font-size: 19px; letter-spacing: .3px; }
.sos-hold small { opacity: .9; font-size: 12.5px; }
.emg-calls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.emg-call { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 72px; padding: 8px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; text-align: center; font: inherit; cursor: pointer; }
.emg-call b { font-size: 21px; line-height: 1; }
.emg-call b .i { width: 22px; height: 22px; }
.emg-call span { font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.emg-call.red { background: #e5384f; border-color: #e5384f; color: #fff; }
.emg-call.red span { color: rgba(255,255,255,.9); }
.emg-call.add { border-style: dashed; }
@media (max-width: 380px) { .emg-calls { grid-template-columns: repeat(2, 1fr); } }
.emg-loc, .emg-med { padding: 12px 14px; }
.emg-k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 700; margin-top: 8px; }
.emg-k:first-child { margin-top: 0; }
.emg-v { font-size: 15px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.emg-v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .3px; }
.emg-v.warn { color: #e5384f; }
.emg-v a { color: var(--brand); }

/* ---------------------------------------------------------------- Plans */
.plan-cards { display: grid; gap: 10px; }
@media (min-width: 640px) { .plan-cards { grid-template-columns: repeat(3, 1fr); } }
.plan-card { position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.plan-card.gold { border-color: #f2b705; box-shadow: 0 6px 20px rgba(242,183,5,.18); }
.plan-card.current { outline: 2px solid var(--brand); outline-offset: -2px; }
.plan-name { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.plan-card.gold .plan-name .i { color: #f2b705; }
.plan-price { font-size: 24px; font-weight: 800; }
.plan-price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; flex: 1; font-size: 13px; }
.plan-card li { display: flex; gap: 6px; align-items: flex-start; }
.plan-card li .i { color: var(--ok); flex: none; margin-top: 2px; }
.plan-badge { font-size: 12px; font-weight: 700; color: var(--brand); text-align: center; padding: 6px; border-radius: 10px; background: var(--brand-soft); }
.save-tag { font-size: 10.5px; font-weight: 800; color: var(--ok); background: var(--ok-soft); border-radius: 6px; padding: 1px 5px; margin-left: 4px; }
.plan-row.free .ic { color: #f2b705; }
.plan-row:not(.free) .ic { color: #f2b705; }

/* ---------------------------------------------------------------- Crime map */
.layer-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 700; padding: 8px 10px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.layer-menu button .i:last-child:not(:first-child) { margin-left: auto; opacity: .6; }
.crime-chip { position: absolute; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 450; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 13px; font: 600 12.5px var(--font); box-shadow: var(--shadow); cursor: pointer; }
.lvl { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--ok); }
.lvl.medium { background: #f2b705; }
.lvl.high { background: #e5384f; }
.crime-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.crime-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.crime-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.crime-legend span { display: flex; align-items: center; gap: 5px; }
.crime-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.share-card.warn { background: var(--warn-soft); border-color: transparent; }
.share-card.warn .ic { color: var(--warn); }
.share-card.warn .icon-btn { width: 30px; height: 30px; flex: none; }
