/**
 * VertexCapitals Centralized Institutional Design Token System & UI Engine
 * Preserves authentic brand palette (#183EFA Royal Cobalt, Institutional Carbon/Porcelain surfaces,
 * Emerald Yield #10B981, Amber VIP #F59E0B, Rose Alert #F43F5E).
 */

:root {
  color-scheme: light dark;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Universal Brand Tokens (Preserved) */
  --primary: #183EFA;
  --primary-hover: #1232D0;
  --primary-deep: #102DA8;
  --primary-glow: rgba(24, 62, 250, 0.25);
  --emerald-accent: #10B981;
  --amber-accent: #F59E0B;
  --rose-accent: #F43F5E;

  /* Light Mode Raw Tokens (Ultra-Clean Executive Porcelain) */
  --bg-page-light: #F8FAFC;
  --bg-card-light: #FFFFFF;
  --bg-card-secondary-light: #F1F5F9;
  --bg-header-light: rgba(255, 255, 255, 0.90);
  --border-light: #E2E8F0;
  --border-subtle-light: #CBD5E1;
  --text-primary-light: #0F172A;
  --text-secondary-light: #475569;
  --text-muted-light: #64748B;
  --shadow-luxury-light: 0 12px 32px -6px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow-card-light: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 0 0 1px rgba(15, 23, 42, 0.04);

  /* Dark Mode Raw Tokens (Deep Institutional Navy / Carbon) */
  --bg-page-dark: #070A11;
  --bg-card-dark: #0C121E;
  --bg-card-secondary-dark: #101726;
  --bg-header-dark: rgba(12, 18, 30, 0.92);
  --border-dark: rgba(255, 255, 255, 0.08);
  --border-subtle-dark: #1E293B;
  --text-primary-dark: #F8FAFC;
  --text-secondary-dark: #94A3B8;
  --text-muted-dark: #64748B;
  --shadow-luxury-dark: 0 24px 48px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-card-dark: 0 10px 28px -6px rgba(0, 0, 0, 0.50), 0 0 0 1px rgba(255, 255, 255, 0.05);

  /* Semantic --vx-* Design Tokens (Default Light, overridden by html.dark) */
  --vx-primary: #183EFA;
  --vx-primary-hover: #1232D0;
  --vx-primary-deep: #102DA8;
  --vx-primary-tint: rgba(24, 62, 250, 0.09);
  --vx-primary-border: rgba(24, 62, 250, 0.24);
  --vx-primary-glow: rgba(24, 62, 250, 0.16);
  --vx-bg-page: var(--bg-page-light);
  --vx-bg-card: var(--bg-card-light);
  --vx-bg-recessed: var(--bg-card-secondary-light);
  --vx-bg-header: var(--bg-header-light);
  --vx-marketing-dark: #131313;
  --vx-text-primary: var(--text-primary-light);
  --vx-text-secondary: var(--text-secondary-light);
  --vx-text-muted: var(--text-muted-light);
  --vx-border: var(--border-light);
  --vx-border-subtle: var(--border-subtle-light);
  --vx-emerald: #059669;
  --vx-emerald-tint: rgba(16, 185, 129, 0.12);
  --vx-emerald-border: rgba(16, 185, 129, 0.28);
  --vx-amber: #D97706;
  --vx-amber-tint: rgba(245, 158, 11, 0.12);
  --vx-amber-border: rgba(245, 158, 11, 0.28);
  --vx-rose: #E11D48;
  --vx-rose-tint: rgba(244, 63, 94, 0.12);
  --vx-rose-border: rgba(244, 63, 94, 0.28);
  --vx-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --vx-shadow-card: var(--shadow-card-light);
  --vx-shadow-luxury: var(--shadow-luxury-light);
  --vx-shadow-glow: 0 10px 26px -6px var(--vx-primary-glow);

  /* Typography Scale (Fluid clamp() capped <= 2.5x min for 200% zoom) */
  --vx-font-xs: 0.75rem;
  --vx-font-sm: 0.8125rem;
  --vx-font-base: 0.9375rem;
  --vx-font-lg: 1.125rem;
  --vx-font-xl: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);
  --vx-font-2xl: clamp(1.35rem, 1.1rem + 1.2vw, 2.125rem);
  --vx-font-3xl: clamp(1.75rem, 1.3rem + 2vw, 3rem);

  /* Spacing & Radius Scale */
  --vx-space-1: 0.25rem;
  --vx-space-2: 0.5rem;
  --vx-space-3: 0.75rem;
  --vx-space-4: 1rem;
  --vx-space-6: 1.5rem;
  --vx-space-8: 2rem;
  --vx-radius-sm: 0.625rem;
  --vx-radius-md: 0.875rem;
  --vx-radius-lg: 1.25rem;
  --vx-radius-xl: 1.5rem;
  --vx-radius-pill: 9999px;

  /* Form-Factor Touch Target Baseline (WCAG 2.5.8 / 2.5.5) */
  --vx-target-size: 24px;

  --vx-table-head-bg: #F1F5F9;
  --vx-table-head-text: #475569;
  --vx-scrollbar-track: #F1F5F9;
  --vx-scrollbar-thumb: #94A3B8;

  accent-color: var(--vx-primary);
  scrollbar-color: var(--vx-scrollbar-thumb) var(--vx-scrollbar-track);
  scrollbar-width: thin;
}

