/**
 * SparkleCharge Master Design System — Enterprise Engineering Architecture (Phase 3)
 * Dark-first hero aesthetic with Electric Blue, Indigo & Cyan accents.
 * 90% sophisticated neutral dark surfaces, 10% intentional brand/semantic accents.
 * Author: Abdulsamad Usman (SparkleCharge)
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   1. GLOBAL DESIGN TOKENS (CSS CUSTOM PROPERTIES)
   ========================================================================== */
:root {
  /* ── Canvas & Surface Hierarchy (Dark Mode Hero) ── */
  --color-bg-base: #060913;
  --color-bg-canvas: #080C17;
  --color-bg-surface: #0D1527;
  --color-bg-surface-elevated: #131D31;
  --color-bg-interactive: #162238;
  --color-bg-interactive-hover: #1E2D4A;
  --color-bg-glass: rgba(13, 21, 39, 0.82);
  --color-bg-input: #080E1B;

  /* ── Border & Divider Tokens ── */
  --color-border-subtle: rgba(255, 255, 255, 0.08);
  --color-border-muted: #1E293B;
  --color-border-interactive: #24324D;
  --color-border-focus: #3B82F6;

  /* ── Brand & Accent Tokens ── */
  --color-brand-primary: #2563EB;
  --color-brand-primary-hover: #1D4ED8;
  --color-brand-secondary: #6366F1;
  --color-brand-cyan: #06B6D4;
  --color-brand-violet: #8B5CF6;
  --color-brand-glow: rgba(37, 99, 235, 0.25);
  --color-brand-glow-cyan: rgba(6, 182, 212, 0.20);

  /* ── Typography Tokens ── */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --color-text-primary: #F8FAFC;
  --color-text-secondary: #94A3B8;
  --color-text-muted: #64748B;
  --color-text-inverse: #060913;

  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* ── Semantic Status Tokens ── */
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-border: rgba(16, 185, 129, 0.25);

  --color-warning: #F59E0B;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-warning-border: rgba(245, 158, 11, 0.25);

  --color-danger: #EF4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-danger-border: rgba(239, 68, 68, 0.25);

  --color-info: #0EA5E9;
  --color-info-bg: rgba(14, 165, 233, 0.12);
  --color-info-border: rgba(14, 165, 233, 0.25);

  /* ── Spacing Tokens ── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ── Radius Tokens ── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-pill: 9999px;
  --radius-full: 9999px;

  /* ── Shadows & Elevations ── */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -1px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -2px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.65), 0 10px 10px -5px rgba(0, 0, 0, 0.40);
  --shadow-glow: 0 0 35px -5px rgba(37, 99, 235, 0.28);
  --shadow-glow-cyan: 0 0 30px -5px rgba(6, 182, 212, 0.25);

  /* ── Layout ── */
  --container-max: 1240px;
  --header-height: 72px;
  --admin-sidebar-width: 260px;

  /* ── Motion & Transitions ── */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Backward Compatibility Token Aliases ── */
  --color-page-bg: var(--color-bg-base);
  --color-surface: var(--color-bg-surface);
  --color-grid-lines: var(--color-border-subtle);
  --color-primary-indigo: var(--color-brand-primary);
  --color-accent-teal: var(--color-brand-cyan);
  --color-accent-cyan: var(--color-brand-cyan);
  --color-button-bg: var(--color-brand-primary);
  --color-button-text: #FFFFFF;

  --bg-primary: var(--color-bg-base);
  --bg-secondary: var(--color-bg-surface);
  --bg-tertiary: var(--color-bg-surface-elevated);
  --bg-card: var(--color-bg-surface);
  --bg-card-hover: var(--color-bg-surface-elevated);
  --bg-input: var(--color-bg-input);
  --bg-surface: var(--color-bg-surface);

  --border-subtle: var(--color-border-subtle);
  --border-muted: var(--color-border-muted);
  --border-focus: var(--color-border-focus);

  --brand-primary: var(--color-brand-primary);
  --brand-primary-hover: var(--color-brand-primary-hover);
  --brand-secondary: var(--color-brand-secondary);
  --brand-accent: var(--color-brand-cyan);
  --brand-glow: var(--color-brand-glow);

  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: var(--color-text-muted);
  --text-inverse: var(--color-text-inverse);

  --status-success: var(--color-success);
  --status-warning: var(--color-warning);
  --status-danger: var(--color-danger);
  --status-info: var(--color-info);

  --portal-nav-bg: var(--color-bg-surface);
  --portal-card-bg: var(--color-bg-surface);
  --portal-border: var(--color-border-subtle);
  --portal-accent: var(--color-brand-primary);
  --portal-accent-hover: var(--color-brand-primary-hover);

  --bg-surface: var(--color-bg-surface);
  --bg-light: var(--color-bg-surface-elevated);
  --border-color: var(--color-border-subtle);
  --text-dark: var(--color-text-primary);
}

