/* ================= Gladzzy Web — phones and tablets =================
   One site, responsive. Desktop (≥1024 px) is not touched by this file: every rule below is either
   inside a max-width / touch media query or styles an element that only exists for phones
   (the tab bar, the app strip, back links), and those are display:none by default.
   Breakpoints: tablet 768–1023 (style.css already stacks the layouts; tweaks here),
   phone <768 (patterns of the mobile app: compact header, bottom tab bar, sheets, single-pane messenger).
   Markers set by core.js renderAll(): body[data-page="home|cat|search|item|seller|favs|post|import|rentcal|chats|profile|notfound"],
   body[data-sub] = "open" for an open chat, the profile section otherwise. */

/* phone-only elements: hidden everywhere else */
.tabbar,.appstrip,.pback,.sidehead,.mcall,.galdots{display:none}

/* ---------- touch devices of any width: iOS zoom, tap equivalents of hover-only controls ---------- */
@media (pointer:coarse){
 input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important}
 /* channel / group post delete: hover on desktop, a tap on the post shows it on touch screens */
 .b .pdel{visibility:hidden}
 .b.act .pdel{visibility:visible;opacity:1}
 .phbtns{opacity:1}
 .ctabs .chip{-webkit-touch-callout:none;-webkit-user-select:none}
 .citem{-webkit-touch-callout:none}
}

/* ---------- tablet + phone (<1024) ---------- */
@media (max-width:1023px){
 /* filter panel: a header with «Закрыть» inside the drawer */
 .side.open .sidehead{display:flex;align-items:center;gap:8px;padding:12px 10px 12px 18px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--surface);z-index:2}
 .sidehead h3{flex:1;margin:0;font-size:18px;font-weight:800}
 .side .sfoot{position:sticky;bottom:0;background:var(--surface);z-index:2;padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))}
 .side{overscroll-behavior:contain}
 .itemlay{padding-bottom:24px}
}

/* listing page stacked (style.css: one column under 900 px): photos, title, price and buttons, then the details */
@media (max-width:900px){
 .itemmain{display:contents}
 .itemmain>*{order:1}
 .itemmain>div:first-child{order:0}
 .itemmain>.gal{order:-1}
 .buybox{order:0}
}

/* ---------- touch screens under 1024 px (phones and tablets): tap targets of at least 44 px ---------- */
@media (max-width:1023px) and (pointer:coarse){
 .btn{height:48px}
 .btn.sm{height:44px}
 .icbtn{width:44px;height:44px}
 .chip{height:44px}
 .seg button{height:44px}
 .geo{height:44px!important}
 .card .fav{width:44px!important;height:44px!important}
 .dchip{min-height:44px}
 .prow,.pv{min-height:48px;flex-shrink:0}
 .rzoom button{width:44px;height:44px}
 .pfcsv{min-height:44px;display:inline-flex;align-items:center}
 .tgl{box-sizing:content-box;border:8px solid transparent;background-clip:padding-box;margin:-8px}
 #msg{min-height:44px}
 .csearch{min-height:44px}
 .dealbar a.grow,.chtop a.grow{min-height:44px}
 .b .pdel{width:44px;height:44px}
 .b.me .pdel{left:-48px;margin-top:-22px}
 button.chip[data-act="copyId"]{height:44px!important}
 .sbox.pks{height:48px;min-height:48px;flex:none}
 .pcontent a.small{display:inline-flex;align-items:center;min-height:44px}
 .ctabs .chip{height:44px!important}
 .dchip{min-width:44px;justify-content:center}
 .calg{gap:2px}
 .rcg button{height:44px}
 .geolist button{min-height:48px}
 .geolist{max-height:none}
 .logo{min-height:44px;display:flex;align-items:center}
 .sbox .go{height:44px}
 .hlogin{height:44px}
 .barr{width:44px;height:44px}
 .seeall{min-height:44px}
 .card .fav{width:44px;height:44px}
 .reportlink{min-height:44px}
 .lrow{min-height:52px}
 .chk{min-height:44px}
 .crumbs a{display:inline-flex;align-items:center;min-height:44px}
 .menu button{min-height:48px}
 .clist button{min-height:44px}
 .navl button{min-height:48px}
 .accb{min-height:56px}
 .gal .thumbs button{min-height:44px}
 .sht{min-height:44px}
 /* a min-height replaces min-height:auto: rows in scrolling flex columns must not shrink below their content */
 .geolist button,.menu button,.lrow,.navl button,.accb,.clist button,.citem,.dchip,.chip{flex-shrink:0}
 /* sheet content scrolls; its blocks (buttons with a fixed height too) keep their size */
 .mbody>*{flex-shrink:0}
 .cathead .sbox{height:46px!important}
 .side .inp,.side .fs button.grow{min-height:46px}
 .composer .icbtn,.composer .send{width:44px;height:44px;flex:none}
 .wallet .wb button{height:44px}
}

