/**
 * App shell: the unified sidebar + header for authenticated in-app pages
 * (Dashboard, Settings, and -- in a later phase -- Admin Dashboard, Help
 * Center). Loaded ONLY by those pages, never by index.html/terms.html/
 * privacy.html/login.html/signup.html/forgot-password.html/
 * reset-password.html -- this file is additive, a new component, not a
 * restyle of the existing .site-header (still used unmodified by the
 * auth pages, which keep their simple logo-only header per this
 * redesign's own Phase 5 scope).
 *
 * Built entirely on the Phase 0 --app-*, --space-*, --text-*, --motion-*
 * tokens (see css/variables.css) -- no arbitrary spacing, no colors
 * outside that palette.
 */

body.app-shell {
  background: var(--app-bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--color-text-primary);
}

@media (prefers-reduced-motion: no-preference) {
  html[data-theme-ready="true"] body.app-shell,
  html[data-theme-ready="true"] .app-header,
  html[data-theme-ready="true"] .app-card,
  html[data-theme-ready="true"] .user-dropdown {
    transition:
      background-color 140ms ease,
      border-color 140ms ease,
      color 140ms ease,
      box-shadow 140ms ease;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  height: 64px;
  padding: 0 var(--space-24);
  /* Solid, flat chrome (shared across every authenticated page) -- the
     dedicated --app-topnav-bg token (css/variables.css), slightly darker
     than --app-surface so the bar reads as a distinct layer above the
     page. Deliberately NOT blurred/translucent this time (superseding
     this project's earlier "heavy glass" nav exploration) -- the
     reference this rebuild matches is flatter and more subdued. */
  background: var(--app-topnav-bg);
  border-bottom: 1px solid var(--color-border-primary);
  box-shadow: none;
}

.app-header-zone {
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-header-zone--left {
  flex: 1 1 0;
}

.app-header-zone--center {
  flex: 0 1 auto;
  justify-content: center;
}

.app-header-zone--right {
  flex: 1 1 0;
  justify-content: flex-end;
  gap: 16px;
}

.app-header .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-primary);
  font-family: var(--font-app-sans);
  font-weight: 600;
  text-decoration: none;
  font-size: var(--text-body-size);
}

/* Logo icon box -- the same accent-box pattern used throughout the app
   (header icon, stat card icons): rounded square, accent color at 15%
   background / 25% border, icon centered with real padding, full-
   strength accent stroke. */
.app-header .logo-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 6px;
  box-sizing: border-box;
  flex: 0 0 auto;
  border-radius: 9px;
  background: color-mix(in srgb, var(--color-brand) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-brand) 25%, transparent);
  color: var(--color-brand);
}

.app-header .logo-icon-box svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.75;
}

/* Database Selector: shows the active/primary connection at a glance,
   opens a listbox of every connection on click. Data is fetched
   on-demand (first open only) via the existing GET /connections
   endpoint -- no new backend surface, no direct Supabase/R2 call. */
.app-db-selector {
  position: relative;
}

.app-db-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-primary);
  border-radius: 14px;
  color: var(--color-text-primary);
  font-family: var(--font-app-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  max-width: 260px;
  transition: border-color var(--motion-duration) var(--motion-ease), background var(--motion-duration) var(--motion-ease);
}

.app-db-selector-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

.app-db-selector-btn .app-db-selector-icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--color-brand);
}

.app-db-selector-btn .app-db-selector-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.75;
}

.app-db-selector-btn .app-db-selector-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-db-selector-btn .app-db-selector-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--color-text-secondary);
  /* Base icon is chevron-LEFT (no separate chevron-down asset); rotate
     -90deg so it points down by default, matching a conventional
     dropdown affordance. */
  transform: rotate(-90deg);
  transition: transform var(--motion-duration) var(--motion-ease);
}

.app-db-selector-btn[aria-expanded="true"] .app-db-selector-chevron {
  transform: rotate(90deg);
}

.app-db-selector-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--color-text-secondary);
}

.app-db-selector-status-dot.is-success { background: var(--color-success); }
.app-db-selector-status-dot.is-warning { background: var(--app-warning); }
.app-db-selector-status-dot.is-danger { background: var(--app-danger); }

.app-db-selector-panel {
  position: absolute;
  top: calc(100% + var(--space-8));
  left: 50%;
  transform: translateX(-50%);
  width: max(260px, 100%);
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 44px var(--color-shadow-modal);
  padding: var(--space-8);
  z-index: 70;
}

