/*
 * Mobile app shell (docs/mobile-app-shell.md): bottom tab bar, Add sheet, Explore hub tiles, Profile hub rows.
 * Mobile first: the bar exists below 720px only. Tokens come from site.css (so light/dark/data-theme just work).
 */
:root { --tabbar-h: 60px; }

/* ---------- Bottom tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 719px) {
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; align-items: stretch; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--line);
  }
  .tab {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; padding-bottom: 8px;
    color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; line-height: 1.1;
    -webkit-tap-highlight-color: transparent; position: relative;
  }
  .tab svg { display: block; }
  .tab.is-active { color: var(--accent); }
  .tab:focus-visible, .sheet-item:focus-visible, .chip:focus-visible, .sheet-close:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px; border-radius: 8px; }
  .tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  /* Centre Garage: raised round button. */
  .tab-garage { color: var(--fg); }
  .tab-garage .tab-garage-btn {
    position: relative; display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; margin-top: -26px;
    border-radius: 50%; background: var(--accent); color: var(--accent-fg); border: 4px solid var(--bg); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  }
  .tab-garage.is-active { color: var(--accent); }
  .tab-garage.is-active .tab-garage-btn { box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0, 0, 0, .25); }
  .tab-dot { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--err); border: 2px solid var(--bg); }
  /* Keyboard open: bar gets out of the way (class set by js/tabbar.js). */
  html.kb-open .tabbar { display: none; }
  html.kb-open body.has-tabbar { padding-bottom: 0; }
  .form .actions.sticky { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  html.kb-open .form .actions.sticky { bottom: 0; }

  /* Header on phones: brand + language + sign-in only; the bar carries the rest. */
  body.has-tabbar .apps-toggle, body.has-tabbar .hdr-garage { display: none; }
  body.has-tabbar .nav-primary { margin-left: auto; }
  /* No footer on phones: apps, legal pages and contact live in the menu (layouts/_app-menu.php). */
  body.has-tabbar .site-footer { display: none; }

  /* F19.5 apps menu on phones: title + one short perk line. */
  .apps-item-text .perk-2 { display: none; }
  .apps-item { padding: .7rem .9rem; }
  .apps-item-text small { font-size: .82rem; }
}
@media print { .tabbar, .sheet, #help-slot { display: none !important; } body.has-tabbar { padding-bottom: 0; } }

/* ---------- Add sheet (<dialog>, bottom) ---------- */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  padding: 0; border: 0; border-radius: 18px 18px 0 0; background: var(--bg); color: var(--fg);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .5); }
dialog.sheet[open] { animation: sheet-up .18s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet-body { padding: .6rem 16px calc(1.2rem + env(safe-area-inset-bottom)); }
.sheet-body::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto .5rem; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 1.15rem; min-height: 48px; }
.sheet-close { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--fg); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.sheet-cars { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem 0 .8rem; scrollbar-width: none; }
.chip { flex: none; min-height: 40px; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 99px; background: var(--bg-alt); color: var(--fg); font: inherit; font-size: .92rem; cursor: pointer; }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.sheet-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 84px; padding: .6rem .3rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-alt); color: var(--fg); text-decoration: none; font-weight: 600; font-size: .95rem; text-align: center; }
.sheet-item svg { color: var(--accent); }
.sheet-item:active { border-color: var(--accent); }
.sheet-signin { display: flex; width: 100%; }

/* ---------- Explore hub ---------- */
.explore-search { display: grid; gap: .6rem; margin: .4rem 0 1rem; }
.explore-search input[type=search] { width: 100%; min-height: 52px; padding: .7rem 1rem; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg-alt); color: var(--fg); }
.explore-search .chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.explore-search .chips .chip { padding: .35rem .75rem; font-size: .88rem; }
.explore-search .chips .chip { cursor: pointer; }
.tile-grid { display: grid; gap: .7rem; grid-template-columns: repeat(2, 1fr); margin: 1rem 0 1.5rem; }
@media (min-width: 720px) { .tile-grid { grid-template-columns: repeat(3, 1fr); gap: var(--gap); } }
.tile { display: flex; flex-direction: column; gap: .35rem; padding: .9rem; min-height: 120px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-alt); color: var(--fg); text-decoration: none; }
.tile:hover, .tile:active { border-color: var(--accent); }
.tile b { font-size: 1.02rem; line-height: 1.2; }
.tile small { color: var(--muted); font-size: .82rem; line-height: 1.3; }
.tile .app-icon { width: 44px; height: 44px; }

/* ---------- Profile hub: list rows like a phone settings screen ---------- */
.hub-group { margin: 1.4rem 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.row-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-alt); overflow: hidden; }
.row-list > li + li { border-top: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: .9rem; min-height: 56px; padding: .6rem 1rem; color: var(--fg); text-decoration: none; width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.row-item:hover, .row-item:active { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.row-item .row-icon { flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, var(--bg)); color: var(--accent); }
.row-item .row-text { flex: 1; min-width: 0; }
.row-item .row-text b { display: block; font-weight: 600; }
.row-item .row-text small { display: block; color: var(--muted); font-size: .84rem; line-height: 1.3; }
.row-item .row-end { flex: none; color: var(--muted); font-size: .9rem; display: inline-flex; align-items: center; gap: .3rem; }
a.row-item .row-end::after { content: ""; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); }
.row-item:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px; }
.row-seg { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .7rem 1rem; min-height: 56px; }
.row-seg > span { font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; background: var(--bg); }
.seg a, .seg button { min-height: 40px; padding: .4rem .95rem; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: .92rem; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; }
.seg .is-on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.signin-card { display: flex; flex-direction: column; gap: .6rem; }
.hub-back { display: inline-block; margin: 0 0 .6rem; padding: .4rem 0; }
.about-list { padding-left: 1.2rem; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }
.hub-back { text-decoration: none; }
.search-box { position: relative; }
.search-box input[type=search] { padding-right: 3.2rem; }
.search-go { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
[hidden] { display: none !important; }
/* City filter of the Explore search (city select) */
.explore-city { display: block; margin: 0; }
.explore-city .city-select input { width: 100%; box-sizing: border-box; min-height: 48px; padding: .6rem 1rem; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg-alt); color: var(--fg); }
