/* =========================================================
   SmartersWeb AI Hub - production theme shell v18.45
   Purpose: final light/dark conflict resolver + modern header/footer polish.
   Loaded after older rescue/stability CSS so it controls the real UI theme.
   ========================================================= */

:root{
  color-scheme:dark;
  --bg:#070a12;
  --bg-soft:#0b1020;
  --panel:#101827;
  --panel-2:#151f32;
  --panel-3:#0c1323;
  --text:#f8fafc;
  --muted:#a7b0c3;
  --muted-2:#828da3;
  --line:rgba(255,255,255,.12);
  --brand:#7c5cff;
  --brand-2:#16d6b6;
  --brand-3:#4f8cff;
  --success:#4ade80;
  --warning:#fbbf24;
  --danger:#fb7185;
  --shadow:0 28px 90px rgba(0,0,0,.42);
  --shadow-soft:0 18px 50px rgba(0,0,0,.24);
  --shell-max:1680px;
  --public-max:1180px;
  --header-h:74px;
  --surface-glass:linear-gradient(180deg,rgba(255,255,255,.086),rgba(255,255,255,.038));
  --surface-card:linear-gradient(180deg,rgba(255,255,255,.078),rgba(255,255,255,.034));
  --surface-popover:#0f1728;
  --surface-field:rgba(2,6,23,.42);
  --header-bg:rgba(7,10,18,.86);
  --footer-bg:linear-gradient(180deg,rgba(10,15,29,.62),rgba(7,10,18,.94));
  --theme-focus:0 0 0 4px rgba(22,214,182,.18),0 0 0 1px rgba(22,214,182,.44) inset;
}

:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f5f7fb;
  --bg-soft:#eaf0f8;
  --panel:#ffffff;
  --panel-2:#f7f9fd;
  --panel-3:#eef3fa;
  --text:#111827;
  --muted:#5d687b;
  --muted-2:#7b8494;
  --line:rgba(17,24,39,.12);
  --shadow:0 28px 90px rgba(17,24,39,.13);
  --shadow-soft:0 18px 50px rgba(17,24,39,.09);
  --surface-glass:linear-gradient(180deg,rgba(255,255,255,.94),rgba(255,255,255,.76));
  --surface-card:linear-gradient(180deg,#ffffff,#f8fbff);
  --surface-popover:#ffffff;
  --surface-field:#ffffff;
  --header-bg:rgba(255,255,255,.86);
  --footer-bg:linear-gradient(180deg,#ffffff,#edf3fb);
}

html:not([data-theme="light"]) body,
html[data-theme="dark"] body{
  background:
    radial-gradient(circle at 8% 0%,rgba(124,92,255,.22),transparent 30%),
    radial-gradient(circle at 92% 8%,rgba(22,214,182,.16),transparent 28%),
    linear-gradient(180deg,var(--bg),var(--bg-soft)) !important;
  color:var(--text) !important;
}

html[data-theme="light"] body{
  background:
    radial-gradient(circle at 8% 0%,rgba(124,92,255,.12),transparent 30%),
    radial-gradient(circle at 92% 8%,rgba(22,214,182,.11),transparent 28%),
    linear-gradient(180deg,var(--bg),var(--bg-soft)) !important;
  color:var(--text) !important;
}

/* Logged-in app theme resolution. Older patches forced these pages to dark;
   these selectors intentionally come last and use matching !important rules. */
html[data-theme="light"] body.section-client,
html[data-theme="light"] body.section-admin{
  --bg:#f5f7fb;
  --bg-soft:#eaf0f8;
  --panel:#ffffff;
  --panel-2:#f7f9fd;
  --panel-3:#eef3fa;
  --text:#111827;
  --muted:#5d687b;
  --muted-2:#7b8494;
  --line:rgba(17,24,39,.12);
  --shadow:0 28px 90px rgba(17,24,39,.13);
  --shadow-soft:0 18px 50px rgba(17,24,39,.09);
  background:
    radial-gradient(circle at 0% 45%,rgba(124,92,255,.12),transparent 30%),
    radial-gradient(circle at 100% 42%,rgba(22,214,182,.12),transparent 30%),
    linear-gradient(180deg,var(--bg),var(--bg-soft)) !important;
  color:var(--text) !important;
}

html:not([data-theme="light"]) body.section-client,
html:not([data-theme="light"]) body.section-admin,
html[data-theme="dark"] body.section-client,
html[data-theme="dark"] body.section-admin{
  --bg:#070a12;
  --bg-soft:#0b1020;
  --panel:#111827;
  --panel-2:#162033;
  --panel-3:#0e1525;
  --text:#f8fafc;
  --muted:#a7b0c3;
  --muted-2:#7f8aa1;
  --line:rgba(255,255,255,.115);
  --shadow:0 24px 80px rgba(0,0,0,.38);
  --shadow-soft:0 16px 45px rgba(0,0,0,.22);
  background:
    radial-gradient(circle at 0% 50%,rgba(124,92,255,.20),transparent 28%),
    radial-gradient(circle at 100% 45%,rgba(22,214,182,.18),transparent 28%),
    linear-gradient(180deg,var(--bg),var(--bg-soft)) !important;
  color:var(--text) !important;
}

body.layout-v18-25 a{color:inherit;}
body.layout-v18-25 .muted,
body.layout-v18-25 small{color:var(--muted);}
body.layout-v18-25 h1,
body.layout-v18-25 h2,
body.layout-v18-25 h3,
body.layout-v18-25 h4,
body.layout-v18-25 strong{color:var(--text);}

/* Modern unified header */
body.layout-v18-25 .site-header-v18-25{
  min-height:var(--header-h) !important;
  padding:10px max(18px,calc((100vw - var(--shell-max))/2 + 18px)) !important;
  background:var(--header-bg) !important;
  border-bottom:1px solid var(--line) !important;
  box-shadow:0 10px 32px rgba(0,0,0,.12) !important;
  backdrop-filter:blur(20px) saturate(1.3) !important;
  -webkit-backdrop-filter:blur(20px) saturate(1.3) !important;
}
body.section-public .site-header-v18-25{
  padding-inline:max(24px,calc((100vw - var(--public-max))/2)) !important;
}
body.layout-v18-25 .header-left,
body.layout-v18-25 .header-actions{
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  min-width:0 !important;
}
body.layout-v18-25 .brand{
  min-width:0 !important;
  gap:12px !important;
  letter-spacing:-.035em !important;
}
body.layout-v18-25 .brand-logo-img{
  width:44px !important;
  height:44px !important;
  display:grid !important;
  place-items:center !important;
  border-radius:16px !important;
  overflow:hidden !important;
  background:linear-gradient(135deg,rgba(124,92,255,.22),rgba(22,214,182,.18)) !important;
  border:1px solid color-mix(in srgb,var(--line) 70%,transparent) !important;
  box-shadow:0 12px 32px rgba(124,92,255,.18) !important;
}
body.layout-v18-25 .brand-logo-img img{
  display:block !important;
  width:100% !important;
  height:100% !important;
  object-fit:contain !important;
}
body.layout-v18-25 .brand-copy{
  display:grid !important;
  gap:1px !important;
  min-width:0 !important;
}
body.layout-v18-25 .brand-text{
  color:var(--text) !important;
  font-size:1.02rem !important;
  line-height:1.06 !important;
  max-width:245px !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
}
body.layout-v18-25 .brand-copy small{
  color:var(--muted) !important;
  font-size:.73rem !important;
  font-weight:850 !important;
  line-height:1.1 !important;
  letter-spacing:.02em !important;
}
.header-context-pill{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:5px 9px;
  border-radius:999px;
  border:1px solid var(--line);
  color:var(--muted);
  background:color-mix(in srgb,var(--panel) 72%,transparent);
  font-size:.74rem;
  font-weight:950;
  white-space:nowrap;
}
body.section-admin .header-context-pill{
  color:color-mix(in srgb,var(--brand-2) 82%,var(--text));
  border-color:rgba(22,214,182,.28);
}

body.layout-v18-25 .primary-nav{
  justify-content:center !important;
  gap:8px !important;
  min-width:0 !important;
}
body.layout-v18-25 .primary-nav > a,
body.layout-v18-25 .nav-dropdown-toggle,
body.layout-v18-25 .header-actions > a:not(.btn),
body.layout-v18-25 .header-actions > button,
body.layout-v18-25 .command-btn,
body.layout-v18-25 .theme-toggle,
body.layout-v18-25 .theme-icon,
body.layout-v18-25 .icon-btn,
body.layout-v18-25 .nav-toggle,
body.layout-v18-25 .sidebar-toggle,
body.layout-v18-25 .user-chip{
  min-height:42px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:8px !important;
  border:1px solid transparent !important;
  border-radius:999px !important;
  background:transparent !important;
  color:color-mix(in srgb,var(--text) 78%,var(--muted)) !important;
  box-shadow:none !important;
  font-weight:900 !important;
  line-height:1 !important;
  padding:9px 13px !important;
  cursor:pointer !important;
  transition:background .18s ease,border-color .18s ease,color .18s ease,transform .18s ease !important;
}
body.layout-v18-25 .primary-nav > a:hover,
body.layout-v18-25 .primary-nav > a.active,
body.layout-v18-25 .nav-dropdown.active .nav-dropdown-toggle,
body.layout-v18-25 .nav-dropdown-toggle:hover,
body.layout-v18-25 .header-actions > a:not(.btn):hover,
body.layout-v18-25 .header-actions > button:hover,
body.layout-v18-25 .command-btn:hover,
body.layout-v18-25 .theme-toggle:hover,
body.layout-v18-25 .theme-icon:hover,
body.layout-v18-25 .icon-btn:hover,
body.layout-v18-25 .nav-toggle:hover,
body.layout-v18-25 .sidebar-toggle:hover,
body.layout-v18-25 .user-chip:hover{
  color:var(--text) !important;
  border-color:var(--line) !important;
  background:color-mix(in srgb,var(--panel) 72%,transparent) !important;
  transform:translateY(-1px) !important;
}
body.layout-v18-25 .btn,
body.layout-v18-25 button.btn{
  border:1px solid transparent !important;
  box-shadow:0 14px 34px rgba(124,92,255,.24) !important;
}
body.layout-v18-25 .btn-secondary,
body.layout-v18-25 .btn-ghost{
  border-color:var(--line) !important;
  color:var(--text) !important;
  background:color-mix(in srgb,var(--panel) 68%,transparent) !important;
  box-shadow:none !important;
}
body.layout-v18-25 .theme-toggle,
body.layout-v18-25 .theme-icon{
  min-width:42px !important;
}
.theme-toggle-icon{
  width:22px;
  height:22px;
  display:inline-grid;
  place-items:center;
  border-radius:999px;
  background:linear-gradient(135deg,rgba(124,92,255,.24),rgba(22,214,182,.18));
  color:var(--text);
  font-size:.82rem;
}
body.layout-v18-25 .theme-icon [data-theme-label]{display:none;}
body.layout-v18-25 .notification-btn{position:relative !important;padding-inline:12px !important;}
body.layout-v18-25 .notification-btn strong{
  position:absolute;
  right:-2px;
  top:-4px;
  min-width:19px;
  min-height:19px;
  border-radius:999px;
  display:grid;
  place-items:center;
  padding:2px 5px;
  background:linear-gradient(135deg,var(--danger),#ff9a76);
  color:#fff;
  font-size:.68rem;
  line-height:1;
  border:2px solid var(--panel);
}
body.layout-v18-25 .notification-btn strong.is-hidden{display:none;}

/* Dropdown and popover polish */
body.layout-v18-25 .nav-dropdown{position:relative;}
body.layout-v18-25 .nav-dropdown-menu,
body.layout-v18-25 .notification-popover,
body.layout-v18-25 .user-popover{
  background:var(--surface-popover) !important;
  color:var(--text) !important;
  border:1px solid var(--line) !important;
  box-shadow:var(--shadow) !important;
  border-radius:22px !important;
  backdrop-filter:blur(18px) !important;
  -webkit-backdrop-filter:blur(18px) !important;
}
body.layout-v18-25 .nav-dropdown-menu{
  min-width:236px !important;
  padding:8px !important;
}
body.layout-v18-25 .nav-dropdown-menu a,
body.layout-v18-25 .user-popover a,
body.layout-v18-25 .notification-item{
  border-radius:14px !important;
  color:color-mix(in srgb,var(--text) 80%,var(--muted)) !important;
}
body.layout-v18-25 .nav-dropdown-menu a:hover,
body.layout-v18-25 .nav-dropdown-menu a.active,
body.layout-v18-25 .user-popover a:hover,
body.layout-v18-25 .notification-item:hover,
body.layout-v18-25 .notification-item.is-unread{
  color:var(--text) !important;
  background:linear-gradient(135deg,rgba(22,214,182,.12),rgba(124,92,255,.10)) !important;
}

/* Card, field, table, sidebar consistency across light/dark. */
body.layout-v18-25 .panel,
body.layout-v18-25 .card,
body.layout-v18-25 .metric-card,
body.layout-v18-25 .insight-card,
body.layout-v18-25 .module-card,
body.layout-v18-25 .tool-card,
body.layout-v18-25 .workflow-card,
body.layout-v18-25 .feature-row,
body.layout-v18-25 .article-card,
body.layout-v18-25 .support-card,
body.layout-v18-25 .pricing-card-v18-5,
body.layout-v18-25 .pricing-trust-card,
body.layout-v18-25 .client-billing-note{
  background:var(--surface-card) !important;
  border-color:var(--line) !important;
  color:var(--text) !important;
  box-shadow:var(--shadow-soft) !important;
}
body.layout-v18-25 input,
body.layout-v18-25 textarea,
body.layout-v18-25 select,
body.layout-v18-25 .filter-input,
body.layout-v18-25 .command-search{
  background:var(--surface-field) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}
body.layout-v18-25 input::placeholder,
body.layout-v18-25 textarea::placeholder{
  color:var(--muted-2) !important;
}
body.layout-v18-25 input:focus,
body.layout-v18-25 textarea:focus,
body.layout-v18-25 select:focus,
body.layout-v18-25 button:focus-visible,
body.layout-v18-25 a:focus-visible{
  outline:none !important;
  box-shadow:var(--theme-focus) !important;
}
body.layout-v18-25 .table-wrap,
body.layout-v18-25 .table,
body.layout-v18-25 table{
  background:color-mix(in srgb,var(--panel) 78%,transparent) !important;
  color:var(--text) !important;
}
body.layout-v18-25 th{
  background:color-mix(in srgb,var(--panel) 94%,transparent) !important;
  color:var(--muted) !important;
}
body.layout-v18-25 td{color:var(--text) !important;}
body.layout-v18-25 tbody tr:hover{background:color-mix(in srgb,var(--brand) 8%,transparent) !important;}
body.section-client .sidebar,
body.section-admin .sidebar{
  background:
    radial-gradient(circle at top left,rgba(124,92,255,.10),transparent 34%),
    var(--surface-glass) !important;
  border-color:var(--line) !important;
  color:var(--text) !important;
}
html[data-theme="light"] body.section-client .sidebar,
html[data-theme="light"] body.section-admin .sidebar{
  box-shadow:0 20px 54px rgba(17,24,39,.10) !important;
}
body.section-client .sidebar a,
body.section-admin .sidebar a{
  color:color-mix(in srgb,var(--text) 76%,var(--muted)) !important;
}
body.section-client .sidebar a:hover,
body.section-client .sidebar a.active,
body.section-admin .sidebar a:hover,
body.section-admin .sidebar a.active{
  color:var(--text) !important;
  border-color:rgba(22,214,182,.32) !important;
  background:linear-gradient(135deg,rgba(22,214,182,.13),rgba(124,92,255,.10)) !important;
}

/* Professional public footer */
body.layout-v18-25 .site-footer-v18-23{
  margin-top:40px !important;
  padding:46px 0 24px !important;
  background:var(--footer-bg) !important;
  border-top:1px solid var(--line) !important;
  color:var(--text) !important;
}
body.layout-v18-25 .site-footer-v18-23 .footer-inner{
  width:min(var(--public-max),calc(100% - 32px)) !important;
  max-width:var(--public-max) !important;
  margin:0 auto !important;
  display:grid !important;
  grid-template-columns:minmax(260px,1.15fr) repeat(3,minmax(150px,.55fr)) !important;
  align-items:start !important;
  gap:30px !important;
}
body.layout-v18-25 .footer-brand{
  display:grid !important;
  gap:14px !important;
  max-width:460px !important;
}
body.layout-v18-25 .footer-brand-top{
  display:flex;
  align-items:center;
  gap:12px;
}
body.layout-v18-25 .footer-logo{
  width:46px;
  height:46px;
  display:grid;
  place-items:center;
  border-radius:16px;
  overflow:hidden;
  border:1px solid var(--line);
  background:linear-gradient(135deg,rgba(124,92,255,.20),rgba(22,214,182,.14));
}
body.layout-v18-25 .footer-logo img{width:100%;height:100%;object-fit:contain;display:block;}
body.layout-v18-25 .footer-brand strong{font-size:1.08rem;line-height:1.1;}
body.layout-v18-25 .footer-brand span,
body.layout-v18-25 .footer-brand p{color:var(--muted);margin:0;}
body.layout-v18-25 .footer-column{
  display:grid;
  gap:10px;
}
body.layout-v18-25 .footer-column strong{
  color:var(--text);
  font-size:.82rem;
  text-transform:uppercase;
  letter-spacing:.10em;
}
body.layout-v18-25 .footer-links{
  display:grid !important;
  gap:8px !important;
  justify-content:stretch !important;
  align-items:start !important;
  margin:0 !important;
}
body.layout-v18-25 .footer-links a,
body.layout-v18-25 .footer-column a{
  color:var(--muted) !important;
  font-weight:800 !important;
  line-height:1.25 !important;
}
body.layout-v18-25 .footer-links a:hover,
body.layout-v18-25 .footer-column a:hover{
  color:var(--text) !important;
}
body.layout-v18-25 .footer-bottom{
  width:min(var(--public-max),calc(100% - 32px));
  max-width:var(--public-max);
  margin:34px auto 0;
  padding-top:18px;
  border-top:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  color:var(--muted);
  font-size:.88rem;
}
body.layout-v18-25 .footer-bottom a{color:var(--muted);font-weight:850;}
body.layout-v18-25 .footer-bottom a:hover{color:var(--text);}

/* Mobile shell */
@media (max-width:1180px){
  body.layout-v18-25{--header-h:68px;}
  body.layout-v18-25 .site-header-v18-25{
    min-height:68px !important;
    padding:10px 14px !important;
  }
  body.layout-v18-25 .primary-nav{
    position:fixed !important;
    left:14px !important;
    right:14px !important;
    top:78px !important;
    z-index:700 !important;
    display:none !important;
    grid-template-columns:1fr !important;
    align-items:stretch !important;
    justify-content:start !important;
    padding:12px !important;
    border:1px solid var(--line) !important;
    border-radius:24px !important;
    background:var(--surface-popover) !important;
    box-shadow:var(--shadow) !important;
  }
  body.layout-v18-25 .primary-nav.open{display:grid !important;}
  body.layout-v18-25 .primary-nav > a,
  body.layout-v18-25 .nav-dropdown-toggle{
    justify-content:flex-start !important;
    width:100% !important;
  }
  body.layout-v18-25 .nav-dropdown-menu{
    position:static !important;
    display:none !important;
    min-width:0 !important;
    margin:4px 0 8px !important;
    box-shadow:none !important;
    border-radius:18px !important;
  }
  body.layout-v18-25 .nav-dropdown.is-open .nav-dropdown-menu,
  body.layout-v18-25 .nav-dropdown.open .nav-dropdown-menu,
  body.layout-v18-25 .nav-dropdown:focus-within .nav-dropdown-menu{display:grid !important;}
  body.layout-v18-25 .nav-toggle{display:inline-flex !important;}
  .header-context-pill{display:none;}
}

@media (max-width:760px){
  body.layout-v18-25 .brand-text{max-width:46vw !important;}
  body.layout-v18-25 .brand-logo-img{width:40px !important;height:40px !important;border-radius:14px !important;}
  body.layout-v18-25 .command-btn,
  body.layout-v18-25 .theme-toggle [data-theme-label],
  body.layout-v18-25 .theme-icon [data-theme-label],
  body.layout-v18-25 .user-chip-name{display:none !important;}
  body.layout-v18-25 .site-footer-v18-23 .footer-inner{
    grid-template-columns:1fr !important;
    gap:22px !important;
  }
  body.layout-v18-25 .footer-bottom{
    display:grid;
    justify-content:start;
  }
}

/* =========================================================
   v18.46 production responsive shell correction
   Purpose: fix crowded header, tablet/mobile menu, dashboard/sidebar,
   forms, cards, and tables across light/dark modes.
   ========================================================= */
:root{
  --shell-mobile-break:1320px;
  --tap-target:44px;
}

body.layout-v18-25 .site-header-v18-25{
  display:grid !important;
  grid-template-columns:minmax(220px,max-content) minmax(0,1fr) max-content !important;
  align-items:center !important;
  column-gap:16px !important;
  width:100% !important;
}
body.layout-v18-25 .header-left{justify-self:start !important;}
body.layout-v18-25 .primary-nav{justify-self:center !important;max-width:100% !important;}
body.layout-v18-25 .header-actions{justify-self:end !important;white-space:nowrap !important;}
body.layout-v18-25 .nav-toggle{display:none !important;}
body.layout-v18-25 .sidebar-toggle{display:none !important;}
body.layout-v18-25 .nav-dropdown-toggle span{margin-left:2px;opacity:.72;}
body.layout-v18-25 .nav-dropdown.open .nav-dropdown-toggle,
body.layout-v18-25 .nav-dropdown:focus-within .nav-dropdown-toggle{
  color:var(--text) !important;
  background:color-mix(in srgb,var(--panel) 74%,transparent) !important;
  border-color:var(--line) !important;
}
body.layout-v18-25 .nav-dropdown.open .nav-dropdown-menu,
body.layout-v18-25 .nav-dropdown:focus-within .nav-dropdown-menu{
  display:grid !important;
  gap:3px !important;
}
body.layout-v18-25 .nav-dropdown-menu{
  position:absolute !important;
  top:calc(100% + 10px) !important;
  left:50% !important;
  transform:translateX(-50%) !important;
  display:none !important;
  z-index:10020 !important;
}
body.layout-v18-25 .nav-dropdown-menu a{padding:11px 12px !important;}
body.layout-v18-25 .user-popover,
body.layout-v18-25 .notification-popover{
  right:0 !important;
  z-index:10025 !important;
}
body.layout-v18-25 .avatar-mini{
  width:26px !important;
  height:26px !important;
  display:grid !important;
  place-items:center !important;
  border-radius:999px !important;
  background:linear-gradient(135deg,var(--brand),var(--brand-2)) !important;
  color:#fff !important;
  font-size:.78rem !important;
  font-weight:950 !important;
}

/* Desktop squeeze: keep the header professional before it reaches tablet. */
@media (min-width:1321px) and (max-width:1510px){
  body.section-client.layout-v18-25 .site-header-v18-25,
  body.section-admin.layout-v18-25 .site-header-v18-25{
    grid-template-columns:minmax(200px,250px) minmax(0,1fr) max-content !important;
    column-gap:10px !important;
  }
  body.section-client.layout-v18-25 .brand-text,
  body.section-admin.layout-v18-25 .brand-text{max-width:175px !important;}
  body.section-client.layout-v18-25 .brand-copy small,
  body.section-admin.layout-v18-25 .brand-copy small{display:none !important;}
  body.section-client.layout-v18-25 .primary-nav,
  body.section-admin.layout-v18-25 .primary-nav{gap:4px !important;}
  body.section-client.layout-v18-25 .nav-dropdown-toggle,
  body.section-admin.layout-v18-25 .nav-dropdown-toggle,
  body.section-client.layout-v18-25 .primary-nav > a,
  body.section-admin.layout-v18-25 .primary-nav > a{padding-inline:10px !important;font-size:.88rem !important;}
  body.section-client.layout-v18-25 .command-btn,
  body.section-admin.layout-v18-25 .command-btn{display:none !important;}
}

/* Tablet/mobile app shell. Switch earlier so the header never feels cramped. */
@media (max-width:1320px){
  :root{--header-h:68px;--sw-fixed-header-h:68px;--sw-header-h:68px;}
  body.layout-v18-25 .site-header-v18-25,
  body.section-client .site-header-v18-25,
  body.section-admin .site-header-v18-25{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) max-content !important;
    gap:10px !important;
    min-height:68px !important;
    padding:10px 14px !important;
  }
  body.layout-v18-25 .header-left{min-width:0 !important;overflow:hidden !important;}
  body.layout-v18-25 .header-actions{gap:6px !important;min-width:0 !important;}
  body.layout-v18-25 .brand{max-width:100% !important;min-width:0 !important;}
  body.layout-v18-25 .brand-text{max-width:32vw !important;font-size:.96rem !important;}
  body.layout-v18-25 .brand-copy small{max-width:32vw !important;font-size:.68rem !important;}
  body.layout-v18-25 .header-context-pill{display:none !important;}
  body.layout-v18-25 .sidebar-toggle,
  body.layout-v18-25 .nav-toggle{
    display:inline-flex !important;
    min-width:var(--tap-target) !important;
    min-height:var(--tap-target) !important;
    padding-inline:12px !important;
    font-size:.88rem !important;
  }
  body.layout-v18-25 .sidebar-toggle{order:5 !important;}
  body.layout-v18-25 .nav-toggle{order:30 !important;}
  body.layout-v18-25 .primary-nav,
  body.section-public.layout-v18-25 .primary-nav,
  body.section-client.layout-v18-25 .primary-nav,
  body.section-admin.layout-v18-25 .primary-nav{
    position:fixed !important;
    top:78px !important;
    left:14px !important;
    right:14px !important;
    width:auto !important;
    max-height:calc(100dvh - 92px) !important;
    overflow:auto !important;
    display:none !important;
    grid-template-columns:1fr !important;
    align-items:stretch !important;
    justify-content:start !important;
    gap:7px !important;
    padding:12px !important;
    border:1px solid var(--line) !important;
    border-radius:24px !important;
    background:var(--surface-popover) !important;
    box-shadow:var(--shadow) !important;
    z-index:10010 !important;
    overscroll-behavior:contain !important;
  }
  body.layout-v18-25.nav-open .primary-nav,
  body.layout-v18-25 .primary-nav.open,
  body.nav-open.layout-v18-25 .primary-nav{
    display:grid !important;
  }
  body.layout-v18-25 .primary-nav > a,
  body.layout-v18-25 .nav-dropdown-toggle{
    width:100% !important;
    min-height:46px !important;
    justify-content:space-between !important;
    text-align:left !important;
    border:1px solid var(--line) !important;
    background:color-mix(in srgb,var(--panel) 66%,transparent) !important;
    border-radius:16px !important;
    padding:12px 14px !important;
  }
  body.layout-v18-25 .nav-dropdown{display:grid !important;gap:7px !important;}
  body.layout-v18-25 .nav-dropdown-menu{
    position:static !important;
    left:auto !important;
    top:auto !important;
    transform:none !important;
    width:100% !important;
    min-width:0 !important;
    padding:7px !important;
    margin:0 0 3px !important;
    border-radius:18px !important;
    box-shadow:none !important;
    background:color-mix(in srgb,var(--panel) 86%,transparent) !important;
  }
  body.layout-v18-25 .nav-dropdown-menu a{
    min-height:42px !important;
    display:flex !important;
    align-items:center !important;
  }
  body.section-client.layout-v18-25 .main-client,
  body.section-admin.layout-v18-25 .main-admin{
    padding-top:68px !important;
  }
  body.section-client.layout-v18-25 .subnav-flow,
  body.section-admin.layout-v18-25 .subnav-flow,
  body.section-client.layout-v18-25 .extension-subnav-v18-23,
  body.section-admin.layout-v18-25 .extension-subnav-v18-23{
    display:none !important;
  }
  body.section-client.layout-v18-25 .dashboard,
  body.section-admin.layout-v18-25 .dashboard,
  body.section-client.layout-v18-25 .ai-tools-suite-page,
  body.section-client.layout-v18-25 .visual-suite-page,
  body.section-client.layout-v18-25 .voice-suite-page,
  body.section-client.layout-v18-25 .chatbot-builder-page{
    width:min(100% - 28px,var(--shell-max)) !important;
    max-width:100% !important;
    display:block !important;
    margin:0 auto !important;
    padding:18px 0 44px !important;
  }
  body.section-client.layout-v18-25 .dashboard > .sidebar,
  body.section-client.layout-v18-25 .dashboard > aside.sidebar,
  body.section-admin.layout-v18-25 .dashboard > .sidebar,
  body.section-admin.layout-v18-25 .dashboard > aside.sidebar,
  body.section-client.layout-v18-25 .ai-tools-sidebar,
  body.section-admin.layout-v18-25 .ai-tools-sidebar{
    position:fixed !important;
    left:14px !important;
    right:auto !important;
    top:80px !important;
    bottom:14px !important;
    width:min(352px,calc(100vw - 28px)) !important;
    max-width:none !important;
    max-height:none !important;
    transform:translateX(calc(-100% - 32px)) !important;
    transition:transform .22s ease,box-shadow .22s ease !important;
    z-index:10015 !important;
    overflow:auto !important;
    padding:14px !important;
    border-radius:24px !important;
    box-shadow:var(--shadow) !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
  }
  body.sidebar-open.section-client.layout-v18-25 .dashboard > .sidebar,
  body.sidebar-open.section-client.layout-v18-25 .dashboard > aside.sidebar,
  body.sidebar-open.section-admin.layout-v18-25 .dashboard > .sidebar,
  body.sidebar-open.section-admin.layout-v18-25 .dashboard > aside.sidebar,
  body.sidebar-open.section-client.layout-v18-25 .ai-tools-sidebar,
  body.sidebar-open.section-admin.layout-v18-25 .ai-tools-sidebar{
    transform:translateX(0) !important;
  }
  body.nav-open .mobile-scrim,
  body.sidebar-open .mobile-scrim,
  body.section-client.nav-open .mobile-scrim,
  body.section-admin.nav-open .mobile-scrim,
  body.section-client.sidebar-open .mobile-scrim,
  body.section-admin.sidebar-open .mobile-scrim{
    display:block !important;
    opacity:1 !important;
    visibility:visible !important;
    pointer-events:auto !important;
    position:fixed !important;
    inset:0 !important;
    z-index:10000 !important;
    background:rgba(2,6,23,.56) !important;
    backdrop-filter:blur(4px) !important;
  }
}

/* Project-wide responsive content fixes. */
@media (max-width:1080px){
  body.layout-v18-25 .container,
  body.layout-v18-25 .hero,
  body.layout-v18-25 .section,
  body.layout-v18-25 .auth-shell{
    width:min(100% - 28px,var(--public-max)) !important;
    padding-left:0 !important;
    padding-right:0 !important;
  }
  body.layout-v18-25 .hero,
  body.layout-v18-25 .auth-shell,
  body.layout-v18-25 .dash-hero-grid,
  body.layout-v18-25 .dashboard-grid-main,
  body.layout-v18-25 .dashboard-lists,
  body.layout-v18-25 .grid-2,
  body.layout-v18-25 .grid-3,
  body.layout-v18-25 .grid-4,
  body.layout-v18-25 .tool-grid,
  body.layout-v18-25 .module-grid,
  body.layout-v18-25 .front-module-grid,
  body.layout-v18-25 .pricing-grid,
  body.layout-v18-25 .pricing-grid-v18-5,
  body.layout-v18-25 .feature-grid,
  body.layout-v18-25 .feature-row{
    grid-template-columns:1fr !important;
  }
  body.layout-v18-25 .section-head,
  body.layout-v18-25 .table-tools,
  body.layout-v18-25 .output-toolbar,
  body.layout-v18-25 .metric-row{
    align-items:flex-start !important;
    flex-direction:column !important;
  }
  body.layout-v18-25 .quick-actions,
  body.layout-v18-25 .action-row,
  body.layout-v18-25 .hero-actions,
  body.layout-v18-25 .inline-form{
    display:flex !important;
    flex-wrap:wrap !important;
    align-items:stretch !important;
  }
  body.layout-v18-25 .inline-form input,
  body.layout-v18-25 .inline-form select,
  body.layout-v18-25 .inline-form button,
  body.layout-v18-25 .quick-actions .btn,
  body.layout-v18-25 .hero-actions .btn{
    max-width:100% !important;
  }
  body.layout-v18-25 .dash-main .page-title,
  body.layout-v18-25 .dash-main .dash-hero .page-title,
  body.layout-v18-25 .page-title,
  body.layout-v18-25 .hero h1{
    font-size:clamp(2rem,7vw,3.2rem) !important;
    line-height:1.04 !important;
    letter-spacing:-.052em !important;
  }
  body.layout-v18-25 .lead,
  body.layout-v18-25 .dash-main .lead{
    font-size:clamp(.98rem,2.6vw,1.08rem) !important;
    line-height:1.62 !important;
  }
  body.layout-v18-25 .panel,
  body.layout-v18-25 .card,
  body.layout-v18-25 .metric-card,
  body.layout-v18-25 .insight-card,
  body.layout-v18-25 .dash-hero{
    padding:20px !important;
    border-radius:22px !important;
  }
  body.layout-v18-25 .table-wrap{
    width:100% !important;
    max-width:100% !important;
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch !important;
  }
  body.layout-v18-25 table,
  body.layout-v18-25 .table{
    min-width:720px !important;
  }
}

@media (max-width:760px){
  :root{--header-h:64px;--sw-fixed-header-h:64px;--sw-header-h:64px;}
  body.layout-v18-25 .site-header-v18-25,
  body.section-client .site-header-v18-25,
  body.section-admin .site-header-v18-25{
    min-height:64px !important;
    padding:9px 10px !important;
    grid-template-columns:minmax(0,1fr) auto !important;
  }
  body.layout-v18-25 .brand-logo-img{width:38px !important;height:38px !important;border-radius:13px !important;}
  body.layout-v18-25 .brand{gap:9px !important;}
  body.layout-v18-25 .brand-text{max-width:40vw !important;font-size:.9rem !important;}
  body.layout-v18-25 .brand-copy small{display:none !important;}
  body.layout-v18-25 .header-actions > a:not(.btn),
  body.layout-v18-25 .command-btn,
  body.layout-v18-25 .notification-btn span,
  body.layout-v18-25 .theme-toggle [data-theme-label],
  body.layout-v18-25 .theme-icon [data-theme-label],
  body.layout-v18-25 .user-chip-name{display:none !important;}
  body.layout-v18-25 .header-actions > button,
  body.layout-v18-25 .theme-toggle,
  body.layout-v18-25 .theme-icon,
  body.layout-v18-25 .icon-btn,
  body.layout-v18-25 .nav-toggle,
  body.layout-v18-25 .sidebar-toggle,
  body.layout-v18-25 .user-chip{
    min-width:40px !important;
    min-height:40px !important;
    width:40px !important;
    padding:0 !important;
    border-radius:14px !important;
  }
  body.layout-v18-25 .nav-toggle{font-size:0 !important;position:relative !important;}
  body.layout-v18-25 .nav-toggle::before{content:'☰';font-size:1rem !important;line-height:1 !important;}
  body.layout-v18-25 .sidebar-toggle{font-size:0 !important;position:relative !important;}
  body.layout-v18-25 .sidebar-toggle::before{content:'☰';font-size:1rem !important;line-height:1 !important;}
  body.layout-v18-25 .primary-nav,
  body.section-public.layout-v18-25 .primary-nav,
  body.section-client.layout-v18-25 .primary-nav,
  body.section-admin.layout-v18-25 .primary-nav{
    top:72px !important;
    left:10px !important;
    right:10px !important;
    max-height:calc(100dvh - 84px) !important;
    border-radius:22px !important;
  }
  body.section-client.layout-v18-25 .main-client,
  body.section-admin.layout-v18-25 .main-admin{padding-top:64px !important;}
  body.section-client.layout-v18-25 .dashboard,
  body.section-admin.layout-v18-25 .dashboard,
  body.section-client.layout-v18-25 .ai-tools-suite-page,
  body.section-client.layout-v18-25 .visual-suite-page,
  body.section-client.layout-v18-25 .voice-suite-page,
  body.section-client.layout-v18-25 .chatbot-builder-page{
    width:calc(100% - 20px) !important;
    padding-top:14px !important;
  }
  body.section-client.layout-v18-25 .dashboard > .sidebar,
  body.section-client.layout-v18-25 .dashboard > aside.sidebar,
  body.section-admin.layout-v18-25 .dashboard > .sidebar,
  body.section-admin.layout-v18-25 .dashboard > aside.sidebar{
    left:10px !important;
    top:74px !important;
    bottom:10px !important;
    width:calc(100vw - 20px) !important;
  }
  body.layout-v18-25 .panel,
  body.layout-v18-25 .card,
  body.layout-v18-25 .metric-card,
  body.layout-v18-25 .insight-card,
  body.layout-v18-25 .dash-hero{
    padding:16px !important;
    border-radius:20px !important;
  }
  body.layout-v18-25 .stat{font-size:1.85rem !important;}
  body.layout-v18-25 .form input,
  body.layout-v18-25 .form select,
  body.layout-v18-25 .form textarea,
  body.layout-v18-25 input,
  body.layout-v18-25 select,
  body.layout-v18-25 textarea{
    min-height:44px !important;
    font-size:16px !important;
  }
  body.layout-v18-25 .btn,
  body.layout-v18-25 button.btn,
  body.layout-v18-25 .quick-actions .btn,
  body.layout-v18-25 .hero-actions .btn,
  body.layout-v18-25 .action-row .btn{
    width:100% !important;
  }
  body.layout-v18-25 .oauth-grid{grid-template-columns:1fr !important;}
  body.layout-v18-25 .table-tools input{max-width:100% !important;width:100% !important;}
  body.layout-v18-25 .site-footer-v18-23{padding-top:32px !important;}
}

@media (max-width:460px){
  body.layout-v18-25 .brand-text{max-width:44vw !important;}
  body.layout-v18-25 .brand-logo-img{width:36px !important;height:36px !important;}
  body.layout-v18-25 .header-actions{gap:4px !important;}
  body.layout-v18-25 .header-actions > button,
  body.layout-v18-25 .theme-toggle,
  body.layout-v18-25 .theme-icon,
  body.layout-v18-25 .icon-btn,
  body.layout-v18-25 .nav-toggle,
  body.layout-v18-25 .sidebar-toggle,
  body.layout-v18-25 .user-chip{width:38px !important;min-width:38px !important;min-height:38px !important;}
}
