:root {
  /* ========== BASE COLOR PALETTE ========== */
  --brand-ink-900: #10151f;
  --brand-ink-850: #141a28;
  --brand-ink-700: #1b2232;
  --brand-ink-600: #242c3f;
  --brand-ink-400: #2e384f;
  --brand-sand-50: #fdf9ea;
  --brand-sand-100: #f7f1d6;
  --brand-sand-200: #e9dfb6;
  --brand-gold-400: #e8d284;
  --brand-gold-500: #f2dd85;
  --brand-amber-600: #cfa648;
  --brand-success: #32d296;
  --brand-warning: #f5a623;
  --brand-error: #ef5a5a;
  --brand-info: #3fa9f5;

  /* ========== EFFECTS & SPACING ========== */
  --brand-shadow-sm: 0 6px 20px rgba(8, 12, 20, 0.24);
  --brand-shadow-md: 0 16px 32px rgba(8, 12, 20, 0.35);
  --brand-radius-lg: 18px;

  /* ========== SEMANTIC COLOR DICTIONARY ========== */
  
  /* TEXT & FOREGROUND COLORS */
  --color-text-primary: var(--brand-sand-50);
  --color-text-secondary: rgba(245, 238, 212, 0.8);
  --color-text-tertiary: rgba(247, 241, 214, 0.65);
  --color-text-light: #fdf4c5;
  --color-text-lightest: #fff7d6;
  --color-text-white: #ffffff;
  --color-text-on-accent: #1e1606;
  --color-text-placeholder: rgba(247, 241, 214, 0.75);
  --color-text-muted: rgba(249, 245, 223, 0.85);
  --color-text-contrast: rgba(248, 249, 253, 0.95);
  
  /* BACKGROUND COLORS */
  --color-bg-primary: var(--brand-ink-900);
  --color-bg-secondary: rgba(20, 26, 40, 0.95);
  --color-bg-tertiary: rgba(16, 21, 31, 0.92);
  --color-bg-quaternary: rgba(12, 16, 25, 0.95);
  --color-bg-input: rgba(24, 30, 45, 0.94);
  --color-bg-input-enhanced: rgba(30, 36, 54, 0.95);
  --color-bg-input-focus: rgba(34, 42, 60, 0.98);
  --color-bg-input-focused-alt: rgba(36, 46, 68, 0.98);
  --color-bg-sidebar: rgba(18, 24, 36, 0.96);
  --color-bg-sidebar-end: rgba(12, 16, 25, 0.98);
  --color-bg-nav-item: rgba(232, 210, 132, 0.16);
  --color-bg-nav-item-hover: rgba(232, 210, 132, 0.18);
  --color-bg-nav-item-active: rgba(232, 210, 132, 0.22);
  --color-bg-dropdown-menu: var(--brand-ink-850);
  --color-bg-dropdown-item-hover: rgba(232, 210, 132, 0.22);
  --color-bg-button-ghost: transparent;
  --color-bg-button-ghost-hover: rgba(232, 210, 132, 0.16);
  --color-bg-hero: rgba(20, 26, 40, 0.9);
  --color-bg-hero-end: rgba(12, 16, 25, 0.95);
  --color-bg-toast: rgba(18, 24, 36, 0.96);
  --color-bg-alert: rgba(18, 24, 36, 0.9);
  --color-bg-modal: rgba(18, 24, 36, 0.98);
  --color-bg-range-track: rgba(232, 210, 132, 0.16);
  --color-bg-range-track-focus: rgba(232, 210, 132, 0.24);
  --color-bg-mainContent-gradient-start: rgba(12, 16, 25, 0.98);
  --color-bg-mainContent-gradient-end: rgba(16, 21, 31, 0.96);
  --color-bg-mainContent-radial: rgba(232, 210, 132, 0.06);
  
  /* BORDER COLORS */
  --color-border-default: rgba(232, 210, 132, 0.16);
  --color-border-light: rgba(232, 210, 132, 0.18);
  --color-border-medium: rgba(232, 210, 132, 0.26);
  --color-border-strong: rgba(232, 210, 132, 0.36);
  --color-border-focus: var(--brand-gold-400);
  --color-border-sidebar: rgba(232, 210, 132, 0.18);
  --color-border-nav-hover: rgba(232, 210, 132, 0.55);
  --color-border-nav-active: var(--brand-gold-500);
  --color-border-dropdown: rgba(232, 210, 132, 0.24);
  --color-border-input-enhanced: rgba(232, 210, 132, 0.36);
  --color-border-range: rgba(232, 210, 132, 0.25);
  --color-border-range-focus: var(--brand-gold-400);
  --color-border-hero: rgba(232, 210, 132, 0.22);
  --color-border-toast: rgba(232, 210, 132, 0.18);
  --color-border-modal: rgba(232, 210, 132, 0.24);
  --color-border-card-hover: rgba(232, 210, 132, 0.32);
  --color-border-icon-inset: rgba(8, 12, 20, 0.45);
  --color-border-icon-inset-strong: rgba(8, 12, 20, 0.6);
  
  /* ACCENT & INTERACTIVE COLORS */
  --color-accent-gold: var(--brand-gold-500);
  --color-accent-gold-secondary: var(--brand-gold-400);
  --color-accent-amber: var(--brand-amber-600);
  --color-accent-gold-dim: rgba(232, 210, 132, 0.78);
  --color-accent-gold-hover: var(--brand-gold-500);
  --color-accent-gold-shadow: rgba(232, 210, 132, 0.28);
  --color-accent-gold-ring: rgba(232, 210, 132, 0.2);
  --color-accent-gold-ring-strong: rgba(232, 210, 132, 0.25);
  --color-accent-gold-ring-strong-alt: rgba(232, 210, 132, 0.16);
  --color-accent-gold-overlay: rgba(232, 210, 132, 0.12);
  --color-accent-gold-gradient-start: var(--brand-gold-500);
  --color-accent-gold-gradient-end: var(--brand-amber-600);
  /* Form & select option background (semantic, use only color variables) */
  --color-form-option-bg: var(--brand-sand-100);
  
  /* ICON COLORS */
  --color-icon-default: rgba(232, 210, 132, 0.78);
  --color-icon-active: var(--brand-gold-500);
  --color-icon-gold: rgba(232, 210, 132, 0.88);
  --color-icon-light: rgba(245, 240, 183, 0.92);
  --color-icon-dark: #2f2609;
  
  /* SHADOW & OVERLAY COLORS */
  --color-overlay-dark: rgba(6, 8, 15, 0.55);
  --color-overlay-darker: rgba(6, 9, 15, 0.42);
  --color-overlay-sidebar: rgba(8, 9, 16, 0.55);
  --color-overlay-toast-gradient: rgba(232, 210, 132, 0.12);
  --color-shadow-thumb: rgba(8, 9, 16, 0.45);
  --color-shadow-thumb-hover: rgba(8, 9, 16, 0.5);
  --color-shadow-thumb-border: rgba(8, 10, 17, 0.85);
  --color-overlay-hero-gradient: rgba(232, 210, 132, 0.22);
  --color-nav-highlight-inset: rgba(232, 210, 132, 0.18);
  /* Toggler contrast background when placed on dark/transparent header */
  --color-toggler-contrast-bg: rgba(255, 255, 255, 0.04);
  --color-toggler-contrast-border: rgba(255, 255, 255, 0.06);
  
  /* STATUS & SEMANTIC COLORS */
  --color-status-success: var(--brand-success);
  --color-status-warning: var(--brand-warning);
  --color-status-error: var(--brand-error);
  --color-status-info: var(--brand-info);
  
  /* ERROR & ALERT COLORS */
  --color-error-light: #fca5a5;
  --color-error-bg-light: rgba(220, 38, 38, 0.1);
  --color-error-border: rgba(220, 38, 38, 0.3);
  
  /* GRADIENT ACCENTS */
  --color-accent-amber-gradient: #d4b870;
}