.app-db-selector-option {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  padding: var(--space-8) var(--space-16);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-app-sans);
  font-size: var(--text-description-size);
  text-align: left;
  cursor: pointer;
}

.app-db-selector-option:hover,
.app-db-selector-option:focus-visible {
  background: color-mix(in srgb, var(--color-text-primary) 6%, transparent);
}

.app-db-selector-empty {
  padding: var(--space-16);
  color: var(--color-text-secondary);
  font-size: var(--text-description-size);
}

/* Right-zone icon buttons: Notifications, Settings, User Avatar. */
.app-header-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}

.app-header-icon-btn svg {
  width: var(--icon-size);
  height: var(--icon-size);
  stroke-width: 1.75;
}

.app-header-icon-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

/* Notifications unread dot -- only ever added when a real unread state
   exists (this rebuild adds no backend for that yet, so it's never
   present today; the markup/CSS is here so a future real notifications
   feature can add the class without another CSS change). */
.app-header-icon-btn .app-header-unread-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--color-brand);
  border: 1.5px solid var(--app-topnav-bg);
}

/* Sidebar */
.app-shell-body {
  display: flex;
  align-items: flex-start;
}

.app-sidebar {
  position: sticky;
  top: 64px;
  flex: 0 0 auto;
  width: 240px;
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Diagonal navy gradient (sourced from the Connections page reference,
     applied site-wide) -- same shared-chrome reasoning as .app-header
     above, just no longer a flat fill. */
  background: var(--sidebar-bg-gradient);
  border-right: 1px solid var(--color-border-primary);
  padding: var(--space-16) var(--space-8);
}

body.app-sidebar-collapsed .app-sidebar {
  width: 72px;
}

@media (prefers-reduced-motion: no-preference) {
  .app-sidebar {
    transition: width var(--motion-duration) var(--motion-ease);
  }
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.app-sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-16);
  height: 40px;
  padding: 0 var(--space-16);
  border-radius: var(--radius-md);
  color: var(--sidebar-text-nav-inactive);
  text-decoration: none;
  font-family: var(--font-app-sans);
  font-size: var(--text-description-size);
  white-space: nowrap;
  overflow: hidden;
}

/* Transition declared on :hover only (not the base rule): app-nav.js
   assigns .is-active synchronously at parse time, before the auth-gate
   reveals the page (variables.css's body[data-auth]:not(.auth-ready)
   rule) -- a transition on the base rule would animate that very first,
   never-visible paint too, which only race-conditions tests that read
   the active item's color immediately after auth-ready with no settle
   time. Scoping it to :hover keeps the smooth hover-in the spec asks
   for without touching the initial route-driven active state at all. */
.app-sidebar-item:hover {
  color: var(--sidebar-text-primary);
  background: var(--color-surface-hover);
  transition: all 200ms ease;
}

/* Glass/accent icon box -- same small rounded-box-around-the-icon
   pattern as .app-header .logo-icon-box above and the Connections page's
   per-connection .cxn-db-icon-wrap, now applied to every sidebar nav
   icon. Base rule is deliberately faint/uniform (no glow, border kept
   transparent rather than omitted so .is-active's border-color doesn't
   shift the box's size) so inactive items stay calm and don't compete
   with each other -- only .is-active below gets the full accent+glow
   treatment. */
.app-sidebar-item .app-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 5px;
  box-sizing: border-box;
  border-radius: 9px;
  background: color-mix(in srgb, var(--sidebar-text-muted) 12%, transparent);
  border: 1px solid transparent;
  transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.app-sidebar-item .app-sidebar-icon svg {
  width: 100%;
  height: 100%;
}

/* White label text with an emerald icon (reference: Connections page
   sidebar) -- the icon carries the accent color via its own `color`
   (Lucide icons use stroke="currentColor", see icons.js's
   buildLucideIcon()), overriding the label-level white so the two read
   as deliberately distinct, not a single flat accent tint. */
.app-sidebar-item.is-active {
  color: var(--sidebar-text-primary);
  background: var(--sidebar-active-bg);
  border-radius: 8px;
  font-weight: 700;
}

.app-sidebar-item.is-active .app-sidebar-icon {
  color: var(--sidebar-accent-emerald);
  background: color-mix(in srgb, var(--sidebar-accent-emerald) 15%, transparent);
  border-color: color-mix(in srgb, var(--sidebar-accent-emerald) 25%, transparent);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--sidebar-accent-emerald) 18%, transparent);
}

