/* Shared layout safeguards. Loaded after page styles on all three surfaces.
   Wide tables/code scroll within their container; the page itself stays fluid. */
*, *::before, *::after { box-sizing:border-box; }
body { margin:0; }
:where(.site-surface,.client-surface,.admin-surface) { overflow-wrap:anywhere; }
:where(.wrap,.doc,.prose,.content,.main,.card,.card-body,.card-head,.field,.auth-main,.auth-card,
  .grid > *,.row > *,.form-grid > *,.stack > *,.hero-grid > *,.doc > *,.settings-grid > *,
  .wa-center-grid > *,.care-survey-layout > *,.public-modules > *) { min-width:0; }
:where(img,video,canvas) { max-width:100%; }
:where(input,select,textarea,fieldset) { min-width:0; max-width:100%; }
:where(pre,.code,.table-wrap,.prose table) { min-width:0; max-width:100%; }
:where(pre,.table-wrap,.prose table) { overflow-x:auto; overscroll-behavior-x:contain; }
.prose { width:100%; }
.prose pre code { overflow-wrap:normal; word-break:normal; }
.prose :where(p,li,td,dd), .ep-line { overflow-wrap:anywhere; }
.prose th,.prose td { min-width:140px; }
.legal-id dd { margin:0; }
.site-surface .public-modules article { border-top:1px solid var(--line); }
.site-surface .public-module-icon { color:var(--ink-2); background:var(--surface-alt); }
.site-surface .public-module-detail { color:var(--muted); }
.site-surface .hero-pills span { background:var(--surface); color:var(--ink-2); border:1px solid var(--line); }
.site-surface .public-modules article:hover { transform:none; border-color:var(--line-strong); box-shadow:none; }
.site-surface .faq summary { padding-right:6px; }
.site-surface .paywith-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; max-width:800px; margin:auto; }
.site-surface .paywith .pw { min-width:0; padding:14px 10px; gap:8px; border:1px solid var(--line); background:var(--surface); border-radius:8px; justify-content:center; }
.payment-logo { display:flex; align-items:center; justify-content:center; width:112px; max-width:100%; height:52px; padding:6px 10px; background:#fff; border-radius:5px; }
.payment-logo img { display:block; width:100%; height:100%; object-fit:contain; }
.site-surface .paywith .pw span:not(.payment-logo) { color:var(--muted); margin:0; font-size:12px; }
.site-surface .paywith .pw b { color:var(--ink); font-style:normal; font-size:14px; }
.site-surface .pw.bank svg { width:28px; height:28px; color:var(--ink-2); }
:is(.client-surface,.admin-surface) :is(.kpi,.kpi3) { border-top:1px solid var(--line); }
:is(.client-surface,.admin-surface) .shell .nav a:not(.active) svg { color:var(--sidebar-muted); }
.wa-summary-icon:not(.good), .wa-account-icon { background:var(--surface-alt); color:var(--ink-2); }
.wa-account.selected { background:var(--accent-bg); border-color:var(--accent-line); box-shadow:inset 3px 0 var(--brand-blue); }
.inbox-workspace .bubble.agent { background:var(--surface-hover); border-color:var(--line-strong); color:var(--ink); }
.inbox-workspace .bubble.agent .by,.inbox-workspace .bubble.agent .btext a,.inbox-workspace .bubble.agent .dlv { color:var(--accent); }
.inbox-workspace .bubble.agent { background:var(--surface-hover); border-color:var(--line-strong); color:var(--ink); }
.inbox-workspace .bubble.agent .by,.inbox-workspace .bubble.agent .btext a,.inbox-workspace .bubble.agent .dlv { color:var(--accent); }
.table-wrap { width:100%; }
/* Older detail screens render tables directly inside cards. */
:not(.table-wrap) > table.table { display:block; max-width:100%; overflow-x:auto; }
.agent-grid { grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr)); }
.src-pick { grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr)); }
.pick-grid { grid-template-columns:repeat(auto-fill,minmax(min(100%,200px),1fr)); }
.check-grid { grid-template-columns:repeat(auto-fill,minmax(min(100%,180px),1fr)); }
.modal,.drawer { max-width:100%; max-height:100dvh; }
.card-head,.page-head,.section-heading { flex-wrap:wrap; }
.page-head > .row { flex-wrap:wrap; }
.kv dd { min-width:0; overflow-wrap:anywhere; }
.file-card { min-width:0; max-width:100%; }
.attach-preview b { max-width:100%; }

