/* IuVe user-panel surface — soft-glow + frosted glass SSOT for cabinet pages.
   Must win over iuve-sidebar-v2 white / bare-transparent shells.
   Legacy blue/teal atmosphere archived:
   ops/archive/legacy_panel_surface_20261122/
*/

@import url("/static/css/iuve-public-surface.css");

:root {
  /* Glass / shell tokens live in iuve-public-surface.css (light+dark). */
  --iuve-panel-bg: var(--iuve-surface-bg, #f7f5f2);
  --iuve-panel-bg-image: var(--iuve-surface-bg-image);
  --iuve-panel-elev: var(--iuve-glass);
  --iuve-panel-ink: var(--iuve-surface-ink, #14121a);
  --iuve-panel-glow-a: var(--iuve-surface-glow-a, rgba(255, 45, 143, 0.1));
  --iuve-panel-glow-b: var(--iuve-surface-glow-b, rgba(109, 40, 217, 0.12));

  --iuve-shell-bg: transparent;
  --sidebar-v2-bg: var(--iuve-shell-sidebar-bg);
  --sidebar-v2-border: var(--iuve-shell-border);
  --app-shell-content-bg: transparent;
}

html {
  background-color: var(--iuve-panel-bg);
}

html,
body,
body.low-effects,
html.dash-preload body,
html:has(.app-shell.app-shell-v2),
body:has(.app-shell.app-shell-v2),
.app-shell.app-shell-v2,
body.iuve-shell.app-shell,
.iuve-shell.app-shell {
  color: var(--iuve-panel-ink) !important;
  background: var(--iuve-panel-bg-image) !important;
  background-attachment: fixed !important;
}

.iuve-shell .app-content,
.iuve-shell .iuve-main,
.app-shell-v2 > .app-content,
.app-shell > .app-content,
.app-shell.app-shell-v2 .app-content,
.app-shell.app-shell-v2 .main-layout {
  background: transparent !important;
}

body[data-page="iuve-chat"],
html:has(body[data-page="iuve-chat"]),
body[data-page="iuve-chat"][data-active-mode="apps"] {
  background: var(--iuve-panel-bg-image) !important;
  background-attachment: fixed !important;
}

/* Sidebar rail: frosted cream — soft-glow shows, layers do not bleed */
html body .sidebar-v2.side-nav,
html body[data-active-mode] .sidebar-v2.side-nav,
html body[data-page="iuve-chat"] #app-shell .sidebar-v2.side-nav,
html body[data-page="iuve-chat"] #app-shell .side-nav,
html body .app-shell.app-shell-v2 .sidebar-v2.side-nav,
html body .side-nav,
html body .iuve-shell #app-side-nav,
html body .iuve-shell .side-nav,
html body .iuve-shell .sidebar-v2,
html body .sidebar-v2 {
  background: var(--iuve-shell-sidebar-bg) !important;
  background-image: none !important;
  background-color: var(--iuve-shell-sidebar-bg) !important;
  backdrop-filter: var(--iuve-glass-blur) !important;
  -webkit-backdrop-filter: var(--iuve-glass-blur) !important;
  border-right: 1px solid var(--iuve-glass-border) !important;
  isolation: isolate;
  z-index: 30;
}

html body .sidebar-v2.side-nav :is(
  .sidebar-v2__header,
  .sidebar-v2__scroll,
  .sidebar-v2__footer,
  .side-nav-header,
  .side-nav-scroll,
  .side-nav-footer
) {
  background: transparent !important;
  background-image: none !important;
}

/* Kill leftover flat-white chips / profile / popovers in rail */
html body .sidebar-v2.side-nav :is(
  .side-nav-subcontrol-select,
  .side-nav-subcontrol-chip,
  .mode-chip.side-nav-subcontrol-chip
) {
  background: var(--iuve-glass) !important;
  border-color: var(--iuve-glass-border) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: none !important;
}

/* Chat column isolated so sidebar text cannot composite through */
html body[data-page="iuve-chat"] #app-shell > .app-content,
html body[data-page="iuve-chat"] #app-shell .dashboard-layout,
html body[data-page="iuve-chat"] .unified-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
  background: transparent !important;
}

html body[data-page="iuve-chat"] #app-shell,
html body[data-page="iuve-chat"] #unified-card.unified-card,
html body[data-page="iuve-chat"] .unified-card.card,
html body[data-page="iuve-chat"] .unified-card.unified-pristine,
html body[data-page="iuve-chat"] .unified-chat,
html body[data-page="iuve-chat"] #unified-messages,
html body[data-page="iuve-chat"] .unified-messages,
html body[data-page="iuve-chat"] #unified-main.dashboard-layout {
  background: transparent !important;
  background-image: none !important;
  background-color: transparent !important;
}

/* Sticky composer zone: matte cream glass — no message text bleed-through */
html body[data-page="iuve-chat"] #unified-input-footer.unified-input,
html body[data-page="iuve-chat"] .unified-input {
  background-image: linear-gradient(
    180deg,
    rgba(247, 245, 242, 0) 0%,
    rgba(247, 245, 242, 0.72) 22%,
    var(--iuve-shell-sidebar-bg-strong) 55%,
    rgba(247, 245, 242, 0.96) 100%
  ) !important;
  background-color: rgba(247, 245, 242, 0.88) !important;
  backdrop-filter: blur(16px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.06) !important;
  box-shadow: none !important;
  border-top-color: transparent !important;
}

html body[data-page="iuve-chat"] #unified-form,
html body[data-page="iuve-chat"] .unified-composer-wrap {
  background: transparent !important;
  box-shadow: none !important;
}

/* Input pill: readable glass */
html body[data-page="iuve-chat"] .unified-composer,
html body[data-page="iuve-chat"] #unified-composer-area.unified-composer {
  background: var(--iuve-glass-strong) !important;
  border: 1px solid var(--iuve-glass-border) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05) !important;
}

/* Route / Connect chips */
html body[data-page="iuve-chat"] .unified-route-hud,
html body[data-page="iuve-chat"] #unified-route-hud,
html body[data-page="iuve-chat"] .unified-connect-chip,
html body[data-page="iuve-chat"] #unified-connect-chip {
  background: var(--iuve-glass-strong) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--iuve-glass-border) !important;
}

/* AI message cards: soft glass, not #fff slab */
html body[data-page="iuve-chat"] .unified-msg.unified-msg-ai,
html body[data-page="iuve-chat"] #unified-card .unified-msg-ai {
  background: var(--iuve-glass-soft) !important;
  border: 1px solid rgba(20, 18, 26, 0.08) !important;
  box-shadow: none !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html body[data-page="iuve-chat"] .unified-msg.unified-msg-ai.unified-msg-pending,
