/* WAHA PRO V21.40 — Admin quality tokens, contrast guardrails and responsive QA
   Scope: only dashboard/admin and recently-added contact metadata surfaces.
   Rationale: keep new component fixes isolated from legacy public theme CSS. */
:root {
  --waha-admin-bg: #06172f;
  --waha-admin-surface: #0d2445;
  --waha-admin-surface-2: #132d51;
  --waha-admin-card: #102640;
  --waha-admin-card-2: #182f4e;
  --waha-admin-ink: #f8fbff;
  --waha-admin-text: #e8f1ff;
  --waha-admin-muted: #b9cbe2;
  --waha-admin-soft: #8fb5de;
  --waha-admin-line: rgba(166, 205, 255, .22);
  --waha-admin-blue: #2f8cff;
  --waha-admin-blue-strong: #0b62d8;
  --waha-admin-focus: #8bc4ff;
  --waha-admin-shadow: 0 22px 60px rgba(0, 0, 0, .28);
  --waha-admin-radius: 22px;
}

body.admin-route-active {
  background: #071426 !important;
  color: var(--waha-admin-text) !important;
}
body.admin-route-active .admin-main,
body.admin-route-active .dedicated-dashboard-shell {
  color: var(--waha-admin-text) !important;
}
body.admin-route-active .admin-main h1,
body.admin-route-active .admin-main h2,
body.admin-route-active .admin-main h3,
body.admin-route-active .admin-main h4,
body.admin-route-active .admin-main b,
body.admin-route-active .admin-head h1 {
  color: var(--waha-admin-ink) !important;
  text-shadow: none !important;
}
body.admin-route-active .admin-main p,
body.admin-route-active .admin-main li,
body.admin-route-active .admin-main small,
body.admin-route-active .admin-main label,
body.admin-route-active .admin-main .muted,
body.admin-route-active .admin-main .muted2 {
  color: var(--waha-admin-muted) !important;
  opacity: 1 !important;
  text-shadow: none !important;
}
body.admin-route-active .card:not(.dashboard-global-search-card):not(.builder-pro-hero),
body.admin-route-active .admin-help,
body.admin-route-active .table-wrap,
body.admin-route-active .form-builder-card,
body.admin-route-active .lead-stage-card {
  background: linear-gradient(145deg, rgba(24, 47, 78, .96), rgba(12, 31, 57, .98)) !important;
  color: var(--waha-admin-text) !important;
  border: 1px solid var(--waha-admin-line) !important;
  box-shadow: var(--waha-admin-shadow) !important;
}
body.admin-route-active .card:not(.dashboard-global-search-card):not(.builder-pro-hero) h2,
body.admin-route-active .card:not(.dashboard-global-search-card):not(.builder-pro-hero) h3,
body.admin-route-active .card:not(.dashboard-global-search-card):not(.builder-pro-hero) b,
body.admin-route-active .lead-stage-card b {
  color: var(--waha-admin-ink) !important;
}
body.admin-route-active input,
body.admin-route-active select,
body.admin-route-active textarea {
  background: #edf5ff !important;
  color: #07172e !important;
  border: 1px solid rgba(142, 186, 238, .75) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55) !important;
}
body.admin-route-active input::placeholder,
body.admin-route-active textarea::placeholder {
  color: #53677e !important;
  opacity: 1 !important;
}
body.admin-route-active input:focus,
body.admin-route-active select:focus,
body.admin-route-active textarea:focus,
body.admin-route-active button:focus-visible,
body.admin-route-active a:focus-visible {
  outline: 3px solid rgba(139, 196, 255, .88) !important;
  outline-offset: 2px !important;
}
body.admin-route-active .btn.primary {
  background: linear-gradient(135deg, #0b62d8, #0e7df0) !important;
  color: #fff !important;
  border-color: rgba(147, 197, 253, .42) !important;
  text-shadow: none !important;
}
body.admin-route-active .btn.secondary,
body.admin-route-active .btn.ghost,
body.admin-route-active .btn.small.secondary {
  background: rgba(17, 36, 66, .94) !important;
  color: #f8fbff !important;
  border: 1px solid rgba(180, 210, 250, .35) !important;
  text-shadow: none !important;
}
body.admin-route-active .btn.secondary:hover,
body.admin-route-active .btn.primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

/* Dashboard overview search: isolated light surface with guaranteed readable controls. */
body.admin-route-active .dashboard-global-search-card,
body.dark.admin-route-active .dashboard-global-search-card {
  background: linear-gradient(135deg, #ffffff 0%, #f2f8ff 55%, #eaf4ff 100%) !important;
  color: #07172e !important;
  border: 1px solid rgba(42, 119, 218, .26) !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .22) !important;
}
body.admin-route-active .dashboard-global-search-card h2,
body.admin-route-active .dashboard-global-search-card p,
body.admin-route-active .dashboard-global-search-card label,
body.admin-route-active .dashboard-global-search-card b,
body.admin-route-active .dashboard-global-search-card span:not(.eyebrow),
body.admin-route-active .dashboard-global-search-card .dashboard-search-results a,
body.admin-route-active .dashboard-global-search-card .dashboard-search-results a span {
  color: #07172e !important;
  opacity: 1 !important;
}
body.admin-route-active .dashboard-global-search-card .eyebrow {
  color: #064ba7 !important;
  background: #e7f1ff !important;
  border-color: rgba(10, 88, 202, .28) !important;
}
body.admin-route-active .dashboard-search-box .btn,
body.admin-route-active .dashboard-global-search-card .btn {
  min-height: 48px;
  color: #fff !important;
  background: linear-gradient(135deg, #0b62d8, #0e7df0) !important;
  border: 1px solid rgba(10, 88, 202, .22) !important;
}
body.admin-route-active .dashboard-search-results a {
  background: linear-gradient(135deg, #ffffff, #edf6ff) !important;
  border-color: rgba(10, 88, 202, .22) !important;
}
body.admin-route-active .dashboard-search-results a b { color: #053d8f !important; }
body.admin-route-active .dashboard-search-pending { color: #0f172a !important; background: #eaf4ff !important; }

/* SEO Intelligence: fix dark-card numbers and labels. */
body.admin-route-active .seo-intelligence-hero {
  background: linear-gradient(135deg, #082653, #0b62d8) !important;
  border-color: rgba(166, 205, 255, .26) !important;
}
body.admin-route-active .seo-intelligence-hero h2,
body.admin-route-active .seo-intelligence-hero .eyebrow,
body.admin-route-active .seo-intelligence-gauge b,
body.admin-route-active .seo-intelligence-gauge span {
  color: #fff !important;
}
body.admin-route-active .seo-intelligence-hero .muted {
  color: #dbeafe !important;
}
body.admin-route-active .seo-intelligence-grid .card h3 {
  color: #f8fbff !important;
  opacity: 1 !important;
  text-shadow: none !important;
}
body.admin-route-active .seo-intelligence-grid .card .muted,
body.admin-route-active .seo-intelligence-grid .card p {
  color: #dbeafe !important;
}
body.admin-route-active .seo-intelligence-table small,
body.admin-route-active .admin-table small {
  color: #bfd5ee !important;
}
body.admin-route-active .seo-issue.warn { background: rgba(251, 191, 36, .16) !important; color: #fde68a !important; border-color: rgba(251, 191, 36, .30) !important; }
body.admin-route-active .seo-issue.bad { background: rgba(251, 113, 133, .16) !important; color: #fecdd3 !important; border-color: rgba(251, 113, 133, .30) !important; }

/* Public contact privacy notice: no washed-out gray on dark cards. */
.managed-lead-form .lead-privacy-notice,
.contact-intel-card + .card .lead-privacy-notice {
  background: linear-gradient(135deg, rgba(8, 38, 83, .96), rgba(13, 45, 81, .94)) !important;
  color: #dbeafe !important;
  border: 1px solid rgba(139, 196, 255, .34) !important;
  box-shadow: 0 18px 45px rgba(2, 12, 28, .20) !important;
}
.managed-lead-form .lead-privacy-notice b,
.contact-intel-card + .card .lead-privacy-notice b {
  color: #8bc4ff !important;
}
.managed-lead-form .lead-privacy-notice p,
.contact-intel-card + .card .lead-privacy-notice p {
  color: #dbeafe !important;
  opacity: 1 !important;
}

/* Legacy image cleanup: clear visual fallback rather than broken blank blocks. */
.waha-image-fallback,
.waha-legacy-image-replaced {
  object-fit: cover !important;
  background: linear-gradient(135deg, #0b62d8, #052b67) !important;
}

/* Dashboard long-screen QA for 1920x1080 / Windows 125% and mobile. */
body.admin-route-active .admin-main {
  min-width: 0 !important;
  max-width: 100% !important;
  padding: clamp(14px, 1.4vw, 24px) !important;
  scroll-padding-bottom: 140px;
}
body.admin-route-active .admin-head,
body.admin-route-active .dashboard-command-bar,
body.admin-route-active .governance-toolbar,
body.admin-route-active .actions {
  flex-wrap: wrap !important;
  min-width: 0 !important;
}
body.admin-route-active .admin-head .actions,
body.admin-route-active .dashboard-command-actions {
  gap: 10px !important;
}
body.admin-route-active .admin-head .actions .btn,
body.admin-route-active .dashboard-command-actions .btn {
  white-space: normal !important;
  text-align: center !important;
  justify-content: center !important;
}
body.admin-route-active .grid.two,
body.admin-route-active .hero-studio-grid,
body.admin-route-active .media-studio-hero,
body.admin-route-active .security-center-hero,
body.admin-route-active .backup-restore-hero,
body.admin-route-active .release-center-hero {
  gap: clamp(14px, 1.4vw, 22px) !important;
}
@media (max-width: 1700px) {
  body.admin-route-active .admin-shell.v9-admin-shell:not(.admin-collapsed) {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }
  body.admin-route-active .admin-shell.v9-admin-shell:not(.admin-collapsed) .admin-side {
    width: 260px !important;
  }
  body.admin-route-active .grid.two,
  body.admin-route-active .hero-studio-grid,
  body.admin-route-active .media-studio-hero,
  body.admin-route-active .builder-pro-hero {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
@media (max-width: 980px) {
  body.admin-route-active .admin-main { padding: 12px 10px 120px !important; }
  body.admin-route-active .admin-table { min-width: 680px !important; }
  body.admin-route-active .card { border-radius: 18px !important; }
  body.admin-route-active .dashboard-global-search-card { padding: 16px !important; }
  body.admin-route-active .dashboard-search-box { grid-template-columns: 1fr !important; }
  body.admin-route-active .seo-intelligence-hero { grid-template-columns: 1fr !important; }
  body.admin-route-active .seo-intelligence-gauge { width: 112px !important; height: 112px !important; }
}
@media (max-width: 560px) {
  body.admin-route-active .admin-head h1 { font-size: clamp(1.45rem, 8vw, 2rem) !important; }
  body.admin-route-active .admin-head .actions .btn,
  body.admin-route-active .dashboard-command-actions .btn,
  body.admin-route-active .actions .btn { flex: 1 1 100% !important; width: 100% !important; }
  body.admin-route-active .seo-intelligence-grid,
  body.admin-route-active .stats-admin,
  body.admin-route-active .governance-stats { grid-template-columns: minmax(0, 1fr) !important; }
}
