/* ==========================================================================
   JEWELLERYFLOW LUXURY DESIGN SYSTEM
   Bespoke Design Architecture for Fine Jewellery Manufacturers & Ateliers
   ========================================================================== */

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

:root {
  /* Default Luxury Palette: Midnight Cobalt (Default) */
  --theme-name: 'midnight';
  --bg-main: #070b14;
  --bg-surface: #0d1322;
  --bg-surface-elevated: #131b2e;
  --bg-surface-translucent: rgba(13, 19, 34, 0.88);
  --bg-card: #101728;
  --bg-card-hover: #172138;
  --bg-input: #090e1a;
  --bg-secondary: #101728;
  --bg-tertiary: #131b2e;
  
  --gold-primary: #3b82f6;
  --gold-light: #93c5fd;
  --gold-dark: #1d4ed8;
  --gold-gradient: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #06b6d4 100%);
  --gold-gradient-soft: linear-gradient(135deg, rgba(59, 130, 246, 0.14) 0%, rgba(6, 182, 212, 0.06) 100%);
  --gold-glow: 0 0 25px rgba(59, 130, 246, 0.3);
  
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --danger: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #06b6d4;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-gold: #93c5fd;
  
  --border-subtle: rgba(59, 130, 246, 0.16);
  --border-medium: rgba(59, 130, 246, 0.32);
  --border-gold: rgba(59, 130, 246, 0.55);
  --border-dark: rgba(255, 255, 255, 0.08);

  --font-serif: 'Cinzel', serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
  --shadow-gold: 0 8px 28px rgba(59, 130, 246, 0.22);

  --topbar-height: 68px;
  --sidebar-width: 265px;
}

/* ==========================================================================
   THE COMPLETE 10-THEME PALETTE SUITE
   ========================================================================== */

/* 1. Midnight Cobalt (Default) */
body.theme-midnight, html.theme-midnight body,
body.theme-imperial, html.theme-imperial body {
  --bg-main: #070b14;
  --bg-surface: #0d1322;
  --bg-surface-elevated: #131b2e;
  --bg-surface-translucent: rgba(13, 19, 34, 0.88);
  --bg-card: #101728;
  --bg-card-hover: #172138;
  --bg-input: #090e1a;
  --bg-secondary: #101728;
  --bg-tertiary: #131b2e;
  --gold-primary: #3b82f6;
  --gold-light: #93c5fd;
  --gold-dark: #1d4ed8;
  --gold-gradient: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #06b6d4 100%);
  --gold-glow: 0 0 25px rgba(59, 130, 246, 0.3);
  --border-subtle: rgba(59, 130, 246, 0.16);
  --border-medium: rgba(59, 130, 246, 0.32);
  --border-gold: rgba(59, 130, 246, 0.55);
  --text-gold: #93c5fd;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
}