html:not(.dark) {
  color-scheme: light;
}

html.dark {
  color-scheme: dark;
  --vx-primary-hover: #1332C9;
  --vx-primary-tint: rgba(24, 62, 250, 0.16);
  --vx-primary-border: rgba(24, 62, 250, 0.34);
  --vx-primary-glow: rgba(24, 62, 250, 0.28);
  --vx-bg-page: var(--bg-page-dark);
  --vx-bg-card: var(--bg-card-dark);
  --vx-bg-recessed: var(--bg-card-secondary-dark);
  --vx-bg-header: var(--bg-header-dark);
  --vx-marketing-dark: #070A11;
  --vx-text-primary: var(--text-primary-dark);
  --vx-text-secondary: var(--text-secondary-dark);
  --vx-text-muted: var(--text-muted-dark);
  --vx-border: var(--border-dark);
  --vx-border-subtle: var(--border-subtle-dark);
  --vx-emerald: #10B981;
  --vx-amber: #F59E0B;
  --vx-rose: #F43F5E;
  --vx-shadow-card: var(--shadow-card-dark);
  --vx-shadow-luxury: var(--shadow-luxury-dark);
  --vx-table-head-bg: #070A11;
  --vx-table-head-text: #94A3B8;
  --vx-scrollbar-track: #070A11;
  --vx-scrollbar-thumb: #334155;
}

/* Base Body Surfaces */
html:not(.dark) body {
  background-color: var(--vx-bg-page);
  color: var(--vx-text-primary);
  background-image:
    radial-gradient(at 0% 0%, rgba(24, 62, 250, 0.04) 0px, transparent 52%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.035) 0px, transparent 52%);
}

html.dark body {
  background-color: var(--vx-bg-page);
  color: var(--vx-text-primary);
  background-image:
    radial-gradient(at 0% 0%, rgba(24, 62, 250, 0.08) 0px, transparent 52%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 52%);
}

/* Smooth Transitions */
body, header, aside, .theme-card, .theme-bg, .vx-card, .vx-card-interactive, .vx-kpi-card, input, select, textarea {
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.18s ease, box-shadow 0.22s ease, transform 0.2s ease;
}

/* Brand Logo Adaptation (Full-Color Light SVG by default; clean white/sky SVG in Dark Mode) */
html:not(.dark) .brand-logo-adaptive {
  filter: none;
}

html.dark img.brand-logo-adaptive {
  content: url('../images/footerlogo.svg');
  filter: none;
}

html.dark .brand-logo-adaptive:not(img) {
  filter: brightness(1.15);
}

/* ==========================================================
   REUSABLE INSTITUTIONAL DESIGN SYSTEM COMPONENTS (.vx-*)
   ========================================================== */
