
/* TamuBN v84.3 — global layout stability layer
   Loaded after app.css so it can safely normalize every current page. */

:root{
  --tamubn-page-max:1560px;
  --tamubn-workspace-sidebar:260px;
  --tamubn-safe-gap:clamp(14px,2vw,28px);
}
*,*::before,*::after{box-sizing:border-box}
html{width:100%;max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{width:100%;max-width:100%;min-width:0;overflow-x:hidden}
img,svg,video,canvas{max-width:100%;height:auto}
button,input,select,textarea{max-width:100%;font:inherit}
textarea{resize:vertical}
[hidden]{display:none!important}
.shell{width:min(var(--tamubn-page-max),calc(100% - 40px))!important;max-width:100%;margin-inline:auto!important}
.section,.page-hero,.commercial-intro,.recommendation-zone,.cube-signature{min-width:0}
body :where(.workspace-card,.shop-card,.collection-strip,.seller-form,.support-card,.checkout-card,.order-card,.modal,.modal-card){min-width:0}
body :where(h1,h2,h3,p,small,span,b,strong,label){overflow-wrap:anywhere}
body :where(a,button){touch-action:manipulation}
body :where(input,select,textarea){min-width:0}
body :where(table){max-width:100%;border-collapse:collapse}

/* Buyer header and SPA */
.site-header,.public-header{max-width:100%;overflow:visible}
.header-main,.site-header-inner,.public-header-inner{min-width:0}
#app{width:100%;min-width:0;overflow-x:clip}
.commercial-hero{overflow:hidden}
.commercial-hero-grid{grid-template-columns:minmax(0,.92fr) minmax(460px,1.08fr)!important;gap:clamp(28px,4vw,72px)!important;align-items:center}
.commercial-hero-copy,.hero-cabinet{min-width:0}
.hero-cabinet{width:100%;max-width:100%}
.horizontal-products{max-width:100%;overscroll-behavior-inline:contain}
.collection-heading>*{min-width:0}
.shop-placeholder,.product-grid,.shops-grid,.for-you-grid,.recommendation-grid{min-width:0}
.shop-card{overflow:hidden}
.shop-cover img{width:100%;height:100%;object-fit:cover}
.page-hero input,.seller-form input,.seller-form select{width:100%}

/* Forms */
.buyer-auth-modal,.wizard-modal,.checkout-modal,.modal-card{
  width:min(680px,calc(100vw - 28px))!important;
  max-width:calc(100vw - 28px)!important;
  max-height:min(92vh,900px);
  overflow:auto;
}
.modal,.modal-backdrop{overscroll-behavior:contain}
.buyer-auth-form,.workspace-form{min-width:0}
.buyer-auth-form input,.buyer-auth-form select,
.workspace-form input,.workspace-form select,.workspace-form textarea,
.checkout-form input,.checkout-form select,.checkout-form textarea{
  width:100%;
  min-width:0;
}
.buyer-auth-tabs{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.buyer-auth-tabs button{min-width:0;white-space:normal}

/* Seller + Admin shared workspace */
.workspace-body{background:#f7f4fa}
.workspace-shell{
  width:100%;
  min-height:100dvh;
  display:grid!important;
  grid-template-columns:var(--tamubn-workspace-sidebar) minmax(0,1fr)!important;
}
.workspace-sidebar{
  width:var(--tamubn-workspace-sidebar)!important;
  max-width:var(--tamubn-workspace-sidebar);
  min-width:0;
  height:100dvh;
  position:sticky!important;
  top:0;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-width:thin;
}
.workspace-main{width:100%;min-width:0;max-width:100%;overflow-x:hidden}
.workspace-topbar{
  width:100%;
  min-width:0;
  padding-inline:clamp(18px,2.2vw,34px)!important;
  gap:16px;
}
.workspace-topbar>div{min-width:0}
.workspace-topbar h1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.workspace-account-actions{min-width:0;flex-shrink:0}
.workspace-content{
  width:100%;
  max-width:1500px;
  min-width:0;
  margin-inline:auto;
  padding:clamp(18px,2.2vw,34px)!important;
}
.tabview{width:100%;min-width:0}
.workspace-grid{
  grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr))!important;
  min-width:0;
}
.workspace-card{max-width:100%;overflow:hidden}
.workspace-wide{grid-column:1/-1}
.workspace-list,.workspace-row,.commercial-ledger,.launch-check-list{min-width:0}
.workspace-row{grid-template-columns:auto minmax(0,1fr) auto}
.workspace-row>*,.growth-card-head>*,.commercial-admin-shop>*{min-width:0}

/* Any data table becomes horizontally scrollable instead of breaking the page. */
.tamubn-table-scroll{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  border-radius:12px;
}
.tamubn-table-scroll>table{min-width:720px}
.workspace-card table{width:100%}

/* Seller inventory editor */
.inventory-layout,.inventory-grid,.product-editor-grid,.seller-inventory-layout{
  grid-template-columns:minmax(320px,.72fr) minmax(0,1.28fr)!important;
  gap:18px!important;
}
.inventory-layout>*,.inventory-grid>*,.product-editor-grid>*,.seller-inventory-layout>*{min-width:0}
.workspace-form label{min-width:0}

/* Commercial/admin complex grids */
.commercial-plan-grid,.commercial-admin-grid,.launch-grid{
  grid-template-columns:minmax(0,1.25fr) minmax(300px,.75fr)!important;
}
.seller-plan-cards{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))!important}
.commercial-admin-shop{grid-template-columns:minmax(0,1fr) minmax(150px,190px) auto!important}