body {
  font-family: "Space Mono", "Courier New", monospace;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

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

a:hover {
  color: var(--color-accent-gold);
}

#mainContent {
  min-height: 100vh;
  transition: margin-left 0.3s ease;
  background: radial-gradient(circle at top left, var(--color-bg-mainContent-radial), transparent 55%),
    linear-gradient(180deg, var(--color-bg-mainContent-gradient-start), var(--color-bg-mainContent-gradient-end));
}

.app-shell.sidebar-expanded #mainContent {
  margin-left: 16rem;
}

.app-shell.sidebar-collapsed #mainContent {
  margin-left: 3.5rem;
}

.sidebar-shell {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  padding: 0.75rem 0.6rem 1.1rem;
  background: linear-gradient(180deg, var(--color-bg-sidebar) 0%, var(--color-bg-sidebar-end) 100%);
  border-right: 1px solid var(--color-border-sidebar);
  box-shadow: 20px 0 45px -32px var(--color-overlay-sidebar);
  overflow: hidden;
  z-index: 1100;
  transition: width 0.3s ease;
}

.sidebar-shell::-webkit-scrollbar {
  width: 0.45rem;
}

.sidebar-shell::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-shell::-webkit-scrollbar-thumb {
  background: var(--color-accent-gold-dim);
  border-radius: 999px;
}

.sidebar-shell__content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  gap: 0.75rem;
}

/* Enmind: reclaim vertical space for the Sessions panel */
.app-shell--enmind .sidebar-shell__content {
  gap: 0.55rem;
}

.app-shell--enmind .sidebar-meter {
  padding-bottom: 0.4rem !important;
}

