/**
 * AlphaCouncil - Shared Design System CSS
 * Version: 1.0.0
 *
 * This file contains all shared styles for the AlphaCouncil platform.
 * Extracted from individual HTML files to eliminate duplication.
 *
 * Sections:
 * 1. CSS Custom Properties (Design Tokens)
 * 2. Base & Reset Styles
 * 3. Typography
 * 4. Navigation (.app-nav)
 * 5. Market Indices Bar (.indices-bar)
 * 6. Layout System (.app-wrapper, .app-main)
 * 7. AI Adviser Sidebar (.adviser-sidebar)
 * 8. Cards & Surfaces
 * 9. Buttons & Controls
 * 10. Form Elements
 * 11. Tables
 * 12. Badges & Tags
 * 13. Modals & Overlays
 * 14. Toast Notifications
 * 15. Footer
 * 16. Utility Classes
 * 17. Animations
 * 18. Accessibility
 * 19. Responsive Breakpoints
 * 20. Print Styles
 */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ========================================================================== */

:root {
  /* Background Colors */
  --bg-deep: #07111F;
  --bg-base: #0B1120;
  --bg-elevated: #101624;

  /* Surface Colors */
  --surface: #111A2B;
  --surface-elevated: #141D2F;
  --surface-glass: rgba(17, 26, 43, 0.95);

  /* Foreground Colors */
  --fg: #F8FAFC;
  --fg-muted: #AAB6C5;
  --fg-dim: #6B7A8F;

  /* Accent Colors */
  --accent-primary: #27D3C3;
  --accent-primary-glow: rgba(39, 211, 195, 0.2);
  --accent-gold: #D7B76A;
  --accent-gold-glow: rgba(215, 183, 106, 0.15);
  --accent-violet: #8B5CF6;
  --accent-violet-glow: rgba(139, 92, 246, 0.15);
  --accent-blue: #3B82F6;
  --accent-blue-glow: rgba(59, 130, 246, 0.15);

  /* Semantic Colors */
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --danger: #EF4444;
  --danger-glow: rgba(239, 68, 68, 0.15);
  --warning: #F59E0B;
  --warning-glow: rgba(245, 158, 11, 0.15);

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Monaco, monospace;

  /* Animation */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout Dimensions */
  --nav-height: 56px;
  --indices-height: 40px;
  --sidebar-width: 400px;
  --settings-nav-width: 240px;

  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 50;
  --z-fixed: 100;
  --z-modal-backdrop: 200;
  --z-modal: 250;
  --z-council-modal: 300;
  --z-toast: 9999;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Border Radius Scale */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Shadow Scale */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.4);

  /* Focus Ring */
  --focus-ring: 0 0 0 3px rgba(39, 211, 195, 0.3);
}

/* ==========================================================================
   2. BASE & RESET STYLES
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--fg);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-dim);
}

/* Atmosphere Background */
.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.atmosphere::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(39, 211, 195, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(139, 92, 246, 0.025) 0%, transparent 50%);
}

/* Selection */
::selection {
  background: rgba(39, 211, 195, 0.3);
  color: var(--fg);
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 13px; }

p { color: var(--fg-muted); }

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  text-decoration: underline;
}

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

/* ==========================================================================
   4. NAVIGATION (.app-nav)
   ========================================================================== */

.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-fixed);
}

.app-nav-inner {
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.app-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.app-logo:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.app-logo img {
  height: 28px;
  width: auto;
}

.app-nav-links {
  display: flex;
  gap: 2px;
}

.app-nav-links a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.app-nav-links a:hover {
  color: var(--fg);
  background: var(--surface);
}

.app-nav-links a.active {
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
}

.app-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search Box */
.app-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 200px;
}

.app-search:hover {
  border-color: var(--border-strong);
}

.app-search:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--focus-ring);
}

.app-search svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.app-search kbd {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-family: inherit;
  margin-left: auto;
}