/* ==========================================================================
   2. RESET & BASE ELEMENTS
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  background-color: var(--color-bg-base);
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  line-height: 1.6;
  font-size: var(--text-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

/* Accessible visible focus states */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-4);
  overflow-wrap: break-word;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.25rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); font-weight: 700; letter-spacing: -0.03em; }
h3 { font-size: clamp(1.35rem, 2.5vw, 1.75rem); font-weight: 600; letter-spacing: -0.02em; }
h4 { font-size: var(--text-xl); font-weight: 600; }
h5 { font-size: var(--text-lg); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
  overflow-wrap: break-word;
}

p.lead {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--color-text-secondary);
}

a {
  color: var(--color-brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #60A5FA;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  background: var(--color-bg-surface-elevated);
  color: #93C5FD;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  word-break: break-word;
}

pre {
  background: #040711;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  color: #E2E8F0;
  line-height: 1.55;
  margin-bottom: var(--space-6);
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

ul, ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
  color: var(--color-text-secondary);
}

li {
  margin-bottom: var(--space-2);
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-8) 0;
}

/* Tabular Numerals for Finance, Metrics & Data */
.tabular-nums, .num, td.amount, .stat-value, .metric-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ==========================================================================
   3. BACKGROUND PATTERNS & VISUAL SIGNATURES
   ========================================================================== */
.bg-glow-radial {
  background: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.18) 0%, rgba(6, 9, 19, 0) 70%);
}

.bg-tech-grid {
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-circuit-overlay {
  position: relative;
}
.bg-circuit-overlay::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(37, 99, 235, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.6;
}

/* ==========================================================================
   4. LAYOUT & CONTAINERS
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

@media (max-width: 640px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

.container-narrow {
  max-width: 820px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.section {
  padding-top: var(--space-20);
  padding-bottom: var(--space-20);
  width: 100%;
  position: relative;
}

@media (max-width: 768px) {
  .section {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
  }
}

.section-hero {
  padding-top: var(--space-24);
  padding-bottom: var(--space-20);
  position: relative;
  overflow: hidden;
  width: 100%;
  background: radial-gradient(ellipse 90% 60% at 50% -15%, rgba(37, 99, 235, 0.22), transparent 75%);
}

@media (max-width: 768px) {
  .section-hero {
    padding-top: var(--space-16);
    padding-bottom: var(--space-12);
  }
}

.main-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: 100vw;
}

/* Split Layout Pattern (Alternative to repetitive cards) */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  align-items: start;
}

@media (max-width: 900px) {
  .split-layout {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

/* ==========================================================================
   5. BUTTONS & INTERACTIVE CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.68rem 1.35rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled, .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Electric Blue Button */
.btn-primary {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #FFFFFF !important;
}

/* Secondary Translucent Dark Button */
.btn-secondary {
  background: var(--color-bg-surface-elevated);
  color: var(--color-text-primary) !important;
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--color-bg-interactive);
  border-color: var(--color-border-interactive);
  color: #FFFFFF !important;
}

/* Outline Ghost Button */
.btn-outline {
  background: transparent;
  color: var(--color-text-primary) !important;
  border: 1px solid var(--color-border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--color-text-secondary);
  color: #FFFFFF !important;
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.5);
}

/* Success Emerald Button */
.btn-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover {
  background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #FFFFFF !important;
}

/* Warning Amber Button */
.btn-warning {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #0F172A !important;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
  color: #0F172A !important;
}

/* Button Sizes */
.btn-sm {
  font-size: 0.8rem;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-pill);
}

.btn-lg {
  font-size: 1.05rem;
  padding: 0.85rem 1.85rem;
  border-radius: var(--radius-pill);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
}

/* ==========================================================================
   6. PANELS, CARDS & STRUCTURAL SURFACES
   ========================================================================== */
/* Standard Panel & Card (High-End Dark Surface) */
.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-primary);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:has(.card-body) {
  padding: 0;
}

.card.card-flush, .card[style*="padding: 0"], .card[style*="padding:0"], .card[style*="padding: 0px"], .card[style*="padding:0px"] {
  padding: 0 !important;
}

.card:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.panel:hover {
  border-color: var(--color-border-interactive);
}

.panel-header, .card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.015);
}

.panel-title, .card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: -0.015em;
}

.panel-body, .card-body {
  padding: 1.5rem;
  flex: 1 1 auto;
}

.panel-footer, .card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border-subtle);
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Glass Surface (For Nav, Floating Badges, Hero Overlays) */
.surface-glass {
  background: var(--color-bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--color-border-subtle);
}