.app-shell--enmind .sidebar-shell__fixed {
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.app-shell--enmind .sidebar-shell__footer {
  padding-bottom: 0.9rem !important;
}

.sidebar-shell__primary {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-shell__secondary {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.sidebar-shell__secondary:empty {
  display: none;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-shell__secondary,
.app-shell.sidebar-collapsed .sidebar-shell__secondary {
  display: none;
}

.sidebar-shell__fixed {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.sidebar-shell__footer {
  flex: 0 0 auto;
}

.sidebar-shell.sidebar-shell--expanded,
.app-shell.sidebar-expanded .sidebar-shell {
  width: 16rem;
  min-width: 16rem;
  max-width: 16rem;
}

.sidebar-shell.sidebar-shell--collapsed,
.app-shell.sidebar-collapsed .sidebar-shell {
  width: 4rem;
  min-width: 4rem;
  max-width: 4rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  padding-top: 1.6rem;
  overflow: visible;
}

.sidebar-shell .dropdown-menu {
  z-index: 3000;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-link {
  position: relative;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-link .sidebar-text {
  position: absolute;
  left: 3.1rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-bg-dropdown-menu);
  color: var(--color-text-primary);
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-dropdown);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  z-index: 3500;
  font-size: 0.85rem;
  align-items: center;
  gap: 0.35rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-link:hover .sidebar-text,
.sidebar-shell.sidebar-shell--collapsed .sidebar-link:focus-visible .sidebar-text {
  opacity: 1;
  visibility: visible;
}


.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0.95rem 0.75rem;
  border-bottom: 1px solid var(--color-border-sidebar);
}

/* Removed sidebar-atrium icon; logo stands alone */

.sidebar-atrium {
  display: none;
}

.sidebar-edge-toggle {
  position: absolute;
  /* Sit inside the header band beside the logo */
  top: 0.85rem;
  right: -10px;
  transform: translateY(0);
  width: 30px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  border: none;
  border-radius: 0 0.55rem 0.55rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-icon-dark);
  font-size: 1rem;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 100;
  cursor: pointer;
}

.sidebar-edge-toggle:hover {
  width: 32px;
  box-shadow: 2px 0 12px rgba(218, 165, 32, 0.3);
}

.sidebar-shell--collapsed .sidebar-edge-toggle {
  right: -10px;
  top: 0.65rem;
  z-index: 2000;
}

.sidebar-shell--collapsed .sidebar-edge-toggle i::before {
  content: "\f285"; /* bi-chevron-right */
}

.sidebar-toggle {
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  color: var(--color-icon-dark);
  border: none;
  border-radius: 0.7rem;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: var(--brand-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px var(--color-accent-gold-shadow);
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-toggle,
.app-shell.sidebar-collapsed .sidebar-toggle {
  margin-left: auto;
  margin-right: auto;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 100%;
}

.sidebar-brand__company-link,
.sidebar-brand__app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-brand__company-link:hover,
.sidebar-brand__app-link:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.sidebar-company-logo {
  height: 36px;
  width: 36px;
  object-fit: contain;
}

.sidebar-logo {
  height: 32px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: width 0.3s ease, height 0.3s ease;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-header,
.app-shell.sidebar-collapsed .sidebar-header {
  padding: 0.7rem 0.35rem;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-company-logo,
.app-shell.sidebar-collapsed .sidebar-company-logo {
  height: 40px;
  width: 40px;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-logo,
.app-shell.sidebar-collapsed .sidebar-logo {
  display: none;
}

/* Mobile Top Navbar (hidden on desktop) */
.mobile-navbar {
  display: none;
}

@media (max-width: 991px) {
  .mobile-navbar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(180deg, var(--color-bg-sidebar) 0%, var(--color-bg-sidebar-end) 100%);
    border-bottom: 1px solid var(--color-border-sidebar);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1200;
  }

  .mobile-navbar__content {
    display: flex;
    flex-direction: column;
  }

  .mobile-navbar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    min-height: 64px;
  }

  .mobile-navbar__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 0.75rem;
    margin-right: 0.25rem;
    min-width: 0;
  }

  .mobile-navbar__brand-link {
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s ease;
  }

  .mobile-navbar__brand-link:hover {
    opacity: 0.85;
  }

  .mobile-navbar__company-icon {
    height: 34px;
    width: 34px;
    object-fit: contain;
  }

  .mobile-navbar__logo-link {
    display: inline-flex;
    transition: opacity 0.2s ease;
    min-width: 0;
  }

  .mobile-navbar__logo-link:hover {
    opacity: 0.85;
  }

  .mobile-navbar__logo {
    height: 32px;
    width: auto;
  }

  .mobile-navbar__app-logo {
    max-width: 140px;
    object-fit: contain;
  }

  .mobile-navbar__toggle {
    background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
    color: var(--color-icon-dark);
    border: none;
    border-radius: 0.7rem;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: var(--brand-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-navbar__toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px var(--color-accent-gold-shadow);
  }

  .mobile-navbar__toggle.is-open i::before {
    content: "\f659"; /* bi-x icon */
  }

  .mobile-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
  }

  .mobile-menu.is-open {
    max-height: calc(100vh - 64px);
    opacity: 1;
    overflow-y: auto;
  }

  .mobile-menu__content {
    padding: 1rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .mobile-menu__app-content {
    display: flex;
    flex-direction: column;
  }

  .mobile-menu__section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .mobile-menu__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0;
    padding: 0 0.5rem;
  }

  .mobile-menu__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .mobile-menu__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.85rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none;
  }

  .mobile-menu__link i {
    font-size: 1.1rem;
    color: var(--color-icon-default);
    transition: color 0.2s ease;
  }

  .mobile-menu__link:hover {
    background: var(--color-bg-nav-item-hover);
    color: var(--color-text-lightest);
  }

  .mobile-menu__link:hover i {
    color: var(--color-accent-gold-hover);
  }

  .mobile-menu__link--active {
    background: var(--color-bg-nav-item-active);
    color: var(--color-accent-gold);
  }

  .mobile-menu__link--active i {
    color: var(--color-accent-gold);
  }

  .mobile-meter {
    padding: 0.9rem 0.95rem;
    border-radius: 1.1rem;
    border: 1px solid rgba(232, 210, 132, 0.18);
    background: rgba(17, 22, 34, 0.68);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-meter__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    gap: 0.75rem;
  }

  .mobile-meter__percent {
    color: var(--color-text-primary);
    font-weight: 700;
  }

  .mobile-meter__bar {
    height: 6px;
    width: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
  }

  .mobile-meter__fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width 0.25s ease;
  }

  .mobile-meter__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(232, 210, 132, 0.6);
    padding: 0.35rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-text-primary);
    text-decoration: none;
    background: rgba(232, 210, 132, 0.1);
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  .mobile-meter__cta:hover {
    background: rgba(232, 210, 132, 0.18);
    border-color: rgba(232, 210, 132, 0.78);
  }

  /* Hide desktop sidebar on mobile */
  .sidebar-shell {
    display: none !important;
  }

  /* Adjust main content for mobile navbar */
  #mainContent {
    margin-left: 0 !important;
    padding-top: 5.5rem !important;
    width: 100%;
  }

  /* Responsive chart containers */
  .message-bubble.rich-content,
  .message-bubble.chat-html {
    max-width: 100% !important;
    width: 100% !important;
  }

  .rich-content,
  .chat-html {
    /* Let inner content handle its own overflow to avoid collapsing height on mobile */
    overflow: visible;
    width: 100%;
  }

  /* Chart canvas responsive container */
  .rich-content canvas,
  .chat-html canvas {
    max-width: 100% !important;
    display: block !important;
  }

  /* Chart wrapper for aspect ratio */
  .rich-content > div,
  .chat-html > div {
    max-width: 100%;
    width: 100%;
    position: relative;
  }
}

.sidebar-menu,
.sidebar-app-switch {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.85rem;
  border-left: 3px solid transparent;
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-link i {
  font-size: 1.1rem;
  color: var(--color-icon-default);
  transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
  background: var(--color-bg-nav-item-hover);
  color: var(--color-text-lightest);
  border-left-color: var(--color-border-nav-hover);
}

.sidebar-link:hover i {
  color: var(--color-accent-gold-hover);
  transform: translateY(-1px);
}

.sidebar-link--active {
  background: var(--color-bg-nav-item-active);
  color: var(--color-text-lightest);
  border-left-color: var(--color-border-nav-active);
  box-shadow: inset 0 0 0 1px var(--color-nav-highlight-inset);
}

.sidebar-link--active i {
  color: var(--color-icon-active);
}

.app-shell.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0.75rem 0;
}

.app-shell.sidebar-collapsed .sidebar-link i {
  margin-right: 0;
}

.sidebar-text {
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .sidebar-text {
  display: none !important;
}

.app-shell.sidebar-collapsed .sidebar-link:hover .sidebar-text,
.app-shell.sidebar-collapsed .sidebar-link:focus-visible .sidebar-text {
  display: inline-flex !important;
}

.sidebar-divider {
  border-top: 1px solid var(--color-border-light);
  margin: 0.9rem 0 1.1rem;
}

.lang-dropdown {
  text-align: center;
}

.lang-dropdown .lang-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-medium);
  background: var(--color-accent-gold-overlay);
  color: var(--color-text-light);
  padding: 0.45rem 1.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lang-dropdown .lang-button:hover,
.lang-dropdown .lang-button:focus {
  background: rgba(232, 210, 132, 0.18);
  border-color: var(--color-border-strong);
  color: var(--color-text-white);
}

.lang-dropdown .dropdown-menu {
  background: var(--color-bg-dropdown-menu);
  border: 1px solid var(--color-border-dropdown);
  border-radius: 0.75rem;
  padding: 0.35rem;
  min-width: 8rem;
}

.lang-dropdown .dropdown-item {
  color: var(--color-text-muted);
  border-radius: 0.65rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-dropdown .dropdown-item:hover {
  background: var(--color-bg-dropdown-item-hover);
  color: var(--color-text-white);
}

.app-shell.sidebar-collapsed .lang-dropdown {
  display: none;
}

/* Mobile top-menu language dropdown should always be visible even when
   the sidebar has been collapsed (desktop behavior hides sidebar lang)
   — keep it accessible in the mobile menu. */
.app-shell.sidebar-collapsed .mobile-menu .lang-dropdown {
  display: block;
}

#sidebarToggle {
  display: inline-flex;
}

@media (max-width: 991px) {
  #sidebarToggle {
    display: none;
  }
}

.surface-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--brand-radius-lg);
  box-shadow: var(--brand-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.surface-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--brand-shadow-md);
  border-color: var(--color-border-card-hover);
}

