/* ไปกัน! — HOME, new-trip sheet, trip menu, SETTINGS (prefix .hm-) · design v2
   clean · minimal · bright white · violet → blue · line icons in soft tiles.
   Tokens only (css/tokens.css); base components from css/base.css. */

/* =========================================================================
   avatars (initials, Contacts style)
   ========================================================================= */
.hm-av {
  --av: var(--primary); --av-soft: var(--primary-soft);
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--av-soft); color: var(--av);
  font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1;
  user-select: none;
}
.hm-av.sm { width: 24px; height: 24px; font-size: 11px; }
.hm-av.lg { width: 46px; height: 46px; font-size: 19px; }
.hm-av-t { display: block; transform: translateY(.04em); }
.hm-av.more { --av: var(--ink-2); --av-soft: var(--surface-sunk); font-family: var(--font-num); font-size: 10px; }

/* =========================================================================
   HOME page layout
   phone: one column (hero · bike · quick · search + profile · trips · stats)
   ≥760px: hero left, quick/search/stats right, trips full width below
   ========================================================================= */
.hm-page { display: flex; flex-direction: column; gap: var(--sp-5); }
.hm-side { display: contents; }
.hm-trips { order: 5; min-width: 0; }
.hm-stats-sec { order: 6; }

/* profile button (lives next to the search bar: there is no greeting header any more) */
.hm-avatar {
  flex: 0 0 auto; padding: 0; border: 0; background: none; border-radius: 50%;
  width: 52px; height: 52px; display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--surface), var(--shadow-1);
  transition: transform 120ms var(--ease);
}
.hm-avatar:active { transform: scale(.94); }
.hm-avatar:focus-visible { box-shadow: 0 0 0 3px var(--surface), var(--focus-ring); }
.hm-avatar .hm-av { background: var(--grad-brand-soft); }

/* ---------- hero: next / ongoing trip (v3 white map card, css/base.css .hero) ---------- */
.hm-next { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.hm-next[hidden] { display: none; }
.hm-hero-slot { display: contents; }
.hm-hero { --hero-map-h: 176px; --hero-map-overlap: 34px; display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; flex: 1 1 auto; }
.hm-hero-top { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.hm-hero-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hm-hero .hm-hero-badge { font-size: var(--fs-xs); padding: 4px 11px; box-shadow: 0 0 0 3px var(--surface); }
.hm-live { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: hm-live 1.6s ease-in-out infinite; }
@keyframes hm-live { 50% { opacity: .35; } }
.hm-hero-title {
  margin-top: 2px; font-size: clamp(1.5rem, 1.15rem + 3cqi, 2rem); line-height: 1.2; letter-spacing: -0.02em; color: var(--ink);
  overflow-wrap: break-word; text-shadow: 0 0 14px var(--surface), 0 0 4px var(--surface), 0 0 1px var(--surface);
}
.hm-hero-link { color: inherit; }
.hm-hero-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.hm-hero-link:focus-visible { box-shadow: none; }
.hm-hero:has(.hm-hero-link:focus-visible) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--primary); }
.hm-hero-sub { font-size: var(--fs-sm); color: var(--ink-2); text-shadow: 0 0 8px var(--surface), 0 0 2px var(--surface); }
.hm-hero-bike { position: relative; z-index: 2; flex: 0 0 auto; }
.hm-hero-bike[hidden] { display: none; }
.hm-hero-bike .bk-thumb { width: 104px; height: 70px; box-shadow: var(--shadow-1); }