/* Language Toggle */
.lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: 6px;
  padding: 2px;
}

.lang-toggle button {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--fg-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-toggle button.active {
  background: var(--accent-primary);
  color: var(--bg-deep);
}

/* Navigation Icon Buttons */
.nav-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.nav-icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.nav-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.nav-icon-btn.active {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.nav-icon-btn svg {
  width: 18px;
  height: 18px;
}

.nav-icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  border: 2px solid var(--bg-base);
  border-radius: var(--radius-full);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* User Avatar */
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--bg-deep);
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.user-avatar:hover {
  border-color: var(--accent-primary);
}

.user-avatar:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   5. MARKET INDICES BAR (.indices-bar)
   ========================================================================== */

.indices-bar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  height: var(--indices-height);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  z-index: calc(var(--z-fixed) - 1);
  overflow: hidden;
}

.indices-inner {
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.index-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  white-space: nowrap;
}

.index-name {
  color: var(--fg-dim);
  font-weight: 500;
}

.index-value {
  color: var(--fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.index-change {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.index-change.up { color: var(--success); }
.index-change.down { color: var(--danger); }

.indices-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.indices-time::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* ==========================================================================
   6. LAYOUT SYSTEM
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: calc(var(--nav-height) + var(--indices-height));
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
  padding-bottom: var(--space-12);
  transition: all 0.3s var(--ease-out);
}

/* Main content grid adjusts when sidebar opens */
body.sidebar-open .main-grid {
  grid-template-columns: 1fr;
}

/* Page Header */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-title-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-primary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--accent-violet-glow);
}

.page-title-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.page-subtitle {
  font-size: 15px;
  color: var(--fg-muted);
  max-width: 500px;
  line-height: 1.6;
}

/* ==========================================================================
   7. AI ADVISER SIDEBAR (.adviser-sidebar)
   ========================================================================== */

.adviser-sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid transparent;
  display: flex;
  flex-direction: column;
  transition: all 0.3s var(--ease-out);
  position: sticky;
  top: calc(var(--nav-height) + var(--indices-height));
  height: calc(100vh - var(--nav-height) - var(--indices-height));
}

.adviser-sidebar.open {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  border-left-color: var(--border);
}

.sidebar-inner {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.2s ease 0s;
}

.adviser-sidebar.open .sidebar-inner {
  opacity: 1;
  transition: opacity 0.2s ease 0.1s;
}

/* Sidebar Header */
.sidebar-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

.sidebar-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.sidebar-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-muted);
  transition: all 0.2s;
}

.sidebar-close:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.sidebar-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sidebar-close svg {
  width: 16px;
  height: 16px;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 95%;
}

.chat-message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.chat-message.adviser .chat-avatar {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-gold));
  color: var(--bg-deep);
}

.chat-message.user .chat-avatar {
  background: var(--accent-violet);
  color: white;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  line-height: 1.6;
}

.chat-message.adviser .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-top-left-radius: var(--radius-sm);
}

.chat-message.adviser .chat-bubble strong {
  color: var(--fg);
  font-weight: 500;
}

.chat-message.user .chat-bubble {
  background: var(--accent-primary);
  color: var(--bg-deep);
  border-top-right-radius: var(--radius-sm);
  font-weight: 500;
}

.chat-time {
  font-size: 10px;
  color: var(--fg-dim);
  margin-top: 4px;
}

.chat-message.user .chat-time {
  text-align: right;
}

/* Suggested Questions */
.suggested-questions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-elevated);
}

.suggested-label {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.suggested-question {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
}

.suggested-question:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
}

.suggested-question:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Chat Input */
.chat-input-area {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--bg-base);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 13px;
  color: var(--fg);
  outline: none;
  resize: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input::placeholder {
  color: var(--fg-dim);
}

.chat-input:focus {
  border-color: var(--accent-primary);
}