/* 2. Cyber Emerald */
body.theme-cyber, html.theme-cyber body,
body.theme-emerald, html.theme-emerald body {
  --bg-main: #06120c;
  --bg-surface: #0a1d13;
  --bg-surface-elevated: #0f2b1d;
  --bg-surface-translucent: rgba(10, 29, 19, 0.88);
  --bg-card: #0d2418;
  --bg-card-hover: #143524;
  --bg-input: #08160f;
  --bg-secondary: #0d2418;
  --bg-tertiary: #0f2b1d;
  --gold-primary: #10b981;
  --gold-light: #6ee7b7;
  --gold-dark: #047857;
  --gold-gradient: linear-gradient(135deg, #34d399 0%, #10b981 55%, #059669 100%);
  --gold-glow: 0 0 25px rgba(16, 185, 129, 0.3);
  --border-subtle: rgba(16, 185, 129, 0.18);
  --border-medium: rgba(16, 185, 129, 0.35);
  --border-gold: rgba(16, 185, 129, 0.55);
  --text-gold: #6ee7b7;
  --text-primary: #f0fdf4;
  --text-secondary: #bbf7d0;
  --text-muted: #86efac;
}

/* 3. Royal Amethyst */
body.theme-amethyst, html.theme-amethyst body {
  --bg-main: #0d0718;
  --bg-surface: #150d26;
  --bg-surface-elevated: #20133a;
  --bg-surface-translucent: rgba(21, 13, 38, 0.88);
  --bg-card: #1a1030;
  --bg-card-hover: #281848;
  --bg-input: #110920;
  --bg-secondary: #1a1030;
  --bg-tertiary: #20133a;
  --gold-primary: #a855f7;
  --gold-light: #d8b4fe;
  --gold-dark: #7e22ce;
  --gold-gradient: linear-gradient(135deg, #c084fc 0%, #a855f7 50%, #7e22ce 100%);
  --gold-glow: 0 0 25px rgba(168, 85, 247, 0.3);
  --border-subtle: rgba(168, 85, 247, 0.18);
  --border-medium: rgba(168, 85, 247, 0.35);
  --border-gold: rgba(168, 85, 247, 0.55);
  --text-gold: #d8b4fe;
  --text-primary: #faf5ff;
  --text-secondary: #e9d5ff;
  --text-muted: #c084fc;
}

/* 4. Sunset Amber */
body.theme-amber, html.theme-amber body,
body.theme-bronze, html.theme-bronze body {
  --bg-main: #0e0b08;
  --bg-surface: #17130e;
  --bg-surface-elevated: #231c15;
  --bg-surface-translucent: rgba(23, 19, 14, 0.88);
  --bg-card: #1d1712;
  --bg-card-hover: #2c231b;
  --bg-input: #120e0a;
  --bg-secondary: #1d1712;
  --bg-tertiary: #231c15;
  --gold-primary: #f59e0b;
  --gold-light: #fde68a;
  --gold-dark: #b45309;
  --gold-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%);
  --gold-glow: 0 0 25px rgba(245, 158, 11, 0.3);
  --border-subtle: rgba(245, 158, 11, 0.18);
  --border-medium: rgba(245, 158, 11, 0.35);
  --border-gold: rgba(245, 158, 11, 0.55);
  --text-gold: #fde68a;
  --text-primary: #fffbeb;
  --text-secondary: #fef3c7;
  --text-muted: #fcd34d;
}

/* 5. Crimson Ruby */
body.theme-ruby, html.theme-ruby body,
body.theme-rosegold, html.theme-rosegold body {
  --bg-main: #140508;
  --bg-surface: #1f0a0e;
  --bg-surface-elevated: #2c0e14;
  --bg-surface-translucent: rgba(31, 10, 14, 0.88);
  --bg-card: #250b11;
  --bg-card-hover: #381119;
  --bg-input: #18060a;
  --bg-secondary: #250b11;
  --bg-tertiary: #2c0e14;
  --gold-primary: #e11d48;
  --gold-light: #fda4af;
  --gold-dark: #9f1239;
  --gold-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 50%, #be123c 100%);
  --gold-glow: 0 0 25px rgba(225, 29, 72, 0.3);
  --border-subtle: rgba(225, 29, 72, 0.18);
  --border-medium: rgba(225, 29, 72, 0.35);
  --border-gold: rgba(225, 29, 72, 0.55);
  --text-gold: #fda4af;
  --text-primary: #fff1f2;
  --text-secondary: #ffe4e6;
  --text-muted: #f43f5e;
}

/* 6. Nordic Cyan */
body.theme-nordic, html.theme-nordic body,
body.theme-sapphire, html.theme-sapphire body {
  --bg-main: #040d14;
  --bg-surface: #071520;
  --bg-surface-elevated: #0b1e2e;
  --bg-surface-translucent: rgba(7, 21, 32, 0.88);
  --bg-card: #091927;
  --bg-card-hover: #0f263b;
  --bg-input: #051019;
  --bg-secondary: #091927;
  --bg-tertiary: #0b1e2e;
  --gold-primary: #06b6d4;
  --gold-light: #a5f3fc;
  --gold-dark: #0e7490;
  --gold-gradient: linear-gradient(135deg, #22d3ee 0%, #06b6d4 50%, #0891b2 100%);
  --gold-glow: 0 0 25px rgba(6, 182, 212, 0.3);
  --border-subtle: rgba(6, 182, 212, 0.18);
  --border-medium: rgba(6, 182, 212, 0.35);
  --border-gold: rgba(6, 182, 212, 0.55);
  --text-gold: #a5f3fc;
  --text-primary: #ecfeff;
  --text-secondary: #cffafe;
  --text-muted: #67e8f9;
}

/* 7. Galaxy Indigo */
body.theme-indigo, html.theme-indigo body {
  --bg-main: #080915;
  --bg-surface: #0d1024;
  --bg-surface-elevated: #141836;
  --bg-surface-translucent: rgba(13, 16, 36, 0.88);
  --bg-card: #11142e;
  --bg-card-hover: #1a2046;
  --bg-input: #0a0b1c;
  --bg-secondary: #11142e;
  --bg-tertiary: #141836;
  --gold-primary: #6366f1;
  --gold-light: #c7d2fe;
  --gold-dark: #4338ca;
  --gold-gradient: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
  --gold-glow: 0 0 25px rgba(99, 102, 241, 0.3);
  --border-subtle: rgba(99, 102, 241, 0.18);
  --border-medium: rgba(99, 102, 241, 0.35);
  --border-gold: rgba(99, 102, 241, 0.55);
  --text-gold: #c7d2fe;
  --text-primary: #eef2ff;
  --text-secondary: #e0e7ff;
  --text-muted: #a5b4fc;
}

/* 8. Stealth Carbon */
body.theme-carbon, html.theme-carbon body {
  --bg-main: #0b0c0e;
  --bg-surface: #121417;
  --bg-surface-elevated: #1a1d22;
  --bg-surface-translucent: rgba(18, 20, 23, 0.88);
  --bg-card: #16181d;
  --bg-card-hover: #21252b;
  --bg-input: #0e1012;
  --bg-secondary: #16181d;
  --bg-tertiary: #1a1d22;
  --gold-primary: #94a3b8;
  --gold-light: #f1f5f9;
  --gold-dark: #475569;
  --gold-gradient: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 50%, #64748b 100%);
  --gold-glow: 0 0 25px rgba(148, 163, 184, 0.25);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-medium: rgba(148, 163, 184, 0.3);
  --border-gold: rgba(148, 163, 184, 0.5);
  --text-gold: #e2e8f0;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
}

/* 9. Titanium Daylight (Light Edition) */
body.theme-titanium, html.theme-titanium body,
body.theme-pearl, html.theme-pearl body {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #e2e8f0;
  --bg-surface-translucent: rgba(255, 255, 255, 0.94);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-gold: #2563eb;
  --gold-primary: #2563eb;
  --gold-light: #1d4ed8;
  --gold-dark: #1e40af;
  --gold-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%);
  --border-subtle: rgba(37, 99, 235, 0.14);
  --border-medium: rgba(37, 99, 235, 0.28);
  --border-gold: rgba(37, 99, 235, 0.5);
  --border-dark: rgba(0, 0, 0, 0.08);
}

/* 10. Solar Ivory (Light Edition) */
body.theme-ivory, html.theme-ivory body,
body.theme-champagne, html.theme-champagne body {
  --bg-main: #fdfbf7;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f5eee1;
  --bg-surface-translucent: rgba(255, 255, 255, 0.94);
  --bg-card: #ffffff;
  --bg-card-hover: #faf6ef;
  --bg-input: #faf7f2;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5eee1;
  --text-primary: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #78716c;
  --text-gold: #b45309;
  --gold-primary: #d97706;
  --gold-light: #b45309;
  --gold-dark: #92400e;
  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 60%, #b45309 100%);
  --border-subtle: rgba(217, 119, 6, 0.16);
  --border-medium: rgba(217, 119, 6, 0.3);
  --border-gold: rgba(217, 119, 6, 0.52);
  --border-dark: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   RESET & SMOOTH TRANSITIONS
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 13.5px;
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  background-image: 
    radial-gradient(circle at 10% 0%, rgba(212, 175, 55, 0.035) 0%, transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(121, 40, 202, 0.035) 0%, transparent 40%);
  background-attachment: fixed;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* ==========================================================================
   LAYOUT STRUCTURE & BALANCED DASHBOARD WIDTH
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.25s ease;
}

.brand-wrapper {
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.06) 0%, transparent 100%);
}