/* =====================================================================
   PHONE (<768)
   ===================================================================== */
@media (max-width:767px){
 :root{--hdr:62px;--tabbar:60px;--side:max(16px,env(safe-area-inset-left,0px));--sider:max(16px,env(safe-area-inset-right,0px))}
 html{scroll-padding-top:calc(var(--hdr) + 8px);-webkit-text-size-adjust:100%}
 body{padding-bottom:calc(var(--tabbar) + env(safe-area-inset-bottom,0px))}
 main{min-height:calc(100dvh - 160px)}

 /* ---------- header: row 1 logo + «Где искать» (scrolls away), row 2 search (stays) ---------- */
 .top{top:calc(env(safe-area-inset-top,0px) - 50px)}
 .topin{height:auto;flex-wrap:wrap;gap:0 10px;padding-top:0;padding-bottom:10px}
 .logo{width:104px;margin-left:-4px;height:50px;display:flex;align-items:center}
 .geo{order:2;margin-left:auto;width:auto!important;max-width:58%;padding:0 12px!important;justify-content:flex-start!important;border-radius:999px;gap:6px}
 .geo .lb{display:flex!important;flex-direction:row;align-items:center;gap:4px;min-width:0}
 .geo .lb small{display:none}
 .geo .lb span{max-width:none;font-size:14px}
 .sbox{order:3;flex:1 1 100%;max-width:none;height:46px;border-radius:14px;padding:0 4px 0 14px}
 .sbox input{font-size:16px}
 .sbox .catsel,.sbox .go{display:none!important}
 .postbtn,.hic{display:none!important}

 /* ---------- bottom tab bar (app TabBar) ---------- */
 .tabbar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:40;background:var(--surface);border-top:1px solid var(--line);
  padding:0 env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);box-shadow:0 -8px 24px -18px rgba(10,30,90,.35);border-radius:18px 18px 0 0}
 .tabbar a{position:relative;height:var(--tabbar);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-decoration:none;color:var(--muted);font-size:11px;font-weight:600;min-width:0;-webkit-tap-highlight-color:transparent}
 .tabbar a.on{color:var(--accent)}
 .tabbar a.on::before{content:"";position:absolute;top:0;left:50%;width:28px;height:3px;margin-left:-14px;border-radius:0 0 3px 3px;background:var(--accent)}
 .tabbar .tbi{position:relative;display:grid;place-items:center;height:26px}
 .tabbar .tbl{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 2px}
 .tabbar .badge{position:absolute;top:-5px;left:calc(50% + 6px);min-width:18px;height:18px;font-size:10.5px;box-shadow:0 0 0 2px var(--surface)}
 .tabbar .hav{width:26px;height:26px;font-size:11px;box-shadow:none}
 .tabbar a.on .hav{box-shadow:0 0 0 2px var(--accent)}
 body[data-page="item"] .tabbar,body[data-page="chats"][data-sub="open"] .tabbar,body[data-page="post"] .tabbar,body[data-page="rentcal"] .tabbar,body[data-page="import"] .tabbar{display:none}
 body[data-page="item"],body[data-page="chats"][data-sub="open"],body[data-page="post"],body[data-page="rentcal"],body[data-page="import"]{padding-bottom:0}

 /* ---------- app strip (open in the app / download) ---------- */
 .appstrip:not([hidden]){display:flex;align-items:center;gap:10px;padding:8px var(--sider) 8px 6px;padding-top:calc(8px + env(safe-area-inset-top,0px));background:var(--surface);border-bottom:1px solid var(--line);font-size:13px;line-height:1.25}
 .appstrip .asx{width:44px;height:44px;display:grid;place-items:center;color:var(--muted);flex:none;margin-right:-6px}
 .appstrip img{width:40px;height:40px;border-radius:10px;flex:none}
 .appstrip b{display:block;font-size:14px}
 .appstrip .muted{font-size:12px}
 .appstrip .btn{height:36px;padding:0 14px;border-radius:999px;font-size:13.5px;flex:none}
 body:has(.appstrip:not([hidden]))::before{background:var(--surface)}

 /* ---------- common ---------- */
 .crumbs{padding:12px 0 6px;font-size:12.5px;flex-wrap:nowrap;overflow-x:auto;white-space:nowrap;scrollbar-width:none}
 .crumbs::-webkit-scrollbar{display:none}
 .crumbs a{padding:6px 0}
 .panel{border-radius:16px}
 .sec{padding:16px}
 .two{gap:8px}
 .inp{height:48px}
 .specs{grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:8px 12px}
 .specs dt,.specs dd{font-size:14px;overflow-wrap:anywhere}
 .empty{padding:36px 16px}
 .h2{font-size:18px}
 .lrow{padding:12px 16px;min-height:56px}
 .chk{min-height:44px}
 .chk input{width:22px;height:22px}
 .optin input{width:22px;height:22px}
 .tgl{width:50px;height:30px}.tgl::after{width:24px;height:24px}.tgl.on::after{transform:translateX(20px)}

 /* ---------- modals → bottom sheets, menus → action sheets ---------- */
 #modal{place-items:end stretch;padding:0;padding-top:calc(env(safe-area-inset-top,0px) + 24px)}
 .mdl,.mdl.wide,.mdl.mid,.mdl.auth,.mdl.pick{width:100%;max-width:none;max-height:calc(100dvh - env(safe-area-inset-top,0px) - 24px);border-radius:22px 22px 0 0;animation:sheetup .22s ease-out}
 .mdl::before{content:"";display:block;width:40px;height:5px;border-radius:3px;background:var(--line);margin:8px auto -4px;flex:none;position:relative;z-index:2}
 .mdl.auth::before{position:absolute;left:50%;margin-left:-20px;background:rgba(255,255,255,.55)}
 .mdl.wide,.mdl.mid{height:calc(100dvh - env(safe-area-inset-top,0px) - 24px)}
 .mhead{padding:12px 8px 10px 16px}
 .mhead h3{font-size:18px}
 .mbody{padding:16px;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;flex:1 1 auto}
 .mfoot{padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));flex-wrap:wrap}
 .mfoot .btn{flex:1 1 auto}
 .mfoot .grow{display:none}
 .mbody:last-child{padding-bottom:calc(16px + env(safe-area-inset-bottom,0px))}
 .menu{left:0!important;right:0!important;top:auto!important;bottom:0;min-width:0;max-height:80dvh;overflow-y:auto;border-radius:22px 22px 0 0;padding:10px 10px calc(10px + env(safe-area-inset-bottom,0px));
  box-shadow:0 0 0 100vmax var(--scrim),var(--shadow-lg);animation:sheetup .2s ease-out;overscroll-behavior:contain}
 .menu::before{content:"";display:block;width:40px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 8px;flex:none}
 .menu button{min-height:48px;font-size:15px}
 .proc .pd{margin:16px}
 #toast{bottom:calc(var(--tabbar) + 14px + env(safe-area-inset-bottom,0px));max-width:calc(100vw - 32px)}
 #push{top:calc(env(safe-area-inset-top,0px) + 8px);right:8px;left:8px;width:auto;max-width:none}

 /* ---------- home ---------- */
 .hero{padding-block:14px 52px}
 .cats{gap:10px;justify-content:flex-start;margin-inline:calc(var(--side) * -1);padding-inline:var(--side);scroll-padding-inline:var(--side);scroll-snap-type:x proximity;-webkit-mask-image:none;mask-image:none}
 .cat{flex:0 0 96px!important;width:96px!important;height:96px!important;scroll-snap-align:start}
 .cat-ic{width:42px!important;height:42px!important}
 .cat-nm{max-width:82px!important}
 .cat:hover{transform:none}
 .bnrow{margin-top:16px;margin-inline:calc(var(--side) * -1)}
 .banners{padding-inline:var(--side);scroll-padding-inline:var(--side);gap:10px}
 .banner{flex:0 0 62vw!important;min-width:0!important;max-width:260px;height:100px}
 .barr{display:none}
 .sheet{border-radius:24px 24px 0 0;margin-top:-30px;padding-block:20px 24px}
 .fhead h2{font-size:22px}
 .seeall{font-size:15px;min-height:44px}
 .chips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin-inline:calc(var(--side) * -1);padding-inline:var(--side);margin-bottom:14px}
 .chips::-webkit-scrollbar{display:none}
 .recent{margin-inline:calc(var(--side) * -1);padding-inline:var(--side);scrollbar-width:none}
 .grid,.grid.c4{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 10px}
 .card:hover{transform:none;box-shadow:none}
 .card .cb{padding:10px 10px 12px}

 /* ---------- category / search: filters as a full-screen sheet ---------- */
 .cathead{gap:10px;margin-bottom:12px}
 .cathead>div:first-child{width:100%}
 .cathead h1{font-size:24px}
 .cathead>div:last-child{width:100%;flex-wrap:nowrap!important}
 .cathead .sbox{width:auto!important;flex:1;height:46px!important}
 .cathead .fbtn{height:46px;flex:none}
 .side{inset:0!important;width:100%!important;height:100dvh!important;border-radius:0!important;border:0}
 .side.open{padding-top:env(safe-area-inset-top,0px)}
 .side .inp{height:48px}
 .fs{padding:14px 16px}
 .clist button{min-height:44px}
 .drill,.resbar{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin-inline:calc(var(--side) * -1);padding-inline:var(--side)}
 .drill::-webkit-scrollbar,.resbar::-webkit-scrollbar{display:none}
 .resbar .grow{display:none}
 .dchip{flex:none}

 /* ---------- listing page: stacked, swipe gallery, sticky action bar ---------- */
 .itemlay{gap:14px;padding-bottom:16px}
 .itemmain>.gal{margin-inline:calc(var(--side) * -1)}
 .buybox{gap:12px}
 .ititle{font-size:22px}
 .imeta{gap:6px 14px;font-size:13px}
 .gal .thumbs{display:none}
 .gal .main{border-radius:0;touch-action:pan-y}
 .gal .main .ph{aspect-ratio:4/3}
 .gal .gn{display:none}
 .galdots{display:flex;position:absolute;left:0;right:0;bottom:12px;justify-content:center;gap:6px;pointer-events:none}
 .galdots i{width:7px;height:7px;border-radius:50%;background:rgba(255,255,255,.55);box-shadow:0 0 0 1px rgba(0,0,0,.08)}
 .galdots i.on{background:#fff;width:18px;border-radius:4px}
 .bprice{font-size:28px}
 .bbtns{position:fixed;left:0;right:0;bottom:0;z-index:40;display:flex!important;gap:8px;padding:10px max(12px,env(safe-area-inset-right,0px)) calc(10px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));background:var(--surface);border-top:1px solid var(--line);box-shadow:0 -8px 24px -18px rgba(10,30,90,.35)}
 .bbtns .btn{flex:1 1 0;min-width:0;height:50px;font-size:14.5px;padding:0 10px;gap:6px}
 .bbtns .mcall{display:inline-flex}
 .bbtns:has(.btn:nth-child(3)) .mcall{flex:0 0 52px;padding:0}
 .bbtns:has(.btn:nth-child(3)) .mcall span{display:none}
 body[data-page="item"] main{padding-bottom:calc(76px + env(safe-area-inset-bottom,0px))}
 body[data-page="item"] .foot{display:none}
 body[data-page="item"] #toast{bottom:calc(84px + env(safe-area-inset-bottom,0px))}
 .reportlink{min-height:44px}
 .similar{padding-block:4px 16px}
 .similar .fhead{flex-wrap:wrap;gap:4px}
 .calwrap{grid-template-columns:minmax(0,1fr)}

 /* checkout: a smaller map so the pickup-point list shows under it */
 .mapbox{height:auto!important;aspect-ratio:4/3}
 .sumrow{gap:8px}
 .sumrow>span:last-child{white-space:nowrap}

 /* ---------- seller ---------- */
 .sptop{gap:14px;padding:16px}
 .sptop>div{min-width:0!important;flex:1 1 100%}
 .sptop>.av{flex:none}
 .sptop h1{font-size:24px!important}
 .sptop .av{width:72px;height:72px;font-size:24px}
 .spstats{gap:18px}

 /* ---------- messenger: one pane, the open chat takes the whole screen ---------- */
 body[data-page="chats"] .wrap:has(>.msgr){padding:0}
 .msgr{height:calc(100dvh - var(--hdr) - var(--tabbar) - env(safe-area-inset-bottom,0px) - env(safe-area-inset-top,0px));margin:0;border:0;border-radius:0;box-shadow:none}
 body[data-page="chats"][data-sub="open"] .top,body[data-page="chats"][data-sub="open"] .appstrip{display:none}
 body[data-page="chats"][data-sub="open"] .msgr{height:calc(100dvh - env(safe-area-inset-top,0px));margin-top:env(safe-area-inset-top,0px)}
 body[data-page="chats"]{overflow:hidden;overscroll-behavior:none}
 .cphead{padding:12px 12px 8px 16px}
 .ctabs{padding:0 10px 10px;gap:4px}
 .citem{padding:10px 16px;min-height:64px}
 .chhead{padding:6px 8px;gap:6px;min-height:58px}
 .chhead .who .av{width:40px;height:40px}
 .chhead #cstatus{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .chhead .who{min-width:0}
 .msgs{padding:12px 10px 14px!important}
 .b{max-width:86%!important}
 .composer{padding:8px 8px calc(8px + env(safe-area-inset-bottom,0px));gap:4px}
 .composer textarea,.composer #msg{font-size:16px!important}
 .composer .icbtn,.composer .send{width:44px;height:44px;flex:none}
 .chfoot{padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))!important}

 /* ---------- profile: sections as a list → section page ---------- */
 .proflay{padding-block:12px 24px;gap:14px}
 body[data-page="profile"][data-sub="overview"] .pcontent{order:1}
 body[data-page="profile"]:not([data-sub="overview"]) .pnav{display:none}
 .navl{flex-direction:column!important;overflow:visible!important;padding:6px}
 .navl button{min-height:50px;font-size:15px}
 .navl button.on{background:none;color:inherit}
 .navl button.on .ic{color:var(--accent)}
 .navl button.on i{color:var(--muted)}
 .navl button::after{content:"";width:8px;height:8px;border-right:2px solid var(--muted);border-top:2px solid var(--muted);transform:rotate(45deg);margin-left:8px;flex:none;opacity:.7}
 .navl button .badge,.navl button i{margin-left:auto}
 .navl button:not(:has(.badge,i))::after{margin-left:auto}
 .accsw{padding:10px;gap:6px;flex-wrap:wrap;overflow:visible}
 .accsw .glabel{flex:1 1 100%;padding:2px 6px 4px!important}
 .accsw .accb{flex:1 1 100%!important;min-width:0}
 .pback{display:inline-flex;align-items:center;gap:4px;min-height:44px;margin:-6px 0 -8px -6px;padding:0 8px 0 0;color:var(--accent);font-weight:700;font-size:15px;text-decoration:none;width:fit-content}
 .pcontent{gap:14px}
 .ptop{flex-wrap:wrap;align-items:flex-start;gap:14px;padding:16px}
 .ptop>.grow{flex:1 1 100%}
 .ptop .pfmore{position:absolute;top:10px;right:10px}
 body[data-page="profile"][data-sub="overview"] .pnav{display:contents}
 body[data-page="profile"][data-sub="overview"] .accsw{order:0}
 body[data-page="profile"][data-sub="overview"] .navl{order:2}
 body[data-page="profile"][data-sub="overview"] .navl::before{content:"Все разделы";display:block;padding:8px 12px 4px;font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
 .pcontent h1{font-size:24px!important}
 .pcontent h1.grow{flex:1 1 100%}
 .pv{flex-wrap:wrap;row-gap:4px}
 .pv>b.small{flex:1 1 100%;padding-left:48px;white-space:normal!important}
 .tiles{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}
 .wallet{padding:18px}
 .wallet .sum{font-size:30px}
 .wallet .wb button{height:44px;flex:1 1 auto}
 .doclay{grid-template-columns:minmax(0,1fr)}

 /* ---------- posting: one column, full-width fields ---------- */
 .postlay{grid-template-columns:minmax(0,1fr);gap:14px;padding-bottom:24px}
 .postlay .two,.mdl .two:not(:has(>input[inputmode])){grid-template-columns:minmax(0,1fr)}
 .pfcard .btn.primary,.mylist .btn.primary{width:100%}
 .upl{height:96px}

 /* ---------- footer ---------- */
 .foot{font-size:13px}
 .footin{grid-template-columns:1fr;gap:14px;padding-block:20px 24px}
 .foot a{padding:10px 0;min-height:44px;display:flex;align-items:center}
 body[data-page="chats"] .foot{display:none}
 .nf{margin-top:16px}
}
/* narrow Android phones (360 px): seven 44 px days in the rental calendar */
@media (max-width:389px){
 body[data-page="rentcal"] .wrap{padding-inline:8px}
 body[data-page="rentcal"] .sec:has(.rcg){padding-inline:6px}
}
@keyframes sheetup{from{transform:translateY(40px);opacity:.4}}
@media (max-width:767px) and (prefers-reduced-motion:reduce){.mdl,.menu{animation:none}}
