/* =========================================================
   Mobile-first polish layer — loaded LAST, after every other stylesheet.
   Goals: no sideways scrolling, 16px inputs (stops iOS zoom-on-focus),
   comfortable 44px tap targets, safe-area aware bars, easy-to-use forms.
   ========================================================= */

html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body.store{overflow-x:hidden;-webkit-tap-highlight-color:rgba(176,54,95,.12)}
body.store img,body.store video,body.store svg{max-width:100%}
body.store img{height:auto}

/* Inputs: 16px text so mobile browsers never zoom the page on focus */
body.store input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]),
body.store select,body.store textarea{font-size:16px;max-width:100%}
body.store input,body.store select,body.store textarea{touch-action:manipulation}
body.store button,body.store .btn,body.store a.btn{touch-action:manipulation}

/* ---------- Login / Register ---------- */
body.page-auth main{min-height:56vh}
.auth-card{box-shadow:var(--shadow);}
.auth-card .field{margin-bottom:16px}
.auth-card .field label{margin-bottom:6px}
.auth-card input{min-height:50px;width:100%}
.auth-card .form-row{gap:0 14px}
.auth-card--wide{max-width:560px}
.auth-card .alt-2{margin-top:6px}
.auth-card .alt-2 a{font-weight:600;color:var(--muted)}
.pass-wrap{position:relative}
.pass-wrap input{padding-right:104px}
body.store .pass-toggle{position:absolute;right:6px;top:50%;transform:translateY(-50%);min-height:38px;padding:0 12px;border-radius:8px;background:var(--rose-soft);color:var(--rose-dark);font-size:.8rem;font-weight:700;border:0}
body.store .pass-toggle:hover{background:var(--rose-soft);color:var(--rose-dark)}

@media(max-width:640px){
  .auth-card,.track-card{margin:18px auto 28px;padding:22px 18px;border-radius:18px}
  .auth-card h1,.track-card h1{font-size:1.65rem}
  .auth-card .form-row{grid-template-columns:1fr}
  body.page-auth .announce{display:none}
}

/* ---------- Header / navigation ---------- */
@media(max-width:820px){
  body.store .announce .announce-alt{display:none}
  body.store .announce .container{justify-content:center;text-align:center}
  body.store .nav-links a{min-height:48px;display:flex;align-items:center}
  body.store .catbar .container{-webkit-overflow-scrolling:touch;scroll-snap-type:x proximity;padding-bottom:2px}
  body.store .catbar a{white-space:nowrap;min-height:44px;display:inline-flex;align-items:center;scroll-snap-align:start}
  body.store .nav-icon,body.store .menu-toggle{min-width:44px;min-height:44px}
}