.app-sidebar-item.is-active:hover {
  color: var(--sidebar-text-primary);
  background: var(--sidebar-active-bg);
}

/* Left accent bar, active item only -- full item height, gradient fill
   plus a soft glow (per the Connections-page reference; supersedes this
   bar's previous flat-color/no-glow treatment). */
.app-sidebar-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 999px;
  background: var(--sidebar-active-indicator-gradient);
  box-shadow: 0 0 8px color-mix(in srgb, var(--sidebar-accent-emerald) 28%, transparent);
}

/* API Keys (and any future plan-gated destination) when the account's
   current plan can't use it -- settings.js's applyApiKeysPlanGate().
   Still a real, focusable, clickable link (it opens the tab's own
   locked/upgrade block, same as dashboard.js's Database Health card) --
   this is a visual "you can't use this yet" cue, not a hard disable. */
.app-sidebar-item.is-locked {
  opacity: 0.55;
}

.app-sidebar-divider {
  margin: var(--space-8) var(--space-12);
  border: none;
  border-top: 1px solid var(--color-border-primary);
  opacity: 0.6;
}

body.app-sidebar-collapsed .app-sidebar-divider {
  margin: var(--space-8) var(--space-8);
}

.app-sidebar-item .app-sidebar-lock {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  opacity: 0.7;
  flex: 0 0 auto;
}

.app-sidebar-item .app-sidebar-lock svg {
  width: 14px;
  height: 14px;
}

body.app-sidebar-collapsed .app-sidebar-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body.app-sidebar-collapsed .app-sidebar-item {
  justify-content: center;
  padding: 0;
}

.app-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  height: 36px;
  background: none;
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  color: var(--sidebar-text-nav-inactive);
  cursor: pointer;
  transition: border-color var(--motion-duration) var(--motion-ease), color var(--motion-duration) var(--motion-ease);
}

.app-sidebar-toggle:hover {
  border-color: var(--color-border-strong);
  color: var(--sidebar-text-primary);
  background: var(--color-surface-hover);
}

/* Account dropdown belongs to the app shell; main.css also styles this
   generic menu for older dark pages, so keep the light-aware treatment
   scoped here instead of changing the global dropdown. */
body.app-shell .user-menu {
  color: var(--color-text-secondary);
  border-radius: 10px;
}

