/* ============ responsive-pro.css · one consistent layout system for every screen ============
   Loaded last on purpose. Breakpoints used everywhere:
   phone  ≤ 560 · tablet ≤ 820 (sidebar becomes a drawer) · laptop 821-1499 · desktop ≥ 1500 · wide ≥ 1900
   Also handles: landscape phones (short screens), notches (safe areas), touch targets and very narrow screens. */

/* ---------- safety net: nothing may push the page sideways ---------- */
html,body{max-width:100%;overflow-x:hidden}
main,.vw,.pg-in,.pn,.card{min-width:0}
img,video,canvas{max-width:100%;height:auto}
.bub,.pn,.ph p,.mt{overflow-wrap:anywhere}
.bub pre,.cb pre{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.bub table{max-width:100%}

/* ---------- notches and rounded corners (landscape phones, foldables) ---------- */
@supports(padding:max(0px)){
  .app{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
  .dash{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
}

/* ---------- stat cards: two across on phones instead of one long column ---------- */
.grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,132px),1fr))}
@media(min-width:561px){.grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr))}}

/* ---------- new-chat welcome: always fully reachable, never cut off at the top ---------- */
.nc{justify-content:flex-start;min-height:min(64vh,100%)}
.nc>:first-child{margin-top:auto}
.nc>:last-child{margin-bottom:auto}
@media(max-height:760px){.nc{padding-top:12px}.nc-mark{transform:scale(.85);margin-bottom:12px}.nc-grid{margin-top:20px}}
@media(max-height:620px){.nc-mark,.nc .nc-sub{display:none}.nc .nc-h{font-size:clamp(24px,5vw,32px)}.nc-grid{gap:8px;margin-top:16px}.nc-perks{display:none}}
/* phones: a calm, single-column welcome with comfortable touch targets */
@media(max-width:560px){
  .nc{padding:18px 0 6px;min-height:0}
  .nc-mark{width:56px;height:56px;margin-bottom:18px}
  .nc .nc-mark .logo{width:50px;height:50px;border-radius:15px;font-size:22px}
  .nc .nc-sub{font-size:13.5px;max-width:300px}
  .nc-grid{grid-template-columns:1fr;gap:8px;margin-top:22px}
  .nc-card{min-height:62px;padding:11px 14px;gap:12px;border-radius:14px}
  .nc-tx small{-webkit-line-clamp:1}
  .nc-perks{display:none}   /* the line under the greeting already says it; keeps the phone screen uncluttered */
}

/* ---------- Premium banner: stacks cleanly on phones ---------- */
.ub-tx b{flex-wrap:wrap}
@media(max-width:560px){
  .upbar{margin:8px 12px 0;border-radius:14px}
  .ub-main{flex-wrap:nowrap;align-items:center;gap:10px;padding:9px 2px 9px 10px}
  .ub-ic{width:34px;height:34px;border-radius:10px}.ub-ic svg{width:17px;height:17px}
  .ub-tx{flex:1 1 auto;gap:0}
  .ub-tx b{font-size:13.5px;line-height:1.3;gap:6px}
  .ub-tag,.ub-chips{display:none}
  .ub-go{flex:none;min-height:36px;padding:0 13px;font-size:13px;border-radius:10px}.ub-go .ub-arr{display:none}
  .ub-x{align-self:center;margin:0 6px 0 0}
  .ub-x::after{content:"";position:absolute;inset:-9px}
}
@media(max-width:380px){.ub-ic{display:none}.ub-main{padding-left:12px}.ub-go{padding:0 12px}}

/* ---------- composer ---------- */
.comp{padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px))}
.fbar{gap:10px;flex-wrap:wrap}
.ebtn{position:relative}.ebtn::after{content:"";position:absolute;inset:-8px -4px}
.pmenu,.emenu{max-width:calc(100vw - 24px);max-height:min(60dvh,420px);overflow-y:auto}

/* ---------- touch screens: every control is easy to hit (44px) ---------- */
@media(pointer:coarse){
  .nv a{min-height:44px}
  .hi{min-height:40px;display:flex;align-items:center}
  .up,.new,.me,.xl,.pwa-nav{min-height:44px}
  .xl{display:flex;align-items:center;gap:8px}
  .qt,.tab,.seg button,.dt{min-height:44px}
  .pwa-act button{min-height:44px}
  .ub-go{min-height:40px}
  .cb-h button{min-height:36px;padding:8px 14px}
  .acts .ab,.ab{min-height:40px}
  .pill{min-height:40px}
}