.surface-card--static:hover {
  transform: none;
  box-shadow: var(--brand-shadow-sm);
  border-color: var(--color-border-default);
}

.chat-shell.surface-card:hover {
  transform: none;
  box-shadow: var(--brand-shadow-sm);
  border-color: var(--color-border-default);
}

.form-control,
.form-select {
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-medium);
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  box-shadow: inset 0 0 0 1px var(--color-border-icon-inset);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  color-scheme: dark;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-accent-gold-ring);
  background: var(--color-bg-input-focus);
  color: var(--color-text-primary);
}

.form-control::placeholder {
  color: var(--color-text-tertiary);
}

.surface-card input[type="text"],
.surface-card input[type="email"],
.surface-card input[type="number"],
.surface-card input[type="password"],
.surface-card input[type="search"],
.surface-card input[type="tel"],
.surface-card input[type="url"],
.surface-card input[type="date"],
.surface-card input[type="month"],
.surface-card input[type="time"],
.surface-card textarea {
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-medium);
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  box-shadow: inset 0 0 0 1px var(--color-border-icon-inset);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  color-scheme: dark;
}

.surface-card input[type="text"]:focus,
.surface-card input[type="email"]:focus,
.surface-card input[type="number"]:focus,
.surface-card input[type="password"]:focus,
.surface-card input[type="search"]:focus,
.surface-card input[type="tel"]:focus,
.surface-card input[type="url"]:focus,
.surface-card input[type="date"]:focus,
.surface-card input[type="month"]:focus,
.surface-card input[type="time"]:focus,
.surface-card textarea:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-accent-gold-ring);
  background: var(--color-bg-input-focus);
  color: var(--color-text-primary);
}