@media (max-width:1100px) {
  .site-surface .hero-grid { grid-template-columns:minmax(0,1fr); }
  .site-surface .demo { width:100%; max-width:620px; margin:auto; }
}
@media (max-width:960px) {
  .site-surface .links { display:none; position:absolute; top:100%; left:0; right:0; padding:16px 24px; flex-direction:column; gap:12px; background:var(--surface); border-bottom:1px solid var(--line); }
  .site-surface .links.open { display:flex; }
  .site-surface .burger { display:flex; }
  .site-surface .nav-in { gap:16px; }
  .site-surface .nav-cta .link-quiet { display:none; }
  .shell,.shell.nav-collapsed { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:700px) {
  .site-surface .wrap { width:calc(100% - 32px); }
  .site-surface .paywith { padding:20px 14px; }
  .site-surface .paywith-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .site-surface .paywith-note { text-align:left; }
  .site-surface .public-modules { grid-template-columns:minmax(0,1fr); gap:12px; }
  .site-surface .public-modules article { padding:20px; }
  .site-surface .public-modules h3 { font-size:16px; }
  .site-surface .public-modules p { font-size:14px; margin-bottom:14px; }
  .site-surface .public-module-detail { font-size:12px; }
  .site-surface .public-module-icon { margin-bottom:14px; }
  .site-surface .page-hero { padding:32px 0 28px; }
  .prose { font-size:14px; }
  .prose th,.prose td { padding:10px; }
  .code pre { font-size:12px; }
  .site-surface .btn { white-space:normal; height:auto; min-height:44px; padding-block:10px; text-align:center; }
  .site-surface .sandbox-cta { padding:20px 16px; }
  .site-surface .webbot { padding:20px 16px; }
  .site-surface .foot-bottom { flex-wrap:wrap; gap:12px; }
}
@media (max-width:640px) {
  :is(.client-surface,.admin-surface) .content { padding:18px 12px; }
  :is(.client-surface,.admin-surface) .btn { height:auto; min-height:40px; padding-block:8px; white-space:normal; text-align:center; }
  :is(.client-surface,.admin-surface) .btn-icon { flex:none; padding:0; }
  .filters-bar :is(.input,.select,.select.sm,.grow) { min-width:0; max-width:100%; flex:1 1 150px; }
  .filters-bar { align-items:stretch; }
  .form-grid.tight { grid-template-columns:minmax(0,1fr); }
  .seg { max-width:100%; flex-wrap:wrap; }
  .seg button { white-space:normal; }
  .vt-scroll { grid-template-columns:minmax(0,1fr); }
  .survey-options { grid-template-columns:minmax(0,1fr); }
  .survey-options label span { display:flex; align-items:center; gap:12px; text-align:left; font-size:14px; padding:10px 14px; }
  .survey-options label b { font-size:18px; }
  .page-head > .row { width:100%; }
  .page-head > .row > .btn { flex:1 1 auto; }
  .card-head > .row { flex-wrap:wrap; }
  .kv { grid-template-columns:minmax(0,1fr); gap:4px; }
  .kv dd { margin-bottom:10px; }
  .modal { width:100%; }
  .modal-head,.modal-body,.modal-foot,.drawer-body { padding:16px; }
  .modal-foot,.drawer-foot { flex-wrap:wrap; }
  .wa-overview { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .wa-center-grid { grid-template-columns:minmax(0,1fr); }
  .wa-connect-help .row { flex-wrap:wrap; }
  .wa-connect-help .btn { flex:1 1 180px; }
  .auth-main { padding:64px 20px 28px; }
  .auth-card { width:100%; }
  .ai-usage-nav { grid-template-columns:minmax(0,1fr); }
  .topbar { gap:8px; }
  .topbar > .wa-pill { max-width:110px; overflow:hidden; }
  .topbar .wa-pill span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
@media (max-width:380px) {
  .site-surface .logo img[data-brand="wordmark"] { width:120px; }
  .site-surface .nav-in { gap:8px; }
  .site-surface .nav-cta .btn { display:none; }
  .site-surface .hero h1 { font-size:28px; }
  .module-shelf { grid-template-columns:minmax(0,1fr); }
  .topbar > .wa-pill { display:none; }
}