html body[data-page="iuve-chat"] #unified-card .unified-msg-ai.unified-msg-pending {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

/* User bubbles denser for contrast */
html body[data-page="iuve-chat"] .unified-msg.unified-msg-user,
html body[data-page="iuve-chat"] #unified-card .unified-msg-user {
  background: rgba(232, 238, 246, 0.92) !important;
  border: 1px solid rgba(211, 220, 232, 0.9) !important;
}

/* Artifact / download cards */
html body[data-page="iuve-chat"] .iuve-artifact-download,
html body[data-page="iuve-chat"] .iuve-artifact-card,
html body[data-page="iuve-chat"] .unified-file-card {
  background: rgba(255, 252, 250, 0.82) !important;
  border-color: rgba(20, 18, 26, 0.10) !important;
}

/* Quick action / widget buttons under composer */
html body[data-page="iuve-chat"] .unified-quick-btn,
html body[data-page="iuve-chat"] #unified-quick-actions .unified-quick-btn {
  background: var(--iuve-glass-soft) !important;
  border-color: var(--iuve-glass-border) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Account popover denser — cream only in light (dark override lost the specificity war) */
html:not([data-theme-resolved="dark"]) body .sidebar-v2__user-popover,
html:not([data-theme-resolved="dark"]) body .sidebar-v2.side-nav .sidebar-v2__user-popover,
html:not([data-theme-resolved="dark"]) body[data-page="iuve-chat"] #app-shell .sidebar-v2__user-popover,
html:not([data-theme-resolved="dark"]) body .app-shell.app-shell-v2.mobile-nav-open .sidebar-v2__user-popover,
html:not([data-theme-resolved="dark"]) body .app-shell.app-shell-v2[data-sidebar-mobile="open"] .sidebar-v2__user-popover {
  background: #fcf8f5 !important;
  background-color: #fcf8f5 !important;
  backdrop-filter: blur(22px) saturate(1.1) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.1) !important;
  border: 1px solid rgba(20, 18, 26, 0.10) !important;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12) !important;
}

html body .sidebar-v2__user-trigger-row,
html body .sidebar-v2.side-nav .sidebar-v2__user-trigger-row {
  background: rgba(109, 40, 217, 0.07) !important;
  border: 1px solid rgba(20, 18, 26, 0.08) !important;
}

html body .sidebar-v2 .side-nav-picker-item.is-active,
html body .sidebar-v2 .side-nav-picker-item:hover,
html body[data-page="iuve-chat"] #app-shell .side-nav-picker-item.is-active,
html body .app-shell.app-shell-v2.mobile-nav-open .side-nav-picker-item.is-active,
html body .app-shell.app-shell-v2[data-sidebar-mobile="open"] .side-nav-picker-item.is-active {
  background: rgba(109, 40, 217, 0.08) !important;
  border: 1px solid rgba(109, 40, 217, 0.12) !important;
}