.brand-emblem {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gold-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--gold-glow);
  color: #0c0a10;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.sidebar nav {
  padding: 12px 10px 20px;
  flex: 1;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-primary);
  padding: 14px 10px 4px;
  opacity: 0.88;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar nav a .nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.sidebar nav a:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  transform: translateX(3px);
}

.sidebar nav a:hover .nav-icon {
  color: var(--gold-primary);
}

.sidebar nav a.active {
  background: var(--gold-gradient-soft);
  color: var(--gold-light);
  font-weight: 600;
  border-left: 3px solid var(--gold-primary);
}

.sidebar nav a.active .nav-icon {
  color: var(--gold-primary);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.user-profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gold-gradient);
  color: #0c0a10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--text-primary);
}

.user-role {
  font-size: 10.5px;
  color: var(--gold-primary);
  font-weight: 500;
}

/* --- MAIN CONTAINER & BALANCED CONTENT WIDTH --- */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Fixed container max-width to prevent dashboard stretching on wide screens */
.content {
  padding: 24px 28px 48px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ==========================================================================
   SWITCHABLE HEADER STYLES
   ========================================================================= */

.topbar {
  height: var(--topbar-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- HEADER STYLE 1: Atelier Imperial Gold (Default) --- */
.header-style-imperial {
  background: rgba(15, 12, 20, 0.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.header-style-imperial::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold-gradient);
  opacity: 0.5;
}

/* --- HEADER STYLE 2: Modern Crystal Glassmorphism --- */
.header-style-glass {
  background: rgba(24, 20, 34, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: 10px 20px 0;
  border-radius: var(--radius-lg);
  height: 60px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* --- HEADER STYLE 3: Royal Sovereign Velvet --- */
.header-style-velvet {
  background: linear-gradient(90deg, #180c26 0%, #2a103e 50%, #150822 100%);
  border-bottom: 2px solid var(--gold-primary);
  box-shadow: 0 6px 24px rgba(42, 16, 62, 0.5);
}

/* --- HEADER STYLE 4: Emerald Gemological Studio --- */
.header-style-emerald {
  background: linear-gradient(90deg, #071912 0%, #0c2b1e 50%, #05140e 100%);
  border-bottom: 2px solid #10b981;
  box-shadow: 0 6px 24px rgba(6, 40, 26, 0.45);
}

/* --- HEADER STYLE 5: Compact Factory Workshop --- */
.header-style-compact {
  height: 52px;
  background: #120f18;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 18px;
}

/* Header Elements */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-badge-title {
  display: flex;
  flex-direction: column;
}

.page-main-heading {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-company-tag {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-company-tag .dot-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.rate-ticker-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-sm);
}

.rate-ticker-pill .rate-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rate-ticker-pill .rate-item .metal-lbl {
  color: var(--text-muted);
  font-weight: 600;
}

.rate-ticker-pill .rate-item .metal-val {
  color: var(--gold-light);
  font-weight: 700;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.style-switch-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: var(--radius-md);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.style-switch-btn:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: var(--bg-card-hover);
}

.dropdown-menu-wrap {
  position: relative;
  display: inline-block;
}

.dropdown-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 230px;
  z-index: 50;
  padding: 6px;
  display: none;
  backdrop-filter: blur(16px);
}

.dropdown-popover.show {
  display: block;
  animation: fadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2-Column Executive Theme Dropdown */
.dropdown-popover-2col {
  width: 520px;
  max-width: 92vw;
  padding: 12px;
  border: 1px solid var(--border-gold);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg), var(--gold-glow);
}

.theme-dropdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .dropdown-popover-2col {
    width: 320px;
  }
  .theme-dropdown-grid {
    grid-template-columns: 1fr;
  }
}

.theme-col-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-gold);
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.theme-option-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.theme-option-card.active {
  background: var(--gold-gradient-soft);
  border-color: var(--gold-primary);
  box-shadow: 0 0 12px var(--gold-glow);
}

.theme-option-card.active .theme-title {
  color: var(--text-gold);
  font-weight: 700;
}

/* Multi-Stop Color Swatches */
.theme-swatch {
  width: 28px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.theme-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.theme-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-desc {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: var(--gold-gradient-soft);
  color: var(--gold-light);
}

.dropdown-item.active {
  color: var(--gold-primary);
  font-weight: 700;
  background: rgba(59, 130, 246, 0.12);
}

/* ==========================================================================
   CARDS & GRIDS (Compact, Balanced Proportion)
   ========================================================================== */

.grid {
  display: grid;
  gap: 16px;
}
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.card-gold-glow {
  border-color: var(--border-gold);
  box-shadow: var(--shadow-gold);
}

.card-gold-glow::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--gold-gradient);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title .icon {
  color: var(--gold-primary);
}

/* Metric Display Cards */
.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
}

.kpi-card .kpi-icon-watermark {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 32px;
  opacity: 0.12;
}

.kpi-card .kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-card .kpi-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
}

.kpi-card .kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-gold { color: var(--gold-light) !important; }
.metric-ok { color: var(--accent-emerald) !important; }
.metric-bad { color: var(--accent-rose) !important; }
.metric-purple { color: #c084fc !important; }
.metric-blue { color: #60a5fa !important; }

/* ==========================================================================
   TABLES & LISTS
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 13px;
}

.table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: middle;
  transition: background 0.15s ease;
}

.table tr:hover td {
  background: rgba(212, 175, 55, 0.03);
  color: var(--text-primary);
}

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

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--gold-gradient);
  color: #0c0a10;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.22);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
}

.actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
  background: var(--bg-surface);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ==========================================================================
   BADGES & STATUS PILLS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.badge-gold {
  background: rgba(212, 175, 55, 0.14);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.badge-ok, .badge-success {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.badge-bad, .badge-danger {
  background: rgba(244, 63, 94, 0.14);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.28);
}

.badge-warn, .badge-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.badge-purple {
  background: rgba(121, 40, 202, 0.18);
  color: #d8b4fe;
  border: 1px solid rgba(121, 40, 202, 0.35);
}

/* ==========================================================================
   ALERTS & NOTIFICATIONS
   ========================================================================== */

.alert {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}

.alert.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
}

.alert.error {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.28);
  color: #fda4af;
}

/* ==========================================================================
   PIPELINE STEPPER
   ========================================================================== */

.workflow-pipeline {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: 8px 4px;
  gap: 6px;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pipeline-step.active {
  border-color: var(--gold-primary);
  background: var(--gold-gradient-soft);
  color: var(--gold-light);
  font-weight: 700;
}

.pipeline-arrow {
  color: var(--text-muted);
  font-size: 10px;
}

/* ==========================================================================
   PRINT MEDIA STYLES
   ========================================================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar, .topbar, .actions, .btn, .style-switch-btn {
    display: none !important;
  }
  .main {
    margin-left: 0 !important;
  }
  .content {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  .table th {
    background: #f0f0f0 !important;
    color: #000 !important;
  }
  .table td {
    color: #000 !important;
  }
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* ==========================================================================
   MODAL DIALOG SYSTEM (HTML5 <dialog>)
   ========================================================================== */

dialog, .modal-dialog {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-medium) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), var(--shadow-gold) !important;
  padding: 24px !important;
  max-width: 620px;
  width: min(94vw, 620px);
  max-height: 90vh;
  overflow-y: auto;
  margin: auto !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  outline: none;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 9998 !important;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Form controls & labels */
.form-label {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--text-muted) !important;
  margin-bottom: 12px !important;
  width: 100% !important;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-primary) !important;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18) !important;
  background: var(--bg-surface) !important;
}

