/* Magic Herd — phone-first styles. Colours are defined once here; change them to re-theme the app. */
:root {
  --bg: #f7f3ee;
  --card: #ffffff;
  --ink: #2d2620;
  --muted: #7b6f64;
  --line: #e8e0d6;
  --soft: #efe7dd;
  --brand: #6b4f3a;       /* saddle brown */
  --brand-ink: #ffffff;
  --accent: #6f9a5b;      /* paddock green */
  --danger: #c0392b;
  --star: #e0a526;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(45, 38, 32, .05), 0 4px 14px rgba(45, 38, 32, .06);
  --tabbar-h: 62px;
  --badge-gap: 0px;       /* extra space under the menu (see .host-badge below) */
  color-scheme: light;
}
/* On Netlify trial links, Netlify shows a "Powered by Netlify" badge in the bottom-right corner.
   Leave an empty strip under the menu so the badge sits there instead of over the buttons. */
:root.host-badge { --badge-gap: 64px; }
/* Dark colours. Used when the phone is in dark mode (unless the user picked Light in Settings),
   or when the user picked Dark in Settings. Keep the two blocks below identical. */
:root[data-theme="dark"] {
  --bg: #18140f;
  --card: #241e18;
  --ink: #f2ece5;
  --muted: #a99d90;
  --line: #3a3129;
  --soft: #2f2720;
  --brand: #d2a676;
  --brand-ink: #1b140e;
  --accent: #8fb877;
  --danger: #ef6b5e;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18140f;
    --card: #241e18;
    --ink: #f2ece5;
    --muted: #a99d90;
    --line: #3a3129;
    --soft: #2f2720;
    --brand: #d2a676;
    --brand-ink: #1b140e;
    --accent: #8fb877;
    --danger: #ef6b5e;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; }
/* App frame: the header and the bottom menu stay perfectly still; only the middle (#view) scrolls.
   The frame is pinned to the screen so the phone can never scroll (or restore a scroll) on it. */
body {
  margin: 0;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  /* No text selection or "Copy / Save image" menus on buttons, menus and photos */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, select, .selectable { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img { -webkit-user-drag: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
button, a, label { touch-action: manipulation; }

/* Icons (line style for every icon in the app) */
.ic { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-xs { width: 14px; height: 14px; vertical-align: -2px; }
.ic-inline { width: 18px; height: 18px; vertical-align: -3px; }
.ic-xl { width: 56px; height: 56px; stroke-width: 1.5; color: var(--brand); }

/* ---------- Launch screen ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  transition: opacity .35s ease;
}
#splash img { border-radius: 24px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); }
.splash-name { font-weight: 800; font-size: 22px; color: var(--brand); letter-spacing: -.3px; }
#splash.hide { opacity: 0; pointer-events: none; }

/* ---------- Top bar & tab bar ---------- */
.topbar {
  flex: none; position: relative; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s ease; }
.topbar:not(.show-title) h1 { opacity: 0; }
#topActions { display: flex; gap: 6px; }
.icon-btn {
  appearance: none; border: 0; background: var(--soft); color: var(--ink);
  width: 40px; height: 40px; border-radius: 50%; font-size: 20px; line-height: 1;
  display: inline-grid; place-items: center; cursor: pointer; flex: none; font-family: inherit;
}
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn.small { width: 34px; height: 34px; }
.icon-btn.small .ic { width: 16px; height: 16px; }
.back-btn .ic { width: 26px; height: 26px; }
.icon-btn:active { transform: scale(.94); }

main#view {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px max(16px, calc((100% - 640px) / 2)) 32px;
}
.large-title { font-size: 32px; font-weight: 800; letter-spacing: -.6px; margin: 2px 0 14px; line-height: 1.15; }

.tabbar {
  flex: none; position: relative; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(env(safe-area-inset-bottom) + var(--badge-gap) + 6px);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.tabbar a .ti { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; transition: background .2s ease; }
.tabbar a .ti .ic { width: 24px; height: 24px; }
.tabbar a.active { color: var(--brand); font-weight: 700; }
.tabbar a.active .ti { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.tabbar a.active .ti .ic { stroke-width: 2.3; }

/* Pull-to-refresh indicator */
.ptr {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 56px); z-index: 15;
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  background: var(--card); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); color: var(--muted);
  display: grid; place-items: center; opacity: 0; pointer-events: none;
}
.ptr.show { opacity: 1; }
.ptr.armed { color: var(--brand); }
.ptr.spinning .ic { animation: spin .8s linear infinite; color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading placeholders */
.skel { border-radius: 14px; background: linear-gradient(90deg, var(--soft) 25%, var(--card) 50%, var(--soft) 75%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.skel-title { height: 30px; width: 55%; margin: 6px 0 18px; }
.skel-card { height: 74px; margin-bottom: 10px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Swipe a list item left */
.swipe { position: relative; border-radius: 12px; overflow: hidden; touch-action: pan-y; }
.swipe > :last-child { position: relative; }
.swipe-bg {
  position: absolute; inset: 0; border-radius: 12px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 22px; font-weight: 700; font-size: 15px;
}
.swipe-bg span { display: flex; align-items: center; gap: 6px; transition: transform .15s ease; }
.swipe-bg.danger { background: var(--danger); }
.swipe-bg.undo { background: var(--muted); }
.swipe.armed .swipe-bg span { transform: scale(1.12); }
.swipe .card { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.ride-float {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 25;
  bottom: calc(var(--tabbar-h) + var(--badge-gap) + env(safe-area-inset-bottom) + 10px);
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 14px;
  padding: 9px 16px; border-radius: 999px; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout helpers ---------- */
.mt0 { margin-top: 0; }
.mt-s { margin-top: 6px; }
.mt { margin-top: 12px; }
.mt-l { margin-top: 24px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--muted); flex: none; display: grid; place-items: center; }
.chev .ic { width: 20px; height: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

h2.section { font-size: 17px; margin: 26px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.title { font-weight: 650; }
.big-title { font-size: 20px; }
.sub { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.italic { font-style: italic; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.link-inline { color: var(--brand); font-weight: 600; }
.due { margin-top: 4px; font-weight: 600; color: var(--accent); }
.due.overdue, .overdue-h { color: var(--danger); }

/* ---------- Cards & lists ---------- */
.card {
  display: block; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px;
}
section > .card + .card, .card + .card { margin-top: 10px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list > .card + .card { margin-top: 0; }
.card h3 { margin: 0 0 8px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 12px; }
.card p:last-child { margin-bottom: 0; }
.card.tap { cursor: pointer; }
.card.soon { background: var(--soft); border-style: dashed; box-shadow: none; }
.card.welcome { border-color: var(--brand); }
.tips ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.tips li + li { margin-top: 4px; }

.horse-card, .ride-item { display: flex; gap: 14px; align-items: center; }
.avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex: none; background: var(--soft); }
.avatar-ph { display: grid; place-items: center; color: var(--muted); }
.avatar-ph .ic { width: 50%; height: 50%; stroke-width: 1.6; }
.avatar.initials { font-size: 22px; font-weight: 700; color: var(--brand); }
.avatar.lg { width: 112px; height: 112px; font-size: 56px; }
.avatar.lg.initials { font-size: 38px; }
.add-ph { font-size: 28px; color: var(--muted); border: 2px dashed var(--line); background: transparent; }

.hero { text-align: center; padding: 6px 0 2px; }
.hero .avatar { margin: 0 auto 10px; }
.hero h2 { margin: 0; font-size: 26px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.chip {
  appearance: none; font-family: inherit; font-size: 13px; color: var(--ink);
  background: var(--soft); border: 1px solid transparent; border-radius: 999px;
  padding: 6px 12px; white-space: nowrap; cursor: pointer; display: inline-block;
}
.chip.active { background: var(--brand); color: var(--brand-ink); }
.chip-scroll { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }

.seg { display: flex; gap: 2px; background: var(--soft); padding: 4px; border-radius: 12px; margin: 18px 0 14px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1; appearance: none; border: 0; background: transparent; color: var(--muted);
  padding: 8px 10px; border-radius: 9px; font-family: inherit; font-size: 14px; font-weight: 650; white-space: nowrap; cursor: pointer;
}
.seg button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 550; text-align: right; overflow-wrap: anywhere; }

.badge { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--soft); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 12px 16px;
  font-family: inherit; font-size: 16px; font-weight: 650; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--soft); color: var(--ink); text-align: center; min-height: 44px;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid currentColor; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.link { background: transparent; color: var(--muted); font-weight: 500; text-decoration: underline; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; min-height: 34px; }
.btn.block { display: flex; width: 100%; }
.btn.big { padding: 18px; font-size: 19px; border-radius: 16px; }
.btn:active { transform: scale(.97); }
.btn .ic { width: 20px; height: 20px; }
.btn.small .ic { width: 16px; height: 16px; }
.btn.big .ic { width: 24px; height: 24px; }
.chip .ic, .link-inline .ic { width: 15px; height: 15px; vertical-align: -2px; }
.chip { display: inline-flex; align-items: center; gap: 5px; }
.type-opt span .ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; }
.sub .ic-xs { opacity: .8; }
.file-btn { cursor: pointer; }
label.btn { flex-direction: row; font-size: 16px; font-weight: 650; }
label.btn.primary { color: var(--brand-ink); }
label.btn:not(.primary) { color: var(--ink); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form fieldset {
  border: 1px solid var(--line); background: var(--card); border-radius: var(--radius);
  padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.form legend { font-weight: 700; padding: 0 6px; font-size: 14px; color: var(--brand); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); font-weight: 550; }
label small { font-weight: 400; font-size: 12px; }
input, select, textarea {
  font-family: inherit; font-size: 16px; /* 16px stops iPhone zooming in */
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%; min-height: 44px; min-width: 0;
}
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input[type=file] { padding: 8px; font-size: 14px; }

.dyn-rows { display: flex; flex-direction: column; gap: 8px; }
.dyn-rows:empty { display: none; }
.dyn-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.lesson-row { grid-template-columns: 1fr 64px 76px auto; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.lesson-row .span-all { grid-column: 1 / -1; }
.goal-row { grid-template-columns: auto 1fr auto; }
.goal-row input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); }

.form-actions, .row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.form-actions .btn.primary { flex: 1; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.confirm-msg { font-size: 17px; margin: 4px 0 18px; white-space: pre-line; }
.check-row { flex-direction: row; align-items: center; gap: 12px; color: var(--ink); font-size: 16px; font-weight: 500; padding: 8px 0; }
.check-row input { width: 22px; height: 22px; accent-color: var(--brand); }

/* "We've moved" notice (old Netlify address only) */
.moved-banner { display: flex; flex-direction: column; gap: 6px; margin: 12px 16px 0; padding: 14px; border-radius: 14px; border: 2px solid var(--brand); background: var(--card); font-size: 14px; }
.moved-banner strong { font-size: 16px; }
.moved-banner .btn { align-self: flex-start; }
.moved-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Accounts */
.account-cta { display: flex; align-items: center; gap: 12px; border-color: var(--brand); }
.cta-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.cta-icon .ic { width: 24px; height: 24px; }
.account-intro .title { display: flex; align-items: center; gap: 8px; }
.account-intro ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.account-intro li + li { margin-top: 4px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-size: 14px; font-weight: 600; }
.sync-status { font-size: 14px; color: var(--accent); margin: 10px 0 12px; font-weight: 600; }
.sync-status[data-state="offline"], .sync-status[data-state="error"] { color: var(--muted); font-weight: 500; }
.sync-status[data-state="syncing"] { color: var(--muted); }
.small-check { font-size: 14px; padding: 0; color: var(--muted); }

/* Past horses */
.horse-card.past { opacity: .85; }
.horse-card.past .avatar { filter: saturate(.6); }
.status-pill { display: inline-block; margin-top: 10px; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 650; background: var(--soft); color: var(--muted); }
.status-pill.status-deceased { background: linear-gradient(90deg, #f6d7e4, #e3dcf6, #d6ecf6); color: #4a3f5c; }
.card.memory { border-color: #cdbfe6; }

.type-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.type-opt { flex-direction: row; position: relative; }
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt span { display: inline-block; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 14px; cursor: pointer; }
.type-opt input:checked + span { background: var(--c); border-color: var(--c); color: #fff; }

.week-row { display: grid; grid-template-columns: 40px 1fr 70px; gap: 8px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.week-row:last-child { border-bottom: 0; padding-bottom: 0; }
.week-row .day { font-weight: 800; color: var(--brand); }
.week-row .notes { grid-column: 2 / 4; }
.week-row.is-today .day::after { content: "•"; color: var(--accent); margin-left: 2px; }

.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { font-size: 34px; color: var(--line); cursor: pointer; line-height: 1; }
.stars input:checked ~ label { color: var(--star); }
.star-text { color: var(--star); letter-spacing: 1px; }
.star-off { color: var(--line); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { flex: 1; margin: 0; font-size: 20px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 2px 0; }
.cal-cell {
  appearance: none; border: 0; background: var(--card); border-radius: 10px; min-height: 54px;
  padding: 5px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: inherit; color: var(--ink); cursor: pointer;
}
.cal-cell.other { opacity: .4; }
.cal-cell .num { font-size: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.cal-cell.today .num { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.selected { outline: 2px solid var(--brand); outline-offset: -2px; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); display: block; }
.more { font-size: 10px; font-style: normal; color: var(--muted); line-height: 6px; }

.agenda-item {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 12px; padding: 10px 10px 10px 12px; cursor: pointer;
}
.agenda-item.done .title { text-decoration: line-through; opacity: .55; }
.ai-icon {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 16%, transparent);
}
.ai-icon .ic { width: 22px; height: 22px; }
.ai-body { flex: 1; min-width: 0; }
.check {
  appearance: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line);
  background: transparent; color: transparent; cursor: pointer; flex: none; display: grid; place-items: center; padding: 0;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.check .ic { width: 18px; height: 18px; stroke-width: 3; }
.check:active { transform: scale(.88); }
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Stats & training ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.progress { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.template-opt { width: 100%; text-align: left; appearance: none; font-family: inherit; font-size: 16px; color: inherit; cursor: pointer; }
.template-opt .small { margin-top: 6px; }

.tracker-intro { padding: 16px 0 4px; }
.tracker-intro h2 { margin: 6px 0 4px; }
.tracker-time { font-size: 68px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -1px; margin: 4px 0; }
.gps { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; }
.gait-now { font-size: 24px; text-align: center; font-weight: 800; margin: 0 0 18px; }
.ride-live-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #ff5a4e; animation: pulse 1.2s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .25; } }

.gait-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--soft); }
.gait-bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.route { width: 100%; height: auto; background: var(--soft); border-radius: 14px; display: block; }

/* ---------- Photos & timeline ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--soft); cursor: pointer; display: block; }
.viewer { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; background: #000; display: block; }

.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; cursor: pointer; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid var(--bg); }

/* ---------- Home ---------- */
.greet p { margin: 0; color: var(--muted); font-size: 14px; }
.greet h2 { margin: 2px 0 0; font-size: 26px; }
.banner { display: flex; align-items: center; gap: 10px; background: var(--brand); color: var(--brand-ink); padding: 14px; border-radius: 14px; font-weight: 700; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick a { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 2px; text-align: center; font-size: 12px; font-weight: 650; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.quick a { transition: transform .1s ease; }
.quick a:active { transform: scale(.95); }
.q-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.q-ic .ic { width: 23px; height: 23px; }

/* "Install the app" card */
.install-card { display: flex; gap: 12px; align-items: flex-start; border-color: var(--brand); }
.install-card img { border-radius: 12px; flex: none; }
.install-card ol { margin: 6px 0 2px; padding-left: 18px; }
.install-btns { display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.soon-line { display: flex; align-items: center; justify-content: center; gap: 6px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll a { flex: none; width: 76px; text-align: center; font-size: 13px; font-weight: 650; }
.hscroll .avatar { margin: 0 auto 6px; width: 68px; height: 68px; }

.empty { text-align: center; padding: 44px 12px; }
.empty-icon { font-size: 56px; line-height: 1.1; color: var(--brand); }
.empty h2 { margin: 8px 0 4px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Pop-up sheets & toasts ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.modal-sheet {
  position: relative; background: var(--bg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 22px 16px calc(env(safe-area-inset-bottom) + var(--badge-gap) + 20px);
  animation: sheet-up .22s ease-out; -webkit-overflow-scrolling: touch;
}
.modal-sheet h2 { margin: 0 0 14px; font-size: 20px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--badge-gap) + env(safe-area-inset-bottom) + 58px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  max-width: calc(100% - 32px); text-align: center;
}