.vx-glass-header {
  background-color: var(--vx-bg-header);
  border-bottom: 1px solid var(--vx-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.vx-card,
.theme-card {
  background-color: var(--vx-bg-card);
  border: 1px solid var(--vx-border);
  box-shadow: var(--vx-shadow-card);
  border-radius: 1.5rem;
}

.vx-card-interactive {
  background-color: var(--vx-bg-card);
  border: 1px solid var(--vx-border);
  box-shadow: var(--vx-shadow-card);
  border-radius: 1.5rem;
}

.vx-card-interactive:hover {
  border-color: var(--vx-primary-border);
  box-shadow: var(--vx-shadow-luxury);
  transform: translateY(-2px);
}

.vx-kpi-card {
  position: relative;
  overflow: hidden;
  background-color: var(--vx-bg-card);
  border: 1px solid var(--vx-border);
  box-shadow: var(--vx-shadow-card);
  border-radius: 1.35rem;
}

.vx-kpi-card::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--vx-primary), rgba(16, 185, 129, 0.7));
  opacity: 0.75;
}

.vx-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.vx-badge-primary {
  background-color: var(--vx-primary-tint);
  color: var(--vx-primary);
  border-color: var(--vx-primary-border);
}

html.dark .vx-badge-primary {
  color: #60A5FA;
}

.vx-badge-emerald {
  background-color: var(--vx-emerald-tint);
  color: var(--vx-emerald);
  border-color: var(--vx-emerald-border);
}

.vx-badge-amber {
  background-color: var(--vx-amber-tint);
  color: var(--vx-amber);
  border-color: var(--vx-amber-border);
}

.vx-badge-rose {
  background-color: var(--vx-rose-tint);
  color: var(--vx-rose);
  border-color: var(--vx-rose-border);
}

.vx-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--vx-primary);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 700;
  box-shadow: 0 10px 22px -6px var(--vx-primary-glow);
  transition: background-color 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
}

.vx-btn-primary:hover:not(:disabled) {
  background-color: var(--vx-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -6px var(--vx-primary-glow);
}

.vx-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--vx-bg-recessed);
  color: var(--vx-text-primary);
  border: 1px solid var(--vx-border-subtle);
  font-weight: 700;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.vx-btn-secondary:hover:not(:disabled) {
  border-color: var(--vx-primary);
  color: var(--vx-primary);
}

.vx-btn-emerald {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #059669, #10B981);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 800;
  box-shadow: 0 10px 22px -6px rgba(16, 185, 129, 0.35);
}

.vx-btn-emerald:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.vx-btn-primary:focus-visible,
.vx-btn-secondary:focus-visible,
.vx-btn-emerald:focus-visible,
.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--vx-primary);
  outline-offset: 2px;
}

/* Responsive Data Table Wrapper (Sticky Context & Keyboard Scrollable) */
.vx-table-wrap {
  overflow: auto;
  max-inline-size: 100%;
  container-type: inline-size;
  scrollbar-gutter: stable;
}

.vx-table-wrap table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.vx-table-wrap thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background-color: var(--vx-table-head-bg);
  color: var(--vx-table-head-text);
  border-bottom: 1px solid var(--vx-border);
}

/* Multi-segment Portfolio Allocation Bar */
.vx-allocation-bar {
  display: flex;
  height: 10px;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--vx-bg-recessed);
  border: 1px solid var(--vx-border);
}