body.app-shell .user-menu:hover,
body.app-shell .user-menu[aria-expanded="true"] {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

body.app-shell .avatar {
  background: var(--color-brand-soft);
  border: 1px solid var(--color-brand-border);
  color: var(--color-brand);
}

body.app-shell .user-dropdown {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-primary);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

body.app-shell .user-dropdown [role="menuitem"],
body.app-shell .user-dropdown [role="menuitemradio"] {
  color: var(--color-text-secondary);
}

body.app-shell .user-dropdown [role="menuitem"]:hover,
body.app-shell .user-dropdown [role="menuitemradio"]:hover,
body.app-shell .user-dropdown [role="menuitem"]:focus-visible,
body.app-shell .user-dropdown [role="menuitemradio"]:focus-visible {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

body.app-shell .user-dropdown [role="menuitem"]:focus-visible,
body.app-shell .user-dropdown [role="menuitemradio"]:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: -2px;
}

body.app-shell .user-dropdown .menu-divider {
  background: var(--color-border-primary);
}

.theme-menu-label {
  padding: 0.45rem 0.75rem 0.25rem;
  color: var(--color-text-muted);
  font: 700 0.68rem var(--font-app-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.theme-choice {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.theme-choice svg,
.theme-current-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.theme-choice.is-active {
  color: var(--color-brand);
  background: var(--color-brand-soft);
}

.app-sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--motion-duration) var(--motion-ease);
}

body.app-sidebar-collapsed .app-sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ── Sidebar: Current Plan card + Documentation link ──────────────────
   Shared chrome, rendered identically on every authenticated app page
   by js/app-nav.js's loadSidebarPlanCard() into #app-plan-card.
   Originally Connections-page-only markup/styling (sourced from the
   IMG_4128.PNG reference); promoted here unchanged so every page gets
   the same real plan name + real manual-backup usage aggregate. ────── */

.app-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 8px;
  margin-top: auto;
}

.app-plan-card {
  padding: 16px;
  background: var(--sidebar-surface-bg);
  border: 1px solid var(--sidebar-surface-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.035);
}

.app-plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.app-plan-card-label {
  font-family: var(--font-app-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-plan-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--font-app-sans);
  font-size: 10px;
  font-weight: 700;
  color: var(--sidebar-accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.app-plan-name {
  margin: 0 0 12px;
  font-family: var(--font-app-sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--sidebar-text-primary);
}

.app-plan-usage-label {
  margin: 0 0 2px;
  font-family: var(--font-app-sans);
  font-size: 11px;
  color: var(--sidebar-text-muted);
}

.app-plan-usage-value {
  margin: 0 0 2px;
  font-family: var(--font-app-sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--sidebar-text-primary);
}

/* Real per-connection limit stated explicitly here (e.g. "Across 3
   connections — up to 20/day each") -- deliberately NOT folded into
   app-plan-usage-value as an implied shared "{used} / {cap}" total,
   since this quota genuinely has no single account-wide cap to divide
   by (see renderSidebarPlanCard()'s own header comment, app-nav.js). */
.app-plan-usage-caption {
  margin: 0;
  font-family: var(--font-app-sans);
  font-size: 11px;
  color: var(--sidebar-text-muted);
}

.app-sidebar-help {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  color: var(--sidebar-text-nav-inactive);
  text-decoration: none;
  font-family: var(--font-app-sans);
  font-size: 12.5px;
  transition: background 150ms ease, color 150ms ease;
}

.app-sidebar-help:hover {
  background: var(--color-surface-hover);
  color: var(--sidebar-text-primary);
}

.app-sidebar-help svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
  flex: 0 0 auto;
}

.app-sidebar-help strong {
  color: var(--sidebar-accent-emerald);
}

body.app-sidebar-collapsed .app-sidebar-footer {
  display: none;
}

/* Content area next to the sidebar. */
.app-content {
  flex: 1 1 0;
  min-width: 0;
  max-width: var(--app-container-max);
  margin: 0 auto;
}

/* Visible focus states, WCAG AA -- every interactive element in the shell
   gets the same treatment. */
.app-header-icon-btn:focus-visible,
.app-db-selector-btn:focus-visible,
.app-db-selector-option:focus-visible,
.app-sidebar-item:focus-visible,
.app-sidebar-toggle:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* Tablet: sidebar starts collapsed (icons only) to leave room for content;
   the user's explicit toggle choice (localStorage) still wins on repeat
   visits via the collapsed class applied before paint (see app-nav.js). */
@media (max-width: 1024px) {
  .app-sidebar:not([data-user-set]) {
    width: 72px;
  }

  .app-db-selector-btn .app-db-selector-label {
    max-width: 120px;
  }
}

/* Mobile: sidebar becomes a bottom-anchored icon rail rather than a side
   column, so it never eats into the narrow content width; header keeps
   just logo + essential right-side actions. Fixed to the viewport (not
   left in normal document flow) so it stays reachable without scrolling
   to the bottom of a long page, matching standard mobile tab-bar
   behavior. */
@media (max-width: 640px) {
  .app-shell-body {
    flex-direction: column;
    /* Space for the fixed-position bottom rail below, so it never
       overlaps the page's last piece of content. */
    padding-bottom: 64px;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    width: 100% !important;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    border-top: 1px solid var(--color-border-primary);
    padding: var(--space-8);
  }

  .app-sidebar-nav {
    flex-direction: row;
    flex: 1 1 auto;
    justify-content: space-around;
  }

  .app-sidebar-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .app-sidebar-item {
    justify-content: center;
    padding: 0;
    width: 40px;
  }

  .app-sidebar-item.is-active::before {
    left: 6px;
    right: 6px;
    top: auto;
    bottom: 0;
    width: auto;
    height: 2px;
  }

  .app-sidebar-toggle {
    display: none;
  }

  .app-header {
    padding: 0 var(--space-16);
  }

  .app-header-zone--center {
    display: none;
  }
}

/* ==========================================================================
   PaywallGuard: World-Class 10/10 Enterprise SaaS Paywall Design System
   ========================================================================== */

@keyframes paywallShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

.paywall-guard-outer-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-32) var(--space-16);
  min-height: calc(100vh - 110px);
  width: 100%;
  box-sizing: border-box;
}