select option {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* Table Cards */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.table-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-card .table-wrap {
  border: none;
  border-radius: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-card table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 13px;
}

.table-card table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table-card table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: middle;
}

.table-card table tr:hover td {
  background: rgba(212, 175, 55, 0.03);
  color: var(--text-primary);
}

/* Admin Tabs (Horizontal Scroll on Mobile) */
.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  margin-bottom: 20px;
}

.admin-tabs::-webkit-scrollbar {
  height: 4px;
}
.admin-tabs::-webkit-scrollbar-track {
  background: transparent;
}
.admin-tabs::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
  display: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE PWA
   ========================================================================== */

.mobile-menu-btn {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--gold-light);
  padding: 6px 12px;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar {
    transform: translateX(0);
  }
  body.nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 0 14px;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .page-badge-title h1 {
    font-size: 16px !important;
  }
  .page-company-tag {
    font-size: 11px !important;
  }
  .content {
    padding: 12px;
  }
  .grid-4, .grid-3, .grid-2, .form-grid, .form-grid-4, .form-grid-2, .grid-1-2, .grid-2-1 {
    grid-template-columns: 1fr !important;
  }
  .rate-ticker-pill {
    display: none;
  }
  dialog, .modal-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 16px 14px !important;
    margin: 10px auto !important;
  }
  dialog .form-grid,
  .modal-dialog .form-grid {
    grid-template-columns: 1fr !important;
  }
  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .table-header .actions,
  .table-header button,
  .table-header a {
    width: 100%;
    justify-content: center;
  }
}