/* Interactive Clickable Panel */
.panel-interactive {
  cursor: pointer;
}
.panel-interactive:hover {
  background: var(--color-bg-surface-elevated);
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* KPI Metric Block (Replaces Generic Cards in Dashboards) */
.metric-block, .stat-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.metric-block::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.4), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.metric-block:hover {
  border-color: var(--color-border-interactive);
}
.metric-block:hover::before {
  opacity: 1;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.35rem;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   7. FORM CONTROLS & INPUT SYSTEM
   ========================================================================== */
.form-group {
  margin-bottom: 1.35rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-control, .form-select, .form-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  box-sizing: border-box;
}

.form-control::placeholder, .form-textarea::placeholder {
  color: #475569;
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  background: #0B1324;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.20);
}

.form-control:disabled, .form-select:disabled, .form-textarea:disabled {
  background: #080D1A;
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.1em;
  padding-right: 2.5rem;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-helper {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.form-error {
  font-size: 0.8rem;
  color: var(--color-danger);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Custom Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.form-check input[type="checkbox"], .form-check input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: all var(--transition-fast);
  margin: 0;
  flex-shrink: 0;
}

.form-check input[type="radio"] {
  border-radius: 50%;
}

.form-check input[type="checkbox"]:checked, .form-check input[type="radio"]:checked {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
}

.form-check input[type="checkbox"]:checked::after {
  content: '✓';
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
}

.form-check input[type="radio"]:checked::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #FFFFFF;
  border-radius: 50%;
}

/* ==========================================================================
   8. DATA TABLES & LISTS
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.table th {
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border-subtle);
  white-space: nowrap;
}

.table td {
  padding: 1rem 1.25rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  transition: background-color var(--transition-fast);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background-color: rgba(37, 99, 235, 0.04);
  color: var(--color-text-primary);
}

/* ==========================================================================
   9. BADGES & SEMANTIC STATUS PILLS
   ========================================================================== */
.badge, .tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* Brand Accent Badge */
.badge-brand {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #60A5FA !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.15);
}
.badge-brand .badge-dot {
  background: #60A5FA;
}

/* Semantic Badges */
.badge-success, .status-paid, .status-active, .status-completed, .status-published {
  background: var(--color-success-bg);
  color: #34D399 !important;
  border-color: var(--color-success-border);
}
.badge-success .badge-dot { background: #34D399; }

.badge-warning, .status-pending, .status-in-progress, .status-review, .status-partially-paid {
  background: var(--color-warning-bg);
  color: #FBBF24 !important;
  border-color: var(--color-warning-border);
}
.badge-warning .badge-dot { background: #FBBF24; }

.badge-danger, .status-overdue, .status-failed, .status-urgent, .status-revoked {
  background: var(--color-danger-bg);
  color: #F87171 !important;
  border-color: var(--color-danger-border);
}
.badge-danger .badge-dot { background: #F87171; }

.badge-info, .status-draft, .status-new, .status-scheduled {
  background: var(--color-info-bg);
  color: #38BDF8 !important;
  border-color: var(--color-info-border);
}
.badge-info .badge-dot { background: #38BDF8; }

.badge-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-secondary) !important;
  border-color: var(--color-border-subtle);
}
.badge-neutral .badge-dot { background: var(--color-text-muted); }

/* ==========================================================================
   10. EMPTY STATES & SKELETON LOADERS
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: #60A5FA;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-6);
}

/* ==========================================================================
   11. NAVIGATION & HEADER STYLES
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(6, 9, 19, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border-subtle);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: #FFFFFF;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-logo .logo-spark {
  color: #38BDF8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

.brand-logo span {
  color: #60A5FA;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: 70px;
  display: flex;
  align-items: center;
  transition: all var(--transition-normal);
}

.site-header.scrolled {
  background: rgba(6, 9, 19, 0.95);
  border-bottom-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
}

.nav-link {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: #60A5FA;
  background: rgba(37, 99, 235, 0.15);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-link-portal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-fast);
}

.nav-link-portal:hover {
  color: #FFFFFF;
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.08);
}

.btn-glow {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%) !important;
  box-shadow: 0 0 20px -3px rgba(37, 99, 235, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #FFFFFF !important;
}

.btn-glow:hover {
  box-shadow: 0 0 25px -2px rgba(37, 99, 235, 0.65) !important;
  transform: translateY(-1px);
}

/* Mobile Toggle Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #FFFFFF;
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
  .nav-links, .nav-actions {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
}

/* Mobile Navigation Drawer */
.mobile-nav {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  background: rgba(13, 21, 39, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: translateY(-120%);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 999;
}

.mobile-nav.open, .mobile-nav.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav .nav-link {
  font-size: 1rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-nav .nav-link.active {
  background: rgba(37, 99, 235, 0.15);
  color: #60A5FA;
}

.mobile-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Client Portal Navigation Shell ── */
.portal-topbar {
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  background: #080C17 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--color-text-primary) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}

.portal-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.portal-brand-title {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: #FFFFFF;
}

.portal-brand-badge {
  background: rgba(37, 99, 235, 0.15);
  color: #60A5FA;
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.portal-desktop-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.portal-nav-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.portal-nav-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.05);
}

.portal-nav-link.active {
  color: #60A5FA;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-weight: 600;
}

.portal-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 7, 17, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.portal-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #080C17 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
  overflow-y: auto;
}

.portal-sidebar.open {
  transform: translateX(0);
}

.portal-sidebar-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.portal-sidebar-close-btn:hover {
  color: #FFFFFF;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

.portal-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.75rem;
}

.portal-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.portal-sidebar-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.05);
}

.portal-sidebar-link.active {
  color: #60A5FA;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.15);
  font-weight: 600;
}

.portal-sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 1rem;
}

.portal-badge-pill {
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  margin-left: 0.35rem;
}

#portalSidebarToggle {
  display: none;
}

@media (max-width: 1024px) {
  #portalSidebarToggle {
    display: inline-flex;
  }
  .portal-desktop-nav {
    display: none !important;
  }
}