.chat-send {
  width: 44px;
  height: 44px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send:hover {
  transform: scale(1.05);
}

.chat-send:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.chat-send svg {
  width: 18px;
  height: 18px;
  color: var(--bg-deep);
}

/* Sidebar Context */
.sidebar-context {
  padding: 12px 16px;
  background: var(--accent-primary-glow);
  border-bottom: 1px solid var(--border);
}

.context-label {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.context-stock {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
}

.context-stock span {
  color: var(--fg-muted);
  font-weight: 400;
}

.context-clear {
  margin-top: 8px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.context-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ==========================================================================
   8. CARDS & SURFACES
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.card-action {
  font-size: 12px;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.card-action:hover {
  color: var(--accent-primary);
}

.card-body {
  padding: 16px 20px;
}

/* Metric Cards */
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.metric-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-label {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-label svg {
  width: 14px;
  height: 14px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.metric-change {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-change.up { color: var(--success); }
.metric-change.down { color: var(--danger); }

.metric-change svg {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   9. BUTTONS & CONTROLS
   ========================================================================== */

.btn {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border: none;
  font-family: inherit;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-deep);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 14px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 26px;
  transition: all 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--fg-dim);
  border-radius: 50%;
  transition: all 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--accent-primary);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   10. FORM ELEMENTS
   ========================================================================== */

.form-group {
  margin-bottom: 24px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.form-label span {
  font-weight: 400;
  color: var(--fg-dim);
  margin-left: 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--fg-dim);
  margin-top: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--fg);
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.form-input::placeholder {
  color: var(--fg-dim);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--focus-ring);
}

.form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7A8F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* ==========================================================================
   11. TABLES
   ========================================================================== */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

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

.data-table tr:hover td {
  background: var(--accent-primary-glow);
}

/* Responsive table wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   12. BADGES & TAGS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.badge-primary {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border: 1px solid rgba(39, 211, 195, 0.3);
}

.badge-gold {
  background: var(--accent-gold-glow);
  color: var(--accent-gold);
  border: 1px solid rgba(215, 183, 106, 0.3);
}

.badge-violet {
  background: var(--accent-violet-glow);
  color: var(--accent-violet);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-success {
  background: var(--success-glow);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-glow);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-glow);
  color: var(--warning);
}

/* Ticker Badge */
.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.ticker-badge:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ==========================================================================
   13. MODALS & OVERLAYS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 31, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s var(--ease-out);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon svg {
  width: 22px;
  height: 22px;
}

.modal-title h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-title p {
  font-size: 12px;
  color: var(--fg-dim);
  margin-top: 2px;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-dim);
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.modal-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   14. TOAST NOTIFICATIONS
   (Styles also in JS for injection when CSS not loaded)
   ========================================================================== */

.global-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease-out);
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.global-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.global-toast .toast-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.global-toast .toast-icon svg {
  width: 18px;
  height: 18px;
}

.global-toast .toast-icon.success {
  background: var(--success-glow);
  color: var(--success);
}

.global-toast .toast-icon.info {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}

.global-toast .toast-icon.warning {
  background: var(--warning-glow);
  color: var(--warning);
}

.global-toast .toast-icon.error {
  background: var(--danger-glow);
  color: var(--danger);
}

.global-toast .toast-content {
  flex: 1;
  min-width: 0;
}

.global-toast .toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.global-toast .toast-text {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.4;
}

.global-toast .toast-close {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-dim);
  transition: all 0.2s;
  flex-shrink: 0;
}

.global-toast .toast-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-muted);
}

.global-toast .toast-close svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   15. FOOTER
   ========================================================================== */

.app-footer {
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  padding: var(--space-6);
  margin-top: var(--space-12);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-logo img {
  height: 24px;
}

.footer-slogan {
  font-size: 11px;
  color: var(--fg-dim);
  font-style: italic;
}

.footer-disclaimer {
  max-width: 600px;
  font-size: 10px;
  color: var(--fg-dim);
  line-height: 1.5;
  text-align: right;
}

/* ==========================================================================
   16. UTILITY CLASSES
   ========================================================================== */

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex utilities */
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.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); }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--fg-muted); }
.text-dim { color: var(--fg-dim); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent-primary); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Width/Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-w-0 { min-width: 0; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Visibility */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* Tabular numbers */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   17. ANIMATIONS
   ========================================================================== */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOut {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 0.8s linear infinite; }
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.sm { width: 16px; height: 16px; }
.spinner.lg { width: 32px; height: 32px; }

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-elevated) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ==========================================================================
   18. ACCESSIBILITY
   ========================================================================== */