html body .app-shell.app-shell-v2.mobile-nav-open .sidebar-v2.side-nav,
html body .app-shell.app-shell-v2[data-sidebar-mobile="open"] .sidebar-v2.side-nav {
  background: var(--iuve-shell-sidebar-bg-strong) !important;
  background-color: var(--iuve-shell-sidebar-bg-strong) !important;
  backdrop-filter: blur(20px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
}

/* Soft-glow: cabinet pages + full admin (last-word frost) */
html body .app-shell.app-shell-v2 .dashboard-layout > .card,
html body .app-shell.app-shell-v2 .workspace-layout > .card,
html body .app-shell.app-shell-v2 .marketplace-layout > .card,
html body .app-shell.app-shell-v2 .account-layout > .card,
html body .app-shell.app-shell-v2 .billing-layout > .card,
html body .app-shell.app-shell-v2 .team-layout > .card,
html body .app-shell.app-shell-v2 .profile-card,
html body .app-shell.app-shell-v2 .chat-card,
html body .app-shell.app-shell-v2 .usage-table-card,
html body .app-shell.app-shell-v2 .usage-card,
html body .app-shell.app-shell-v2 .usage-plan-card,
html body .app-shell.app-shell-v2 .usage-card-total,
html body .app-shell.app-shell-v2 .usage-kpi-card,
html body .app-shell.app-shell-v2 .billing-kpi-card,
html body .app-shell.app-shell-v2 .billing-plan-card,
html body .app-shell.app-shell-v2 .billing-current-card,
html body .app-shell.app-shell-v2 .billing-usage-card,
html body .app-shell.app-shell-v2 .api-key-create-card,
html body .app-shell.app-shell-v2 .api-key-new-card,
html body .app-shell.app-shell-v2 .team-overview-card,
html body .app-shell.app-shell-v2 .team-invite-card,
html body .app-shell.app-shell-v2 .team-invites-card,
html body .app-shell.app-shell-v2 .team-members-card,
html body .app-shell.app-shell-v2 .team-invite-link-card,
html body .app-shell.app-shell-v2 .admin-card,
html body .app-shell.app-shell-v2 .admin-action-card,
html body .app-shell.app-shell-v2 .admin-audit-card,
html body .app-shell.app-shell-v2 .admin-card-spaced,
html body .app-shell.app-shell-v2 .ruflo-main-panel,
html body .app-shell.app-shell-v2 .ruflo-analytics-panel,
html body .app-shell.app-shell-v2 .ruflo-upgrade-card,
html body .app-shell.app-shell-v2 .ruflo-form-wrap,
html body .app-shell.app-shell-v2 .ruflo-presets-wrap,
html body .app-shell[data-page="account"] .card,
html body .app-shell[data-page="billing"] .card,
html body .app-shell[data-page="api_keys"] .card,
html body .app-shell[data-page="usage"] .card,
html body .app-shell[data-page="team"] .card,
html body .app-shell[data-page="admin"] .card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-action-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-audit-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .usage-table-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .usage-kpi-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .profile-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .ruflo-main-panel,
html body :is(.app-shell, #app-shell)[data-page="admin"] .ruflo-analytics-panel,
html body :is(.app-shell, #app-shell)[data-page="admin"] .ruflo-upgrade-card {
  background: var(--iuve-glass-soft) !important;
  background-image: none !important;
  background-color: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
}

html body .app-shell.app-shell-v2 .dashboard-layout > .card:hover,
html body .app-shell.app-shell-v2 .account-layout > .card:hover,
html body .app-shell.app-shell-v2 .billing-layout > .card:hover,
html body .app-shell.app-shell-v2 .team-layout > .card:hover,
html body .app-shell[data-page] .card:hover {
  transform: none !important;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08) !important;
}

/* Table wraps / inner panels */
html body .app-shell.app-shell-v2 .usage-table-wrap,
html body .app-shell.app-shell-v2 .table-wrap,
html body .app-shell.app-shell-v2 .admin-audit-table-wrap,
html body .app-shell.app-shell-v2 .team-table-wrap,
html body :is(.app-shell, #app-shell)[data-page="admin"] .usage-table-wrap,
html body :is(.app-shell, #app-shell)[data-page="admin"] .table-wrap,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-audit-table-wrap {
  background: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Admin KPI / section tiles — beat admin-visual-unify #fff */
html body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-security-kpi-item,
  .admin-apps-kpi-item,
  .admin-backup-kpi-item,
  .admin-trader-kpi-item,
  .admin-marketplace-kpi-item,
  .admin-dataset-kpi-item,
  .admin-pages-kpi-item,
  .admin-trader-worker,
  .admin-trader-panel,
  .admin-trader-card,
  .admin-section,
  .admin-panel,
  .acc-card,
  .acc-panel,
  .acc-module-card,
  .admin-control-center .card,
  #admin-control-center .card,
  #admin-control-center [class*="acc-"][class*="card"],
  #admin-control-center [class*="acc-"][class*="panel"]
):not(.is-warn):not(.is-alert) {
  background: var(--iuve-glass-soft) !important;
  background-color: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  backdrop-filter: blur(12px) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.05) !important;
  box-shadow: none !important;
}

/* Keep warn/alert semantic tints readable (not flat white) */
html body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-security-kpi-item,
  .admin-apps-kpi-item,
  .admin-backup-kpi-item,
  .admin-trader-kpi-item,
  .admin-marketplace-kpi-item,
  .admin-dataset-kpi-item,
  .admin-pages-kpi-item,
  .admin-trader-worker
).is-warn {
  background: rgba(255, 247, 237, 0.85) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
html body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-security-kpi-item,
  .admin-apps-kpi-item,
  .admin-backup-kpi-item,
  .admin-trader-kpi-item,
  .admin-marketplace-kpi-item,
  .admin-dataset-kpi-item,
  .admin-pages-kpi-item,
  .admin-trader-worker
).is-alert {
  background: rgba(255, 241, 242, 0.85) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Account/Team heroes + inputs (cabinet forms) */
html body .app-shell[data-page="account"] .account-identity-hero,
html body .app-shell[data-page="team"] .team-identity-hero {
  background:
    linear-gradient(135deg, rgba(109, 40, 217, 0.06), rgba(255, 45, 143, 0.04)),
    var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html body .app-shell[data-page="account"] .account-meta > div,
html body .app-shell[data-page="account"] .account-user-id,
html body .app-shell[data-page="account"] .account-settings-links,
html body .app-shell[data-page="team"] .team-settings-links {
  background: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
}

html body .app-shell[data-page="account"] :is(input[type="password"], input[type="text"], input[type="email"], select, textarea),
html body .app-shell[data-page="team"] :is(input[type="password"], input[type="text"], input[type="email"], select, textarea),
html body .app-shell[data-page="billing"] :is(input, select, textarea),
html body .app-shell[data-page="api_keys"] :is(input, select, textarea),
html body .app-shell[data-page="admin"] :is(input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea) {
  background: var(--iuve-glass-strong) !important;
  border-color: rgba(20, 18, 26, 0.12) !important;
}

/* Admin section nav / tabs strip */
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs,
html body .app-shell.app-shell-v2 .admin-section-tabs {
  background: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}


/* admin-nav-adblock-fallback: layout for pills/overview must NOT live only in admin-*.css
   (uBlock/EasyList often abort URLs containing "admin"). Keep chrome here in panel-surface. */
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: 14px !important;
  padding: 12px !important;
  border-radius: 16px !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-group {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px 8px !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-group-label {
  flex: 0 0 auto !important;
  min-width: 8.5rem !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: #64748b !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-group-links {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-link,
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav a,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs a {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 34px !important;
  padding: 0 13px !important;
  border-radius: 999px !important;
  font-size: 12.5px !important;
  font-weight: 650 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  border: 1px solid rgba(148, 163, 184, 0.42) !important;
  color: #334155 !important;
  -webkit-text-fill-color: #334155 !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-link:hover,
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav a:hover,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs a:hover {
  border-color: rgba(11, 95, 255, 0.4) !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: rgba(11, 95, 255, 0.10) !important;
  text-decoration: none !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-link.active,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs a.active,
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav a.is-active {
  background: #0b5fff !important;
  border-color: #0b5fff !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-decoration: none !important;
  box-shadow: 0 6px 14px rgba(11, 95, 255, 0.22) !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 0 10px !important;
}
/* admin-nav-adblock-fallback-mobile: keep horizontal scroll on narrow viewports */
@media (max-width: 640px) {
  html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    gap: 6px !important;
  }
  html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav a {
    flex-shrink: 0 !important;
  }
}

html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-global-search {
  display: block !important;
  width: 100% !important;
  max-width: 520px !important;
  min-height: 38px !important;
  padding: 9px 14px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(148, 163, 184, 0.45) !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-size: 0.95rem !important;
  box-sizing: border-box !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-overview-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
  margin: 0 0 16px !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-health-card {
  padding: 14px 16px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(148, 163, 184, 0.32) !important;
  background: rgba(248, 250, 252, 0.85) !important;
  box-sizing: border-box !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-health-card-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin-bottom: 8px !important;
  flex-wrap: wrap !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-health-card-title {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: #475569 !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-health-card-value {
  font-size: 1.45rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  color: #0f172a !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-health-card-foot {
  margin-top: 6px !important;
  font-size: 0.82rem !important;
  color: #4b5563 !important;
  line-height: 1.4 !important;
}
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-badge {
  display: inline-block !important;
  padding: 3px 9px !important;
  border-radius: 4px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  white-space: nowrap !important;
}

/* Soft-glow admin nuclear last-word */
html body.admin-settings-page .profile-card.acc-settings-alerts-only,
html body.admin-planner-page .profile-card.acc-planner-shell-header,
html body.admin-routing-page .profile-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .dashboard-layout > .profile-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .dashboard-layout > .card.profile-card,
html body :is(.app-shell, #app-shell)[data-page="admin"] .card.profile-card.acc-settings-alerts-only,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-nav,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-link,
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav a,
html body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs a,
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-security-kpi-item:not(.is-warn):not(.is-alert):not(.is-ok),
html body :is(.app-shell, #app-shell)[data-page="admin"] .acc-global-search {
  background: var(--iuve-glass) !important;
  background-color: var(--iuve-glass) !important;
  background-image: none !important;
  border-color: rgba(20, 18, 26, 0.10) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
  box-shadow: none !important;
}

html:not([data-theme-resolved="dark"]) body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-nav {
  background: linear-gradient(180deg, rgba(255,252,250,0.82) 0%, rgba(247,245,242,0.75) 100%) !important;
}

html:not([data-theme-resolved="dark"]) body :is(.app-shell, #app-shell)[data-page="admin"] .admin-nav-link.active,
html:not([data-theme-resolved="dark"]) body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs a.active,
html:not([data-theme-resolved="dark"]) body :is(.app-shell, #app-shell)[data-page="admin"] .acc-module-nav a.is-active {
  background: #0b5fff !important;
  border-color: #0947d6 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-decoration: none !important;
}

/* Soft-glow: widget + marketplace + trader + connect */
/* Website widget (unified chat mode=apps) */
html body[data-page="iuve-chat"] .unified-apps-wizard,
html body[data-page="iuve-chat"][data-active-mode="apps"] .unified-apps-wizard,
html body[data-page="iuve-chat"] .unified-apps-card,
html body[data-page="iuve-chat"][data-active-mode="apps"] .unified-apps-card,
html body[data-page="iuve-chat"] .unified-apps-preview,
html body[data-page="iuve-chat"] .unified-apps-btn:not(.unified-apps-btn-primary) {
  background: var(--iuve-glass-soft) !important;
  background-image: none !important;
  background-color: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
}

html body[data-page="iuve-chat"] .unified-apps-field :is(input, textarea, select) {
  background: var(--iuve-glass-strong) !important;
  border-color: rgba(20, 18, 26, 0.12) !important;
}

/* Marketplace catalog + all subsections */
html body .app-shell[data-page="marketplace"] .card,
html body .app-shell[data-page="marketplace"] .profile-card,
html body .app-shell[data-page="marketplace"] .marketplace-card,
html body .app-shell[data-page="marketplace"] .marketplace-license-card,
html body .app-shell[data-page="marketplace"] .marketplace-subnav .mode-chip:not(.active) {
  background: var(--iuve-glass-soft) !important;
  background-image: none !important;
  background-color: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
}

html body .app-shell[data-page="marketplace"] .marketplace-license-card {
  background:
    linear-gradient(135deg, rgba(109, 40, 217, 0.05), rgba(255, 45, 143, 0.03)),
    var(--iuve-glass-soft) !important;
  border-left-color: rgba(109, 40, 217, 0.35) !important;
}

/* Trader */
html body .app-shell[data-page="trader"] .card,
html body .app-shell[data-page="trader"] .profile-card,
html body .app-shell[data-page="trader"] .trader-bot-card,
html body .app-shell[data-page="trader"] .trader-activity-card,
html body .app-shell[data-page="trader"] .trader-advisor-card,
html body .app-shell[data-page="trader"] .trader-alloc-panel,
html body .app-shell[data-page="trader"] .trader-account-strip,
html body .app-shell[data-page="trader"] [class*="trader-"][class*="card"],
html body .app-shell[data-page="trader"] [class*="trader-"][class*="panel"] {
  background: var(--iuve-glass-soft) !important;
  background-image: none !important;
  background-color: var(--iuve-glass-soft) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
}

html body .app-shell[data-page="trader"] :is(input, select, textarea) {
  background: var(--iuve-glass-strong) !important;
  border-color: rgba(20, 18, 26, 0.12) !important;
}

/* IuVe Connect — beat inline monochrome #fff !important */
html body.app-shell[data-page="iuve_connect"] .ic-page :is(
  [class*="card"],
  [class*="panel"],
  [class*="tile"],
  [class*="banner"],
  [class*="strip"],
  [class*="section"],
  [class*="surface"],
  [class*="chain"],
  [class*="parity"],
  [class*="topology"],
  [class*="policy"],
  [class*="evidence"],
  [class*="trust"],
  [class*="runtime"],
  [class*="platform"],
  [class*="device"],
  [class*="summary"],
  [class*="timeline"],
  [class*="continuity"],
  [class*="registry"],
  [class*="integrity"],
  section,
  article
),
html body.app-shell[data-page="iuve_connect"] :is(
  .ic-gov-panel,
  .ic-policy-card,
  .ic-evidence-card,
  .ic-platform-card,
  .ic-registry-card,
  .ic-device-card,
  .ic-trust-tile,
  .ic-modal,
  .ic-security-notice,
  .ic-plan-banner,
  .ic-continuity-strip,
  .ic-token,
  .ic-evidence-digest
),
html body.app-shell[data-page="iuve_connect"] :is(.ic-btn, .ic-btn--ghost, .ic-btn--secondary, .ic-btn--primary),
html body.app-shell[data-page="iuve_connect"] :is(.ic-input, .ic-select, .ic-textarea, input, select, textarea) {
  background: var(--iuve-glass) !important;
  background-color: var(--iuve-glass) !important;
  background-image: none !important;
  border-color: rgba(20, 18, 26, 0.10) !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
}

html body.app-shell[data-page="iuve_connect"] .ic-btn--primary {
  background: rgba(109, 40, 217, 0.12) !important;
  background-color: rgba(109, 40, 217, 0.12) !important;
  border-color: rgba(109, 40, 217, 0.28) !important;
  color: #5b21b6 !important;
  -webkit-text-fill-color: #5b21b6 !important;
}

html body.app-shell[data-page="iuve_connect"] :is(.ic-policy-card, .ic-evidence-card, .ic-platform-card, .ic-device-card, .ic-trust-tile, .ic-gov-panel):hover {
  background: var(--iuve-glass-strong) !important;
  border-color: rgba(109, 40, 217, 0.22) !important;
}

/* Connect sidebar — body IS #app-shell; force frost (no bare transparency) */
html body.app-shell[data-page="iuve_connect"] .sidebar-v2.side-nav,
html body.app-shell[data-page="iuve_connect"] .side-nav.sidebar-v2,
html body.app-shell[data-page="iuve_connect"] .side-nav {
  background: var(--iuve-shell-sidebar-bg) !important;
  background-color: var(--iuve-shell-sidebar-bg) !important;
  background-image: none !important;
  backdrop-filter: blur(18px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.08) !important;
  border-right: 1px solid rgba(20, 18, 26, 0.1) !important;
}

/* Trader nested shells that trader.css still paints opaque */
html body .app-shell[data-page="trader"] .trader-decision-summary,
html body .app-shell[data-page="trader"] .trader-loss-create,
html body .app-shell[data-page="trader"] .trader-activity-list > li,
html body .app-shell[data-page="trader"] .trader-bot-card li,
html body .app-shell[data-page="trader"] [class*="trader-"][class*="summary"],
html body .app-shell[data-page="trader"] [class*="trader-"][class*="tile"],
html body .app-shell[data-page="trader"] [class*="trader-"][class*="chip"],
html body .app-shell[data-page="trader"] fieldset {
  background: var(--iuve-glass-soft) !important;
  background-color: var(--iuve-glass-soft) !important;
  background-image: none !important;
  backdrop-filter: blur(12px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.06) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
}

/* Marketplace secondary actions: glass not chalk */
html body .app-shell[data-page="marketplace"] .btn:not(.btn-primary):not(.marketplace-btn-primary),
html body .app-shell[data-page="marketplace"] button.secondary,
html body .app-shell[data-page="marketplace"] .marketplace-card .btn-ghost,
html body .app-shell[data-page="marketplace"] .marketplace-card a.btn:not(.btn-primary) {
  background: var(--iuve-glass-soft) !important;
  background-color: var(--iuve-glass-soft) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

html body[data-page="iuve-chat"] .unified-apps-wizard,
html body[data-page="iuve-chat"][data-active-mode="apps"] .unified-apps-wizard,
html body[data-page="iuve-chat"] .unified-apps-stepper {
  background: var(--iuve-glass-soft) !important;
  background-color: var(--iuve-glass-soft) !important;
  background-image: none !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
}

/* Genesis product detail shells + marketplace assistant chips */
html body .app-shell[data-page="marketplace"] .marketplace-doc-section,
html body .app-shell[data-page="marketplace"] .marketplace-changelog-entry,
html body .app-shell[data-page="marketplace"] .marketplace-suggestion-chip,
html body .app-shell[data-page="marketplace"] .marketplace-textarea,
html body .app-shell[data-page="marketplace"] .marketplace-assistant-panel,
html body .app-shell[data-page="marketplace"] .marketplace-assistant-card,
html body .app-shell[data-page="marketplace"] .marketplace-detail-panel,
html body .app-shell[data-page="marketplace"] .marketplace-hero,
html body .app-shell[data-page="marketplace"] .marketplace-media-card,
html body .app-shell[data-page="marketplace"] .mode-chip:not(.active),
html body .app-shell[data-page="marketplace"] .mode-chip.ghost,
html body .app-shell[data-page="marketplace"] .marketplace-btn:not(.primary),
html body .app-shell[data-page="marketplace"] button.marketplace-btn:not(.primary) {
  background: var(--iuve-glass-soft) !important;
  background-color: var(--iuve-glass-soft) !important;
  background-image: none !important;
  backdrop-filter: blur(12px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.06) !important;
  border-color: rgba(20, 18, 26, 0.08) !important;
}

/* Dark resolved — panel ink/active follow surface tokens (no layout rewrite) */
html[data-theme-resolved="dark"] {
  --iuve-panel-bg: var(--iuve-surface-bg);
  --iuve-panel-bg-image: var(--iuve-surface-bg-image);
  --iuve-panel-elev: var(--iuve-glass);
  --iuve-panel-ink: var(--iuve-surface-ink);
  --sidebar-v2-bg: var(--iuve-shell-sidebar-bg);
  --sidebar-v2-border: var(--iuve-shell-border);
  --iuve-shell-active-text: var(--iuve-surface-ink);
}

html[data-theme-resolved="dark"] body,
html[data-theme-resolved="dark"] .app-shell.app-shell-v2,
html[data-theme-resolved="dark"] .iuve-shell.app-shell {
  color: var(--iuve-panel-ink) !important;
  background: var(--iuve-panel-bg-image) !important;
}

/* —— Dark contrast fix: sidebar/marketplace kept light ink (#0f172a) on dark glass —— */
html[data-theme-resolved="dark"] {
  --sidebar-v2-text: var(--iuve-surface-ink);
  --sidebar-v2-muted: var(--iuve-surface-muted);
  --sidebar-v2-active-text: var(--iuve-surface-ink);
  --sidebar-active-fg: var(--iuve-surface-ink);
  --sidebar-v2-border: var(--iuve-shell-border);
  --text: var(--iuve-surface-ink);
  --text-muted: var(--iuve-surface-muted);
  --muted: var(--iuve-surface-muted);
}

html[data-theme-resolved="dark"] .sidebar-v2.side-nav,
html[data-theme-resolved="dark"] .side-nav.sidebar-v2,
html[data-theme-resolved="dark"] .sidebar-v2 {
  color: var(--iuve-surface-ink) !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 :is(
  a,
  button,
  .sidebar-v2__brand,
  .side-nav-brand,
  .sidebar-v2__item,
  .side-nav-action,
  .side-nav-new-chat,
  .side-nav-link-text,
  .sidebar-v2__item-label,
  .sidebar-v2__section-label,
  .side-nav-section-title,
  .side-nav-chat-title,
  .side-nav-project-title,
  .sidebar-v2__user-name,
  .sidebar-v2__user-meta,
  .side-nav-user-name,
  .side-nav-user-plan
) {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 :is(
  .side-nav-link-icon,
  .sidebar-v2__item-icon,
  .sidebar-v2__toggle,
  .side-nav-shell-toggle,
  .side-nav-chat-actions,
  .side-nav-project-actions
) {
  color: var(--iuve-surface-muted) !important;
  -webkit-text-fill-color: var(--iuve-surface-muted) !important;
}

/* Outline icons use svg[fill=none]; never force fill:currentColor on their shapes
   (collapse toggle became a solid light square in dark). */
html[data-theme-resolved="dark"] .sidebar-v2 svg {
  color: inherit !important;
}
html[data-theme-resolved="dark"] .sidebar-v2 svg[fill="none"],
html[data-theme-resolved="dark"] .sidebar-v2 svg[fill="none"] * {
  fill: none !important;
}
html[data-theme-resolved="dark"] .sidebar-v2 svg [fill]:not([fill="none"]) {
  fill: currentColor !important;
}
html[data-theme-resolved="dark"] .sidebar-v2 svg[stroke]:not([stroke="none"]),
html[data-theme-resolved="dark"] .sidebar-v2 svg [stroke]:not([stroke="none"]),
html[data-theme-resolved="dark"] .sidebar-v2 svg[fill="none"] :is(path, rect, circle, ellipse, line, polyline, polygon) {
  stroke: currentColor !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 :is(
  .sidebar-v2__section-label,
  .side-nav-section-title,
  .side-nav-muted,
  .sidebar-v2__muted
) {
  color: var(--iuve-surface-muted) !important;
  -webkit-text-fill-color: var(--iuve-surface-muted) !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 :is(
  .sidebar-v2__item:hover,
  .side-nav-action:hover,
  .side-nav-links a:hover,
  .sidebar-v2__item.is-active,
  .side-nav-action.active,
  .side-nav-links a.active
) {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
  background: var(--iuve-shell-hover) !important;
}

/* Marketplace chips / secondary buttons / muted copy */
html[data-theme-resolved="dark"] .app-shell[data-page="marketplace"] :is(
  .mode-chip:not(.active),
  .marketplace-btn:not(.primary),
  .marketplace-card-desc,
  .muted,
  .marketplace-subnav .mode-chip
) {
  color: var(--iuve-surface-muted) !important;
  -webkit-text-fill-color: var(--iuve-surface-muted) !important;
}

html[data-theme-resolved="dark"] .app-shell[data-page="marketplace"] :is(
  h1, h2, h3, .marketplace-card-title, .card > h1, .profile-card > h1
) {
  color: var(--iuve-surface-ink) !important;
}

html[data-theme-resolved="dark"] .app-shell[data-page="marketplace"] .mode-chip.active {
  color: #14121a !important;
  -webkit-text-fill-color: #14121a !important;
}

/* Chat column titles stay readable on dark */
html[data-theme-resolved="dark"] body[data-page="iuve-chat"] .sidebar-v2 :is(
  a, button, .side-nav-link-text, .sidebar-v2__item-label, .side-nav-chat-title
) {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 svg [fill]:not([fill="none"]),
html[data-theme-resolved="dark"] .side-nav svg [fill]:not([fill="none"]) {
  fill: currentColor !important;
}
html[data-theme-resolved="dark"] .sidebar-v2 svg [stroke]:not([stroke="none"]),
html[data-theme-resolved="dark"] .side-nav svg [stroke]:not([stroke="none"]) {
  stroke: currentColor !important;
}

/* Dark contrast pass 2 — picker labels + primary CTA readable */
html[data-theme-resolved="dark"] .sidebar-v2 :is(
  .sidebar-v2__brand-text,
  .side-nav-brand-text,
  .side-nav-picker-item-label,
  .side-nav-picker-item,
  .sidebar-v2__item-label,
  .side-nav-link-text,
  .sidebar-v2__user-plan,
  .side-nav-user-plan
) {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 .side-nav-picker-item-label {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 .sidebar-v2__user-plan,
html[data-theme-resolved="dark"] .sidebar-v2 .side-nav-user-plan {
  color: var(--iuve-surface-muted) !important;
  -webkit-text-fill-color: var(--iuve-surface-muted) !important;
}

/* Primary CTAs: --iuve-primary was remapped to cream → white text on cream */
html[data-theme-resolved="dark"] .app-shell[data-page="marketplace"] .marketplace-btn.primary,
html[data-theme-resolved="dark"] .app-shell[data-page="marketplace"] a.marketplace-btn.primary,
html[data-theme-resolved="dark"] .app-shell[data-page="marketplace"] .mode-chip.active {
  background: #f4f0ea !important;
  background-color: #f4f0ea !important;
  color: #14121a !important;
  -webkit-text-fill-color: #14121a !important;
  border-color: transparent !important;
}

html[data-theme-resolved="dark"] .sidebar-v2 .sidebar-v2__item-label,
html[data-theme-resolved="dark"] .sidebar-v2 .side-nav-link-text,
html[data-theme-resolved="dark"] .sidebar-v2 [class*="label"],
html[data-theme-resolved="dark"] .sidebar-v2 [class*="title"],
html[data-theme-resolved="dark"] body .sidebar-v2.side-nav .sidebar-v2__item-label.side-nav-link-text {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
}

/* Shared theme toggle control (home + panel) */
.iuve-theme-toggle {
  cursor: pointer;
}
.iuve-theme-toggle .iuve-theme-toggle__glyph,
.iuve-theme-toggle [data-iuve-theme-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
.iuve-theme-toggle .iuve-theme-toggle__glyph svg,
.iuve-theme-toggle [data-iuve-theme-icon] svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
}
.sidebar-v2__user-popover-item.iuve-theme-toggle {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
  background: transparent !important;
  border: 0 !important;
  font: inherit;
}
html[data-theme-resolved="dark"] .sidebar-v2__user-popover-item.iuve-theme-toggle {
  color: var(--iuve-surface-ink) !important;
  -webkit-text-fill-color: var(--iuve-surface-ink) !important;
}

/* Dark chat surfaces (external CSS; JS inject covers inline !important) */
html[data-theme-resolved="dark"] body[data-page="iuve-chat"] #unified-input-footer.unified-input,
html[data-theme-resolved="dark"] body[data-page="iuve-chat"] .unified-input {
  background-image: linear-gradient(
    180deg,
    rgba(20, 18, 26, 0) 0%,
    rgba(20, 18, 26, 0.72) 22%,
    rgba(20, 18, 26, 0.92) 55%,
    rgba(20, 18, 26, 0.97) 100%
  ) !important;
  background-color: rgba(20, 18, 26, 0.9) !important;
}
html[data-theme-resolved="dark"] body[data-page="iuve-chat"] .unified-msg.unified-msg-ai,
html[data-theme-resolved="dark"] body[data-page="iuve-chat"] #unified-card .unified-msg-ai {
  background: rgba(36, 30, 46, 0.78) !important;
  color: #f4f0ea !important;
}

/* Dark: account / action popovers sitewide (match cream-rule specificity) */
html[data-theme-resolved="dark"] body .sidebar-v2__user-popover,
html[data-theme-resolved="dark"] body .sidebar-v2.side-nav .sidebar-v2__user-popover,
html[data-theme-resolved="dark"] body[data-page="iuve-chat"] #app-shell .sidebar-v2__user-popover,
html[data-theme-resolved="dark"] body .app-shell.app-shell-v2.mobile-nav-open .sidebar-v2__user-popover,
html[data-theme-resolved="dark"] body .app-shell.app-shell-v2[data-sidebar-mobile="open"] .sidebar-v2__user-popover,
html[data-theme-resolved="dark"] body .side-nav-actions-popover,
html[data-theme-resolved="dark"] body #side-nav-chat-actions-menu,
html[data-theme-resolved="dark"] body #side-nav-project-actions-menu {
  background: rgba(28, 24, 36, 0.97) !important;
  background-color: rgba(28, 24, 36, 0.97) !important;
  border-color: rgba(244, 240, 234, 0.14) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(16px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.08) !important;
}
html[data-theme-resolved="dark"] .sidebar-v2__user-popover :is(
  .sidebar-v2__user-popover-item,
  .sidebar-v2__user-popover-head,
  .sidebar-v2__user-name,
  .sidebar-v2__user-plan
) {
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] .sidebar-v2__user-popover-item:hover,
html[data-theme-resolved="dark"] .sidebar-v2__user-popover-item.is-active {
  background: rgba(192, 132, 252, 0.14) !important;
}

/* ==== ADMIN DARK PASS (all sections) ====
   admin-visual-unify pins --adm-surface:#fff; remap tokens + beat leftover #fff shells. */
html[data-theme-resolved="dark"] :is(.app-shell, #app-shell)[data-page="admin"] {
  --adm-border: rgba(244, 240, 234, 0.12);
  --adm-border-strong: rgba(244, 240, 234, 0.18);
  --adm-surface: rgba(28, 24, 36, 0.78);
  --adm-surface-2: rgba(36, 30, 46, 0.86);
  --adm-surface-3: rgba(44, 36, 58, 0.92);
  --adm-text: #f4f0ea;
  --adm-text-soft: #d6cce0;
  --adm-muted: #a89fb3;
  --adm-accent: #c084fc;
  --adm-focus: rgba(192, 132, 252, 0.35);
  color: #f4f0ea;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .dashboard-layout .card,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .dashboard-layout .card:not(.acc-advanced-wrap),
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .card,
  .profile-card,
  .usage-table-card,
  .usage-kpi-card,
  .admin-actions-grid,
  .admin-card,
  .admin-action-card,
  .admin-audit-card,
  .admin-card-spaced,
  .admin-section,
  .admin-panel,
  .admin-apps-card,
  .admin-backup-card,
  .admin-dataset-card,
  .admin-pages-card,
  .admin-security-sec,
  .admin-decision-journal,
  .marketplace-admin-card,
  .ruflo-main-panel,
  .ruflo-analytics-panel,
  .ruflo-upgrade-card,
  .ruflo-form-wrap,
  .ruflo-presets-wrap,
  .acc-card,
  .acc-panel,
  .acc-module-card,
  .acc-advanced-wrap,
  #admin-control-center .card,
  #admin-control-center [class*="acc-"][class*="card"],
  #admin-control-center [class*="acc-"][class*="panel"]
) {
  background: rgba(28, 24, 36, 0.78) !important;
  background-color: rgba(28, 24, 36, 0.78) !important;
  background-image: none !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28) !important;
  backdrop-filter: blur(14px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  h1, h2, h3, h4, h5, p, label, th, td, li, span, a, .usage-subtitle, .muted,
  .admin-dataset-stats-muted, .admin-dataset-stats-dim, .admin-readonly-note,
  .admin-redirect-help, .admin-export-presets-label, .admin-kb-build-hint,
  .ruflo-section-label, .dc-section-title, .dc-head, .dc-head h2
) {
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .muted, .usage-subtitle, .admin-dataset-stats-muted, .admin-dataset-stats-dim,
  .admin-readonly-note, .admin-redirect-help, .admin-export-presets-label,
  .admin-kb-build-hint, .ruflo-section-label
) {
  color: #a89fb3 !important;
  -webkit-text-fill-color: #a89fb3 !important;
}

/* Section nav / tabs */
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-nav,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-section-tabs {
  background: rgba(20, 18, 26, 0.88) !important;
  background-image: none !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #f4f0ea !important;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-nav-link,
  .admin-section-tabs a,
  .acc-module-nav a,
  .admin-nav-group-label
) {
  background: rgba(36, 30, 46, 0.72) !important;
  background-image: none !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #e9e2f6 !important;
  -webkit-text-fill-color: #e9e2f6 !important;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-nav-link:hover,
  .admin-section-tabs a:hover,
  .acc-module-nav a:hover
) {
  background: rgba(192, 132, 252, 0.14) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-nav-link.active,
  .admin-section-tabs a.active,
  .acc-module-nav a.is-active,
  .acc-module-nav a.active
) {
  background: rgba(192, 132, 252, 0.22) !important;
  border-color: rgba(192, 132, 252, 0.4) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}

/* Tables / wraps / KPI tiles / chips */
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  table,
  .usage-table,
  .admin-table,
  .admin-audit-table,
  .admin-trader-table,
  .usage-table-wrap,
  .table-wrap,
  .admin-audit-table-wrap,
  .admin-security-kpi-item,
  .admin-apps-kpi-item,
  .admin-backup-kpi-item,
  .admin-trader-kpi-item,
  .admin-marketplace-kpi-item,
  .admin-dataset-kpi-item,
  .admin-pages-kpi-item,
  .admin-trader-worker,
  .admin-trader-panel,
  .admin-trader-card,
  .admin-audit-chip,
  .mode-chip,
  .btn-secondary,
  .secondary-btn
) {
  background: rgba(36, 30, 46, 0.82) !important;
  background-color: rgba(36, 30, 46, 0.82) !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}

html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-audit-chip.is-active,
  .mode-chip.active,
  .mode-chip.is-active
) {
  background: rgba(192, 132, 252, 0.22) !important;
  border-color: rgba(192, 132, 252, 0.4) !important;
  color: #f4f0ea !important;
}

/* Warn / alert keep semantic tint but darkened */
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-security-kpi-item,
  .admin-apps-kpi-item,
  .admin-backup-kpi-item,
  .admin-trader-kpi-item,
  .admin-marketplace-kpi-item,
  .admin-dataset-kpi-item,
  .admin-pages-kpi-item,
  .admin-trader-worker
).is-warn,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] tr.is-warn {
  background: rgba(120, 53, 15, 0.45) !important;
  border-color: rgba(251, 191, 36, 0.35) !important;
  color: #fde68a !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-security-kpi-item,
  .admin-apps-kpi-item,
  .admin-backup-kpi-item,
  .admin-trader-kpi-item,
  .admin-marketplace-kpi-item,
  .admin-dataset-kpi-item,
  .admin-pages-kpi-item,
  .admin-trader-worker
).is-alert,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] tr.is-alert {
  background: rgba(127, 29, 29, 0.45) !important;
  border-color: rgba(251, 113, 133, 0.35) !important;
  color: #fecdd3 !important;
}

/* Forms */
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  input, select, textarea, .acc-global-search, .ruflo-task-input, .admin-kb-extra-input,
  input[type="text"], input[type="password"], input[type="email"], input[type="number"],
  input[type="search"], input[type="url"], input[type="date"], input[type="datetime-local"]
) {
  background: rgba(36, 30, 46, 0.92) !important;
  background-color: rgba(36, 30, 46, 0.92) !important;
  border-color: rgba(244, 240, 234, 0.16) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
  caret-color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(input, textarea)::placeholder {
  color: #a89fb3 !important;
  -webkit-text-fill-color: #a89fb3 !important;
  opacity: 1 !important;
}

/* Routing / planner badges that were pastel-on-light */
html[data-theme-resolved="dark"] body.admin-routing-page .ruflo-badge-online,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .ruflo-badge-online {
  background: rgba(22, 101, 52, 0.45) !important;
  color: #bbf7d0 !important;
}
html[data-theme-resolved="dark"] body.admin-routing-page .ruflo-badge-offline,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .ruflo-badge-offline {
  background: rgba(127, 29, 29, 0.45) !important;
  color: #fecaca !important;
}

/* Table zebra / borders */
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(th, td) {
  border-color: rgba(244, 240, 234, 0.10) !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] tbody tr:nth-child(even) {
  background: rgba(244, 240, 234, 0.03) !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] tbody tr:hover {
  background: rgba(192, 132, 252, 0.10) !important;
}

/* Admin decision bell + ACC leftovers */
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-decision-bell__btn {
  background: rgba(36, 30, 46, 0.92) !important;
  border-color: rgba(244, 240, 234, 0.16) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-decision-bell__btn:hover,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-decision-bell__btn[aria-expanded="true"] {
  background: rgba(192, 132, 252, 0.22) !important;
  color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-decision-bell__panel,
  .admin-decision-bell__item-body,
  .admin-decision-bell__reason-input
) {
  background: rgba(28, 24, 36, 0.97) !important;
  background-color: rgba(28, 24, 36, 0.97) !important;
  border-color: rgba(244, 240, 234, 0.14) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45) !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] :is(
  .admin-decision-bell__item-title,
  .admin-decision-bell__item-meta,
  .admin-decision-bell__item-sum,
  .admin-decision-bell__item-solution,
  .admin-decision-bell__empty,
  .admin-decision-bell__foot a,
  .admin-decision-bell__head,
  .admin-decision-bell__icon
) {
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-decision-bell__head .muted,
html[data-theme-resolved="dark"] body :is(.app-shell, #app-shell)[data-page="admin"] .admin-decision-bell__item-meta {
  color: #a89fb3 !important;
  -webkit-text-fill-color: #a89fb3 !important;
}

/* ACC hardcoded whites from admin-control-center.css */
html[data-theme-resolved="dark"] body #admin-control-center :is(
  .usage-table-card,
  .acc-provider-card,
  .acc-security-kpi-item:not(.is-warn):not(.is-alert):not(.is-ok),
  .acc-tile,
  .acc-panel,
  .acc-card
),
html[data-theme-resolved="dark"] body #admin-control-center [style*="background:#fff"],
html[data-theme-resolved="dark"] body #admin-control-center [style*="background: #fff"] {
  background: rgba(28, 24, 36, 0.78) !important;
  background-color: rgba(28, 24, 36, 0.78) !important;
  color: #f4f0ea !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-security-kpi-item.is-ok {
  background: rgba(22, 101, 52, 0.35) !important;
  border-color: rgba(134, 239, 172, 0.35) !important;
  color: #bbf7d0 !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-security-kpi-item.is-warn {
  background: rgba(120, 53, 15, 0.45) !important;
  border-color: rgba(251, 191, 36, 0.35) !important;
  color: #fde68a !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-security-kpi-item.is-muted {
  background: rgba(36, 30, 46, 0.72) !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #a89fb3 !important;
}

/* ACC sticky header was hardcoded white gradient → chalk slab in dark */
html[data-theme-resolved="dark"] body #admin-control-center .acc-sticky-nav-wrap {
  background: linear-gradient(
    180deg,
    rgba(20, 18, 26, 0.98) 0%,
    rgba(28, 24, 36, 0.96) 88%,
    rgba(28, 24, 36, 0)
  ) !important;
  border-bottom-color: rgba(244, 240, 234, 0.12) !important;
  box-shadow: none !important;
  color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body #admin-control-center :is(
  .acc-page-title,
  .acc-page-subtitle,
  .acc-page-header,
  .acc-search-meta,
  .acc-health-card-title,
  .acc-health-card-value,
  .acc-health-card-foot,
  .usage-table-card > h2,
  .usage-table-card > h3
) {
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-page-subtitle,
html[data-theme-resolved="dark"] body #admin-control-center .acc-health-card-foot,
html[data-theme-resolved="dark"] body #admin-control-center .acc-search-meta {
  color: #a89fb3 !important;
  -webkit-text-fill-color: #a89fb3 !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-module-nav a {
  background: rgba(36, 30, 46, 0.78) !important;
  border-color: rgba(244, 240, 234, 0.14) !important;
  color: #e9e2f6 !important;
  -webkit-text-fill-color: #e9e2f6 !important;
  box-shadow: none !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-module-nav a:hover {
  background: rgba(192, 132, 252, 0.16) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-module-nav a.is-active {
  background: rgba(192, 132, 252, 0.28) !important;
  border-color: rgba(192, 132, 252, 0.45) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
  box-shadow: 0 6px 14px rgba(109, 40, 217, 0.25) !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-global-search,
html[data-theme-resolved="dark"] body #admin-control-center .acc-global-search:focus {
  background: rgba(36, 30, 46, 0.92) !important;
  border-color: rgba(244, 240, 234, 0.16) !important;
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body #admin-control-center .acc-health-card {
  background: rgba(36, 30, 46, 0.78) !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body.admin-settings-page .profile-card.acc-settings-alerts-only {
  background: rgba(28, 24, 36, 0.78) !important;
  background-image: none !important;
  border-color: rgba(244, 240, 234, 0.12) !important;
  color: #f4f0ea !important;
}

/* Security spark cards were hardcoded #f8fbff / #0f172a in dashboard.css */
html[data-theme-resolved="dark"] body :is(
  .admin-security-spark-card,
  .admin-security-sparklines .admin-security-spark-card
) {
  background: rgba(36, 30, 46, 0.86) !important;
  border-color: rgba(244, 240, 234, 0.14) !important;
  color: #f4f0ea !important;
}
html[data-theme-resolved="dark"] body .admin-security-spark-card h3 {
  color: #f4f0ea !important;
  -webkit-text-fill-color: #f4f0ea !important;
}