/* ==========================================================================
   12. FOOTER STYLES
   ========================================================================== */
.site-footer {
  background: #040711;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--space-16) 0 var(--space-8);
  margin-top: auto;
  position: relative;
}

.footer-newsletter-card {
  background: #0D1527;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 2rem 2.25rem;
  margin-bottom: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  width: 100%;
}

.footer-newsletter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #2563EB, #06B6D4, #6366F1);
}

.footer-newsletter-info {
  flex: 1 1 300px;
  min-width: 0;
}

.footer-newsletter-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: #FFFFFF;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-newsletter-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.footer-newsletter-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-width: 520px;
}

.footer-newsletter-form {
  display: flex;
  gap: 0.6rem;
  flex: 1 1 320px;
  max-width: 440px;
  width: 100%;
  box-sizing: border-box;
}

.footer-newsletter-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background: #080C17;
  color: #FFFFFF;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.footer-newsletter-input:focus {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.footer-newsletter-form button,
#footerNewsletterBtn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .footer-newsletter-card {
    padding: 1.75rem 1.5rem;
    gap: 1.25rem;
  }
  .footer-newsletter-form {
    max-width: 100%;
    flex: 1 1 100%;
  }
}

@media (max-width: 600px) {
  .footer-newsletter-card {
    padding: 1.25rem 1rem;
    gap: 1rem;
    border-radius: var(--radius-lg);
  }
  .footer-newsletter-info {
    width: 100%;
    min-width: 0;
  }
  .footer-newsletter-title {
    font-size: 1.05rem;
    line-height: 1.35;
  }
  .footer-newsletter-desc {
    font-size: 0.85rem;
  }
  .footer-newsletter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .footer-newsletter-input {
    width: 100% !important;
    display: block;
    font-size: 0.92rem;
    padding: 0.8rem 1rem;
    box-sizing: border-box;
  }
  .footer-newsletter-form button,
  #footerNewsletterBtn {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.85rem 1.25rem !important;
    font-size: 0.95rem !important;
    box-sizing: border-box;
  }
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
  align-items: start;
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-8);
  }
  .footer-brand-col {
    grid-column: span 4;
    margin-bottom: var(--space-2);
  }
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
  .footer-brand-col {
    grid-column: span 2;
  }
}

@media (max-width: 500px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .footer-brand-col {
    grid-column: span 1;
  }
}

.footer-heading {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #FFFFFF;
  margin-bottom: var(--space-4);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.65rem;
}

.footer-links a {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  text-decoration: none;
  transition: color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-links a:hover {
  color: #60A5FA;
  transform: translateX(2px);
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  background-color: #34D399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ==========================================================================
   13. LIGHT MODE (PRECISE HIGH-CONTRAST NEUTRAL THEME)
   ========================================================================== */
[data-theme="light"], .theme-light {
  --color-bg-base: #F8FAFC;
  --color-bg-canvas: #F1F5F9;
  --color-bg-surface: #FFFFFF;
  --color-bg-surface-elevated: #F8FAFC;
  --color-bg-interactive: #F1F5F9;
  --color-bg-interactive-hover: #E2E8F0;
  --color-bg-glass: rgba(255, 255, 255, 0.88);
  --color-bg-input: #FFFFFF;

  --color-border-subtle: #E2E8F0;
  --color-border-muted: #CBD5E1;
  --color-border-interactive: #94A3B8;
  --color-border-focus: #2563EB;

  --color-text-primary: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #64748B;
  --color-text-inverse: #FFFFFF;

  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-danger-bg: rgba(239, 68, 68, 0.1);
  --color-info-bg: rgba(14, 165, 233, 0.1);

  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.10);
  --shadow-glow: 0 0 25px -5px rgba(37, 99, 235, 0.18);
}

/* ==========================================================================
   14. COMPREHENSIVE RESPONSIVE GRID & UTILITIES ENGINE
   ========================================================================== */

/* Responsive Grid System */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(1, 1fr); }