/* Skip Links */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--accent-primary);
  color: var(--bg-deep);
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Focus styles */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ARIA Live Region */
.live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .spinner {
    animation: none;
    border-top-color: var(--accent-primary);
  }

  .animate-pulse,
  .animate-spin {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(255, 255, 255, 0.2);
    --border-strong: rgba(255, 255, 255, 0.3);
  }
}

/* ==========================================================================
   19. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet and below */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 360px;
  }

  .adviser-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    z-index: 150;
    transform: translateX(100%);
  }

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

  .sidebar-inner {
    padding-top: calc(var(--nav-height) + var(--indices-height));
  }

  .app-nav-links {
    display: none;
  }

  .main-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --nav-height: 52px;
    --indices-height: 36px;
  }

  .app-nav-inner {
    padding: 0 12px;
  }

  .app-search {
    min-width: auto;
  }

  .app-search span {
    display: none;
  }

  .app-main {
    padding: var(--space-4);
    padding-bottom: var(--space-10);
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-title {
    font-size: 22px;
  }

  .page-title-icon {
    width: 36px;
    height: 36px;
  }

  .page-title-icon svg {
    width: 20px;
    height: 20px;
  }

  .metric-card {
    padding: var(--space-4);
  }

  .metric-value {
    font-size: 22px;
  }

  .card-header,
  .card-body {
    padding: 12px 16px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .footer-disclaimer {
    text-align: center;
  }

  /* Mobile table scroll */
  .table-responsive {
    margin: 0 -16px;
    padding: 0 16px;
  }

  .data-table {
    min-width: 600px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .app-logo span {
    display: none;
  }

  .lang-toggle {
    display: none;
  }

  .nav-icon-btn {
    width: 32px;
    height: 32px;
  }

  .nav-icon-btn svg {
    width: 16px;
    height: 16px;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .global-toast {
    left: 12px;
    right: 12px;
    transform: translateY(20px);
    min-width: auto;
    max-width: none;
  }

  .global-toast.show {
    transform: translateY(0);
  }
}

/* ==========================================================================
   20. PRINT STYLES
   ========================================================================== */

@media print {
  .app-nav,
  .indices-bar,
  .adviser-sidebar,
  .nav-icon-btn,
  .btn,
  .app-search,
  .lang-toggle {
    display: none !important;
  }

  .app-wrapper {
    padding-top: 0;
  }

  .app-main {
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    border: 1px solid #ddd;
    background: white;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* ==========================================================================
   21. ENHANCED ACCESSIBILITY & INTERACTIONS (Priorities 5-8)
   ========================================================================== */

/* Typing Indicator */
.typing-indicator .chat-bubble {
  padding: 16px 20px;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--fg-dim);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 17, 31, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  border-radius: inherit;
}

.loading-text {
  font-size: 13px;
  color: var(--fg-muted);
}

.is-loading {
  pointer-events: none;
}

/* Enhanced Focus Indicators */
.suggested-question:focus-visible,
.quick-action:focus-visible,
.ticker-badge:focus-visible,
.ask-adviser-btn:focus-visible,
.mover-item:focus-visible,
.holding-row:focus-visible,
.alert-item:focus-visible,
.news-card:focus-visible,
.scenario-card:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* Make interactive items focusable */
.mover-item,
.holding-row,
.alert-item,
.news-card,
.scenario-card {
  cursor: pointer;
}

.mover-item[tabindex],
.holding-row[tabindex],
.alert-item[tabindex],
.news-card[tabindex],
.scenario-card[tabindex] {
  outline: none;
}

/* Expandable Content */
.expandable-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s var(--ease-out), opacity 0.2s, padding 0.3s;
}

.expandable-content.is-expanded {
  max-height: 2000px;
  opacity: 1;
}

[data-expand-trigger] {
  cursor: pointer;
}

[data-expand-trigger]::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s;
  vertical-align: middle;
}

[data-expand-trigger].is-expanded::after {
  transform: rotate(180deg);
}

/* Transaction History Row (expandable) */
.transaction-row {
  border-bottom: 1px solid var(--border);
}

.transaction-row:last-child {
  border-bottom: none;
}

.transaction-summary {
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.transaction-summary:hover {
  background: var(--accent-primary-glow);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.transaction-details {
  padding: 0 0 16px;
  margin-left: 48px;
  border-left: 2px solid var(--border);
  padding-left: 16px;
}

/* Gauge Card Accessibility */
.gauge-card {
  position: relative;
}

.gauge-card:focus-within {
  box-shadow: var(--focus-ring);
}

.gauge-value {
  font-variant-numeric: tabular-nums;
}

/* Scenario Cards */
.scenario-card {
  transition: all 0.3s var(--ease-out);
}

.scenario-card:focus-visible {
  transform: translateY(-2px);
}

.scenario-card[aria-selected="true"],
.scenario-card.active {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, var(--accent-primary-glow), transparent);
}

.scenario-card.compare-mode {
  border-style: dashed;
}

.scenario-card.compare-selected {
  border-color: var(--accent-violet);
  border-style: solid;
}

/* Field Error Styling */
.field-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-error::before {
  content: '!';
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

input.has-error,
select.has-error,
textarea.has-error {
  border-color: var(--danger) !important;
}

/* Button Loading State */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

.btn-primary.is-loading::after {
  border-color: var(--bg-deep);
  border-top-color: transparent;
}

/* Live Indicator Animation */
.live-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
  margin-right: 6px;
}

/* Modal Enhanced ARIA */
.modal-overlay[aria-hidden="true"] {
  display: none;
}

.modal-overlay[aria-hidden="false"] {
  display: flex;
}

/* Council Modal (larger variant) */
.council-modal .modal {
  max-width: 800px;
}

.council-modal .modal-icon {
  background: var(--accent-violet-glow);
}

.council-modal .modal-icon svg {
  color: var(--accent-violet);
}

/* Thesis Dimension Cards */
.dimension-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all 0.2s;
}

.dimension-card:hover,
.dimension-card:focus-within {
  border-color: var(--border-strong);
}

.dimension-card[tabindex]:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.dimension-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dimension-name {
  font-size: 13px;
  font-weight: 600;
}

.dimension-score {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.dimension-score.bullish {
  background: var(--success-glow);
  color: var(--success);
}

.dimension-score.neutral {
  background: var(--warning-glow);
  color: var(--warning);
}

.dimension-score.bearish {
  background: var(--danger-glow);
  color: var(--danger);
}

.dimension-text {
  font-size: 12px;
  color: var(--fg-dim);
  line-height: 1.5;
}

/* Chat Message Long Content Handling */
.chat-bubble {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.chat-bubble ul,
.chat-bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.chat-bubble li {
  margin-bottom: 4px;
}

.chat-bubble br {
  display: block;
  content: '';
  margin: 8px 0;
}

/* Quick Action Enhanced States */
.quick-action {
  position: relative;
  overflow: hidden;
}

.quick-action::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, var(--accent-primary-glow), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.quick-action:hover::before,
.quick-action:focus-visible::before {
  opacity: 1;
}

.quick-action:active {
  transform: scale(0.98);
}

/* Ticker Badge Keyboard Navigation */
.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.ticker-badge:hover,
.ticker-badge:focus-visible {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.ticker-badge.in-portfolio {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.ticker-badge.in-portfolio::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
}

/* Improved Alert Item States */
.alert-item {
  padding: 14px;
  border-radius: var(--radius-lg);
  transition: all 0.2s;
}

.alert-item:hover,
.alert-item:focus-visible {
  background: var(--surface-elevated);
}

.alert-item[aria-current="true"],
.alert-item.is-active {
  background: var(--accent-primary-glow);
  border-left: 3px solid var(--accent-primary);
}

/* Holdings Row with Ask Adviser Integration */
.holding-row .ask-adviser-inline {
  opacity: 0;
  transition: opacity 0.2s;
}

.holding-row:hover .ask-adviser-inline,
.holding-row:focus-within .ask-adviser-inline {
  opacity: 1;
}

/* Comparison Panel */
.comparison-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.comparison-header {
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comparison-body {
  padding: 20px;
}

.comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-metric {
  text-align: center;
}

.comparison-label {
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.comparison-value {
  font-size: 16px;
  font-weight: 600;
}

.comparison-value.positive { color: var(--success); }
.comparison-value.negative { color: var(--danger); }

/* Reduced Motion - Extended */
@media (prefers-reduced-motion: reduce) {
  .typing-dots span {
    animation: none;
    opacity: 0.6;
  }

  .typing-dots span:nth-child(2) { opacity: 0.8; }
  .typing-dots span:nth-child(3) { opacity: 1; }

  .expandable-content {
    transition: none;
  }

  .modal {
    transition: none;
  }

  .modal-overlay {
    transition: none;
  }

  .adviser-sidebar {
    transition: none;
  }

  .card,
  .metric-card,
  .scenario-card,
  .news-card {
    transition: none;
  }

  .btn.is-loading::after {
    animation: none;
    border-color: currentColor;
  }

  .live-indicator {
    animation: none;
  }

  .global-toast {
    transition: opacity 0.1s;
  }
}

/* High Contrast Mode - Extended */
@media (prefers-contrast: high) {
  .field-error {
    font-weight: 600;
  }

  .dimension-score,
  .thesis-score {
    font-weight: 700;
  }

  *:focus-visible {
    outline-width: 3px;
  }

  .btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(39, 211, 195, 0.5);
  }
}

/* ==========================================================================
   COMPONENT: Settings Navigation (settings.html specific)
   ========================================================================== */

.settings-layout {
  display: grid;
  grid-template-columns: var(--settings-nav-width) 1fr;
  gap: 24px;
}

.settings-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 12px;
  height: fit-content;
  position: sticky;
  top: calc(var(--nav-height) + var(--indices-height) + 24px);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.settings-nav-item:hover {
  color: var(--fg);
  background: var(--bg-elevated);
}

.settings-nav-item.active {
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
}

.settings-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.settings-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.settings-section.hidden {
  display: none;
}

.section-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-primary-glow);
  border: 1px solid rgba(39, 211, 195, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.section-icon.violet {
  background: var(--accent-violet-glow);
  border-color: rgba(139, 92, 246, 0.2);
}

.section-icon.violet svg {
  color: var(--accent-violet);
}

.section-icon.gold {
  background: var(--accent-gold-glow);
  border-color: rgba(215, 183, 106, 0.2);
}

.section-icon.gold svg {
  color: var(--accent-gold);
}

.section-icon.danger {
  background: var(--danger-glow);
  border-color: rgba(239, 68, 68, 0.2);
}

.section-icon.danger svg {
  color: var(--danger);
}

.section-title-group h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.section-title-group p {
  font-size: 13px;
  color: var(--fg-dim);
}

.section-body {
  padding: 24px;
}

@media (max-width: 1024px) {
  .settings-layout {
    grid-template-columns: 200px 1fr;
  }
}

@media (max-width: 768px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    border-radius: 0;
    padding: 8px 16px;
    display: flex