/* KPI row: three big numbers with small grey labels */
.hm-hero-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); min-width: 0; }
.hm-hero-chips:empty { display: none; }
.hm-kpi {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line);
}
.hm-kpi-v { font-family: var(--font-num); font-weight: 800; font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.03em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-kpi-v small { margin-left: 3px; font-family: var(--font-body); font-size: .6em; font-weight: 700; letter-spacing: 0; color: var(--ink-3); }
.hm-kpi-k { font-size: var(--fs-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-hero-prog { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.hm-hero-prog-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); }
.hm-hero-stamps { color: var(--ink-2); }
.hm-hero-stamps-v { font-weight: 700; color: var(--ink); }
.hm-hero-bar { height: 8px; }
.hm-hero-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); min-width: 0; font-size: var(--fs-sm); margin-top: -4px; }
.hm-hero-more { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--primary); }
.hm-hero .hm-hero-btn { position: relative; z-index: 2; }
.hm-hero.is-cta { --hero-map-h: 150px; }
.hm-hero.is-cta .hm-hero-foot { margin-top: 0; }
.hm-hero.is-cta .hm-hero-btn { min-height: 44px; }
@container hero (max-width: 340px) { .hm-kpi { padding: 8px 10px; } .hm-kpi-v { font-size: 1.15rem; } }
@container hero (max-width: 400px) { .hm-kpi { padding-inline: 10px; } .hm-kpi-v { font-size: 1.12rem; letter-spacing: -0.04em; } .hm-kpi-v small { margin-left: 2px; } }

/* the optional "my bike" block under the hero (markup + bk- styles from js/features/bike, css/features/bike.css) */
.hm-bike { min-width: 0; }
.hm-bike[hidden] { display: none; }
.hm-bike > .bk-card { border-radius: var(--r-xl); box-shadow: var(--shadow-hero); padding: var(--sp-5); }

/* ---------- quick actions ---------- */
.hm-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); min-width: 0; }
.hm-q {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 0; padding: 4px 0; border: 0; background: none; border-radius: var(--r-md);
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 400; text-align: center; line-height: 1.3;
}
.hm-q .ico-tile {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: transform 120ms var(--ease), box-shadow var(--dur);
}
.hm-q:active .ico-tile { transform: scale(.94); }
@media (hover: hover) { .hm-q:hover .ico-tile { box-shadow: var(--shadow-2); } }
.hm-q:focus-visible { box-shadow: none; }
.hm-q:focus-visible .ico-tile { box-shadow: var(--focus-ring); }
.hm-q-l { max-width: 100%; overflow-wrap: anywhere; }

/* ---------- search look-alike + profile ---------- */
.hm-searchrow { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.hm-search {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: 6px 8px 6px 16px; min-width: 0;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  color: var(--ink-3);
  transition: box-shadow var(--dur), transform 120ms var(--ease);
}
.hm-search:active { transform: scale(.99); }
@media (hover: hover) { .hm-search:hover { box-shadow: var(--shadow-2); } }
.hm-search-ico { display: inline-grid; color: var(--ink-2); }
.hm-search-t { flex: 1 1 auto; min-width: 0; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-search-end { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }

/* ---------- section headings ---------- */
.hm-h2 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.hm-stats-sec { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.hm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.hm-stats .stat { padding: var(--sp-3); box-shadow: var(--shadow-1); }
.hm-stats .stat-label { color: var(--ink-2); }
.hm-stats .stat-label { align-items: flex-start; line-height: 1.35; }
.hm-stats .stat-label > span { min-width: 0; overflow-wrap: anywhere; }
.hm-stats .stat-label svg { flex: 0 0 auto; margin-top: 1px; }
.hm-stats .stat-label svg { color: var(--primary); }
.hm-stats .stat-value { font-size: var(--fs-xl); margin-top: 2px; }

/* ---------- trips ---------- */
.hm-trips-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-width: 0; margin-bottom: var(--sp-2); }
.hm-trips-head .hm-h2 { min-width: 0; }
.hm-new { flex: 0 0 auto; }
.hm-sec + .hm-sec { margin-top: var(--sp-5); }
.hm-sec-h {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-2) 0 var(--sp-3);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2);
}
.hm-sec-n {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill);
  display: inline-grid; place-items: center;
  background: var(--surface-sunk); color: var(--ink-2); font-size: var(--fs-xs);
}
.hm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--sp-3); align-items: start; }