/* Chat */
.portal-chat-panel,.chat-panel,.chat-shell{max-width:calc(100vw - 24px)}
.portal-chat-panel{max-height:calc(100dvh - 90px)}
.chat-composer,.portal-chat-composer{min-width:0}
.chat-composer input,.chat-composer textarea,.portal-chat-composer input,.portal-chat-composer textarea{min-width:0;width:100%}

/* Login screens */
.auth-shell,.portal-auth-shell{min-height:100dvh;max-width:100%;overflow-x:hidden}
.auth-panel,.portal-auth-panel{min-width:0}
.auth-card,.portal-auth-card{width:min(560px,calc(100vw - 28px));max-width:100%}

/* Desktop medium */
@media(max-width:1180px){
  .commercial-hero-grid{grid-template-columns:minmax(0,1fr) minmax(400px,.95fr)!important}
  .workspace-user>span{display:none}
  .commercial-plan-grid,.commercial-admin-grid,.launch-grid{grid-template-columns:1fr!important}
  .inventory-layout,.inventory-grid,.product-editor-grid,.seller-inventory-layout{grid-template-columns:1fr!important}
}

/* Tablet / workspace drawer */
@media(max-width:900px){
  :root{--tamubn-workspace-sidebar:min(300px,86vw)}
  .shell{width:min(100% - 28px,var(--tamubn-page-max))!important}
  .commercial-hero-grid{grid-template-columns:1fr!important}
  .hero-cabinet{transform:none!important;height:min(560px,70vw)!important;min-height:430px}
  .workspace-shell{display:block!important}
  .workspace-sidebar{
    position:fixed!important;
    inset:0 auto 0 0;
    z-index:1001;
    transform:translateX(-104%);
    box-shadow:20px 0 60px rgba(13,6,19,.28);
    transition:transform .22s ease;
  }
  .workspace-sidebar.open{transform:translateX(0)}
  .workspace-sidebar.open::after{content:"";position:fixed;inset:0 0 0 var(--tamubn-workspace-sidebar);background:rgba(12,6,18,.3);pointer-events:none}
  .workspace-main{width:100%!important;margin:0!important}
  .workspace-mobile-toggle{display:inline-grid!important}
  .workspace-topbar{position:sticky;top:0;z-index:80;background:rgba(255,255,255,.96);backdrop-filter:blur(14px)}
  .workspace-content{padding:18px!important}
  .commercial-admin-shop{grid-template-columns:1fr 1fr!important}
  .commercial-admin-shop>div{grid-column:1/-1}
}

/* Mobile */
@media(max-width:640px){
  .shell{width:calc(100% - 24px)!important}
  .page-hero{padding:36px 0 22px!important}
  .page-hero h1{font-size:clamp(36px,12vw,54px)!important;letter-spacing:-2px!important}
  .commercial-hero{padding-bottom:20px}
  .commercial-hero-grid{padding-top:28px!important}
  .commercial-hero-copy h1{font-size:clamp(54px,17vw,78px)!important;letter-spacing:-4px!important}
  .commercial-actions{display:grid!important;grid-template-columns:1fr!important}
  .commercial-actions .button{width:100%;justify-content:center}
  .hero-cabinet{
    min-height:520px!important;
    height:520px!important;
    grid-template-columns:1fr 1fr!important;
    transform:none!important;
    padding:12px!important;
  }
  .cabinet-top{font-size:8px!important}
  .cabinet-cell.cell-large{grid-row:2/3!important;grid-column:1/-1!important}
  .hero-product-copy{padding:10px!important}
  .homepage-sponsor-strip{margin-inline:0!important}
  .collection-heading{align-items:flex-start!important;flex-direction:column!important}
  .collection-controls{align-self:flex-end}
  .horizontal-product{min-width:min(78vw,300px)!important;width:min(78vw,300px)!important}
  .workspace-content{padding:14px!important}
  .workspace-topbar{padding:12px 14px!important}
  .workspace-topbar h1{font-size:17px!important}
  .workspace-account-actions{gap:6px!important}
  .workspace-signout{padding-inline:10px!important}
  .workspace-signout .signout-label{display:none}
  .workspace-grid{grid-template-columns:1fr!important}
  .workspace-card{padding:16px!important;border-radius:16px!important}
  .growth-card-head{align-items:flex-start!important;flex-direction:column!important}
  .commercial-admin-shop{grid-template-columns:1fr!important}
  .commercial-admin-shop>div{grid-column:auto}
  .seller-plan-cards{grid-template-columns:1fr!important}
  .launch-hero{padding:18px!important}
  .launch-score{display:none!important}
  .buyer-auth-modal,.wizard-modal,.checkout-modal,.modal-card{
    width:calc(100vw - 16px)!important;
    max-width:calc(100vw - 16px)!important;
    max-height:94dvh;
    padding:18px!important;
    border-radius:20px!important;
  }
}

/* Very small */
@media(max-width:390px){
  .workspace-content{padding:10px!important}
  .workspace-card{padding:14px!important}
  .hero-cabinet{height:490px!important;min-height:490px!important}
}