@media (min-width: 640px) {
  .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Automatic inline grid collapse for mobile/tablet */
@media (max-width: 900px) {
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns: 1fr 1.25fr"],
  [style*="grid-template-columns: 1fr 1.3fr"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 1.8fr 1fr"],
  [style*="grid-template-columns: 2.2fr 1fr"],
  .case-study-grid,
  .contact-grid,
  .hire-grid,
  .blog-layout-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 680px) {
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: 80px 1fr"],
  [style*="grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fill, minmax(320px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"],
  [style*="repeat(auto-fit, minmax(300px, 1fr))"],
  [style*="repeat(auto-fit, minmax(320px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  [style*="repeat(auto-fit, minmax(200px, 1fr))"],
  [style*="repeat(auto-fit, minmax(210px, 1fr))"],
  [style*="repeat(auto-fit, minmax(220px, 1fr))"],
  [style*="repeat(auto-fit, minmax(240px, 1fr))"],
  [style*="repeat(auto-fit, minmax(260px, 1fr))"],
  [style*="repeat(auto-fit, minmax(280px, 1fr))"] {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
  }

  .portal-page-header,
  .admin-topbar > div,
  [style*="justify-content: space-between"][style*="align-items: center"],
  [style*="justify-content: space-between"][style*="align-items: flex-end"] {
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
  }

  .hero-actions .btn,
  .section-hero .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .mobile-nav {
    max-height: calc(100vh - 70px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  [style*="position: fixed"] > div[style*="width:"],
  [style*="position: fixed"] > div[style*="max-width:"] {
    width: 92vw !important;
    max-width: 92vw !important;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 3.25rem 0 !important;
  }
  .section-hero {
    padding: 3.5rem 0 2.5rem !important;
  }
  h1 { font-size: 2rem !important; }
  h2 { font-size: 1.6rem !important; }
  h3 { font-size: 1.25rem !important; }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.w-full { width: 100%; }

/* Alerts */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.alert-success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: #34D399;
}

.alert-danger, .alert-error {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: #F87171;
}

.alert-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: #FBBF24;
}

.alert-info {
  background: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: #38BDF8;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 17, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  box-sizing: border-box;
}

.modal-content {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-8);
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .modal-content {
    max-width: 100%;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
  }
}

/* Details & FAQ Accordions */
details.card {
  transition: all var(--transition-fast);
  cursor: pointer;
}
details.card[open] {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 4px 20px -2px rgba(37, 99, 235, 0.15);
}
details.card summary {
  cursor: pointer;
  user-select: none;
}
details.card summary::-webkit-details-marker {
  display: none;
}
details.card[open] summary > span:last-child {
  transform: rotate(45deg);
  transition: transform var(--transition-fast);
}
details.card[open] summary > span.faq-icon {
  transform: rotate(180deg);
}

/* ==========================================================================
   15. ADVANCED RESPONSIVE ENGINE & VISITOR AREA SUITE (PHASE 30)
   ========================================================================== */

/* Button Sizes & Utility Extensions */
.btn-md {
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  line-height: 1.4;
  white-space: nowrap;
}

/* Fluid Layout & Grid Primitives */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
  width: 100%;
}
@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: 1.35fr 1fr;
    gap: 3.5rem;
  }
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.5rem;
  width: 100%;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.5rem;
  width: 100%;
}

.featured-blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
}
@media (min-width: 860px) {
  .featured-blog-grid.has-cover {
    grid-template-columns: 1.2fr 1.5fr;
  }
}

.blog-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  width: 100%;
}
@media (min-width: 960px) {
  .blog-layout-grid {
    grid-template-columns: 2.2fr 1fr;
  }
}

/* Technical Article Typography & Layout */
.article-main-column {
  min-width: 0;
  width: 100%;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
  word-break: break-word;
}
.article-body h2 {
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}
.article-body h3 {
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 1.75rem 0;
  border: 1px solid var(--color-border-subtle);
}
.article-body pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.75rem 0;
  background: #040711;
  border: 1px solid var(--color-border-subtle);
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.article-body table th,
.article-body table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border-subtle);
}
.article-body table th {
  background: var(--color-bg-surface-elevated);
  color: #FFFFFF;
}