/* trip card */
.hm-trip {
  position: relative;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: 14px;
  transition: transform 140ms var(--ease), box-shadow 160ms var(--ease);
}
.hm-trip:has(.hm-tk-link:active) { transform: scale(.985); }
@media (hover: hover) { .hm-trip:hover { box-shadow: var(--shadow-2); } }
.hm-trip:has(.hm-tk-link:focus-visible) { box-shadow: var(--focus-ring), var(--shadow-1); }
.hm-trip-top { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.hm-trip-top > .ico-tile { width: 52px; height: 52px; border-radius: 16px; }
.hm-trip-top > .ico-tile svg { width: 26px; height: 26px; }
.hm-trip-head { flex: 1 1 auto; min-width: 0; }
.hm-trip-kicker { font-size: var(--fs-xs); font-weight: 400; color: var(--ink-3); }
.hm-trip-title { font-size: var(--fs-lg); line-height: 1.3; margin-top: 1px; }
.hm-tk-link { color: var(--ink); }
.hm-tk-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.hm-tk-link:focus-visible { box-shadow: none; }
.hm-trip-meta { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }
.hm-trip .hm-trip-more { position: relative; z-index: 2; margin: -4px -6px 0 0; color: var(--ink-3); }
.hm-trip-route {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--ink-2);
}
.hm-trip-veh { display: inline-grid; flex: 0 0 auto; color: var(--tc, var(--primary)); }
.hm-trip-place { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-trip-route.is-empty .hm-trip-place { white-space: normal; overflow-wrap: anywhere; }
.hm-trip-arrow { display: inline-grid; flex: 0 0 auto; color: var(--ink-3); }
.hm-riders { display: inline-flex; align-items: center; flex: 0 0 auto; margin-left: auto; padding-left: 6px; }
.hm-riders .hm-av { box-shadow: 0 0 0 2px var(--surface-2); }
.hm-riders .hm-av + .hm-av { margin-left: -6px; }
.hm-trip-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.hm-trip-stamps { margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-2); flex: 0 1 112px; min-width: 84px; }
.hm-trip-bar { flex: 1 1 auto; height: 6px; }
.hm-trip.is-done .hm-trip-bar > i { background: var(--mint); }
.hm-trip-n { flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); }
.hm-trip-quick {
  position: relative; z-index: 2;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--sp-2);
}
.hm-trip-quick .hm-qa {
  flex-direction: column; gap: 4px;
  min-height: 60px; padding: 8px 4px; border-radius: var(--r-md);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.2;
}
.hm-trip-quick .hm-qa > span { max-width: 100%; }
.hm-pop { animation: pop 380ms var(--ease); }

/* optional "plan a trip" card */
.hm-addcard {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  background: var(--surface-2); color: var(--ink);
}
.hm-addcard-text { display: flex; flex-direction: column; min-width: 0; }
.hm-addcard-t { font-family: var(--font-display); font-weight: 700; }
.hm-addcard-s { font-size: var(--fs-sm); color: var(--ink-2); }

/* empty state */
.hm-empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.hm-empty-art { width: 112px; height: 112px; margin-bottom: var(--sp-2); border-radius: 32px; display: grid; place-items: center; background: var(--grad-brand-soft); }
.hm-empty-art .e3d, .hm-empty-art .emoji { width: 80px; height: 80px; font-size: 3.4rem; }
.hm-empty-p { max-width: 34ch; }
.hm-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-3); }