.surface-card input[type="date"]::-webkit-calendar-picker-indicator,
.surface-card input[type="month"]::-webkit-calendar-picker-indicator,
.surface-card input[type="time"]::-webkit-calendar-picker-indicator {
  /* make the calendar icon clearly visible on dark backgrounds */
  filter: none;
  opacity: 0.95;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

/* Improve overall visibility and spacing for date/month/time inputs */
.surface-card input[type="month"],
.surface-card input[type="date"],
.surface-card input[type="time"] {
  background: var(--color-bg-input-enhanced);
  border: 1px solid var(--color-border-input-enhanced);
  color: var(--color-text-primary);
  padding: 0.65rem 1rem;
  padding-right: 3rem; /* leave room for the calendar icon */
  box-shadow: inset 0 0 0 1px var(--color-border-icon-inset-strong);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.surface-card input[type="month"]::placeholder,
.surface-card input[type="date"]::placeholder,
.surface-card input[type="time"]::placeholder {
  color: var(--color-text-placeholder);
}

/* Ensure the rendered date parts (month/year numbers) are readable */
.surface-card input[type="month"]::-webkit-datetime-edit,
.surface-card input[type="date"]::-webkit-datetime-edit,
.surface-card input[type="time"]::-webkit-datetime-edit {
  color: var(--color-text-primary);
  opacity: 1;
}

.surface-card input[type="date"]:focus,
.surface-card input[type="month"]:focus,
.surface-card input[type="time"]:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 4px var(--color-accent-gold-ring-strong-alt);
  background: var(--color-bg-input-focused-alt);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--color-bg-range-track);
  border: 1px solid var(--color-border-range);
  transition: background 0.2s ease, border-color 0.2s ease;
}

input[type="range"]:focus {
  outline: none;
  border-color: var(--color-border-range-focus);
  box-shadow: 0 0 0 3px var(--color-accent-gold-ring-strong);
  background: var(--color-bg-range-track-focus);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  border: 2px solid var(--color-shadow-thumb-border);
  box-shadow: 0 6px 14px var(--color-shadow-thumb);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px var(--color-shadow-thumb-hover);
}

input[type="range"]::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  border: 2px solid var(--color-shadow-thumb-border);
  box-shadow: 0 6px 14px var(--color-shadow-thumb);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px var(--color-shadow-thumb-hover);
}

.surface-card select,
.surface-card .form-select {
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-medium);
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  box-shadow: inset 0 0 0 1px var(--color-border-icon-inset);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.surface-card select:focus,
.surface-card .form-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-accent-gold-ring);
  background: var(--color-bg-input-focus);
  color: var(--color-text-primary);
}

  .surface-card select option,
  .surface-card .form-select option {
  color: var(--brand-ink-850);
  background: var(--color-form-option-bg);
}

.form-select option {
  color: var(--brand-ink-850);
  background: var(--color-form-option-bg);
}

.btn-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  color: var(--color-text-on-accent);
  font-weight: 600;
  border: none;
  box-shadow: 0 20px 36px rgba(232, 210, 132, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-brand:hover,
.btn-brand:focus {
  transform: translateY(-2px);
  box-shadow: 0 24px 45px rgba(232, 210, 132, 0.36);
  color: var(--color-text-on-accent);
}

.btn-brand--ghost {
  background: var(--color-bg-button-ghost);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-medium);
  box-shadow: none;
}

/* ========== BILLING PAGES ========== */
.billing-page {
  max-width: 56rem;
  margin: 110px auto 0;
  padding: 0 1rem 2.5rem;
}

.billing-page--wide {
  max-width: 64rem;
}

.billing-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
}

.billing-subtitle {
  color: var(--color-text-secondary);
  font-size: 0.98rem;
}

.billing-section-title {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--color-text-primary);
}