/* Table of Contents & Technical Widgets */
.toc-desktop-sidebar {
  position: sticky;
  top: calc(var(--header-height, 70px) + 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.toc-desktop-card, .toc-mobile-box {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toc-link {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  text-decoration: none;
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.toc-link:hover, .toc-link.active {
  color: #60A5FA;
  background: rgba(37, 99, 235, 0.12);
}

.advisory-box, .metadata-box {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}
.meta-row:last-child {
  border-bottom: none;
}
.meta-key {
  color: var(--color-text-muted);
}
.meta-val {
  color: #FFFFFF;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Status & Verification Badges */
.status-banner {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.status-banner.verified {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
}
.status-banner.revoked, .status-banner.tampered {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}
.status-banner.rate_limited {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FBBF24;
}
.status-banner.not_found {
  background: rgba(100, 116, 139, 0.12);
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: #94A3B8;
}

/* ==========================================================================
   16. COMPREHENSIVE CLIENT PORTAL DESIGN SYSTEM & RESPONSIVENESS (PHASE 30)
   ========================================================================== */

/* Client Stats & Pipeline Metrics Grid */
.client-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
}
@media (max-width: 1100px) {
  .client-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
@media (max-width: 600px) {
  .client-stats-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

/* ==========================================================================
   SPARKLECHARGE MODERN STAT CARD ARCHITECTURE
   Replaces dated generic left-border stripes with sleek cyber-modern cards
   ========================================================================== */
.client-stats-grid .portal-card,
.payment-stats-grid .portal-card,
.invoice-summary-grid .portal-card,
.sparkle-stat-card {
  background: linear-gradient(180deg, rgba(19, 29, 49, 0.75) 0%, rgba(13, 21, 39, 0.95) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.08) !important; /* Force completely removes left color stripe */
  border-radius: 14px !important;
  padding: 1.35rem 1.4rem !important;
  margin-bottom: 0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4) !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease !important;
}

/* Subtle electric top accent line (SparkleCharge DNA) */
.client-stats-grid .portal-card::before,
.payment-stats-grid .portal-card::before,
.invoice-summary-grid .portal-card::before,
.sparkle-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.5), rgba(37, 99, 235, 0.7), transparent);
  opacity: 0.6;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Modern hover lift & ambient electric glow */
.client-stats-grid .portal-card:hover,
.payment-stats-grid .portal-card:hover,
.invoice-summary-grid .portal-card:hover,
.sparkle-stat-card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(37, 99, 235, 0.15) !important;
}

.client-stats-grid .portal-card:hover::before,
.payment-stats-grid .portal-card:hover::before,
.invoice-summary-grid .portal-card:hover::before,
.sparkle-stat-card:hover::before {
  opacity: 1;
}

/* Stat Card Label */
.stat-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8;
  margin-bottom: 0.35rem;
}

/* Stat Card Value */
.stat-card-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #FFFFFF !important;
  line-height: 1.15;
  margin-top: 0.2rem;
}

/* Stat Card Subtitle / Hint */
.stat-card-sub {
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Stat Card Glowing Icon Container */
.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.client-stats-grid .portal-card:hover .stat-card-icon,
.sparkle-stat-card:hover .stat-card-icon {
  transform: scale(1.08);
}

.stat-icon-blue {
  background: rgba(37, 99, 235, 0.14);
  color: #60A5FA;
  border: 1px solid rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.18);
}
.stat-icon-emerald {
  background: rgba(16, 185, 129, 0.14);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.28);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.18);
}
.stat-icon-amber {
  background: rgba(245, 158, 11, 0.14);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.18);
}
.stat-icon-purple {
  background: rgba(139, 92, 246, 0.14);
  color: #A78BFA;
  border: 1px solid rgba(139, 92, 246, 0.28);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.18);
}
.stat-icon-cyan {
  background: rgba(6, 182, 212, 0.14);
  color: #38BDF8;
  border: 1px solid rgba(6, 182, 212, 0.28);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.18);
}

/* Global eradication of generic colored left borders on portal cards */
.portal-card {
  border-left: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.08)) !important;
}

/* Client Dashboard Split Columns */
.client-dashboard-grid, .portal-dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.75rem;
  align-items: start;
  width: 100%;
}
@media (max-width: 1024px) {
  .client-dashboard-grid, .portal-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Swipeable Filter Tabs with Hidden Scrollbars */
.portal-filter-tabs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
  margin-bottom: 1.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.portal-filter-tabs::-webkit-scrollbar {
  display: none;
}
.portal-filter-tab {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary) !important;
  text-decoration: none !important;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-surface-elevated);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
}
.portal-filter-tab:hover {
  color: #FFFFFF !important;
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.12);
}
.portal-filter-tab.active {
  color: #FFFFFF !important;
  background: var(--color-brand-primary) !important;
  border-color: var(--color-brand-primary) !important;
  font-weight: 600;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.35);
}

/* Responsive Client Form & Action Grids */
.profile-form-grid, .payment-grid-2, .request-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  width: 100%;
}
@media (max-width: 768px) {
  .profile-form-grid, .payment-grid-2, .request-grid-2 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.budget-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}