.vx-allocation-seg {
  height: 100%;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Legacy Utility Compatibility */
.theme-input {
  background-color: var(--vx-bg-recessed);
  border-color: var(--vx-border-subtle);
  color: var(--vx-text-primary);
}

.theme-table-head {
  background-color: var(--vx-table-head-bg);
  color: var(--vx-table-head-text);
  border-bottom: 1px solid var(--vx-border);
}

html:not(.dark) .theme-table-row {
  border-bottom: 1px solid #F1F5F9;
}
html:not(.dark) .theme-table-row:hover {
  background-color: rgba(241, 245, 249, 0.65);
}

html.dark .theme-table-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
html.dark .theme-table-row:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Theme Switcher Button */
.theme-toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
  background-color: var(--vx-bg-recessed);
  border: 1px solid var(--vx-border-subtle);
  color: var(--vx-text-primary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:hover {
  border-color: var(--vx-primary);
  color: var(--vx-primary);
}

html:not(.dark) .theme-toggle-btn .sun-icon { display: none; }
html.dark .theme-toggle-btn .moon-icon { display: none; }

/* Scrollbar Fallback for Browsers without scrollbar-color */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  ::-webkit-scrollbar-track {
    background: var(--vx-scrollbar-track);
  }
  ::-webkit-scrollbar-thumb {
    background: var(--vx-scrollbar-thumb);
    border-radius: 4px;
  }
}

/* Active Navigation Link Hook (WCAG 1.4.1 non-color indicator via border & tint) */
.vx-nav-link {
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.vx-nav-link[aria-current="page"] {
  background-color: var(--vx-primary-tint);
  color: var(--vx-primary);
  border-color: var(--vx-primary-border);
}

html.dark .vx-nav-link[aria-current="page"] {
  color: #93C5FD;
  border-color: rgba(96, 165, 250, 0.45);
}

.vx-nav-link:focus-visible,
summary.vx-faq-summary:focus-visible {
  outline: 2px solid var(--vx-primary);
  outline-offset: 2px;
}

/* Accessible FAQ Accordion (Native <details> + ::details-content) */
.vx-faq-item {
  background-color: var(--vx-bg-card);
  border: 1px solid var(--vx-border);
  box-shadow: var(--vx-shadow-card);
  border-radius: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vx-faq-item[open] {
  border-color: var(--vx-primary-border);
}

summary.vx-faq-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--vx-text-primary);
  border-radius: 1.25rem;
}

summary.vx-faq-summary::-webkit-details-marker {
  display: none;
}

summary.vx-faq-summary::before {
  content: "";
  inline-size: 1.125rem;
  block-size: 1.125rem;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center / contain;
  rotate: -90deg;
}

summary.vx-faq-summary:dir(rtl)::before {
  rotate: 90deg;
}

details.vx-faq-item[open] > summary.vx-faq-summary::before {
  rotate: 0deg;
}

details.vx-faq-item::details-content {
  interpolate-size: allow-keywords;
  overflow: clip;
  contain: layout;
}

details.vx-faq-item:not([open])::details-content {
  block-size: 0;
}

@media (prefers-reduced-motion: no-preference) {
  summary.vx-faq-summary::before {
    transition: rotate 0.2s ease;
  }

  details.vx-faq-item::details-content {
    transition: block-size, content-visibility, display;
    transition-duration: 0.28s;
    transition-timing-function: ease-in-out;
    transition-behavior: allow-discrete;
  }
}

/* Persistent Desktop Sidebar Navigation Links */
.vx-sidebar {
  background-color: var(--vx-bg-card);
  border-right: 1px solid var(--vx-border);
}

.vx-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--vx-text-secondary);
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.vx-sidebar-link:hover {
  background-color: var(--vx-bg-recessed);
  color: var(--vx-text-primary);
}

.vx-sidebar-link[aria-current="page"] {
  background-color: var(--vx-primary-tint);
  color: var(--vx-primary);
  border-color: var(--vx-primary-border);
  font-weight: 700;
}

html.dark .vx-sidebar-link[aria-current="page"] {
  color: #93C5FD;
  border-color: rgba(96, 165, 250, 0.45);
}

.vx-sidebar-link:focus-visible {
  outline: 2px solid var(--vx-primary);
  outline-offset: 2px;
}

/* Native Modal Dialogs (Scroll-Containment & Top-Layer Backdrop) */
dialog.vx-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--vx-border);
  border-radius: 1.5rem;
  background-color: var(--vx-bg-card);
  color: var(--vx-text-primary);
  box-shadow: var(--vx-shadow-luxury);
  max-width: min(92vw, 34rem);
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(7, 10, 17, 0.72);
  backdrop-filter: blur(4px);
}

