/* ============================================================
   PHONE EXPERIENCE — loads last so it can reshape the shell.
   Everything below only applies at 768px wide or less; the
   desktop layout is untouched.
   ============================================================ */

@media (min-width: 769px) {
  .mnav, .msheet-layer, .mtop-progress { display: none !important; }
}

@media (max-width: 768px) {
  :root {
    --mobile-nav-height: 76px;
    --m-gutter: 12px;
    --m-ease: cubic-bezier(.22, 1, .36, 1);
    --m-spring: cubic-bezier(.34, 1.45, .5, 1);
    --m-press: color-mix(in srgb, var(--accent) 22%, transparent);
  }

  /* ---------- foundations ---------- */
  html { -webkit-tap-highlight-color: var(--m-press); }
  html:not(.reduce-motion) body { overscroll-behavior-y: none; }
  button, a, select, summary, label, [role="button"] { touch-action: manipulation; }
  .tab-panel p, .tab-panel li, .card-title, .mh-lead, .mh-tip-text { text-wrap: pretty; }
  .mh-hello, .mh-block-head h2, .card-title { text-wrap: balance; }

  /* the old left drawer and tab bar are replaced by the new shell */
  .sidebar, .drawer-scrim, nav.mobile-bar { display: none !important; }
  .to-top, .scroll-progress { display: none !important; }

  .btn:active:not(:disabled), .chip:active, .learn-cat:active, .selection-card:active,
  .quick-action:active, .report-item:active, .map-fab:active, .top-btn:active,
  .mrow:active, .mh-action:active, .mh-row:active, .mtile:active, .sos-btn:active {
    animation: mPress .2s var(--m-ease);
  }

  /* ---------- top app bar ---------- */
  .top-bar {
    display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
    align-items: center !important; justify-content: flex-start !important;
    gap: 6px !important; height: 56px !important; min-height: 56px !important;
    padding: calc(4px + env(safe-area-inset-top, 0px)) 10px 4px !important;
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: none !important;
  }
  .top-bar > .top-bar-left, .top-bar > .top-bar-left > .top-title, .top-bar > .top-bar-right { display: contents !important; }
  .top-bar .top-brand, .top-bar .page-subtitle, .top-bar .sync-pill, .top-bar .streak-badge,
  .top-bar .palette-btn, .top-bar .guide-btn, .top-bar .top-export-btn {
    display: none !important;
  }
  /* Map button: opens the full map over a report form to pick a spot. */
  .top-bar #phoneMapBtn:not([hidden]) {
    order: 3; display: inline-flex !important; align-items: center; justify-content: center;
    width: 38px !important; height: 38px !important; min-width: 38px !important; flex: 0 0 38px !important;
    margin: 0 !important; padding: 0 !important; border-radius: 50% !important; font-size: .95rem !important;
    background: var(--bg-secondary) !important; color: var(--accent) !important; box-shadow: none !important;
  }
  .page-title {
    order: 2; flex: 1 1 0; width: auto; min-width: 0; max-width: none;
    font-size: 1.08rem !important; line-height: 1.2 !important; font-weight: 800;
    letter-spacing: -.02em; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis;
    transition: font-size .25s var(--m-ease), transform .3s var(--m-spring), opacity .2s;
  }
  body.m-scrolled .page-title { font-size: .98rem !important; }
  .page-title.m-swap { animation: mTitleIn .42s var(--m-ease); }
  .mtop-progress {
    position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; overflow: hidden;
  }
  .mtop-progress i {
    display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 2px;
    transform: scaleX(0); transform-origin: 0 50%; transition: transform .12s linear, opacity .3s; opacity: 0;
  }
  .mtop-progress.on i { opacity: 1; }

  .top-bar .user-profile-btn {
    order: 1; width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important;
    flex: 0 0 38px !important; margin: 0 !important; padding: 3px !important; border-radius: 50% !important;
    gap: 0 !important; font-size: 0 !important;
  }
  .top-bar .user-profile-btn > div:not(.user-avatar) { display: none !important; }
  .top-bar .user-profile-btn .user-avatar { width: 30px; height: 30px; min-width: 30px; margin: 0; font-size: .8rem; }
  .top-bar #signInBtn {
    order: 1; width: auto !important; height: 38px !important; min-width: 0 !important; min-height: 38px !important;
    flex: 0 0 auto !important; margin: 0 !important; padding: 0 12px !important; border-radius: 999px !important;
    font-size: .82rem !important; letter-spacing: 0 !important; white-space: nowrap; gap: 6px;
  }
  .top-bar #signInBtn i { font-size: .85rem; }
  .top-bar .lang-toggle {
    order: 3; width: auto !important; height: 38px !important; flex: 0 0 auto !important;
    margin: 0 !important; padding: 0 9px !important; border-radius: 999px !important;
    font-size: .9rem !important; font-weight: 700; gap: 0 !important; white-space: nowrap;
  }
  .top-bar .lang-toggle i { display: none !important; }
  .top-bar .lang-toggle span { display: inline !important; font-family: var(--font-bn, inherit); }
  .top-bar .top-bar-right .top-btn:not(.guide-btn):not(.top-export-btn):not(.phone-map-btn):not(.palette-btn) {
    order: 4; position: relative; width: 38px !important; height: 38px !important; flex: 0 0 38px !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important;
    border-radius: 50% !important; color: var(--text-primary); box-shadow: none !important;
  }
  .top-bar .sos-btn:not(#signInBtn) {
    order: 5; width: auto !important; height: 38px !important; min-width: 0 !important; min-height: 38px !important;
    flex: 0 0 auto !important; margin: 0 !important; padding: 0 11px !important; border-radius: 999px !important;
    font-size: .74rem !important; letter-spacing: .05em !important; gap: 5px; white-space: nowrap;
  }
  .top-bar .sos-btn:not(#signInBtn) i { font-size: .8rem; }

  /* ---------- page ---------- */
  html.m-shell .app-layout[data-layout] .panel,
  html.m-shell .app-layout:not([data-layout="wide"]):not(.phone-map) .panel {
    padding: 12px var(--m-gutter) calc(var(--mobile-nav-height) + 6px) !important;
    -webkit-overflow-scrolling: touch;
  }
  html.m-shell .app-layout.phone-map .panel { padding: 0 !important; }
  .panel .card, .panel .rf-card, .panel .about-card, .panel .about-tile, .panel .about-role { padding: 14px !important; }
  .panel .card { border-radius: 18px !important; }
  .form-label { text-transform: none !important; letter-spacing: 0 !important; font-size: .88rem !important; }
  .rf-card .form-input, .rf-card .form-select { border-radius: 12px !important; }
  .btn { border-radius: 14px; }
  .btn-full, .rf-submit { min-height: 50px !important; font-size: .98rem !important; }

  /* chips and tabs scroll sideways instead of wrapping into a pile */
  .filter-row, .learn-cats {
    flex-wrap: nowrap !important; overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-snap-type: x proximity;
    margin-left: calc(var(--m-gutter) * -1) !important; margin-right: calc(var(--m-gutter) * -1) !important;
    padding: 4px var(--m-gutter) 8px; scroll-padding-inline: var(--m-gutter);
  }
  .filter-row::-webkit-scrollbar, .learn-cats::-webkit-scrollbar { display: none; }
  .filter-row > *, .learn-cats > * {
    flex: 0 0 auto !important; scroll-snap-align: start; white-space: nowrap; min-height: 40px;
    border-radius: 999px !important; padding-inline: 14px;
  }

  /* ---------- report forms ---------- */
  #panel-garden { margin-top: 0 !important; margin-bottom: 0 !important; }
  .tab-panel > .weather-widget {
    padding: 9px 12px !important; gap: 10px !important; border-radius: 14px !important; margin-bottom: 10px !important;
  }
  .weather-widget .weather-icon { font-size: 1.2rem !important; width: auto; height: auto; }
  .weather-widget h4 { font-size: .92rem; margin: 0; }
  .tab-panel > .info-banner { padding: 10px 12px !important; gap: 10px !important; margin-bottom: 12px !important; border-radius: 14px !important; }
  .rf-card .form-group:first-of-type, .tab-panel.active > :first-child { margin-top: 0 !important; }
  /* The form leads on a phone; the weather strip and the how-to note follow it. */
  .tab-panel:has(> .rf-card).active { display: flex; flex-direction: column; }
  .tab-panel:has(> .rf-card).active > .rf-card { order: -1; min-width: 0; margin-top: 0 !important; }
  .tab-panel:has(> .rf-card).active > .weather-widget,
  .tab-panel:has(> .rf-card).active > .info-banner { margin-top: 4px; }
  .rf-hero { display: none !important; }
  .rf-track { padding: 9px 12px !important; border-radius: 12px !important; margin-bottom: 10px !important; }
  .rf-track-foot { display: flex !important; margin-top: 7px; }
  .rf-pts-now { display: none !important; }
  .rf-next { font-size: .8rem !important; }
  .rf-meter { padding: 9px 12px !important; border-radius: 12px !important; }
  .rf-tube, .rf-bars, .rf-pile-viz, .rf-meter-hint, .rf-meter-val { display: none !important; }
  .rf-meter-txt { display: flex; align-items: center; gap: 8px; }
  .rf-meter-txt::before { content: attr(data-m-label); font-size: .78rem; font-weight: 800; color: var(--text-secondary); white-space: nowrap; }
  .rf-meter-steps { flex: 1; margin-top: 0; flex-wrap: nowrap; gap: 5px; }
  .rf-meter-steps span { flex: 1 1 0; min-height: 38px; justify-content: center; min-width: 0; padding: 4px 6px; border-radius: 10px; white-space: nowrap; }

  /* floating Send button: waits above the tabs while the real one is below the fold */
  .mstick {
    position: fixed; left: 0; right: 0; bottom: calc(var(--mobile-nav-height) + 4px); z-index: 1090;
    display: flex; justify-content: center; padding: 0 12px; pointer-events: none;
    opacity: 0; transform: translateY(28px); transition: opacity .25s, transform .38s var(--m-spring);
  }
  .mstick.on { opacity: 1; transform: none; pointer-events: auto; }
  body.mnav-hidden .mstick, body.splash-open .mstick { display: none; }

  /* ---------- welcome page ---------- */
  .splash .splash-enter {
    position: sticky; bottom: 4px; z-index: 2; display: flex; width: 100%; max-width: 340px;
    margin: 14px auto 8px; justify-content: center; padding: 15px 20px !important; border-radius: 16px !important;
    box-shadow: 0 10px 30px -8px rgba(21, 128, 61, .55), 0 0 0 6px rgba(255, 255, 255, .62);
  }
  .splash .splash-hint { display: none; }
  .splash .splash-tag { margin-bottom: 8px !important; }
  .splash .splash-stats { margin-top: 10px !important; }
  body:has(.app-layout.phone-map) .mstick { display: none; }
  .mstick-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; max-width: 440px;
    min-height: 50px; padding: 0 18px; border: 0; border-radius: 16px; color: #fff;
    font: inherit; font-size: .98rem; font-weight: 800; cursor: pointer;
    box-shadow: 0 12px 28px -10px rgba(8, 24, 18, .6);
    transition: transform .2s var(--m-ease), opacity .2s;
  }
  .mstick-btn:active { transform: scale(.97); }
  .mstick-btn.is-busy { opacity: .7; }

  /* ---------- map ---------- */
  .app-layout .map-floating {
    top: auto !important; bottom: calc(var(--mobile-nav-height) + 12px) !important; right: 10px !important;
    left: auto !important; transform: none !important; width: auto !important; height: auto !important;
    display: flex !important; flex-direction: column !important; gap: 6px !important; padding: 6px !important;
    border: 1px solid var(--border) !important; border-radius: 18px !important;
    background: var(--bg-secondary) !important; box-shadow: 0 10px 26px -10px rgba(8, 24, 18, .5) !important;
  }
  .app-layout .map-floating .map-fab { width: 42px; height: 42px; border-radius: 14px; font-size: 1rem; margin: 0; }
  .app-layout .map-style-picker { position: static; }
  .app-layout .map-basemaps {
    right: calc(100% + 8px); bottom: 0; width: 176px; padding: 6px; gap: 4px;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app-layout .map-basemap-btn { min-height: 40px; border-radius: 10px; }
  .app-layout .map-legend { top: 114px !important; left: 10px !important; right: auto; bottom: auto; max-width: calc(100% - 24px); border-radius: 999px !important; }
  .app-layout .map-legend .legend-title { min-height: 40px; border-radius: 999px; }
  .app-layout .map-legend[open] { border-radius: 16px !important; }
  .app-layout.phone-map .leaflet-top.leaflet-left { top: 58px; left: 10px; }
  .app-layout.phone-map .leaflet-control-zoom { border-radius: 14px !important; overflow: hidden; }
  .app-layout.phone-map .leaflet-control-zoom a { width: 38px; height: 38px; line-height: 36px; font-size: 1.05rem; }
  .app-layout.phone-map .leaflet-bottom.leaflet-right { bottom: calc(var(--mobile-nav-height) + 2px); }
  .app-layout.phone-map .leaflet-control-attribution { font-size: .62rem; background: color-mix(in srgb, var(--bg-secondary) 86%, transparent); color: var(--text-secondary); border-radius: 8px 0 0 0; }
  #phoneMapClose, .phone-map-close {
    top: calc(env(safe-area-inset-top, 0px) + 64px); left: 10px; right: auto; bottom: auto;
    height: 40px; padding: 0 12px 0 10px; gap: 6px; border-radius: 999px;
    font-size: .82rem; box-shadow: 0 10px 26px -10px rgba(8, 24, 18, .5);
  }

  /* ---------- bottom navigation ---------- */
  .mnav {
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 1100;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; height: 60px;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 22px;
    box-shadow: 0 12px 30px -10px rgba(8, 24, 18, .4);
    transition: transform .32s var(--m-ease), opacity .2s;
  }
  body.splash-open .mnav { visibility: hidden; }
  body.mnav-hidden .mnav { transform: translateY(calc(100% + 20px)); opacity: 0; pointer-events: none; }
  .mnav-pill {
    position: absolute; left: 0; top: 6px; height: 48px; width: 0; border-radius: 16px;
    background: var(--accent-bg); opacity: 0; pointer-events: none;
    transition: transform .45s var(--m-spring), width .45s var(--m-spring), opacity .2s;
  }
  .mnav-pill.no-anim { transition: none; }
  .mnav-item {
    position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: 56px; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: .68rem; font-weight: 700;
    cursor: pointer; -webkit-user-select: none; user-select: none; border-radius: 16px; transition: color .2s;
  }
  .mnav-item i { font-size: 1.15rem; line-height: 1; transition: transform .32s var(--m-spring); }
  .mnav-item.active { color: var(--accent); }
  .mnav-item.active i { transform: translateY(-1px) scale(1.08); }
  .mnav-item:active i { transform: scale(.82); }
  .mnav-badge {
    position: absolute; top: 5px; right: calc(50% - 25px); padding: 2px 5px; border-radius: 999px;
    background: var(--success); color: #fff; font-size: .5rem; font-weight: 800; letter-spacing: .02em; line-height: 1.2;
  }
  .mnav-badge[hidden] { display: none; }
  .mnav-fab {
    position: relative; z-index: 1; justify-self: center; margin-top: -10px; width: 52px; height: 52px; border: 0; border-radius: 50%;
    display: grid; place-items: center; color: #fff; font-size: 1.15rem; cursor: pointer;
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent));
    box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent);
    transition: transform .3s var(--m-spring), box-shadow .3s;
  }
  .mnav-fab i { transition: transform .38s var(--m-spring); }
  .mnav-fab:active { transform: scale(.9); }
  .mnav-fab.active, .mnav-fab[aria-expanded="true"] { box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 0 6px color-mix(in srgb, var(--accent) 26%, transparent); }
  .mnav-fab[aria-expanded="true"] i { transform: rotate(135deg); }

  /* ---------- sheets ---------- */
  .msheet-layer { position: fixed; inset: 0; z-index: 1150; display: flex; align-items: flex-end; justify-content: center; }
  .msheet-scrim { position: absolute; inset: 0; background: rgba(8, 24, 18, .48); opacity: 0; transition: opacity .3s; }
  .msheet-layer.on .msheet-scrim { opacity: 1; }
  .msheet {
    position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 60px - env(safe-area-inset-top, 0px));
    display: flex; flex-direction: column; outline: none; color: var(--text-primary);
    background: var(--bg-secondary); border-radius: 26px 26px 0 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -14px 44px rgba(8, 24, 18, .28);
    transform: translateY(104%); transition: transform .42s var(--m-ease);
  }
  .msheet-layer.on .msheet { transform: none; }
  .msheet.dragging { transition: none; }
  .m-drag { touch-action: none; cursor: grab; }
  .msheet-grab { flex: none; width: 40px; height: 4px; margin: 8px auto 2px; border-radius: 999px; background: color-mix(in srgb, var(--text-secondary) 38%, transparent); }
  .msheet-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 4px 10px 8px 18px; }
  .msheet-title { flex: 1; min-width: 0; margin: 0; font-size: 1.18rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
  .msheet-x {
    flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%;
    background: var(--bg-primary); color: var(--text-secondary); font-size: .95rem; cursor: pointer;
  }
  .msheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 2px 14px 8px; -webkit-overflow-scrolling: touch; }
  .msheet-lead { margin: 0 0 12px 4px; font-size: .88rem; line-height: 1.5; color: var(--text-secondary); }
  .msheet-empty { margin: 18px 0; text-align: center; font-size: .9rem; color: var(--text-secondary); }
  .msheet-empty[hidden] { display: none; }
  .msheet-search {
    flex: none; display: flex; align-items: center; gap: 8px; margin: 0 14px 12px; padding: 0 12px; min-height: 44px;
    background: var(--bg-primary); border: 1px solid var(--border); border-radius: 14px; color: var(--text-muted);
  }
  .msheet-search input {
    flex: 1; min-width: 0; height: 44px; border: 0; background: none; outline: none; color: var(--text-primary);
    font: inherit; font-size: 1rem;
  }

  /* report chooser */
  .mrow {
    display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; padding: 12px;
    border: 1px solid var(--border); border-radius: 16px; background: var(--bg-primary);
    color: var(--text-primary); font: inherit; text-align: left; cursor: pointer;
  }
  .mrow-ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; font-size: 1.1rem; }
  .mrow-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .mrow-title { font-weight: 800; font-size: .98rem; line-height: 1.25; }
  .mrow-sub { font-size: .8rem; line-height: 1.35; color: var(--text-secondary); }
  .mrow-count { flex: none; font-size: .72rem; font-weight: 800; padding: 4px 8px; border-radius: 999px; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }

  /* "everything else" sheet */
  .maccount { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 4px 14px; border: 0; background: none; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
  .maccount-avatar { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 1rem; }
  .maccount-avatar.is-guest { background: var(--accent-bg); color: var(--accent); }
  .maccount-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .maccount-name { font-weight: 800; font-size: .98rem; line-height: 1.25; }
  .maccount-sub { font-size: .78rem; line-height: 1.4; color: var(--text-secondary); }
  .maccount-chev { color: var(--text-muted); font-size: .85rem; }
  .maccount-btn { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; }
  .mt-group { margin-bottom: 12px; }
  .mt-group[hidden] { display: none; }
  .mt-group h3 { margin: 0 0 2px 6px; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
  .mt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 2px; }
  .mtile {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 8px; border: 0; background: none;
    color: var(--text-primary); font: inherit; font-size: .72rem; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; border-radius: 14px;
  }
  .mtile[hidden] { display: none; }
  .mtile-ico { position: relative; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 17px; font-size: 1.12rem; background: var(--mt-soft, var(--accent-bg)); color: var(--mt, var(--accent)); }
  .mtile-badge { position: absolute; top: -4px; right: -8px; padding: 2px 5px; border-radius: 999px; background: var(--success); color: #fff; font-size: .5rem; font-weight: 800; letter-spacing: .02em; line-height: 1.2; }
  .mtile-badge[hidden] { display: none; }

  /* ---------- home ---------- */
  #view-home { padding-top: 4px; }
  .mh-head { padding: 6px 4px 2px; }
  .mh-date { margin: 0 0 4px; font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
  .mh-hello { margin: 0; font-size: 1.62rem; line-height: 1.15; letter-spacing: -.028em; font-weight: 800; }
  .mh-name { color: var(--accent); }
  .mh-lead { margin: 6px 0 0; font-size: .9rem; line-height: 1.5; color: var(--text-secondary); }
  .mh-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
  .mh-stat { min-width: 0; padding: 12px 8px 11px; text-align: center; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; }
  .mh-stat strong { display: block; font-size: 1.38rem; line-height: 1.1; letter-spacing: -.02em; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
  .mh-stat span { display: block; margin-top: 4px; font-size: .72rem; line-height: 1.3; font-weight: 700; color: var(--text-secondary); }
  .mh-stat i { display: block; width: 18px; height: 3px; margin: 0 auto 7px; border-radius: 999px; background: var(--info); }
  .mh-stat.is-open i { background: var(--warning); }
  .mh-stat.is-fixed i { background: var(--success); }
  .mh-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
  .mh-action {
    display: flex; flex-direction: column; align-items: flex-start; gap: 9px; min-width: 0; padding: 13px 13px 14px;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px;
    color: var(--text-primary); font: inherit; font-size: .9rem; font-weight: 700; line-height: 1.25; text-align: left; cursor: pointer;
  }
  .mh-action i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-size: 1rem; background: var(--mh-soft); color: var(--mh); }
  .mh-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 8px 4px; }
  .mh-block-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: -.01em; }
  .mh-link { flex: none; padding: 6px 6px; border: 0; background: none; color: var(--accent); font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; }
  .mh-list { overflow: hidden; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; }
  .mh-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
  .mh-row:last-child { border-bottom: 0; }
  .mh-row-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-size: .95rem; background: var(--mh-soft); color: var(--mh); }
  .mh-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .mh-row-place { font-size: .92rem; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mh-row-meta { font-size: .76rem; line-height: 1.3; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mh-pill { flex: none; padding: 4px 9px; border-radius: 999px; font-size: .7rem; font-weight: 800; white-space: nowrap; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary); }
  .mh-pill.is-new { background: var(--danger-light); border-color: transparent; color: var(--danger); }
  .mh-pill.is-review { background: var(--warning-light); border-color: transparent; color: #b45309; }
  .mh-pill.is-progress { background: var(--info-light); border-color: transparent; color: var(--info); }
  .mh-pill.is-resolved { background: var(--success-light); border-color: transparent; color: var(--success); }
  .mh-empty { margin: 0; padding: 18px 16px; font-size: .9rem; line-height: 1.5; color: var(--text-secondary); }
  .mh-tip { margin-top: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(135deg, var(--accent-bg), var(--bg-secondary) 72%); }
  .mh-tip-kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
  .mh-tip-text { margin: 0; font-size: .94rem; line-height: 1.55; color: var(--text-primary); }
  .mh-tip .mh-link { margin-left: -6px; padding-bottom: 0; }
  .mh-account { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--bg-secondary); }
  .mh-account-txt { flex: 1 1 180px; min-width: 0; }
  .mh-account-txt b { display: block; font-size: .95rem; line-height: 1.25; }
  .mh-account-txt p { margin: 3px 0 0; font-size: .8rem; line-height: 1.45; color: var(--text-secondary); }
  .mh-account-btn { flex: none; min-height: 42px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; }

  /* page entrance */
  .tab-panel.active.m-enter { animation: mRise .42s var(--m-ease); }
  #view-home.m-enter > * { animation: mRise .5s var(--m-ease) backwards; }
  #view-home.m-enter > :nth-child(2) { animation-delay: 45ms; }
  #view-home.m-enter > :nth-child(3) { animation-delay: 90ms; }
  #view-home.m-enter > :nth-child(4) { animation-delay: 135ms; }
  #view-home.m-enter > :nth-child(5) { animation-delay: 180ms; }
  #view-home.m-enter > :nth-child(n + 6) { animation-delay: 220ms; }

  /* ---------- existing popups become bottom sheets ---------- */
  .modal-backdrop { align-items: flex-end !important; padding: 0 !important; }
  .modal-backdrop :is(.modal-box, .legal-modal-box, .exp-box) {
    width: 100% !important; max-width: 100% !important; margin: 0 !important;
    max-height: calc(100dvh - 52px) !important; border-radius: 26px 26px 0 0 !important;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
    animation: mSheetUp .42s var(--m-ease) backwards !important;
  }
  .modal-backdrop .modal-head { touch-action: none; cursor: grab; position: relative; }
  .modal-backdrop .modal-head::before { content: ''; display: block; width: 40px; height: 4px; margin: -6px auto 6px; border-radius: 999px; background: color-mix(in srgb, var(--text-secondary) 38%, transparent); }
  .modal-backdrop .dragging { transition: none !important; }

  .notif-panel#notifPanel {
    position: fixed !important; top: auto !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important; max-width: none !important; height: auto !important; max-height: min(82dvh, 640px) !important;
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 26px 26px 0 0 !important; border-bottom: 0 !important;
    display: block !important; visibility: hidden; pointer-events: none;
    transform: translateY(104%); transition: transform .38s var(--m-ease), visibility 0s linear .38s;
    animation: none !important; z-index: 1140;
  }
  .notif-panel#notifPanel.show { visibility: visible; pointer-events: auto; transform: none; transition: transform .38s var(--m-ease); }
  body:has(#notifPanel.show)::after { content: ''; position: fixed; inset: 0; z-index: 1139; background: rgba(8, 24, 18, .42); animation: mFadeIn .3s; }

  .toast-container {
    left: 50% !important; right: auto !important; bottom: calc(var(--mobile-nav-height) + 8px) !important;
    width: calc(100% - 24px) !important; max-width: 480px; transform: translateX(-50%); align-items: stretch;
  }
  body.mnav-hidden .toast-container { bottom: 12px !important; }
  .toast { width: 100% !important; max-width: none !important; border-radius: 16px !important; touch-action: pan-y; }

  /* ---------- motion ---------- */
  @keyframes mPress { from { transform: scale(.955); } to { transform: none; } }
  @keyframes mRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes mTitleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes mSheetUp { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes mFadeIn { from { opacity: 0; } to { opacity: 1; } }

  html.reduce-motion .mnav, html.reduce-motion .mnav-pill, html.reduce-motion .mnav-item i,
  html.reduce-motion .mnav-fab, html.reduce-motion .mnav-fab i, html.reduce-motion .msheet,
  html.reduce-motion .notif-panel#notifPanel, html.reduce-motion .page-title { transition: none; }
  html.reduce-motion .mnav, html.reduce-motion .tab-panel.active.m-enter, html.reduce-motion #view-home.m-enter > *,
  html.reduce-motion .page-title.m-swap, html.reduce-motion .modal-backdrop :is(.modal-box, .legal-modal-box, .exp-box),
  html.reduce-motion .btn:active, html.reduce-motion .chip:active, html.reduce-motion .mh-action:active,
  html.reduce-motion .mrow:active, html.reduce-motion .mh-row:active, html.reduce-motion .mtile:active,
  html.reduce-motion body:has(#notifPanel.show)::after { animation: none !important; }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .mnav, .mnav-pill, .mnav-item i, .mnav-fab, .mnav-fab i, .msheet, .notif-panel#notifPanel, .page-title { transition: none; }
  .mnav, .tab-panel.active.m-enter, #view-home.m-enter > *, .page-title.m-swap,
  .modal-backdrop :is(.modal-box, .legal-modal-box, .exp-box) { animation: none !important; }
}