@media (max-width: 768px) {
  .budget-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Invoices & Receipts Responsive Sheets */
.invoice-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
}
@media (max-width: 800px) {
  .invoice-summary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.invoice-wrapper, .receipt-wrapper {
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.invoice-sheet, .receipt-sheet {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-sizing: border-box;
  box-shadow: var(--shadow-lg);
  color: var(--color-text-primary);
}
@media (max-width: 640px) {
  .invoice-sheet, .receipt-sheet {
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg);
  }
}

.invoice-header-row, .receipt-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.invoice-details-grid, .receipt-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
@media (max-width: 600px) {
  .invoice-details-grid, .receipt-details-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.invoice-totals-box {
  max-width: 380px;
  margin-left: auto;
  width: 100%;
  margin-top: 1.5rem;
}
@media (max-width: 600px) {
  .invoice-totals-box {
    max-width: 100%;
  }
}

/* Client Auth Views (Modern Dark Aesthetics) */
.portal-login-box {
  width: 100%;
  max-width: 440px;
  background: var(--color-bg-surface, #0D1527) !important;
  border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.08)) !important;
  border-radius: var(--radius-xl, 18px) !important;
  padding: 2.5rem 2rem !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px -5px rgba(37, 99, 235, 0.18) !important;
  box-sizing: border-box !important;
}
@media (max-width: 480px) {
  .portal-login-box {
    padding: 2rem 1.25rem !important;
    border-radius: 14px !important;
  }
}

.portal-login-brand h1 {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  color: #FFFFFF !important;
  margin: 0.5rem 0 0.25rem 0 !important;
}
.portal-login-brand p {
  font-size: 0.88rem !important;
  color: var(--color-text-secondary, #94A3B8) !important;
  margin: 0 !important;
}

.btn-portal-primary {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--color-brand-primary, #2563EB) !important;
  color: #FFFFFF !important;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md, 8px) !important;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 0 20px -3px rgba(37, 99, 235, 0.45) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  box-sizing: border-box;
}
.btn-portal-primary:hover {
  background: var(--color-brand-primary-hover, #1D4ED8) !important;
  transform: translateY(-1px);
  box-shadow: 0 0 25px -2px rgba(37, 99, 235, 0.65) !important;
}

/* ==========================================================================
   17. CLIENT PORTAL THEME OVERRIDES (HIGH-SPECIFICITY NORMALIZATION)
   ========================================================================== */
.portal-container [style*="color: #0C1929"],
.portal-content [style*="color: #0C1929"],
.portal-card [style*="color: #0C1929"],
.portal-container [style*="color:#0C1929"],
.portal-card [style*="color:#0C1929"] {
  color: #F8FAFC !important;
}

.portal-container [style*="color: #5E6D7E"],
.portal-content [style*="color: #5E6D7E"],
.portal-card [style*="color: #5E6D7E"],
.portal-container [style*="color: #8896A6"],
.portal-content [style*="color: #8896A6"],
.portal-card [style*="color: #8896A6"] {
  color: #94A3B8 !important;
}

.portal-container [style*="background: #F8FAFC"],
.portal-content [style*="background: #F8FAFC"],
.portal-card [style*="background: #F8FAFC"],
.portal-container [style*="background:#F8FAFC"],
.portal-card [style*="background:#F8FAFC"] {
  background: #131D31 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #F8FAFC !important;
}

.portal-container [style*="border: 1px solid #E1ECE8"],
.portal-content [style*="border: 1px solid #E1ECE8"],
.portal-card [style*="border: 1px solid #E1ECE8"],
.portal-container [style*="border-bottom: 1px solid #E1ECE8"],
.portal-card [style*="border-bottom: 1px solid #E1ECE8"] {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.portal-container [style*="background: #E1ECE8"],
.portal-card [style*="background: #E1ECE8"] {
  background: rgba(255, 255, 255, 0.12) !important;
}

.portal-container table thead tr,
.portal-card table thead tr,
.portal-container [style*="background: #F8FAFC"][style*="border-bottom"],
.portal-card [style*="background: #F8FAFC"][style*="border-bottom"] {
  background: #131D31 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.portal-container table th,
.portal-card table th {
  color: #FFFFFF !important;
  font-weight: 700 !important;
}

/* ==========================================================================
   18. GLOBAL MOBILE VISITOR & CLIENT AREA VIEWPORT REFINEMENTS
   ========================================================================== */
@media (max-width: 640px) {
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .section {
    padding: 3rem 0 !important;
  }
  .section-hero {
    padding: 3.5rem 0 2.25rem !important;
  }
  .card, .portal-card {
    padding: 1.25rem 1rem !important;
    border-radius: var(--radius-lg) !important;
  }
  [style*="padding: 2.5rem"], [style*="padding: 2rem"] {
    padding: 1.25rem 1rem !important;
  }
  .portal-page-header {
    margin-bottom: 1.5rem !important;
    padding-bottom: 1rem !important;
  }
  .portal-page-title {
    font-size: 1.35rem !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
  }
  h1 { font-size: clamp(1.8rem, 6.5vw, 2.2rem) !important; }
  h2 { font-size: clamp(1.4rem, 5vw, 1.7rem) !important; }
  h3 { font-size: clamp(1.15rem, 4vw, 1.3rem) !important; }

  /* Mobile Form Controls: Prevent iOS Safari Auto-Zoom */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Telemetry in Hero */
  .section-hero [style*="justify-content: space-around"] {
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    justify-content: center !important;
  }
  .section-hero [style*="border-left"] {
    display: none !important;
  }

  /* Site Header & Mobile Drawer */
  .site-header {
    height: 64px !important;
  }
  .brand-logo {
    font-size: 1.15rem !important;
  }
  .mobile-nav {
    top: 64px !important;
    max-height: calc(100vh - 64px) !important;
    padding: 1.25rem 1rem !important;
  }

  /* Admin & Client Portal Responsive Topbars */
  .portal-topbar, .admin-topbar {
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    padding: 0 0.85rem !important;
    gap: 0.5rem !important;
    overflow: hidden !important;
  }
  .portal-topbar-left, .admin-topbar-left {
    gap: 0.5rem !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }
  .portal-brand, .admin-topbar-breadcrumb {
    min-width: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }
  .portal-brand-title {
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .portal-brand-badge,
  .topbar-live-site-btn,
  .topbar-user-name,
  .admin-topbar-breadcrumb > a,
  .admin-topbar-breadcrumb > span:nth-child(2) {
    display: none !important;
  }
  .admin-topbar-breadcrumb > span:last-child {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.92rem !important;
    max-width: 160px !important;
    display: inline-block !important;
  }
  .portal-topbar-right, .admin-topbar-right {
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }
}

/* ── Admin & Client Portal Modern Stat Cards ── */
.client-stats-grid,
.admin-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
}
.admin-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
}
.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
}
@media (max-width: 1200px) {
  .client-stats-grid,
  .admin-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }
}
@media (max-width: 900px) {
  .admin-grid-3,
  .admin-grid-2,
  .admin-detail-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
}
@media (max-width: 580px) {
  .client-stats-grid,
  .admin-grid-4 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

.sparkle-stat-card,
.admin-grid-4 > .card,
.admin-grid-3 > .card,
.admin-grid-2 > .card {
  background: linear-gradient(180deg, rgba(19, 29, 49, 0.75) 0%, rgba(13, 21, 39, 0.95) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  padding: 1.25rem 1.35rem !important;
  margin-bottom: 0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4) !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease !important;
}
.sparkle-stat-card::before,
.admin-grid-4 > .card::before,
.admin-grid-3 > .card::before,
.admin-grid-2 > .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.5), rgba(37, 99, 235, 0.7), transparent);
  opacity: 0.6;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sparkle-stat-card:hover,
.admin-grid-4 > .card:hover,
.admin-grid-3 > .card:hover,
.admin-grid-2 > .card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(37, 99, 235, 0.15) !important;
}
.sparkle-stat-card:hover::before,
.admin-grid-4 > .card:hover::before,
.admin-grid-3 > .card:hover::before,
.admin-grid-2 > .card:hover::before {
  opacity: 1;
}
.stat-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8;
  margin-bottom: 0.35rem;
}
.stat-card-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #FFFFFF !important;
  line-height: 1.15;
  margin-top: 0.2rem;
}
.stat-card-sub {
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.sparkle-stat-card:hover .stat-card-icon,
.admin-grid-4 > .card:hover .stat-card-icon,
.admin-grid-3 > .card:hover .stat-card-icon {
  transform: scale(1.08);
}
.stat-icon-blue {
  background: rgba(37, 99, 235, 0.14);
  color: #60A5FA;
  border: 1px solid rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.18);
}
.stat-icon-emerald {
  background: rgba(16, 185, 129, 0.14);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.28);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.18);
}
.stat-icon-amber {
  background: rgba(245, 158, 11, 0.14);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.18);
}
.stat-icon-purple {
  background: rgba(139, 92, 246, 0.14);
  color: #A78BFA;
  border: 1px solid rgba(139, 92, 246, 0.28);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.18);
}
.stat-icon-cyan {
  background: rgba(6, 182, 212, 0.14);
  color: #38BDF8;
  border: 1px solid rgba(6, 182, 212, 0.28);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.18);
}