.billing-label {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.billing-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-medium);
  background: var(--color-accent-gold-overlay);
  color: var(--color-accent-gold);
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.billing-tag--muted {
  color: var(--color-text-secondary);
  background: var(--color-bg-nav-item);
}

.billing-vat-notice {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  opacity: 0.8;
  font-weight: 500;
}

.billing-metric {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: 1rem;
  padding: 0.9rem 0.95rem;
  height: 100%;
}

.billing-metric__label {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
}

.billing-metric__value {
  margin-top: 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.billing-choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border-default);
  border-radius: 0.95rem;
  background: var(--color-bg-tertiary);
}

.billing-choice + .billing-choice {
  margin-top: 0.6rem;
}

.billing-choice .form-check-label {
  color: var(--color-text-primary);
  font-weight: 600;
}

.billing-choice .form-check-input {
  accent-color: var(--color-accent-gold);
}

.billing-instructions {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-light);
  border-radius: 1rem;
  padding: 1.25rem;
}

.billing-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 0.75rem;
  background: var(--color-accent-gold-overlay);
  color: var(--color-accent-gold);
  border: 1px solid var(--color-border-medium);
}

#iyzicoCheckoutContainer {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.billing-hint {
  color: var(--color-text-tertiary);
}

  .btn-brand--ghost:hover,
  .btn-brand--ghost:focus {
  background: var(--color-bg-button-ghost-hover);
  color: var(--color-text-primary);
}

.hover-scale,
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-scale:hover,
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--brand-shadow-md);
}

.hero-shell {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: radial-gradient(circle at 20% 20%, var(--color-overlay-hero-gradient), transparent 45%),
    linear-gradient(180deg, var(--color-bg-hero), var(--color-bg-hero-end));
  border: 1px solid var(--color-border-hero);
  box-shadow: 0 30px 60px var(--color-overlay-darker);
}

.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.toast-stack {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1200;
  max-width: 24rem;
}

.toast-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.95rem 1.1rem;
  border-radius: 1rem;
  background: var(--color-bg-toast);
  border: 1px solid var(--color-border-toast);
  color: var(--color-text-contrast);
  box-shadow: 0 24px 50px var(--color-overlay-darker);
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, var(--color-overlay-toast-gradient), transparent 55%);
  pointer-events: none;
}

.toast-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(245, 240, 183, 0.9);
}

.toast-card__body {
  font-size: 0.92rem;
  line-height: 1.45;
}

.toast-card__close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: none;
  background: transparent;
  color: rgba(248, 249, 253, 0.65);
  font-size: 1.05rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.toast-card__close:hover,
.toast-card__close:focus {
  color: var(--color-text-white);
}

.toast-card--success {
  border-left: 4px solid var(--color-status-success);
}

.toast-card--warning {
  border-left: 4px solid var(--color-status-warning);
}

.toast-card--error {
  border-left: 4px solid var(--color-status-error);
}

.toast-card--info {
  border-left: 4px solid var(--color-status-info);
}

.toast-card.dismissed {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

@media (max-width: 640px) {
  .toast-stack {
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
  }
}

.alert {
  border-radius: 0.85rem;
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-alert);
  color: var(--color-text-primary);
}

.alert-success {
  border-left: 4px solid var(--color-status-success);
}

.alert-danger {
  border-left: 4px solid var(--color-status-error);
}

.modal-content {
  background: var(--color-bg-modal);
  border: 1px solid var(--color-border-modal);
  border-radius: 1rem;
  color: var(--color-text-primary);
}

.modal-header,
.modal-footer {
  border-color: var(--color-border-light);
}

.modal .btn-primary {
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  border: none;
  color: var(--color-text-on-accent);
}

.modal .btn-secondary {
  background: var(--color-bg-nav-item-hover);
  border: 1px solid var(--color-border-medium);
  color: var(--color-text-primary);
}

.flag-icon {
  border-radius: 999px;
}

/* ========== USAGE DASHBOARD CARD ========== */
.usage-card {
  border: 1px solid var(--color-border-medium);
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: var(--brand-shadow-sm);
}

.usage-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.usage-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.usage-card__subtitle {
  margin: 0.35rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.usage-plan {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  text-align: right;
}

.usage-plan__label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.usage-plan__value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-accent-gold);
}

.usage-meters {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.usage-meter {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.usage-meter__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.usage-meter__label-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.usage-meter__label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.usage-meter__percent {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.usage-meter__tag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent-gold);
  border: 1px solid rgba(232, 210, 132, 0.4);
  border-radius: 999px;
  padding: 0.15rem 0.8rem;
}

.usage-meter__bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-medium);
  overflow: hidden;
}

.usage-meter__fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.usage-meter__fill--ok {
  background: linear-gradient(90deg, rgba(50, 210, 150, 0.45), var(--color-status-success));
}

.usage-meter__fill--warning {
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.35), var(--color-status-warning));
}

.usage-meter__fill--exhausted {
  background: linear-gradient(90deg, rgba(239, 90, 90, 0.35), var(--color-status-error));
}

.usage-meter__fill--unlimited {
  background: linear-gradient(90deg, rgba(232, 210, 132, 0.35), var(--color-accent-gold));
}

