/* =====================================================================
   LoomSetu — phone layout (v4.6)
   Desktop is unchanged: everything here is inside max-width queries,
   except the helpers that hide phone-only parts on big screens.
   ===================================================================== */
.ic{flex:none;vertical-align:middle}
@media(min-width:900px){.m-only{display:none!important}}
.panel-tabs{display:none}
.quick-acts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0 0 18px;max-width:560px}
.quick-acts a{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:.78rem;font-weight:600;color:var(--text);text-align:center;text-decoration:none}
.quick-acts a span{width:56px;height:56px;border-radius:16px;background:#fff;border:1px solid var(--line);color:var(--navy);display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow)}
.quick-acts a:hover span{border-color:var(--accent)}
.wait-card{display:flex;align-items:center;gap:12px;background:#fff;border:1.5px solid #f5c18f;border-radius:16px;padding:14px;margin-bottom:16px;color:var(--text);text-decoration:none!important;box-shadow:0 6px 18px rgba(18,35,63,.08)}
.wait-ic{width:46px;height:46px;border-radius:12px;background:#fff1e3;color:#c25e0b;display:flex;align-items:center;justify-content:center;flex:none}
.wait-txt{flex:1;display:flex;flex-direction:column;min-width:0}
.wait-txt b{font-size:1.02rem}.wait-txt small{color:var(--muted);font-size:.8rem}
.needs-card{padding:6px 0 0;overflow:hidden;margin-bottom:18px}
.needs-card h2{padding:10px 16px 6px;margin:0;font-size:1.05rem}
.needs-row{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 16px;border-top:1px solid #eef1f6;color:var(--text);text-decoration:none!important}
.needs-row:hover{background:#fafbfd}
.needs-ic{width:34px;height:34px;border-radius:10px;background:#eef1f6;color:var(--navy);display:flex;align-items:center;justify-content:center;flex:none}
.needs-txt{flex:1;display:flex;flex-direction:column;font-weight:600;font-size:.94rem}
.needs-txt small{font-weight:400;color:var(--muted);font-size:.78rem}
.needs-n{min-width:26px;height:26px;border-radius:13px;background:var(--err);color:#fff;font-size:.8rem;display:flex;align-items:center;justify-content:center;padding:0 7px}

/* ---------------- shared phone basics ---------------- */
@media(max-width:899px){
  html{-webkit-text-size-adjust:100%}
  input,select,textarea{font-size:16px!important}          /* stops iPhone zooming into fields */
  .btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:6px}
  .btn-sm{min-height:38px}
  .container{padding-left:16px;padding-right:16px}
  .card{border-radius:14px}
  .side-ad,.side-banner,.side-ads{display:none!important}

  /* ---------- tables become cards ---------- */
  .table-wrap{overflow:visible}
  table.m-cards,table.m-cards tbody,table.m-cards tr,table.m-cards td{display:block;width:100%}
  table.m-cards thead{display:none}
  table.m-cards tr{background:#fff;border:1px solid var(--line);border-radius:14px;padding:10px 12px;margin-bottom:10px;box-shadow:var(--shadow)}
  table.m-cards td{border:0!important;padding:5px 0!important;text-align:left!important;display:flex;gap:10px;justify-content:space-between;align-items:flex-start;min-height:0}
  table.m-cards td[data-label]::before{content:attr(data-label);flex:0 0 38%;font-size:.76rem;font-weight:600;color:var(--muted);text-transform:none;padding-top:2px}
  table.m-cards td:not([data-label]){justify-content:flex-start}
  table.m-cards td:first-child{font-weight:600}
  table.m-cards td > *:only-child{max-width:62%}
  table.m-cards td input,table.m-cards td select{max-width:62%}
  table.m-cards td .btn{min-height:40px}
  table.m-cards td:last-child:not([data-label]),table.m-cards td[data-label=""]{padding-top:8px!important}
}

/* ---------------- buyer side (public pages) ---------------- */
@media(max-width:899px){
  body:not(.panel){padding-bottom:calc(78px + env(safe-area-inset-bottom))}
  /* header: logo + big search */
  .topbar{position:sticky;top:0}
  .topbar-inner{gap:10px;padding-top:10px;padding-bottom:12px}
  .topbar .menu-toggle,.topbar .nav{display:none!important}
  .topbar .search{order:3;flex:1 1 100%;min-width:0;height:50px;background:#fff;border-radius:14px;padding:0 5px 0 0;align-items:center}
  .topbar .search input{height:100%;border-radius:14px 0 0 14px;padding:0 14px;font-weight:500;min-width:0}
  .topbar .search button{height:40px;border-radius:10px;padding:0 14px;font-weight:700}
  .partner-strip,.ps-inner{font-size:.78rem}

  /* bottom menu */
  .bottom-nav{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr));height:calc(68px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -4px 16px rgba(18,35,63,.06)}
  .bottom-nav a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:.69rem;font-weight:600;color:#5b6475;position:relative;padding:0}
  .bottom-nav a.on{color:var(--navy);font-weight:800}
  .bottom-nav a.bn-post{color:#c25e0b;justify-content:flex-end;padding-bottom:9px}
  .bottom-nav a .bn-fab{position:absolute;top:-24px;left:50%;transform:translateX(-50%);width:56px;height:56px;border-radius:50%;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center;border:4px solid #fff;box-shadow:0 6px 16px rgba(242,140,40,.45)}
  .bn-badge{position:absolute;top:7px;left:50%;margin-left:5px;min-width:18px;height:18px;border-radius:9px;background:var(--err);color:#fff;font-size:.66rem;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 5px}

  /* home */
  .hero{padding:18px 0 20px}
  .hero h1{font-size:1.45rem;line-height:1.25}
  .hero p,.hero-search,.hero-stats{display:none}
  .hero-inner{gap:14px}
  .hero-banners{min-height:150px}
  .m-cats{display:flex;gap:8px;overflow-x:auto;padding:14px 16px 4px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .m-cats::-webkit-scrollbar{display:none}
  .m-cats a{flex:none;height:38px;padding:0 15px;border-radius:99px;background:#fff;border:1px solid var(--line);color:var(--text);font-size:.88rem;font-weight:600;display:flex;align-items:center;text-decoration:none;white-space:nowrap}
  .m-cats a.on{background:var(--navy);border-color:var(--navy);color:#fff}
  .m-strip{display:flex;align-items:center;gap:12px;margin:12px 16px 4px;min-height:58px;padding:8px 14px;background:#fff;border:1px solid var(--line);border-radius:14px;color:var(--text);text-decoration:none!important}
  .m-strip > span:nth-child(2){flex:1;display:flex;flex-direction:column;min-width:0}
  .m-strip b{font-size:.92rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .m-strip small{color:var(--muted);font-size:.78rem}
  .m-strip-ic{width:38px;height:38px;border-radius:10px;background:#fff1e3;color:#c25e0b;display:flex;align-items:center;justify-content:center;flex:none}
  .section{padding-top:22px;padding-bottom:22px}
  .section-head h2{font-size:1.1rem}

  /* search results */
  .listing{padding-top:10px}
  .listing-grid{gap:10px}
  .m-filterbar{display:flex;gap:8px;overflow-x:auto;padding:2px 0 10px;margin:0 -16px;padding-left:16px;padding-right:16px;scrollbar-width:none}
  .m-filterbar::-webkit-scrollbar{display:none}
  .mf-btn,.mf-chip{flex:none;height:40px;padding:0 13px;border-radius:10px;font:600 .86rem Inter,sans-serif;display:inline-flex;align-items:center;gap:5px;white-space:nowrap;text-decoration:none!important;border:1px solid #d5dbe6;background:#fff;color:var(--text);cursor:pointer}
  .mf-btn{background:var(--navy);border-color:var(--navy);color:#fff;font-weight:700}
  .mf-chip.on{background:#e6f4f4;border-color:var(--teal);color:#0b6e70;font-weight:700}
  .results-bar{gap:8px}
  .results-bar .sort{font-size:.85rem}
  .active-filters{display:none}
  /* filter column becomes a bottom sheet */
  .filters{position:fixed!important;left:0;right:0;bottom:0;top:auto;z-index:80;max-height:86vh;background:#fff;border-radius:22px 22px 0 0;display:flex;flex-direction:column;transform:translateY(105%);transition:transform .25s ease;box-shadow:0 -10px 40px rgba(0,0,0,.2)}
  .filters-open .filters{transform:none}
  .filters-open{overflow:hidden}
  .sheet-backdrop{position:fixed;inset:0;background:rgba(18,35,63,.5);z-index:79;display:none}
  .filters-open .sheet-backdrop{display:block}
  .sheet-head{display:flex;align-items:center;justify-content:space-between;padding:14px 12px 10px 18px;border-bottom:1px solid var(--line);position:relative}
  .sheet-head::before{content:"";position:absolute;top:6px;left:50%;width:44px;height:5px;border-radius:3px;background:#d5dbe6;transform:translateX(-50%)}
  .sheet-head h2{margin:6px 0 0;font-size:1.15rem}
  .sheet-x{width:44px;height:44px;border:0;background:none;color:var(--text);cursor:pointer;display:flex;align-items:center;justify-content:center}
  .filters .filters-box{flex:1;overflow-y:auto;border:0;box-shadow:none;border-radius:0}
  .filters .filters-box summary{display:none}
  .filters .filters-box form{padding:4px 18px 10px}
  .filters .check{min-height:44px;display:flex;align-items:center;gap:10px;font-size:.98rem}
  .filters .check input{width:20px;height:20px}
  .filters .f-scroll{max-height:none}
  .filters .clear-all{display:none}
  .sheet-foot{display:grid;grid-template-columns:1fr 2fr;gap:10px;padding:12px 16px calc(14px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff}
  .sheet-foot .btn{height:52px;border-radius:14px;font-size:1rem}
  .ads-col{display:none!important}
  /* result cards: photo left, details right, buttons below */
  .results .product-grid.with-actions{grid-template-columns:1fr!important;gap:10px}
  .product-card-wrap{background:#fff;border:1px solid var(--line);border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:10px}
  .product-card-wrap .product-card{flex-direction:row;gap:12px;border:0;border-radius:0;box-shadow:none!important;transform:none!important}
  .product-card-wrap .p-img{width:96px;height:96px;aspect-ratio:auto;flex:none;border-radius:10px}
  .product-card-wrap .p-body{padding:0;min-width:0}
  .product-card-wrap .p-body h3{font-size:.98rem}
  .p-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .p-actions a{height:44px;border-radius:10px;display:flex;align-items:center;justify-content:center;gap:6px;font-weight:700;font-size:.9rem;text-decoration:none!important}
  .pa-wa{border:1px solid #1fa855;color:#17803f}
  .pa-price{background:var(--accent);color:#fff!important}
  .p-actions a:only-child{grid-column:1/-1}

  /* product & company page: bottom action bar replaces the menu and floating buttons */
  body:has(.m-actionbar) .bottom-nav,body:has(.m-actionbar) .chat-fabs{display:none!important}
  body:has(.m-actionbar){padding-bottom:calc(80px + env(safe-area-inset-bottom))}
  .m-actionbar{position:fixed;left:0;right:0;bottom:0;z-index:45;display:flex;gap:8px;padding:10px 12px calc(12px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--line);box-shadow:0 -4px 16px rgba(18,35,63,.08)}
  .ab-ic{width:50px;height:50px;flex:none;border-radius:14px;border:1px solid #d5dbe6;background:#fff;color:var(--navy);display:flex;align-items:center;justify-content:center;cursor:pointer;text-decoration:none!important}
  .ab-wa{background:#1fa855;border-color:#1fa855;color:#fff}
  .ab-chat{background:var(--navy);border-color:var(--navy);color:#fff}
  .ab-main{flex:1;height:50px;border-radius:14px;background:var(--accent);color:#fff!important;font-weight:800;font-size:1.02rem;display:flex;align-items:center;justify-content:center;text-decoration:none!important}
  .gallery .g-main{border-radius:0;border-left:0;border-right:0;margin:0 -16px}
  .price-lg{font-size:1.5rem}
  .product-page h1,.product-layout h1{font-size:1.3rem}
  .seller-box{border-radius:14px}

  /* chat */
  .chat-widget.open{z-index:90}
  .buyer-quick{padding:8px 10px 0}
  .chatbox:not(.has-chat) .buyer-quick{display:none}
  .chat-head{padding:10px 12px}
  .chat-compose textarea{min-height:46px}
  .chat-compose .btn{width:46px;height:46px;min-height:46px}
}
.buyer-quick{background:transparent;border-top:0}

/* ---------------- seller / admin / buyer panels ---------------- */
@media(max-width:959px){
  body.panel{padding-bottom:calc(72px + env(safe-area-inset-bottom))}
  .panel-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:40;height:calc(68px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);background:#fff;border-top:1px solid var(--line);box-shadow:0 -4px 16px rgba(18,35,63,.06)}
  .panel-tabs a,.panel-tabs button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font:600 .69rem Inter,sans-serif;color:#5b6475;text-decoration:none!important;background:none;border:0;position:relative;cursor:pointer;padding:0}
  .panel-tabs .on{color:var(--navy);font-weight:800}
  .panel-tabs .on .ic{stroke-width:2.4}
  .panel-top .menu-toggle{display:none}
  .panel-top{padding:12px 16px}
  .panel-top h1{font-size:1.1rem}
  .panel-body{padding:14px 14px 20px}
  /* "More" opens the full menu as a sheet from the bottom */
  .sidebar{inset:auto 0 0 0;width:auto;height:auto;max-height:82vh;overflow-y:auto;border-radius:22px 22px 0 0;transform:translateY(105%);padding:22px 14px calc(84px + env(safe-area-inset-bottom));z-index:35}
  .nav-open .sidebar{transform:none}
  .sidebar::before{content:"";position:absolute;top:8px;left:50%;width:44px;height:5px;border-radius:3px;background:rgba(255,255,255,.3);transform:translateX(-50%)}
  .sidebar > .brand{display:none}
  .sidebar nav{display:grid;grid-template-columns:1fr 1fr;gap:6px}
  .sidebar nav a{min-height:48px;display:flex;align-items:center;background:rgba(255,255,255,.06);border-radius:12px;font-size:.92rem}
  .sidebar-foot{flex-direction:row;flex-wrap:wrap;gap:8px 18px;margin-top:14px;padding:0 4px}
  .nav-open .backdrop{display:block;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:34}
  .acting-bar{flex-direction:column;align-items:flex-start;gap:8px}

  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .stat{padding:12px 14px}
  .stat strong{font-size:1.5rem}
  .toolbar{flex-wrap:wrap;gap:10px}
  .tabs.small-tabs{overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none;max-width:100%}
  .tabs.small-tabs a{white-space:nowrap}
  .two-col,.seller-layout,.welcome-layout{grid-template-columns:1fr!important}

  /* leads as cards with big buttons */
  .lead summary{flex-wrap:wrap;gap:8px}
  .lead-snip{flex:1 1 100%;margin:2px 0 0;font-size:.9rem;color:#2c3445;line-height:1.45}
  .lead-quick{flex:1 1 100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:4px}
  .lead-quick a,.lead-quick span{height:44px;border-radius:10px;border:1px solid #d5dbe6;color:var(--navy);font-weight:700;font-size:.88rem;display:flex;align-items:center;justify-content:center;gap:5px;text-decoration:none!important;background:#fff}
  .lead-quick .lq-wa{background:#1fa855;border-color:#1fa855;color:#fff}
  .lead-quick .lq-reply{background:var(--navy);border-color:var(--navy);color:#fff}
  .lead.unread{border-color:#f2c497}
  .inline-form.wrap{flex-direction:column;align-items:stretch}

  /* enterprise package: total stays at the bottom */
  .m-sumbar{position:fixed;left:0;right:0;bottom:calc(68px + env(safe-area-inset-bottom));z-index:39;display:flex;align-items:center;gap:12px;background:var(--navy);color:#fff;padding:10px 16px;border-radius:18px 18px 0 0;box-shadow:0 -6px 18px rgba(18,35,63,.2)}
  .m-sumbar > span{flex:1;display:flex;flex-direction:column}
  .m-sumbar small{color:#b8c3d6;font-size:.78rem}
  .m-sumbar b{font-size:1.2rem}
  .m-sumbar .btn{height:48px;padding:0 18px;border-radius:12px;font-weight:800}
  body:has(.m-sumbar) .panel-body{padding-bottom:90px}
  .ent-opt{padding:12px}
  .ent-opt-extra input:not(.mini){min-width:0;flex:1 1 100%}
  .ent-opt-extra .mini{width:70px;height:44px}
  .ent-hero{flex-direction:column;align-items:flex-start;padding:18px}
  .ent-cards{grid-template-columns:1fr}
  .ent-items td:first-child{min-width:0}
  .ent-items .num input{width:100%;max-width:62%}
  .inbox{height:calc(100vh - 150px - 68px)}
  .chat-compose{padding-bottom:10px}
}
@media(min-width:900px) and (max-width:959px){.m-sumbar{display:none}}
@media(max-width:899px){
  /* the bottom bar already has these */
  body:has(.m-actionbar) .btn-row > .btn-accent[href="#enquiry"],
  body:has(.m-actionbar) .btn-row > .btn-wa,
  body:has(.m-actionbar) .btn-row > .btn-chat{display:none}
}
@media(max-width:959px){
  .seg-inline,.ent-tabs{min-width:0!important;max-width:100%;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .seg-inline::-webkit-scrollbar{display:none}
  .seg a{white-space:nowrap;flex:none;padding:7px 12px}
}
