/* ==========================================================================
   Mobile safety + simplification layer (loaded last, all pages)
   ========================================================================== */

/* Never let any page scroll sideways. clip (not hidden) keeps position: sticky working. */
html, body { overflow-x: clip; }
/* Grid children must be allowed to shrink below their content width. */
.sb-pdp, .sb-planner, .sb-overview, .sb-qa, .sb-shop, .sb-hero__grid, .sb-help, .sb-acompany, .sb-wlayout { min-width: 0; }
.sb-pdp > *, .sb-planner > *, .sb-planner__main, .sb-overview > *, .sb-qa > *, .sb-shop > *, .sb-hero__grid > *, .sb-buy > *, .sb-wlayout > * { min-width: 0; }
@media (max-width: 960px) { .sb-pdp, .sb-overview, .sb-qa, .sb-shop, .sb-hero__grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) { .sb-planner { grid-template-columns: minmax(0, 1fr); } }

/* ---- header hides on scroll down, returns on scroll up (phones) ---- */
:root { --sb-hdr: var(--sb-header-h); }
@media (max-width: 760px) {
  .sb-header { transition: transform .25s var(--sb-ease); }
  body.sb-hdr-hidden { --sb-hdr: 0px; }
  body.sb-hdr-hidden .sb-header { transform: translateY(-100%); }
  .sb-secnav { top: var(--sb-hdr) !important; transition: top .25s var(--sb-ease); }
}

/* ---- What it can run: one compact card on phones ---- */
@media (max-width: 760px) {
  .sb-run .sb-block__head { margin-bottom: 14px; }
  .sb-run .sb-block__head p { font-size: var(--sb-t-14); }
  .sb-run__spec { display: none; }
  .sb-planner .sb-gauge { display: none; }
  .sb-planner .sb-gauge-mini {
    display: grid !important; gap: 10px; position: sticky; top: calc(var(--sb-hdr) + 60px); z-index: 20;
    margin: 0 0 16px; padding: 14px 16px; border-radius: 18px; background: var(--sb-graphite); color: var(--sb-white);
    opacity: 1 !important; transform: none !important; pointer-events: auto !important; box-shadow: 0 14px 30px -20px rgba(14, 27, 36,.7);
    transition: top .25s var(--sb-ease);
  }
  .sb-gm__top { display: flex; align-items: baseline; gap: 10px; }
  .sb-gm__top b { font-size: 1.75rem; font-weight: 680; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; min-width: 2.6ch; }
  .sb-gm__top span { flex: 1; font-size: var(--sb-t-13); color: var(--sb-fog); font-variant-numeric: tabular-nums; }
  .sb-gm__clear { background: none; border: 0; padding: 6px 0; color: var(--sb-fog); font-size: var(--sb-t-13); text-decoration: underline; cursor: pointer; }
  .sb-gauge-mini .sb-meter { --segs: 20; --h: 10px; gap: 2px; --off: var(--sb-iron); }
  .sb-gm__status { margin: 0; font-size: var(--sb-t-14); font-weight: 560; color: #DADDE2; }
  .sb-gauge-mini[data-state="ok"] .sb-gm__status { color: #6EE7A8; }
  .sb-gauge-mini[data-state="tight"] .sb-gm__status { color: var(--sb-volt); }
  .sb-gauge-mini[data-state="over"] .sb-gm__status, .sb-gauge-mini[data-state="over"] b { color: #3CC48A; }
  .sb-gm__up { font-size: var(--sb-t-13); font-weight: 600; color: var(--sb-volt); text-decoration: none; }
  .sb-gm__up[hidden] { display: none; }
  .sb-presets { margin-bottom: 18px; }
  .sb-presets__label { display: none; }
  .sb-planner__group h3 { margin-bottom: 8px; }
  .sb-planner__groups { gap: 20px; }
  .sb-planner__note { font-size: var(--sb-t-12); }
}
@media (min-width: 761px) { .sb-planner .sb-gauge-mini { display: none !important; } }

/* ---- simple mobile menu ---- */
.sb-dtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 14px; }
.sb-dtile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 128px; padding: 12px; border-radius: 16px; background: var(--sb-mist); text-decoration: none; overflow: hidden; }
.sb-dtile img { position: absolute; top: 8px; right: 8px; width: 64%; height: 62%; object-fit: contain; mix-blend-mode: multiply; }
.sb-dtile b { position: relative; font-size: var(--sb-t-16); font-weight: 620; line-height: 1.2; }
.sb-dtile span { position: relative; font-size: var(--sb-t-12); color: var(--sb-slate); }
.sb-dsec { margin: 10px 0 2px; font-size: var(--sb-t-13); font-weight: 600; color: var(--sb-slate); }
.sb-dlinks { list-style: none; margin: 0 0 6px; padding: 0; }
.sb-dlinks a { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 1px solid var(--sb-line); text-decoration: none; font-size: var(--sb-t-16); font-weight: 520; }
.sb-dlinks a svg { width: 18px; height: 18px; color: var(--sb-slate); }
.sb-dlinks a small { color: var(--sb-slate); font-size: var(--sb-t-13); font-weight: 450; }
.sb-dcall { position: sticky; bottom: 0; margin: 16px calc(var(--sb-gutter) * -1) calc(-24px - env(safe-area-inset-bottom)); padding: 12px var(--sb-gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--sb-white); border-top: 1px solid var(--sb-line); }
.sb-dcall .sb-btn { width: 100%; }
.sb-dcall .sb-btn svg { width: 18px; height: 18px; }

/* ---- app-style bottom bar (phones, not on product/cart/checkout) ---- */
.sb-tabbar { display: none; }
@media (max-width: 760px) {
  .sb-tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--sb-line); }
  .sb-tabbar a, .sb-tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 48px; padding: 6px 0 2px; border: 0; background: none; font-size: 11px; font-weight: 560; color: var(--sb-slate); text-decoration: none; cursor: pointer; }
  .sb-tabbar svg { width: 22px; height: 22px; }
  .sb-tabbar [aria-current="page"] { color: var(--sb-ink); }
  .sb-tabbar .sb-cart-count { top: 2px; right: calc(50% - 22px); }
  body.sb-has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