.usage-meter__description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.usage-meter__value {
  font-weight: 600;
  color: var(--color-text-primary);
}

.usage-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: help;
}

.usage-help:focus-visible {
  outline: 2px solid var(--color-border-focus);
  border-radius: 999px;
}

.usage-help .bi {
  font-size: 1rem;
}

.usage-meter__cta {
  margin-top: 0.6rem;
}

.sidebar-meter {
  position: relative;
}

.sidebar-meter__wide {
  display: block;
}

.sidebar-meter__compact {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.2rem 0;
}

.sidebar-meter__donut {
  --meter-pct: 0;
  --meter-color: var(--color-accent-gold);
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 999px;
  background: conic-gradient(var(--meter-color) calc(var(--meter-pct) * 1%), rgba(255, 255, 255, 0.08) 0deg);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-meter__donut::after {
  content: "";
  position: absolute;
  inset: 0.32rem;
  border-radius: 999px;
  background: var(--color-bg-sidebar);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sidebar-meter__compact-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-meter,
.app-shell.sidebar-collapsed .sidebar-meter {
  padding: 0.25rem 0.4rem 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-meter__wide,
.app-shell.sidebar-collapsed .sidebar-meter__wide {
  display: none;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-meter__compact,
.app-shell.sidebar-collapsed .sidebar-meter__compact {
  display: inline-flex;
}

.sidebar-shell.sidebar-shell--collapsed .sidebar-meter__cta,
.app-shell.sidebar-collapsed .sidebar-meter__cta {
  display: none;
}

.btn-brand.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .usage-card__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .usage-plan {
    align-items: flex-start;
    text-align: left;
  }
}

/* ========== LAYOUT UTILITIES ========== */
.flex-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-wrap {
  flex: 1;
  padding-top: 0;
  margin-top: 0;
}

/* Account pages spacing to avoid navbar overlap */
.account-page-container {
  margin-top: 0;
  padding-top: 1rem;
}

/* Alternative: Add padding to body when on account pages */
body.account-page .content-wrap {
  padding-top: 5rem;
}

/* Legal text pages */
.legal-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 6rem 1rem 3.5rem;
}

.legal-updated {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.legal-content {
  color: var(--color-text-secondary);
  line-height: 1.7;
  font-size: 1rem;
}

.legal-content h1,
.legal-content h2,
.legal-content h3,
.legal-content h4,
.legal-content h5,
.legal-content h6 {
  color: var(--color-text-primary);
  margin-top: 1.6rem;
  margin-bottom: 0.6rem;
}

.legal-content p {
  margin: 0 0 1rem;
}

.legal-content ul,
.legal-content ol {
  margin: 0 0 1rem 1.25rem;
}

.legal-content li {
  margin-bottom: 0.4rem;
}

.legal-content a {
  color: var(--color-accent-gold);
  text-decoration: underline;
}

.legal-content blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-border-medium);
  color: var(--color-text-muted);
}

.legal-content code {
  padding: 0.1rem 0.3rem;
  border-radius: 0.35rem;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-light);
}

.legal-content pre {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-light);
  overflow-x: auto;
}

/* ========== NAVBAR COMPONENT ========== */
.navbar-custom {
  background-color: transparent;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  padding: 0.5rem 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  box-shadow: none;
}

.navbar-custom.scrolled {
  background-color: var(--color-bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-default);
  box-shadow: 0 4px 16px rgba(27, 30, 39, 0.12);
}

.navbar-custom .navbar-brand {
  padding: 0;
}

.navbar-logo,
.footer-logo img {
  height: 30px;
  transition: height 0.3s ease;
}

.navbar-custom .nav-link {
  color: var(--color-text-primary) !important;
  font-weight: 500;
  margin: 0 0.25rem;
  position: relative;
  transition: color 0.2s ease;
  padding-bottom: 4px;
  white-space: nowrap;
}

.navbar-custom .nav-link.active {
  color: var(--color-text-primary) !important;
  font-weight: 600;
}

.navbar-custom .nav-link:not(.dropdown-toggle)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent-gold);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-custom .nav-link:not(.dropdown-toggle):hover::after {
  width: 100%;
}

