/* ============================================================================
   shell.css — cross-cutting layer for the four shells (site, portal, admin /
   expert desk, bare). Loaded LAST, after enterprise.css, by every layout.

   1  Brand mark (uploaded logo or icon tile)
   2  Public header: cart, account, phone fit
   3  Full-width content
   4  Phone navigation: staff tab bar, portal "More" sheet
   5  Help panel + guided tour
   6  Tooltips ([data-tip])
   7  Responsiveness fixes found in the device audit
   8  On-screen documents (invoice / note / quotation)
   ========================================================================== */

/* ── 1 · Brand mark ──────────────────────────────────────────────────────── */
/* The logo keeps its own aspect ratio inside a fixed-height box, so a wide
   wordmark and a square emblem both sit on the bar without distortion. */
body.ent .logo.has-img{
  width:auto !important;height:36px;min-width:0;padding:0;border:0 !important;border-radius:0;
  background:none !important;box-shadow:none !important;display:inline-flex;align-items:center;flex:none
}
body.ent .logo.has-img img{height:100%;width:auto;max-width:180px;object-fit:contain;display:block}
/* Sidebar: an uploaded logo gets its own row so a wide wordmark is not squeezed
   against the name; the name and tagline sit underneath it. */
body.ent .admin-brand:has(.logo.has-img){flex-direction:column;align-items:flex-start;gap:6px}
body.ent .admin-brand:has(.logo.has-img) > div:last-child{width:100%}
body.ent .admin-brand .logo.has-img{height:36px}
body.ent .admin-brand .logo.has-img img{max-width:210px}
body.ent .mb-brand .logo.has-img{height:30px}
body.ent .mb-brand .logo.has-img img{max-width:140px}
body.ent .auth-brand .logo.has-img{height:44px}
body.ent .auth-brand .logo.has-img img{max-width:220px}
body.ent .foot-col.brandcol .logo.has-img{height:40px}
/* No upload yet: the icon tile. app.css paints --brand-logo over the sidebar tile
   with !important and hides its icon; the tile must look the same in every shell. */