/* ---------- Bottom app bar: respect phone notches, keep content clear of it ---------- */
@media(max-width:820px){
  body.store{padding-bottom:calc(84px + env(safe-area-inset-bottom))}
  body.store .bottom-nav{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
  body.store .bottom-nav a{min-height:48px;justify-content:center}
  body.store .back-to-top{bottom:calc(92px + env(safe-area-inset-bottom))}
  body.store .site-footer .sf-grid a{display:block;padding:10px 0}
  body.has-checkout{padding-bottom:calc(150px + env(safe-area-inset-bottom))}
}

/* ---------- Product page: tidy purchase buttons ---------- */
@media(max-width:640px){
  body.store .product-page .actions form{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:stretch}
  body.store .product-page .actions .qty-stepper{grid-column:1/-1;justify-self:start}
  body.store .product-page .actions .btn,
  body.store .product-page .actions .btn-buy{width:100%;min-height:50px;padding:10px 12px;font-size:.92rem;text-align:center;line-height:1.3}
  body.store .product-page .actions form:last-child .btn{grid-column:1/-1}
  body.store .product-page .actions form:first-child .btn svg{display:none}
}
@media(max-width:380px){
  body.store .product-page .actions form{grid-template-columns:1fr}
}

/* ---------- Product listing / filters ---------- */
@media(max-width:640px){
  body.store select,body.store input[type=search],body.store input[type=text],body.store input[type=number]{min-height:46px}
}

/* ---------- Tables: horizontal scroll with a visible edge; never break the layout ---------- */
.table-scroll{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
body:not(.admin-page) .table-scroll table{min-width:520px}
@media(max-width:640px){
  body:not(.admin-page) .table-scroll .table th,body:not(.admin-page) .table-scroll .table td{padding:10px 12px;font-size:.88rem;white-space:nowrap}
}

/* ---------- Cards, grids and misc ---------- */
@media(max-width:640px){
  body.store h1{font-size:1.6rem}
  body.store h2{font-size:1.35rem}
  body.store .btn,body.store button{min-height:46px}
  body.store .alert{font-size:.9rem}
  body.store .flash-stack{margin-top:12px}
}
@media(max-width:360px){
  body.store .brand span{font-size:1rem}
  body.store .nav-tools{gap:2px}
}

/* ---------- Respect "reduce motion" and landscape phones ---------- */
@media(max-height:480px) and (orientation:landscape){
  body.store .bottom-nav{position:static}
  body.store{padding-bottom:0}
}


/* =========================================================
   Chat entry points, badges, install-app banner
   ========================================================= */
[hidden]{display:none!important}
.nav-badge{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 5px;margin-left:4px;border-radius:99px;background:var(--rose,#b0365f);color:#fff;font-size:.68rem;font-weight:800;line-height:1;vertical-align:middle}
.sidebar .nav-badge{margin-left:auto}
.nav-chat-ic{position:relative}
@media(max-width:820px){ body.store .nav-chat-ic{display:none} }
.bottom-nav a.bn-chat{position:relative}
.bn-badge{position:absolute;top:0;left:calc(50% + 6px);min-width:17px;height:17px;padding:0 4px;border-radius:99px;background:var(--rose,#b0365f);color:#fff;font-size:.62rem;font-style:normal;font-weight:800;display:grid;place-items:center;border:2px solid #fff;box-sizing:content-box}

/* Product page: "Chat with admin" */
.chat-cta{display:flex;align-items:center;gap:14px;margin:14px 0 4px;padding:14px 16px;border-radius:16px;background:var(--rose-tint,#fdf4f7);border:1.5px solid var(--rose-soft,#f3d3de);color:inherit;min-height:64px;transition:transform .15s,box-shadow .15s}
.chat-cta:hover{box-shadow:0 8px 22px -14px rgba(176,54,95,.6);transform:translateY(-1px)}
.chat-cta:active{transform:scale(.99)}
.chat-cta-ic{flex:none;width:44px;height:44px;border-radius:50%;background:var(--rose,#b0365f);color:#fff;display:grid;place-items:center}
.chat-cta-tx{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.35}
.chat-cta-tx strong{font-size:1rem;color:var(--rose-dark,#8e2a4c)}
.chat-cta-tx small{font-size:.8rem;color:#6d5a66}
.chat-cta-go{font-size:1.6rem;color:var(--rose,#b0365f);line-height:1}

/* Install app banner */
.pwa-banner{position:fixed;left:12px;right:12px;bottom:calc(86px + env(safe-area-inset-bottom));z-index:450;display:flex;align-items:center;gap:12px;padding:12px 12px 12px 14px;background:#2a1b26;color:#fff;border-radius:16px;box-shadow:0 18px 40px -12px rgba(0,0,0,.5);max-width:520px;margin:0 auto;animation:pwaup .35s cubic-bezier(.22,1,.36,1)}
.pwa-banner img{width:44px;height:44px;border-radius:11px;flex:none;background:#fdf4f7}
.pwa-text{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.3}
.pwa-text strong{font-size:.95rem}
.pwa-text span{font-size:.78rem;opacity:.85}
.pwa-go{flex:none;border:0;background:var(--rose,#b0365f);color:#fff;font-weight:800;border-radius:11px;padding:0 16px;min-height:42px;cursor:pointer}
.pwa-x{flex:none;border:0;background:transparent;color:#fff;opacity:.7;width:34px;min-height:34px;font-size:1rem;cursor:pointer}
@keyframes pwaup{from{transform:translateY(20px);opacity:0}to{transform:none;opacity:1}}
@media(min-width:821px){ .pwa-banner{bottom:20px;left:auto;right:20px;margin:0} }
body.chat-open .pwa-banner{display:none!important}

/* Admin on phones: drop the storefront chrome so the panel gets the whole screen */
@media(max-width:820px){
  body.admin-page .announce,body.admin-page .catbar,body.admin-page .nav-search,body.admin-page .bottom-nav,body.admin-page .back-to-top{display:none!important}
  body.admin-page{padding-bottom:calc(24px + env(safe-area-inset-bottom))!important}
  body.admin-page .topbar .nav{padding-top:8px;padding-bottom:8px}
}