.navbar-custom .dropdown-toggle {
  padding-right: 1.25rem !important;
  position: relative;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.navbar-custom .dropdown-toggle:hover {
  background-color: var(--color-bg-nav-item-hover);
  transform: scale(1.05);
  border-radius: 4px;
}

.navbar-custom .dropdown-menu {
  background-color: var(--color-bg-dropdown-menu);
  border: 1px solid var(--color-border-dropdown);
  margin-top: 0.5rem;
  transform-origin: top;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.navbar-custom .dropdown-item {
  color: var(--color-text-primary);
  transition: all 0.2s ease;
  position: relative;
}

.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item:focus {
  background-color: var(--color-bg-nav-item-hover);
  color: var(--color-text-primary) !important;
  padding-left: 1.25rem;
}

/* Navbar CTA Button Styles */
.navbar-custom .btn-brand {
  padding: 0.4rem 1rem;
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--brand-gold-400);
  color: var(--brand-ink-900);
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.navbar-custom .btn-brand:hover {
  background: var(--brand-gold-500);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(232, 210, 132, 0.3);
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: -8px;
  left: calc(100% - 12px);
  display: none;
  opacity: 0;
  transform: translateY(8px);
}

.dropdown-submenu > .dropdown-menu.dropdown-menu-left {
  left: auto !important;
  right: 100%;
  margin-left: 0;
  margin-right: -12px;
}

.dropdown-submenu:hover > .dropdown-menu,
.dropdown-submenu:focus-within > .dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.dropdown-submenu > .dropdown-toggle::after {
  content: "▸";
  border: none;
  margin-left: 0.75em;
  vertical-align: text-top;
}

.navbar-toggler {
  border-color: var(--color-border-medium);
  transition: border-color 0.2s ease;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 2px var(--color-accent-gold-ring);
}

/* ========== FOOTER ========== */
.footer a {
  text-decoration: none;
}

/* match the footer background to the solid navbar (scrolled state) */
footer.footer, .footer {
  background-color: var(--color-bg-primary) !important;
  color: var(--color-text-primary) !important;
  border-top: 1px solid var(--color-border-default) !important;
}

.footer a {
  color: var(--color-text-secondary) !important;
}

/* ========== RETURN TO TOP BUTTON ========== */
#return-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--color-accent-gold-gradient-start), var(--color-accent-gold-gradient-end));
  color: var(--color-text-on-accent);
  border: 1px solid var(--color-border-medium);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: none;
  transition: opacity 0.3s ease-in-out, transform 0.2s ease;
  box-shadow: 0 10px 24px var(--color-accent-gold-shadow);
  z-index: 1200;
}

#return-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px var(--color-accent-gold-shadow);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
  margin-top: 10px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: slideInRight ease 0.5s;
}

.toast-header {
  border-radius: 8px 8px 0 0;
  padding: 16px 16px;
  color: var(--color-text-white);
  font-size: 16px;
}

.toast-body {
  font-size: 14px;
  padding: 15px;
}

.bg-success {
  background-color: var(--brand-success);
}

.bg-info {
  background-color: var(--brand-info);
}

.bg-error {
  background-color: var(--brand-error);
}

.close {
  background: transparent;
  border: none;
}

.close span {
  color: var(--color-text-white);
  font-size: 20px;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== MOBILE NAVIGATION ========== */
@media (max-width: 991.98px) {
  .navbar-custom {
    /* Use semantic color variable instead of hard-coded rgba */
    background-color: var(--color-bg-primary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .navbar-custom .navbar-collapse {
    /* Use semantic background for expanded mobile menu */
    background-color: var(--color-bg-primary);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }

  .navbar-custom .navbar-nav {
    padding: 1rem 0;
  }

  .navbar-custom .nav-item {
    margin: 0.25rem 0;
  }

  .navbar-custom .dropdown-menu {
    background-color: transparent;
    border: none;
    padding-left: 1.5rem;
    margin-top: 0;
    transform: none !important;
  }

  .dropdown-submenu > .dropdown-menu {
    position: static;
    margin-left: 1rem;
    border-left: 2px solid var(--color-border-light);
  }

  .dropdown-submenu > .dropdown-toggle::after {
    content: "▾";
  }

  /* show toggler on small screens */
  .navbar-custom .navbar-toggler {
    display: inline-flex;
    border: 2px solid var(--color-accent-gold);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(253, 249, 234, 0.15);
    color: var(--color-accent-gold);
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
}

/* Hide toggler on desktop (larger than tablet breakpoint) */
@media (min-width: 992px) {
  .navbar-custom .navbar-toggler {
    display: none;
  }
}

  .navbar-custom .navbar-toggler:hover {
    background: rgba(253, 249, 234, 0.25);
    border-color: var(--color-accent-gold-light);
  }

  .navbar-custom .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem var(--color-accent-gold-ring);
    outline: none;
  }

  .navbar-custom .navbar-toggler-icon {
    width: 28px;
    height: 22px;
    display: inline-block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
    /* SVG uses currentColor - inherits from parent toggler */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='currentColor' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  }

  /* If the header gets a very dark transparent rectangle, provide a light/contrasting button variant */
  .navbar-custom .navbar-toggler.is-contrast {
    background: var(--color-toggler-contrast-bg);
    border-color: var(--color-toggler-contrast-border);
    color: var(--color-text-lightest);
  }

  /* When navbar is scrolled, use darker background */
  .navbar-custom.scrolled .navbar-toggler {
    background: rgba(253, 249, 234, 0.1);
    border-color: var(--color-accent-gold);
  }

/* ========== PAGE LOADER ========== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
}

.page-loader__logo {
  width: 90px;
  height: auto;
  animation: loaderPulse 2s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (max-width: 768px) {
  .toast {
    width: auto;
    left: 10px;
    right: 10px;
  }
  
  .navbar-brand img, 
  .footer-logo img {
    max-height: 30px;
  }

  /* Fix layout shift on responsive mode for cards with animations */
  /* Prevent hover lift animation on mobile to avoid vertical scrollbar */
  .surface-card {
    will-change: box-shadow, border-color;
  }

  .surface-card:hover {
    transform: none;
  }

  /* Ensure grid layout allocates proper space for animated cards */
  [data-aos] {
    will-change: auto;
  }
}