.paywall-guard-main-card {
  position: relative;
  width: 100%;
  max-width: 920px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78) 0%, rgba(10, 15, 29, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 26px;
  padding: 48px 40px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.paywall-guard-main-card::before {
  content: "";
  position: absolute;
  top: -140px;
  right: -140px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.14) 0%, rgba(6, 182, 212, 0.08) 40%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  border-radius: 50%;
  animation: pulseGlow 6s ease-in-out infinite;
}

.paywall-guard-main-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(34, 197, 94, 0.4) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: paywallShimmer 8s linear infinite;
}

/* Header Section */
.paywall-guard-header-hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 40px auto;
}

.paywall-guard-capsule-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #22C55E;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.15);
  backdrop-filter: blur(8px);
}

.badge-sparkle {
  font-size: 0.85rem;
}

.paywall-guard-title-hero {
  font-family: var(--font-app-sans);
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(180deg, #FFFFFF 0%, #CBD5E1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 16px 0;
  letter-spacing: -0.025em;
}

.paywall-guard-subtitle-hero {
  font-size: 1.05rem;
  font-weight: 450;
  color: #94A3B8;
  line-height: 1.6;
  margin: 0;
  letter-spacing: 0.01em;
}

/* 2-Column Responsive Feature Grid */
.paywall-guard-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

@media (max-width: 720px) {
  .paywall-guard-feature-grid {
    grid-template-columns: 1fr;
  }
}

.paywall-guard-fcard {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.paywall-guard-fcard:hover {
  transform: translateY(-4px);
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.paywall-guard-icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-bottom: 14px;
  transition: transform 0.25s ease;
}

.paywall-guard-fcard:hover .paywall-guard-icon-circle {
  transform: rotate(3deg) scale(1.05);
}

.paywall-guard-icon-circle svg {
  width: 22px;
  height: 22px;
}

/* Color Themes for Icons */
.paywall-guard-icon-circle.theme-green {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #22C55E;
}
.paywall-guard-icon-circle.theme-cyan {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: #06B6D4;
}
.paywall-guard-icon-circle.theme-orange {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #F59E0B;
}
.paywall-guard-icon-circle.theme-purple {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
  color: #A855F7;
}

.paywall-guard-fcard-title {
  font-family: var(--font-app-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: #F8FAFC;
  margin: 0 0 6px 0;
}

.paywall-guard-fcard-desc {
  font-size: 0.875rem;
  font-weight: 400;
  color: #64748B;
  line-height: 1.5;
  margin: 0;
}

/* Focal Point CTA Section */
.paywall-guard-cta-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 36px;
}

.paywall-guard-cta-btn-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  color: #FFFFFF !important;
  font-family: var(--font-app-sans);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none !important;
  box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 10px;
}

.paywall-guard-cta-btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(34, 197, 94, 0.55);
  color: #FFFFFF !important;
}

.paywall-guard-cta-caption {
  font-size: 0.85rem;
  color: #64748B;
  margin: 0;
  text-align: center;
}

/* Bottom Compact Pricing Teaser Card */
.paywall-guard-teaser-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 24px;
  backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
  .paywall-guard-teaser-card {
    flex-direction: column;
    text-align: center;
  }
}

.paywall-guard-teaser-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #22C55E;
  white-space: nowrap;
}

.paywall-guard-teaser-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.paywall-guard-teaser-pill {
  font-size: 0.85rem;
  color: #CBD5E1;
  font-weight: 450;
  white-space: nowrap;
}

.teaser-check {
  color: #22C55E;
  font-weight: bold;
}

.paywall-guard-teaser-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: #38BDF8;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.paywall-guard-teaser-link:hover {
  color: #22C55E;
}

/* Locked setting badge & Weekly Digest Paywall Modal */
.locked-pref-badge-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: #f59e0b;
}

.badge-lite-lock {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fbbf24;
}

.pref-row-locked {
  opacity: 0.85;
  transition: background-color 0.2s ease;
  border-radius: 8px;
  padding: 8px;
}

.toggle-disabled {
  pointer-events: none;
}

.pref-row-locked:hover {
  background: rgba(251, 191, 36, 0.05);
}

.paywall-modal {
  max-width: 600px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.paywall-modal-header {
  margin-bottom: 24px;
  text-align: left;
}

.paywall-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-bottom: 12px;
}

.paywall-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 640px) {
  .paywall-preview-grid {
    grid-template-columns: 1fr;
  }
}

.paywall-preview-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
}

.paywall-preview-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  margin-bottom: 10px;
}

.paywall-preview-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.paywall-preview-card p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

.paywall-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