body.ent .admin-brand .logo:not(.has-img){background:var(--blue) !important;border:0 !important;color:#fff}
body.ent .admin-brand .logo:not(.has-img) i{display:block !important}
body.ent .admin-brand{align-items:center}
body.ent .site-brand,body.ent .mb-brand,body.ent .auth-brand{min-width:0}

/* ── 2 · Public header ───────────────────────────────────────────────────── */
body.ent .site-actions{display:flex;align-items:center;gap:6px}
body.ent .hdr-icon{
  position:relative;display:inline-grid;place-items:center;width:40px;height:40px;flex:none;
  border-radius:8px;color:var(--ink-2);font-size:21px;line-height:1;text-decoration:none
}
body.ent .hdr-icon:hover{background:var(--bg-2);color:var(--ink)}
body.ent .hdr-badge{
  position:absolute;top:3px;right:2px;min-width:18px;height:18px;padding:0 5px;border-radius:999px;
  background:var(--blue);color:#fff;font-size:11px;font-weight:700;line-height:18px;text-align:center;
  box-shadow:0 0 0 2px #fff
}
body.ent .show-sm{display:none !important}
@media (max-width:768px){
  body.ent .site-actions .show-sm{display:inline-grid !important}
}
/* Laptops (the full menu is visible down to 1201px): the cart icon and an uploaded
   logo need room, so the account link becomes an icon and the brand is capped. */
@media (min-width:1201px) and (max-width:1560px){
  body.ent .site-header .logo.has-img img{max-width:130px}
  body.ent .site-header .site-brand .name{max-width:130px}
  body.ent .site-header .site-brand:has(.logo.has-img) .name{display:none}
  body.ent .site-header .nav-link{padding:8px 7px;font-size:13.5px}
  body.ent .site-actions .txt-link{display:none}
  body.ent .site-actions .show-sm{display:inline-grid !important}
}
@media (max-width:1200px){
  body.ent .site-header .site-brand .name{max-width:min(320px,40vw)}
}
/* Phones: burger · brand (name may wrap to two lines) · cart · account · CTA.
   The old single-line 110px cap cut "Kuber Consultancy Services" to "Kuber Consultanc…". */
@media (max-width:560px){
  body.ent .site-header .wrap{gap:6px}
  body.ent .site-header .site-brand{flex:1 1 auto;min-width:0}
  body.ent .site-header .site-brand .name{
    max-width:none;white-space:normal;font-size:14px;line-height:1.15;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:clip
  }
  body.ent .site-header .logo.has-img{height:32px}
  body.ent .site-header .logo.has-img img{max-width:110px}
  body.ent .site-actions{margin-left:0;gap:2px}
  body.ent .site-actions .hdr-cta{padding:0 10px;font-size:13px;min-height:34px}
}
@media (max-width:400px){
  body.ent .site-actions .hdr-cta{display:none}     /* still in the drawer and the sticky bar */
}
@media (max-width:340px){
  body.ent .site-header .site-brand .name{display:-webkit-box !important;font-size:13px}
}
/* The drawer brand never truncates at all — it has the full width. */
body.ent .drawer-head .site-brand .name{max-width:none;white-space:normal;line-height:1.2}

/* ── 3 · Full-width content ──────────────────────────────────────────────── */
/* Header, footer and menus span the screen; content uses the screen too.
   Prose (blog posts, legal pages, docs) keeps its own reading measure. */
:root{--wrap:1600px;--wrap-wide:100%}
body.ent.site .site-header > .wrap, body.ent.site .site-footer > .wrap{max-width:none;padding-left:clamp(16px,2.4vw,40px);padding-right:clamp(16px,2.4vw,40px)}
body.ent .p-header-inner{max-width:none;padding-left:clamp(12px,2vw,32px);padding-right:clamp(12px,2vw,32px)}
body.ent .p-layout{max-width:none;padding-left:clamp(12px,2vw,32px);padding-right:clamp(12px,2vw,32px)}
@media (min-width:1600px){ body.ent .p-layout{grid-template-columns:240px minmax(0,1fr)} }
/* Admin / portal screens that boxed their main card at 760–1180px. */
body.ent :is(.admin-content,.p-main) :is(
  [style*="max-width:760px"],[style*="max-width:820px"],[style*="max-width:840px"],
  [style*="max-width:860px"],[style*="max-width:920px"],[style*="max-width:980px"],
  [style*="max-width:1080px"],[style*="max-width:1180px"]){max-width:none !important}
body.ent :is(.uf-card,.uf .perm-bar,.c360,.fg-card,.q-card){max-width:none}
/* …but a document preview and an article keep a page-like measure on huge screens. */
@media (min-width:1500px){
  body.ent .admin-content .doc-card, body.ent .p-main .doc-card{max-width:1100px !important}
}

/* ── 4 · Phone navigation ────────────────────────────────────────────────── */
/* Staff tab bar (admin shell + expert desk). The sidebar is off-canvas below
   1024px; the bar is the always-visible way around. */
body.ent.admin .staff-tabbar{z-index:50}
body.ent.admin .staff-tabbar a{min-width:0}
body.ent.admin .staff-tabbar a span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (max-width:1023px){
  body.ent.admin.has-tabbar .admin-content{padding-bottom:calc(84px + env(safe-area-inset-bottom))}
  body.ent.admin.has-tabbar .fb-fab, body.ent.admin.has-tabbar .push-optin{bottom:calc(72px + env(safe-area-inset-bottom)) !important}
}
@media (min-width:1024px){ body.ent .staff-tabbar{display:none !important} }
/* The open sidebar sits above the bar, and the bar above page content. */
body.ent .admin-sidebar.open{z-index:70}
body.ent .admin-sidebar-backdrop.show{z-index:65}

/* Portal header actions */
body.ent .p-header-actions{display:flex;align-items:center;gap:6px;margin-left:auto;min-width:0}
body.ent .p-header .site-brand{min-width:0;flex:0 1 auto}
body.ent .p-header .site-brand .name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.ent .p-user{text-decoration:none;color:inherit;border-radius:999px;padding:2px}
body.ent .p-user:hover .avatar{border-color:var(--blue)}
@media (max-width:640px){
  body.ent .p-header .buy-btn{width:38px;height:38px;padding:0;justify-content:center;border-radius:10px}
  body.ent .p-header .site-brand .name{max-width:42vw}
}
/* Portal "More" sheet */
.more-ov{position:fixed;inset:0;z-index:120}
.more-bd{position:absolute;inset:0;background:rgba(16,24,40,.45);animation:shFade .15s ease}
.more-sheet{
  position:absolute;left:0;right:0;bottom:0;max-height:88dvh;overflow-y:auto;overscroll-behavior:contain;
  background:#fff;border-radius:18px 18px 0 0;padding:6px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow:0 -18px 40px -18px rgba(16,24,40,.45);animation:shUp .2s cubic-bezier(.2,.8,.2,1)
}
.more-grip{width:40px;height:4px;border-radius:4px;background:var(--line-3,#d0d5dd);margin:6px auto 10px}
.more-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.more-me{display:flex;align-items:center;gap:10px;min-width:0;color:var(--ink);text-decoration:none}
.more-me .avatar{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--sky-soft);color:var(--blue);font-weight:700;flex:none}
.more-me span{display:flex;flex-direction:column;min-width:0}
.more-me b{font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.more-me small{font-size:12px;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.more-head .icon-btn{box-shadow:none}
.more-buy{margin-bottom:14px}
.more-group{margin-bottom:14px}
.more-group h4{font-size:11.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted-2,#98a2b3);margin:0 0 8px}
.more-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.more-grid a{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;text-align:center;
  min-height:76px;padding:10px 6px;border:1px solid var(--line);border-radius:12px;background:#fff;
  font-size:12.5px;font-weight:500;color:var(--ink-2);text-decoration:none;line-height:1.25
}
.more-grid a i{font-size:22px;color:var(--ink-3)}
.more-grid a.active{border-color:var(--blue);background:var(--sky-soft);color:var(--blue)}
.more-grid a.active i{color:var(--blue)}
.more-out{margin-top:6px}
@media (min-width:480px){ .more-grid{grid-template-columns:repeat(4,minmax(0,1fr))} }
@media (min-width:901px){ .more-sheet{left:auto;right:16px;bottom:16px;width:420px;border-radius:16px} }
@keyframes shUp{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
@keyframes shFade{from{opacity:0}to{opacity:1}}
body.no-scroll{overflow:hidden}

/* ── 5 · Help panel + tour ───────────────────────────────────────────────── */
body.ent .help-btn{flex:none;width:36px;height:36px;min-width:36px;min-height:36px;padding:0;display:inline-grid;place-items:center;font-size:18px;color:var(--ink-2)}
body.ent .help-btn:hover{color:var(--blue);border-color:var(--blue)}
.hp-ov{position:fixed;inset:0;z-index:125}
.hp-bd{position:absolute;inset:0;background:rgba(16,24,40,.35);animation:shFade .15s ease}
.hp-panel{
  position:absolute;top:0;right:0;bottom:0;width:min(420px,100%);background:#fff;display:flex;flex-direction:column;
  box-shadow:-18px 0 40px -20px rgba(16,24,40,.4);animation:hpIn .2s cubic-bezier(.2,.8,.2,1)
}
@keyframes hpIn{from{transform:translateX(30px);opacity:.6}to{transform:none;opacity:1}}
.hp-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:18px 18px 14px;border-bottom:1px solid var(--line)}
.hp-head h2{font-size:17px;margin:4px 0 0;line-height:1.3}
.hp-eyebrow{font-size:12px;font-weight:600;color:var(--blue);display:inline-flex;gap:5px;align-items:center}
.hp-head .icon-btn{box-shadow:none;flex:none}
.hp-body{flex:1;overflow-y:auto;padding:16px 18px;font-size:14px;line-height:1.6;color:var(--ink-2)}
.hp-what{margin:0 0 14px;color:var(--ink)}
.hp-body h3{font-size:12px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);margin:16px 0 8px}
.hp-steps{margin:0;padding-left:20px;display:grid;gap:7px}
.hp-steps li::marker{font-weight:700;color:var(--blue)}
.hp-tips{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.hp-tips li{display:flex;gap:9px;align-items:flex-start;background:var(--bg-2,#f8fafc);border-radius:10px;padding:9px 11px;font-size:13.5px}
.hp-tips i{color:#b54708;font-size:16px;margin-top:1px;flex:none}
.hp-foot{display:flex;flex-wrap:wrap;gap:8px;padding:12px 18px calc(14px + env(safe-area-inset-bottom));border-top:1px solid var(--line)}
@media (max-width:600px){
  .hp-panel{top:auto;left:0;width:100%;max-height:86dvh;border-radius:18px 18px 0 0;animation:shUp .2s cubic-bezier(.2,.8,.2,1)}
}
/* Tour */
.tour-ring{
  position:fixed;z-index:140;border-radius:10px;pointer-events:none;
  box-shadow:0 0 0 3px var(--blue),0 0 0 9999px rgba(16,24,40,.55);transition:all .22s ease
}
.tour-ring.none{box-shadow:0 0 0 9999px rgba(16,24,40,.55);width:0 !important;height:0 !important}
.tour-pop{
  position:fixed;z-index:141;width:min(340px,calc(100vw - 24px));background:#fff;border-radius:14px;
  box-shadow:0 20px 50px -12px rgba(16,24,40,.5);padding:16px 16px 12px;font-size:14px;line-height:1.55;color:var(--ink-2)
}
.tour-pop h4{font-size:15.5px;margin:0 0 6px;color:var(--ink)}
.tour-pop p{margin:0}
.tour-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:14px}
.tour-dots{display:flex;gap:5px}
.tour-dots span{width:7px;height:7px;border-radius:50%;background:var(--line-3,#d0d5dd)}
.tour-dots span.on{background:var(--blue)}
.tour-btns{display:flex;gap:6px}
.tour-skip{background:none;border:0;color:var(--ink-3);font:inherit;font-size:13px;cursor:pointer;padding:6px 4px}
.tour-skip:hover{color:var(--ink)}

/* ── 6 · Tooltips ────────────────────────────────────────────────────────── */
/* One floating bubble positioned by shell.js, so it is never clipped by a
   scrolling table or card. Hover/focus on desktop, tap on touch screens. */
.tip-bubble{
  position:fixed;z-index:200;max-width:min(280px,calc(100vw - 16px));padding:7px 10px;border-radius:8px;
  background:#101828;color:#fff;font-size:12.5px;font-weight:500;line-height:1.4;pointer-events:none;
  box-shadow:0 8px 20px -6px rgba(16,24,40,.45);opacity:0;transform:translateY(2px);transition:opacity .12s,transform .12s
}
.tip-bubble.on{opacity:1;transform:none}
[data-tip-help]{cursor:help;text-decoration:underline dotted color-mix(in srgb,currentColor 45%,transparent);text-underline-offset:3px}
.badge[data-tip],.chip[data-tip]{cursor:help}

/* ── 7 · Responsiveness fixes (device audit) ─────────────────────────────── */
/* Row actions were hidden on phones (`hide-sm`) on every generated list and on
   Users — on Users that left NO way to edit a person from a phone. In card
   mode the actions get their own row instead. */
@media (max-width:680px){
  body.ent .table-as-cards td.actions.hide-sm{display:flex !important;justify-content:flex-end;padding-top:8px;border-top:1px dashed var(--line) !important;margin-top:4px}
  body.ent .table-as-cards td.actions.hide-sm::before{content:none}
  body.ent .table-as-cards td.actions .row-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
  body.ent .table-as-cards td{min-width:0;overflow-wrap:anywhere}
  body.ent .table-as-cards td > *{min-width:0}
}
/* Filter bars and tab strips scroll sideways on phones instead of wrapping into
   a tall block (the portal already did this; the admin shell did not). */
@media (max-width:720px){
  body.ent.admin .filter-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch;margin-left:-12px;margin-right:-12px;padding:0 12px 2px}
  body.ent.admin .filter-tabs::-webkit-scrollbar{display:none}
  body.ent.admin .filter-tabs > *{flex:none}
  body.ent .page-actions{gap:6px}
  body.ent .page-actions .gs-open{flex:1 1 auto;justify-content:flex-start;padding:0 12px;width:auto}
  body.ent .page-actions .gs-open span{display:inline}
  body.ent .page-actions .gs-open kbd{display:none}
  /* Wide data tables that are not turned into cards still scroll inside their box. */
  body.ent .table-scroll, body.ent .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
  /* Two-column detail layouts collapse. */
  body.ent :is(.inv-layout,.split,.ow-layout,.grid.g2,.grid.g3){grid-template-columns:minmax(0,1fr) !important}
}
/* Segmented tab strips (Users, Customer questions, Community…) and long page
   lists (Audit log) pushed the page sideways on a phone. */
body.ent .seg-tabs{max-width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
body.ent .seg-tabs::-webkit-scrollbar{display:none}
body.ent .seg-tabs a{flex:none}
body.ent .pagination{flex-wrap:wrap;row-gap:6px}
/* Dialogs and sheets never wider or taller than the screen. */
body.ent :is(.modal-card,.app-dialog-card,.sheet,.fb-card,.wn-panel,.gs-panel){max-width:calc(100vw - 20px);max-height:calc(100dvh - 24px);overflow-y:auto}
/* Sticky bars must not cover the last content line or the cookie sheet. */
@media (max-width:900px){
  body.ent.portal .p-main{padding-bottom:calc(16px + env(safe-area-inset-bottom))}
  body.ent.portal .push-optin, body.ent.portal .fb-fab{bottom:calc(72px + env(safe-area-inset-bottom)) !important}
}
/* Long unbroken values (GSTIN, emails, SRNs, URLs) wrap instead of widening the page. */
body.ent :is(.admin-content,.p-main) :is(dd,.kv,.card p){overflow-wrap:anywhere}
/* Status chips and amounts never break mid-word inside a table cell. */
body.ent :is(td,th) .badge, body.ent td .chip{white-space:nowrap}
/* Portal header on tablets: avatar only, icon-only "Buy", so nothing is pushed off the edge. */
@media (max-width:1100px){
  body.ent .p-header .p-user > span:not(.avatar){display:none}
}
@media (max-width:900px){
  body.ent .p-header .buy-btn .hide-sm{display:none}
  body.ent .p-header .buy-btn{width:38px;height:38px;padding:0;justify-content:center}
}
/* Tablet and up: the header actions keep their natural width on the right (the
   title wraps instead); only a set wider than the whole header drops a line. */
@media (min-width:721px){
  body.ent .admin-header .row.between{flex-wrap:wrap}
  body.ent .admin-header .row.between > :first-child{flex:1 1 280px;min-width:0}
  body.ent .admin-header .page-actions{flex:0 0 auto;max-width:100%;justify-content:flex-end;margin-left:auto}
}

/* ── 8 · On-screen documents ─────────────────────────────────────────────── */
.doc-logo{display:block;height:auto;max-height:56px;max-width:220px;width:auto;object-fit:contain;margin-bottom:10px}
.doc-card{--doc-accent:var(--blue);border-top:3px solid var(--doc-accent)}
.doc-foot{display:flex;justify-content:space-between;align-items:flex-end;gap:24px;flex-wrap:wrap;margin-top:22px;padding-top:16px;border-top:1px solid var(--line-2,var(--line))}
.doc-foot-text{flex:1 1 320px;min-width:0;display:grid;gap:10px}
.doc-foot-block b{display:block;font-size:11.5px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;color:var(--ink-3);margin-bottom:3px}
.doc-foot-block p{margin:0;font-size:12.5px;line-height:1.6;color:var(--ink-2);white-space:pre-line}
.doc-sign{flex:0 0 auto;min-width:200px;text-align:right;font-size:12.5px;color:var(--ink-2)}
.doc-sign-img{height:52px;display:flex;align-items:flex-end;justify-content:flex-end;margin-top:4px}
.doc-sign-img img{max-height:52px;max-width:200px;width:auto;object-fit:contain}
.doc-sign-line{border-top:1px solid #9ca3af;margin:4px 0 5px auto;width:200px}
.doc-sign-name{font-weight:700;color:var(--ink)}
.doc-sign-title{color:var(--ink-3);font-size:12px}
.doc-footnote{margin:14px 0 0;text-align:center;font-size:11.5px;color:var(--ink-3)}
@media (max-width:560px){ .doc-sign{text-align:left;min-width:0;width:100%} .doc-sign-img{justify-content:flex-start} .doc-sign-line{margin-left:0} }
@media print{
  .tip-bubble,.hp-ov,.more-ov,.help-btn,.staff-tabbar,.tour-ring,.tour-pop{display:none !important}
  .doc-card{border-top-color:var(--doc-accent) !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