/* Forced Colors High-Contrast Mode Support */
@media (forced-colors: active) {
  .vx-card,
  .vx-card-interactive,
  .vx-kpi-card,
  .vx-badge,
  .vx-btn-primary,
  .vx-btn-secondary,
  .vx-btn-emerald,
  .vx-faq-item,
  .vx-nav-link[aria-current="page"],
  .vx-sidebar-link[aria-current="page"],
  dialog.vx-dialog {
    border: 1px solid CanvasText;
    box-shadow: none;
  }
}

/* Ensure legacy floating support widget is hidden */
.fixed.bottom-5.right-5.z-50,
.fixed.bottom-5.right-5 {
  display: none !important;
}

/* High-Legibility Institutional & Numerical Typography */
body,
input,
button,
select,
textarea,
.font-mono,
.font-sans,
[class*="font-gilmer"],
.font-gilmerregular,
.font-gilmermedium,
.font-gilmerbold,
.font-gilmerheavy,
.font-gilmerlight {
  font-family: var(--font-sans) !important;
}

.font-mono,
.tabular-nums,
[id*="balance"],
[id*="profit"],
[id*="capital"],
[id*="amount"],
[id*="code"],
[id*="price"],
[id*="fee"],
[id*="rate"],
[id*="total"],
[id*="payout"],
[id*="earned"],
[id*="invested"],
[id*="stat"],
[id*="percent"],
[id*="tracker"],
[id*="networth"],
.stat-number,
.stat-value,
.number-normal {
  font-family: var(--font-sans) !important;
  font-variant-numeric: tabular-nums !important;
  font-style: normal !important;
  letter-spacing: normal !important;
}

input[type="number"],
input[type="text"][inputmode="numeric"],
#login-verify-code,
#input-verify-code,
#reg-verify-code,
#reset-code {
  font-family: var(--font-sans) !important;
}

/* Accessible Form Validation, Password Visibility Toggles & Inline Feedback */
.vx-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.vx-pw-wrap > input {
  padding-right: 2.75rem !important;
}

.vx-pw-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: var(--vx-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.vx-pw-toggle:hover {
  color: var(--vx-text-primary);
  background-color: var(--vx-bg-recessed);
}

.vx-pw-toggle:focus-visible {
  outline: 2px solid var(--vx-primary);
  outline-offset: 2px;
}

.vx-field-hint {
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--vx-text-muted);
  margin-bottom: 0.375rem;
}

.vx-field-error {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--vx-rose);
  margin-top: 0.375rem;
}

.vx-input:is(:user-invalid, [aria-invalid="true"]),
select.vx-input:is(:user-invalid, [aria-invalid="true"]),
input[type="checkbox"]:is(:user-invalid, [aria-invalid="true"]) {
  border-color: var(--vx-rose) !important;
}

.vx-input:is(:user-invalid, [aria-invalid="true"]):focus {
  box-shadow: 0 0 0 3px var(--vx-rose-tint) !important;
}

.vx-field-group:has(:is(:user-invalid, [aria-invalid="true"])) .vx-field-error,
.vx-field-error.is-visible {
  display: block;
}

.vx-feedback-banner {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}

.vx-feedback-banner.is-error {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  background-color: var(--vx-rose-tint);
  border-color: var(--vx-rose-border);
  color: var(--vx-rose);
}

.vx-feedback-banner.is-success {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  background-color: var(--vx-emerald-tint);
  border-color: var(--vx-emerald-border);
  color: var(--vx-emerald);
}

/* Admin Filter Pills */
.vx-admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--vx-border);
  background-color: var(--vx-bg-card);
  color: var(--vx-text-secondary);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.vx-admin-pill:hover {
  border-color: var(--vx-primary-border);
  color: var(--vx-text-primary);
}

.vx-admin-pill.active,
.vx-admin-pill[aria-pressed="true"] {
  background-color: var(--vx-primary);
  border-color: var(--vx-primary);
  color: #FFFFFF;
}

/* ==========================================================
   CENTRALIZED DESIGN SYSTEM PRIMITIVES & RESPONSIVE ENGINE
   (Sections 8 & 9: Typography, Overflow Guards, Touch Targets,
    Inputs, Selects, Responsive Tables, Toasts, Empty States, Skeletons)
   ========================================================== */