/* ---------- tablet / desktop ---------- */
@media (min-width: 760px) {
  .hm-page {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas: "hero side" "trips trips";
    gap: var(--sp-5) var(--sp-6);
    align-items: stretch;
    align-content: start;
  }
  .hm-next { grid-area: hero; min-width: 0; }
  /* with the bike block: hero + quick/search/stats on the left, the bike block on the right */
  .hm-page:has(.hm-bike:not([hidden])) {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas: "hero bike" "side bike" "trips trips";
  }
  .hm-page:has(.hm-bike:not([hidden])) .hm-next:not([hidden]) { display: contents; }
  .hm-page:has(.hm-bike:not([hidden])) .hm-hero { grid-area: hero; }
  .hm-page:has(.hm-bike:not([hidden])) .hm-bike { grid-area: bike; align-self: start; }
  .hm-page:has(.hm-bike:not([hidden])) .hm-stats-sec { justify-content: flex-start; }
  .hm-page.is-empty:has(.hm-bike:not([hidden])) { grid-template-areas: "side bike" "trips trips"; }
  .hm-side { grid-area: side; display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
  .hm-trips { grid-area: trips; }
  .hm-page.is-empty { grid-template-areas: "side side" "trips trips"; }
  .hm-page.is-empty .hm-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
  .hm-hero { --hero-pad: var(--sp-6); }
  .hm-quick { gap: var(--sp-3); }
  .hm-stats-sec { flex: 1 1 auto; justify-content: flex-end; }
  /* status sections side by side (กำลังเที่ยว | วางแผนไว้ | จบแล้ว); a lone section spans the row
     and its own grid fills 2–3 columns */
  .hm-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: var(--sp-5) var(--sp-4); align-items: start; }
  .hm-lists > .hm-empty { grid-column: 1 / -1; }
  .hm-sec { min-width: 0; }
  .hm-sec + .hm-sec { margin-top: 0; }
  .hm-stats .stat-value { font-size: var(--fs-lg); }
  /* narrow tiles beside the hero: icon above the label so a label never breaks onto two lines */
  .hm-stats .stat-label { flex-direction: column; gap: 4px; }
  .hm-stats .stat-label > span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
}

/* =========================================================================
   trip ⋯ menu (sheet)
   ========================================================================= */