/* ── UPGRADE PHASE 2: Global Admin Responsiveness (1024px, 768px, 414px, 375px, 320px) ── */
.admin-main,
.admin-content,
.admin-content > *,
.admin-content .card {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}
@media (max-width: 1080px) {
  .admin-content [style*="grid-template-columns: 2fr 1fr"],
  .admin-content [style*="grid-template-columns: 1fr 2fr"],
  .admin-content [style*="grid-template-columns: 1fr 1.18fr"],
  .admin-content [style*="grid-template-columns: 460px 1fr"],
  .admin-content [style*="grid-template-columns: 340px"],
  .admin-content [style*="grid-template-columns: 320px"],
  .admin-content [style*="grid-template-columns: 1fr 320px"],
  .admin-content [style*="minmax(0, 1fr) 340px"],
  .settings-main-grid,
  .cp-detail-grid,
  .editor-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 1.25rem !important;
  }
}
@media (max-width: 768px) {
  .admin-content [style*="grid-template-columns"],
  .admin-content .grid-cols-2,
  .admin-content .grid-cols-3,
  .admin-content .grid-cols-4,
  .admin-content .form-grid,
  .admin-grid-2,
  .admin-grid-3 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.9rem !important;
  }
  .admin-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.85rem !important;
  }
}
@media (max-width: 640px) {
  .admin-grid-4 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.75rem !important;
  }
}