html.dark {
  --vx-shadow-sm: 0 2px 6px 0 rgba(0, 0, 0, 0.35);
}

/* Mobile-First Reflow & Overflow Protection (WCAG 1.4.10 down to 320px) */
html,
body {
  max-inline-size: 100%;
  overflow-x: clip;
}

body {
  line-height: 1.5;
  text-align: start;
  overflow-wrap: break-word;
}

img,
svg,
video,
canvas {
  max-inline-size: 100%;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

/* Form-Factor Touch Target Adaptation (24px pointer / 44px touch) */
@media (pointer: coarse) {
  :root {
    --vx-target-size: 44px;
  }
}

:where(
  button,
  select,
  input:not([type="checkbox"], [type="radio"]),
  [role="button"],
  .vx-nav-link,
  .vx-sidebar-link,
  .vx-btn-primary,
  .vx-btn-secondary,
  .vx-btn-emerald,
  .vx-btn-danger,
  .vx-btn-ghost,
  .vx-admin-pill
) {
  min-block-size: var(--vx-target-size);
  min-inline-size: var(--vx-target-size);
}

:where(nav, .toolbar) {
  flex-wrap: wrap;
}

@media (pointer: coarse) and (max-width: 640px) {
  input:not([type="checkbox"], [type="radio"]),
  select,
  textarea {
    font-size: max(1rem, 16px) !important;
  }
}

/* Fluid Display Typography Utilities */
.vx-title-xl {
  font-size: var(--vx-font-xl);
  line-height: 1.25;
  font-weight: 800;
}

.vx-title-2xl {
  font-size: var(--vx-font-2xl);
  line-height: 1.2;
  font-weight: 800;
}

.vx-title-3xl {
  font-size: var(--vx-font-3xl);
  line-height: 1.12;
  font-weight: 800;
}

/* Standardized Inputs & Dropdowns (.vx-input, .vx-select) */
.vx-input,
.vx-select {
  background-color: var(--vx-bg-recessed);
  border: 1px solid var(--vx-border-subtle);
  border-radius: var(--vx-radius-md);
  color: var(--vx-text-primary);
  font-size: var(--vx-font-sm);
  line-height: 1.45;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.vx-input::placeholder {
  color: var(--vx-text-muted);
}

.vx-input:focus,
.vx-select:focus {
  outline: none;
  border-color: var(--vx-primary);
  box-shadow: 0 0 0 3px var(--vx-primary-tint);
}

.vx-input:disabled,
.vx-select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

select.vx-input,
.vx-select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 2.35rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

/* Additional Centralized Buttons & Badges */
.vx-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--vx-rose-tint);
  color: var(--vx-rose);
  border: 1px solid var(--vx-rose-border);
  border-radius: var(--vx-radius-md);
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.vx-btn-danger:hover:not(:disabled) {
  background-color: var(--vx-rose);
  color: #FFFFFF;
}

.vx-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: transparent;
  color: var(--vx-text-secondary);
  border: 1px solid transparent;
  border-radius: var(--vx-radius-md);
  font-weight: 600;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.vx-btn-ghost:hover:not(:disabled) {
  background-color: var(--vx-bg-recessed);
  color: var(--vx-text-primary);
}

.vx-btn-primary:disabled,
.vx-btn-secondary:disabled,
.vx-btn-emerald:disabled,
.vx-btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.vx-badge-neutral {
  background-color: var(--vx-bg-recessed);
  color: var(--vx-text-secondary);
  border-color: var(--vx-border-subtle);
}

.vx-modal-panel {
  background-color: var(--vx-bg-card);
  border: 1px solid var(--vx-border);
  border-radius: var(--vx-radius-xl);
  box-shadow: var(--vx-shadow-luxury);
  max-block-size: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Responsive Data Table -> Card Stacking inside Narrow Containers */
@container (width < 560px) {
  table.vx-table-responsive {
    min-inline-size: 0 !important;
  }

  table.vx-table-responsive,
  table.vx-table-responsive thead,
  table.vx-table-responsive tbody,
  table.vx-table-responsive tr,
  table.vx-table-responsive th,
  table.vx-table-responsive td {
    display: block;
    inline-size: 100%;
  }

  table.vx-table-responsive thead {
    display: none;
  }

  table.vx-table-responsive tbody {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  table.vx-table-responsive tbody tr {
    background-color: var(--vx-bg-recessed);
    border: 1px solid var(--vx-border);
    border-radius: var(--vx-radius-lg);
    padding: 0.75rem 0.875rem;
  }

  table.vx-table-responsive tbody tr.vx-skeleton-row,
  table.vx-table-responsive tbody tr.vx-empty-row {
    background-color: transparent;
    border: none;
    padding: 0;
  }

  table.vx-table-responsive td {
    padding: 0.375rem 0 !important;
    text-align: end !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--vx-border);
  }

  table.vx-table-responsive td:last-child {
    border-bottom: none;
  }

  table.vx-table-responsive td[colspan] {
    display: block;
    text-align: center !important;
    border-bottom: none;
  }

  table.vx-table-responsive td[data-label]::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--vx-text-muted);
    text-align: start;
    flex-shrink: 0;
  }
}