.hm-menu-head { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; margin: 0 0 var(--sp-4); }
.hm-menu-sub { min-width: 0; font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.hm-menu + .hm-menu { margin-top: var(--sp-3); }
.hm-menu-item {
  width: 100%; min-height: 60px; text-align: left; cursor: pointer;
  font: inherit; color: inherit;
  transition: background var(--dur);
}
.hm-menu-item:active, .hm-row-btn:active { background: var(--surface-sunk); }
@media (hover: hover) { .hm-menu-item:hover, .hm-row-btn:hover { background: var(--surface-2); } }
.hm-menu-item.is-danger .li-title, .hm-row-btn.is-danger .li-title { color: var(--danger); }
.hm-chev { display: inline-grid; flex: 0 0 auto; color: var(--ink-3); }
.hm-menu-item .li-body, .hm-row .li-body { display: flex; flex-direction: column; }
.hm-menu-item .li-title, .hm-menu-item .li-sub, .hm-row .li-title, .hm-row .li-sub { display: block; }

/* =========================================================================
   new-trip sheet
   ========================================================================= */
.hm-nt { --tc: var(--primary); --tc-soft: var(--primary-soft); display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.hm-nt-preview {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
  padding: 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.hm-nt-ptile { display: inline-grid; flex: 0 0 auto; }
.hm-nt-ptext { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.hm-nt-pno { font-size: var(--fs-xs); font-weight: 400; color: var(--ink-3); }
.hm-nt-ptitle { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); line-height: 1.3; overflow-wrap: anywhere; }
.hm-nt-ptitle.is-empty { color: var(--ink-3); }
.hm-nt-pdate { font-size: var(--fs-sm); color: var(--ink-2); }

.hm-nt-grid2 { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-3); align-items: end; }
.hm-nt-stepper { min-height: 48px; }
.hm-nt-noinput {
  width: 3.2em; min-width: 0; border: 0; background: transparent; text-align: center;
  font-size: 16px; font-weight: 700; color: var(--ink); -moz-appearance: textfield; appearance: textfield;
}
.hm-nt-noinput::-webkit-inner-spin-button, .hm-nt-noinput::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.hm-nt-noinput:focus { outline: none; }
.hm-nt-stepper:focus-within { box-shadow: var(--focus-ring); }

.hm-nt-ideas {
  display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none;
  margin: calc(-1 * var(--sp-3)) calc(-1 * var(--sp-5)) 0; padding: 2px var(--sp-5);
}
.hm-nt-ideas::-webkit-scrollbar { display: none; }
.hm-nt-ideas .chip svg { width: 16px; height: 16px; color: var(--ink-3); }

.hm-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: var(--sp-2); }
/* wider sheets: two tidy rows of 8 instead of 11 + 5 */
@media (min-width: 560px) { .hm-icon-grid { grid-template-columns: repeat(8, minmax(0, 56px)); } }
.hm-icon-btn {
  aspect-ratio: 1; min-height: 46px; min-width: 0;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 14px;
  background: var(--surface-sunk); color: var(--ink-2);
  transition: background var(--dur), color var(--dur), border-color var(--dur), transform 100ms;
}
.hm-icon-btn:active { transform: scale(.94); }
.hm-icon-btn[aria-pressed="true"] { background: var(--tc-soft); color: var(--tc); border-color: var(--tc); box-shadow: inset 0 0 0 1px var(--tc); }

.hm-colors { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.hm-color-btn {
  width: 42px; height: 42px; padding: 3px; border-radius: 50%;
  border: 2px solid transparent; background: transparent;
  display: grid; place-items: center;
  transition: border-color var(--dur), transform 100ms;
}
.hm-color-btn:active { transform: scale(.92); }
.hm-color-dot { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--dot); color: var(--ink-inverse); }
.hm-color-dot svg { opacity: 0; transform: scale(.6); transition: opacity var(--dur), transform var(--dur) var(--ease); }
.hm-color-btn[aria-pressed="true"] { border-color: var(--dot); }
.hm-color-btn[aria-pressed="true"] svg { opacity: 1; transform: none; }

.hm-nt-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.hm-nt-date { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hm-nt-sublabel { font-size: var(--fs-xs); font-weight: 400; color: var(--ink-3); }
.hm-nt-date .input { padding-inline: 10px; }
.hm-nt-styledesc { display: flex; align-items: center; gap: 6px; }
.hm-nt-styledesc svg { flex: 0 0 auto; }

/* vehicle segmented (icon above label) — also used in Settings.
   Equal segments while the labels fit; a segment is never narrower than its one-line label (a Thai word is
   never broken). When the row can't hold every label, fitVehicleSeg() (newtrip.js) sets data-fit="active":
   only the chosen vehicle keeps its visible label, the others show the icon (label kept for screen readers). */
.hm-vseg {
  display: flex; gap: 4px;
  padding: 4px; border-radius: var(--r-md); background: var(--surface-sunk); min-width: 0;
}
.hm-vseg button {
  position: relative; flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 62px; padding: 8px 6px;
  border: 0; border-radius: 14px; background: transparent; color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: 400; line-height: 1.2;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.hm-vseg button > svg { flex: 0 0 auto; }
.hm-vseg button > span { white-space: nowrap; text-align: center; }
.hm-vseg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: var(--shadow-1); }
.hm-vseg[data-fit="active"] button:not([aria-pressed="true"]) > span {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* riders */
.hm-riders-edit { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.hm-friends { display: contents; }
.hm-rider-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hm-rider-row .input { flex: 1 1 auto; min-width: 0; }
.hm-rider-av { display: inline-grid; flex: 0 0 auto; }
.hm-rider-tag { flex: 0 0 auto; }
.hm-add-friend { align-self: flex-start; margin-top: 2px; }
.hm-nt-err > svg { color: var(--danger); }

/* =========================================================================
   SETTINGS (iOS-style grouped lists)
   ========================================================================= */
.hm-set-head { margin-bottom: var(--sp-1); }
.hm-set-head h1 { font-size: var(--fs-2xl); }
.hm-set-sec { margin-top: var(--sp-6); min-width: 0; scroll-margin-top: var(--sp-4); }
.hm-set-sec:first-of-type { margin-top: var(--sp-2); }
.hm-set-sec:focus { outline: none; }
.hm-set-h, .hm-set-subh {
  margin: 0 0 var(--sp-2); padding: 0 var(--sp-4);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 400; letter-spacing: .01em; text-transform: none;
  color: var(--ink-2);
}
.hm-set-subh { margin-top: var(--sp-4); }
.hm-set-note, .hm-set-intro { margin: var(--sp-2) 0 0; padding: 0 var(--sp-4); font-size: var(--fs-sm); color: var(--ink-3); }
.hm-set-intro { margin: 0 0 var(--sp-3); color: var(--ink-2); }
.hm-group + .hm-group, .hm-maps + .hm-group, .hm-group + .hm-callout, .hm-callout + .hm-group, .hm-keys-form + .hm-callout { margin-top: var(--sp-3); }
.hm-group { box-shadow: var(--shadow-1); }

.hm-row { min-height: 56px; padding: 12px 14px; gap: var(--sp-3); }
.hm-row .li-title { font-weight: 700; line-height: 1.35; }
.hm-row .li-sub { line-height: 1.45; margin-top: 1px; }
.hm-row-ctl { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); max-width: 62%; min-width: 0; }
.hm-row.is-stack { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
.hm-row-main { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.hm-row-main > .li-body { flex: 1 1 auto; min-width: 0; }
.hm-row-below { min-width: 0; }
.hm-row-btn { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: background var(--dur); }
.hm-row-btn:disabled { opacity: .55; }
.hm-row-hint { display: inline-grid; color: var(--ink-3); }

/* profile */
.hm-me { padding: 14px; }
.hm-me-av { display: inline-grid; flex: 0 0 auto; }
.hm-me-av .hm-av.lg { width: 56px; height: 56px; font-size: 23px; background: var(--grad-brand-soft); }
.hm-me .li-body { display: flex; flex-direction: column; gap: 4px; }
.hm-me-label { font-weight: 400; }
.hm-me-input { min-height: 44px; }

/* theme segmented: toggle buttons use aria-pressed */
.hm-seg { width: 100%; }
.hm-seg button { flex: 1 1 0; }
.hm-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* font picker */
.hm-font { width: 100%; text-align: left; color: inherit; cursor: pointer; transition: background var(--dur); }
.hm-font:active { background: var(--surface-sunk); }
.hm-font-sample {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-sunk); color: var(--ink);
  font-size: 18px; font-weight: 700; line-height: 1;
}
.hm-font .li-title { font-size: var(--fs-md); }
.hm-check { display: inline-grid; flex: 0 0 auto; color: var(--primary); opacity: 0; transform: scale(.7); transition: opacity var(--dur), transform var(--dur) var(--ease); }
.hm-font[aria-checked="true"] .hm-check { opacity: 1; transform: none; }
.hm-font[aria-checked="true"] .hm-font-sample { background: var(--primary-soft); color: var(--primary); }

/* map style cards */
.hm-maps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .hm-maps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hm-map-btn {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 6px 6px 10px; text-align: left; color: var(--ink);
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: border-color var(--dur), box-shadow var(--dur), transform 120ms var(--ease);
}
.hm-map-btn:active { transform: scale(.98); }
.hm-swatch { width: 100%; height: auto; aspect-ratio: 160 / 96; border-radius: 12px; }
.hm-map-name { padding: 6px 6px 0; font-size: var(--fs-sm); font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.hm-map-desc { padding: 0 6px; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.4; overflow-wrap: anywhere; }
.hm-map-check {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: var(--ink-inverse); box-shadow: var(--shadow-1);
  opacity: 0; transform: scale(.7); transition: opacity var(--dur), transform var(--dur) var(--ease);
}
.hm-map-btn[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary), var(--shadow-1); }
.hm-map-btn[aria-pressed="true"] .hm-map-check { opacity: 1; transform: none; }

/* number / select / range controls */
.hm-num { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.hm-num-in {
  width: 76px; min-width: 0; min-height: 40px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--surface-sunk); color: var(--ink);
  font-size: 16px; font-weight: 700; text-align: right;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.hm-num-in:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: var(--focus-ring); }
.hm-unit { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.hm-select { width: auto; max-width: 100%; min-height: 40px; padding: 6px 30px 6px 12px; border-radius: 10px; font-size: 15px; }
.hm-voice-select { min-height: 44px; }
.hm-range { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.hm-range input { flex: 1 1 auto; min-width: 0; }
.hm-range-out { flex: 0 0 auto; min-width: 3.4em; text-align: right; font-weight: 700; color: var(--ink); }

/* fuel summary facts */
.hm-fuelsum-row { padding: 10px; }
.hm-fuelsum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); width: 100%; }
@media (min-width: 560px) { .hm-fuelsum { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hm-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.hm-fact-l { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 400; color: var(--ink-2); min-width: 0; }
.hm-fact-l > span { min-width: 0; overflow-wrap: anywhere; }
.hm-fact-l svg { flex: 0 0 auto; color: var(--sun); }
.hm-fact-v { font-family: var(--font-num); font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.hm-fact-u { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 400; color: var(--ink-2); }

/* map keys */
.hm-key .badge { flex: 0 0 auto; align-self: flex-start; margin-top: 2px; }
.hm-key .hm-row-main { align-items: flex-start; }
.hm-keynotes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hm-keynotes li {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5;
}
.hm-keynotes li > svg { flex: 0 0 auto; margin-top: 3px; color: var(--ink-3); }
.hm-keynotes li > span { min-width: 0; overflow-wrap: anywhere; }
.hm-keynotes li.is-warn { background: var(--sun-soft); border-color: transparent; color: var(--ink); }
.hm-keynotes li.is-warn > svg { color: var(--warn); }
.hm-origin { word-break: break-all; color: var(--ink); font-weight: 700; }
.hm-key-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.hm-key-row .input { flex: 1 1 auto; min-width: 0; font-family: var(--font-num); }
.hm-key-eye { flex: 0 0 auto; color: var(--ink-2); }
.hm-key-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; font-size: var(--fs-sm); font-weight: 700; }
.hm-key-link > span { min-width: 0; overflow-wrap: anywhere; }
.hm-callout > svg { flex: 0 0 auto; color: var(--ink-2); }
.hm-callout.ok > svg { color: var(--mint); }
.hm-callout.warn > svg { color: var(--warn); }

/* backup / about */
.hm-usage { display: inline-flex; flex-wrap: wrap; gap: 0 6px; }
.hm-usage > span:not(:empty) + span:not(:empty)::before { content: "·"; margin-right: 6px; color: var(--ink-3); }
.hm-about-head { padding: 14px; }
.hm-about-icon { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 14px; box-shadow: var(--shadow-1); }
.hm-about-name { display: block; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); line-height: 1.3; }
.hm-credit { color: inherit; min-height: 52px; transition: background var(--dur); }
.hm-credit .li-title { color: var(--ink); }
.hm-credit.is-plain { cursor: default; }
@media (hover: hover) { a.hm-credit:hover { background: var(--surface-2); } }
a.hm-credit:active { background: var(--surface-sunk); }

/* touch: 44px minimum targets */
@media (pointer: coarse) {
  .hm-color-btn { width: 44px; height: 44px; }
  .hm-num-in, .hm-select { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-pop { animation: none; }
}