/* ---------- phones ---------- */
@media(max-width:560px){
  .pg-in{padding-bottom:12px}
  .ph h2{font-size:26px}
  .page{padding:2px 14px 40px}
  .card{max-height:calc(100dvh - 24px)}
  .ov{padding:12px}
  .dm{padding:14px 12px}
  .dm .tw{max-height:none}
  .dh .btn{flex:1 1 calc(50% - 6px)}
  .tbv{margin-left:-4px;margin-right:-4px}
}
@media(max-width:380px){
  header{padding:8px 10px;padding-top:calc(8px + env(safe-area-inset-top,0px));gap:4px}
  header h1{font-size:14px}
  .pill{padding:5px 9px}
  .col{padding:8px 12px 20px}
  .nc .nc-h{letter-spacing:-.8px}
  .usage,.me{padding:8px}
}

/* ---------- landscape phones and any short screen ---------- */
@media(max-height:520px) and (orientation:landscape){
  header{padding-top:calc(6px + env(safe-area-inset-top,0px));padding-bottom:6px}
  .ib{width:36px;height:36px}
  .comp{padding-top:4px;padding-bottom:calc(6px + env(safe-area-inset-bottom,0px))}
  .fbar{display:none}
  .upbar{display:none!important}
  .col{padding-top:4px}
  .card{max-height:calc(100dvh - 16px);padding:20px 18px}
  .ov{align-items:center}
  aside{padding-top:10px;padding-bottom:10px}
  .usage{display:none}
}

/* ---------- tablets: the drawer is full height and content uses the space ---------- */
@media(min-width:561px) and (max-width:820px){
  .pg-in{max-width:720px}
  .page{padding:2px 24px 48px}
  .col{max-width:720px}
}

/* ---------- laptops ---------- */
@media(min-width:821px) and (max-width:1499px){
  .pg-in{max-width:900px}
}

/* ---------- big desktops and ultra-wide monitors ---------- */
@media(min-width:1500px){
  .pg-in{max-width:1040px}
  .col,.box,.bwrap{max-width:860px}
}
@media(min-width:1900px){
  html{font-size:17px}
  body{font-size:16px}
  aside{width:300px}
  .pg-in{max-width:1180px}
  .col,.box,.bwrap{max-width:940px}
  .dm{padding:32px 44px}
}

/* ---------- admin dashboard: tab bar glides, tables scroll inside themselves ---------- */
@media(max-width:820px){
  .dn{scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none;gap:6px}
  .dn::-webkit-scrollbar{display:none}
  .dt{scroll-snap-align:start;flex:none}
  .dn #dBack{margin-top:0!important;margin-left:auto}
  .dm .tw,.dm table{max-width:100%}
  .dm .tw{overflow-x:auto;-webkit-overflow-scrolling:touch}
}

/* ---------- quest/campaign tab rows scroll sideways with a soft edge instead of being cut ---------- */
.qtabs,.seg,.qts{-webkit-overflow-scrolling:touch;scrollbar-width:none}
.qtabs::-webkit-scrollbar,.seg::-webkit-scrollbar,.qts::-webkit-scrollbar{display:none}

/* ---------- toasts never cover the composer on small screens ---------- */
@media(max-width:560px){
  .toast,#toast{max-width:calc(100vw - 32px)}
}

/* ---------- keyboard-open phones: keep the composer visible ---------- */
@supports(height:100dvh){.app{height:100dvh}.dash{height:100dvh}}

@media print{
  aside,.comp,header,.upbar,.pwa{display:none!important}
  body{background:#fff;color:#000;overflow:visible}
  .app,main,.vw{display:block;height:auto}
}

/* ---------- phone header: title keeps its room, points pill drops its "pts" label ---------- */
@media(max-width:560px){
  header{gap:6px;padding-left:10px;padding-right:10px}
  header h1{font-size:15px}
  .pill{padding:5px 11px}.pill span{display:none}
  .tag{padding:3px 9px;font-size:10.5px}
}

/* ---------- phone composer: one tidy rounded bar with real touch targets ---------- */
@media(max-width:560px){
  .comp{padding-top:6px}
  .box{padding:5px;gap:2px;border-radius:24px}
  textarea{padding:10px 4px;line-height:1.45}
  .plus{width:42px;height:42px}
  .snd{width:42px;height:42px}
  .fbar{margin-top:6px;flex-wrap:nowrap;justify-content:space-between}
  .fnote{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
}
@media(pointer:coarse){.ebtn{height:30px}}