/* Standardized Dual-Theme Toast Notification Region */
.vx-toast-region {
  position: fixed;
  inset-block-start: max(1rem, env(safe-area-inset-top, 0px));
  inset-inline-end: max(1rem, env(safe-area-inset-right, 0px));
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
  max-inline-size: min(24rem, calc(100vw - 2rem));
  inline-size: 100%;
}

.vx-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--vx-radius-md);
  background-color: var(--vx-bg-card);
  color: var(--vx-text-primary);
  border: 1px solid var(--vx-border);
  border-inline-start-width: 3px;
  box-shadow: var(--vx-shadow-luxury);
  font-size: var(--vx-font-xs);
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.vx-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.vx-toast[data-toast-type="success"] {
  border-inline-start-color: var(--vx-emerald);
}

.vx-toast[data-toast-type="error"] {
  border-inline-start-color: var(--vx-rose);
}

.vx-toast[data-toast-type="info"] {
  border-inline-start-color: var(--vx-primary);
}

.vx-toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 1.5rem !important;
  min-inline-size: 1.5rem !important;
  padding: 0.15rem;
  border-radius: 0.45rem;
  color: var(--vx-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.vx-toast-close:hover {
  color: var(--vx-text-primary);
  background-color: var(--vx-bg-recessed);
}

/* Standardized Empty State Component */
.vx-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: var(--vx-radius-lg);
  border: 1px dashed var(--vx-border-subtle);
  background-color: var(--vx-bg-recessed);
  gap: 0.625rem;
}

.vx-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: var(--vx-radius-pill);
  background-color: var(--vx-primary-tint);
  color: var(--vx-primary);
  border: 1px solid var(--vx-primary-border);
}

.vx-empty-title {
  font-size: var(--vx-font-sm);
  font-weight: 800;
  color: var(--vx-text-primary);
  margin: 0;
}

.vx-empty-desc {
  font-size: var(--vx-font-xs);
  color: var(--vx-text-muted);
  max-inline-size: 32ch;
  margin: 0;
}

/* Loading Skeleton Primitives */
@keyframes vx-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.vx-skeleton {
  display: block;
  border-radius: var(--vx-radius-sm);
  background: linear-gradient(
    90deg,
    var(--vx-bg-recessed) 25%,
    var(--vx-border) 50%,
    var(--vx-bg-recessed) 75%
  );
  background-size: 200% 100%;
  animation: vx-shimmer 1.5s infinite linear;
}

.vx-skeleton-line {
  block-size: 0.75rem;
  inline-size: 100%;
}

.vx-skeleton-card {
  block-size: 4.5rem;
  inline-size: 100%;
  border-radius: var(--vx-radius-lg);
}

@media (prefers-reduced-motion: reduce) {
  .vx-skeleton {
    animation: none;
    background: var(--vx-bg-recessed);
  }
  .vx-toast {
    transition: none;
  }
}
