/* ==========================================================================
   AEGIS LIGHT THEME DESIGN SYSTEM — INSTITUTIONAL OPTIONS TRADING DESK
   ========================================================================== */

:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #f8fafc;
  
  --border-light: #e2e8f0;
  --border-focus: #cbd5e1;
  --border-accent: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-50: #ecfdf5;
  --emerald-border: #a7f3d0;

  --coral-600: #e11d48;
  --coral-500: #f43f5e;
  --coral-50: #fff1f2;
  --coral-border: #fecdd3;

  --blue-600: #0284c7;
  --blue-500: #0ea5e9;
  --blue-50: #f0f9ff;
  --blue-border: #bae6fd;

  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-50: #fffbeb;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

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

body.light-theme {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

/* ==========================================================================
   TOAST NOTIFICATION CONTAINER
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.toast {
  background-color: white;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--blue-600);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  animation: slide-in 0.25s ease-out;
}

.toast > span:first-child,
.toast > span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toast.success {
  border-left-color: var(--emerald-600);
}

.toast.error {
  border-left-color: var(--coral-600);
}

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

/* ==========================================================================
   LOGIN / AUTH OVERLAY — 2-panel premium design
   ========================================================================== */

/* Utility */
.hidden { display: none !important; }

.auth-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow: hidden;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Animated background orbs */
.auth-bg-gfx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.22;
  animation: orb-float 8s ease-in-out infinite alternate;
}
.auth-orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #0ea5e9, #2563eb);
  top: -120px; left: -100px;
}
.auth-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #059669, #0284c7);
  bottom: -80px; right: -80px;
  animation-delay: -4s;
}
@keyframes orb-float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

.auth-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.1);
  width: 560px;
  max-width: 96vw;
  max-height: 94vh;
  overflow-y: auto;
  padding: 32px 36px 28px;
  position: relative;
  z-index: 1;
  animation: card-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-logo-badge {
  width: 56px; height: 56px;
  background: transparent;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.shield-icon-lg { width: 30px; height: 30px; }

.aegis-logo {
  display: block;
  object-fit: contain;
}

.aegis-logo-auth {
  width: 38px;
  height: 38px;
}

.auth-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.auth-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tab switcher */
.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}
.auth-tab.active {
  background: white;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.auth-tab:hover:not(.active) { color: var(--text-primary); }

/* Panel */
.auth-panel { animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 2-column row */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.form-hint {
  font-weight: 400;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: none;
}

.form-input {
  border: 1px solid var(--border-light);
  background-color: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input.font-mono { font-family: var(--font-mono); font-size: 12px; }
.form-input:focus {
  outline: none;
  border-color: var(--blue-600);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

/* Show/hide password wrapper */
.input-eye-wrap { position: relative; }
.input-eye-wrap .form-input { padding-right: 40px; }
.eye-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.eye-toggle:hover { color: var(--text-primary); }

/* Password strength */
.password-strength-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}
.pwd-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.pwd-bar-fill.weak      { background: #ef4444; }
.pwd-bar-fill.fair      { background: #f97316; }
.pwd-bar-fill.good      { background: #eab308; }
.pwd-bar-fill.strong    { background: #22c55e; }
.pwd-bar-fill.very-strong { background: #059669; }
.pwd-strength-label { font-size: 10px; font-weight: 600; margin-top: 3px; }
.pwd-strength-label.weak        { color: #ef4444; }
.pwd-strength-label.fair        { color: #f97316; }
.pwd-strength-label.good        { color: #eab308; }
.pwd-strength-label.strong      { color: #22c55e; }
.pwd-strength-label.very-strong { color: #059669; }

.form-divider {
  text-align: center;
  border-top: 1px solid var(--border-light);
  margin: 4px 0 2px;
  position: relative;
}
.form-divider span {
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  background-color: white;
  padding: 0 10px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.form-row-check { margin-top: 2px; }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-primary); cursor: pointer;
}

.btn-auth-submit {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.35);
  margin-top: 6px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  width: 100%;
}
.btn-auth-submit:hover {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.45);
}
.btn-auth-submit:disabled {
  opacity: 0.65; cursor: not-allowed; transform: none;
}

/* Switch text under form */
.auth-switch-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.link-btn {
  background: none; border: none;
  color: var(--blue-600);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--blue-500); }



/* ==========================================================================
   TOP NAVIGATION
   ========================================================================== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 48px;
  height: 48px;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shield-icon {
  width: 22px;
  height: 22px;
}

.aegis-logo-header {
  width: 42px;
  height: 42px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-alpha {
  background-color: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid var(--blue-border);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-center-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--emerald-50);
  color: var(--emerald-600);
  border: 1px solid var(--emerald-border);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald-500);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.account-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.acc-label {
  color: var(--text-muted);
  margin-right: 4px;
}

.acc-val {
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Button Styles */
button {
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all 0.15s ease-in-out;
  border: none;
  outline: none;
}

.btn-primary {
  background-color: #0f172a;
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: #1e293b;
  transform: translateY(-1px);
}

.btn-toggle-auto {
  background-color: var(--emerald-50);
  color: var(--emerald-600);
  border: 1px solid var(--emerald-border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn-toggle-auto:hover {
  background-color: #d1fae5;
}

.btn-toggle-auto.running {
  background-color: var(--coral-50);
  color: var(--coral-600);
  border-color: var(--coral-border);
}

.btn-hedge-danger {
  background-color: var(--coral-50);
  color: var(--coral-600);
  border: 1px solid var(--coral-border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn-hedge-danger:hover {
  background-color: #ffe4e6;
}

.btn-sm-outline {
  background-color: white;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sm-outline:hover {
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
}

.btn-logout {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  background-color: var(--coral-50);
  color: var(--coral-600);
  border-color: var(--coral-border);
}

/* ==========================================================================
   AUDIO BRIEFING BAR
   ========================================================================== */
.briefing-bar {
  background: linear-gradient(90deg, #eff6ff 0%, #f0fdf4 100%);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 24px;
}

.audio-control-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-play-audio {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--blue-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
  flex-shrink: 0;
}

.btn-play-audio:hover {
  background-color: #0274b3;
  transform: scale(1.06);
}

.audio-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--blue-600);
  letter-spacing: 0.5px;
}

.audio-status-pill {
  font-size: 9px;
  font-weight: 800;
  background-color: #ffffff;
  border: 1px solid var(--blue-border);
  padding: 1px 6px;
  border-radius: 9999px;
}

.audio-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 2px;
}

/* ==========================================================================
   METRICS ROW
   ========================================================================== */
.dashboard-grid {
  max-width: 1440px;
  margin: 20px auto;
  padding: 0 24px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-card.card-primary {
  border-left: 4px solid var(--blue-600);
}

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

.metric-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.metric-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.tag-green { background-color: var(--emerald-50); color: var(--emerald-600); border: 1px solid var(--emerald-border); }
.tag-blue { background-color: var(--blue-50); color: var(--blue-600); border: 1px solid var(--blue-border); }
.tag-gold { background-color: var(--amber-50); color: var(--amber-600); border: 1px solid #fde68a; }
.tag-neutral { background-color: var(--bg-card-subtle); color: var(--text-secondary); border: 1px solid var(--border-light); }
.tag-safe { background-color: var(--emerald-50); color: var(--emerald-600); border: 1px solid var(--emerald-border); }

.metric-value {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-bottom: 6px;
}

.metric-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.trend-positive {
  color: var(--emerald-600);
  font-weight: 700;
  font-family: var(--font-mono);
}

.text-emerald { color: var(--emerald-600); }
.text-coral { color: var(--coral-600); }

/* ==========================================================================
   MULTI-AGENT ARCHITECTURE BAR
   ========================================================================== */
.agents-status-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.agent-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  flex: 1;
}

.agent-pill.danger-border {
  border-color: var(--coral-border);
  background-color: var(--coral-50);
}

.agent-pill-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.agent-pill-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-pill-role {
  font-size: 11px;
  color: var(--text-muted);
}

.pill-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  padding: 3px 8px;
  border-radius: 9999px;
  color: var(--blue-600);
}

.badge-danger {
  color: var(--coral-600) !important;
  border-color: var(--coral-border) !important;
}

.agent-connector {
  font-size: 18px;
  color: var(--text-dim);
  padding: 0 12px;
}

/* ==========================================================================
   MAIN CONTENT SPLIT
   ========================================================================== */
.main-content-split {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
}

.panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.panel-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-sm {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-sm:hover {
  background-color: #e2e8f0;
}

.badge-count {
  font-size: 11px;
  font-weight: 600;
  background-color: var(--bg-card-subtle);
  padding: 2px 8px;
  border-radius: 9999px;
  color: var(--text-secondary);
}

.badge-accent {
  font-size: 11px;
  font-weight: 700;
  background-color: var(--emerald-50);
  color: var(--emerald-600);
  border: 1px solid var(--emerald-border);
  padding: 2px 8px;
  border-radius: 9999px;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

.btn-trade-deploy {
  background-color: var(--emerald-50);
  color: var(--emerald-600);
  border: 1px solid var(--emerald-border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 700;
}

.btn-trade-deploy:hover {
  background-color: var(--emerald-600);
  color: white;
}

.mt-4 {
  margin-top: 20px;
}

.mt-3 {
  margin-top: 14px;
}

/* Chart & Backtest Stats */
.chart-wrapper {
  margin: 16px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.stat-box {
  background-color: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.stat-num {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* ==========================================================================
   TERMINAL & RISK GATE
   ========================================================================== */
.flex-col {
  display: flex;
  flex-direction: column;
}

.h-full {
  height: 100%;
}

.pulse-live {
  font-size: 10px;
  font-weight: 700;
  background-color: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid var(--blue-border);
  padding: 2px 8px;
  border-radius: 9999px;
}

.terminal-box {
  background-color: #0f172a;
  border-radius: var(--radius-md);
  padding: 14px;
  height: 380px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: #e2e8f0;
}

.terminal-row {
  margin-bottom: 8px;
  word-break: break-word;
}

.term-time {
  color: #64748b;
  margin-right: 6px;
}

.term-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 6px;
}

.badge-sys { background-color: #334155; color: #f8fafc; }
.badge-quant { background-color: #0284c7; color: #ffffff; }
.badge-sent { background-color: #8b5cf6; color: #ffffff; }
.badge-risk { background-color: #e11d48; color: #ffffff; }
.badge-broker { background-color: #059669; color: #ffffff; }

.risk-gate-box {
  margin-top: 18px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
}

.risk-gate-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.gate-item {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-light);
  color: var(--text-secondary);
}

.gate-item strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background-color: white;
  width: 700px;
  max-width: 95vw;
  max-height: 88vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-sm {
  width: 580px;
}

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

.modal-header h2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
}

.btn-close-modal {
  background: none;
  font-size: 18px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.explainer-section h3 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.explainer-section p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.explainer-list {
  margin: 10px 0 0 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ==========================================================================
   v3.0 PANELS � Market Monitor, News Feed, Journal, Position Marks
   ========================================================================== */
.market-monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 16px 8px;
}

.monitor-tile {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
}

.monitor-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.monitor-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.monitor-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.news-feed {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-item {
  padding: 9px 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-left: 3px solid #0ea5e9;
  border-radius: 6px;
}

.news-headline {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
}

.news-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
}

.journal-table {
  max-height: 320px;
  overflow-y: auto;
}

.metric-tag.tag-red {
  background: #fee2e2;
  color: #dc2626;
}

.btn-trade-close {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'Inter', sans-serif;
}

.btn-trade-close:hover {
  background: #dc2626;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Stress gauge pulse when elevated */
.metric-value.pulse-danger {
  animation: stressPulse 1.6s ease-in-out infinite;
}

@keyframes stressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* WebSocket status badge states */
#ws-status-badge {
  color: #d97706;
  font-weight: 700;
  transition: color 0.3s ease;
}

/* ==========================================================================
   v3.1 UI EXPANSION — SVG ICONS, LOGO, TICKER TAPE, COMMAND PALETTE,
   NOTIFICATION CENTER, SETTINGS, GREEKS MONITOR, P&L ATTRIBUTION,
   JOURNAL TOOLBAR, TIMEFRAME CONTROLS, AUDIO PLAYER UPGRADES, DARK THEME
   ========================================================================== */

/* ---- SVG icon system (replaces emojis; vertically centered with labels) */
.icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-14 { width: 14px; height: 14px; }
.icon-15 { width: 15px; height: 15px; }
.icon-17 { width: 17px; height: 17px; }
.icon-18 { width: 18px; height: 18px; }
.icon-20 { width: 20px; height: 20px; }

.agent-pill-icon { display: flex; align-items: center; color: var(--blue-600); }
.panel-icon { display: flex; align-items: center; color: var(--blue-600); }

.btn-close-modal { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); }
.btn-close-modal:hover { background: var(--bg-card-subtle); }

.modal-title-icon { display: flex; align-items: center; gap: 8px; }
.modal-title-icon .icon { color: var(--blue-600); }
.explainer-section h3 { display: flex; align-items: center; gap: 6px; }
.explainer-section h3 .icon { color: var(--blue-600); }

.toast-ic { color: var(--emerald-600); }
.toast.error .toast-ic { color: var(--coral-600); }

/* ---- Logo (transparent background — no fill, gradient, or shadow) */
.auth-logo-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
  background: transparent;
}

.brand-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  background: transparent;
}

/* ---- Header: countdown chip + icon buttons */
.countdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.4px;
}
.countdown-chip .icon { color: var(--blue-600); }

.btn-cmdk { font-family: var(--font-mono); letter-spacing: 0.5px; }

.btn-icon-only {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.btn-icon-only:hover { background: var(--bg-card-subtle); color: var(--text-primary); }

/* ---- Notification center (icons aligned with notification text) */
.notif-wrap { position: relative; }

.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--coral-600);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 900;
  overflow: hidden;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}
.notif-panel-title { font-size: 12px; font-weight: 800; letter-spacing: 0.4px; color: var(--text-primary); }

.notif-panel-body { max-height: 320px; overflow-y: auto; padding: 6px; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
}
.notif-item:hover { background: var(--bg-card-subtle); }

.notif-ic {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-trade { background: var(--emerald-50); color: var(--emerald-600); }
.notif-veto { background: var(--coral-50); color: var(--coral-600); }
.notif-hedge { background: var(--blue-50); color: var(--blue-600); }
.notif-info { background: var(--bg-card-subtle); color: var(--text-muted); }

.notif-title { font-size: 11.5px; font-weight: 700; color: var(--text-primary); }
.notif-text { font-size: 11px; color: var(--text-secondary); line-height: 1.45; margin-top: 1px; word-break: break-word; }
.notif-time { font-size: 9.5px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 3px; }
.notif-empty { padding: 22px 14px; text-align: center; font-size: 11.5px; color: var(--text-muted); }

/* ---- Settings dropdown */
.settings-wrap { position: relative; }

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 900;
  padding: 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.settings-row:hover { background: var(--bg-card-subtle); color: var(--text-primary); }

/* ---- Command palette (Ctrl+K) */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 8000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.cmdk-panel {
  width: 560px;
  max-width: 92vw;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-muted);
}

#cmdk-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.cmdk-esc {
  font-size: 9px;
  font-weight: 700;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.cmdk-list { max-height: 340px; overflow-y: auto; padding: 6px; }

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
}
.cmdk-item.selected { background: var(--blue-50); color: var(--blue-600); }
.cmdk-item.selected .icon { color: var(--blue-600); }
.cmdk-label { flex: 1; }
.cmdk-empty { padding: 18px; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ---- Keyboard shortcut chips + shortcuts modal */
.shortcuts-grid { display: flex; flex-direction: column; gap: 4px; }

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px dashed var(--border-light);
}
.shortcut-desc { font-size: 12.5px; color: var(--text-secondary); }

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-bottom-width: 2px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
}
.kbd-sm { min-width: 20px; height: 19px; font-size: 9px; padding: 0 5px; }

/* ---- Live ticker tape (seamless marquee) */
.ticker-tape {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  overflow: hidden;
}

.ticker-tape-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 8px 0;
  animation: ticker-scroll 55s linear infinite;
  will-change: transform;
}
.ticker-tape:hover .ticker-tape-track { animation-play-state: paused; }

.ticker-item { display: inline-flex; align-items: baseline; gap: 8px; margin-right: 42px; }
.ticker-sym { font-size: 11px; font-weight: 800; color: #e2e8f0; letter-spacing: 0.6px; }
.ticker-px { font-size: 11px; font-weight: 600; color: #94a3b8; font-family: var(--font-mono); }
.ticker-chg { font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); }
.ticker-chg.up { color: #34d399; }
.ticker-chg.down { color: #fb7185; }
.ticker-loading { color: #64748b; font-size: 11px; padding: 8px 24px; display: inline-block; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-tape-track { animation: none; }
}

/* ---- Audio briefing bar upgrades (label left-aligned, volume, regenerate) */
.audio-info { flex: 1; min-width: 0; text-align: left; }
.audio-title-label { display: flex; align-items: center; gap: 6px; }
.audio-title-label .icon { color: var(--blue-600); }

.audio-controls-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.volume-wrap { display: flex; align-items: center; gap: 7px; color: var(--blue-600); }

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 9999px;
  background: var(--border-focus);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue-600);
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue-600);
  border: none;
  cursor: pointer;
}

.btn-audio-regen {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--blue-border);
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 9999px;
}
.btn-audio-regen:hover { background: var(--blue-50); }
.btn-audio-regen:disabled { opacity: 0.6; cursor: wait; }

/* ---- Chart timeframe controls */
.chart-controls { display: flex; align-items: center; gap: 10px; }

.timeframe-btns {
  display: flex;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.tf-btn { padding: 3px 10px; font-size: 10.5px; font-weight: 700; border-radius: 6px; color: var(--text-muted); background: transparent; }
.tf-btn.active { background: #ffffff; color: var(--blue-600); box-shadow: var(--shadow-sm); }

/* ---- P&L attribution: ticker heatmap + strategy bars */
.attribution-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.attribution-col { min-width: 0; }
.attribution-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.heatmap-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 2px; }
.heatmap-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.heatmap-tile em { font-style: normal; font-size: 10px; font-weight: 600; opacity: 0.92; margin-top: 2px; font-family: var(--font-mono); }
.heatmap-empty { font-size: 11.5px; color: var(--text-muted); padding: 8px 0; display: inline-block; }

.strategy-bars { display: flex; flex-direction: column; gap: 12px; padding: 10px 0 2px; }
.strategy-bar-row { display: flex; flex-direction: column; gap: 4px; }
.strategy-bar-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; }
.strategy-bar-head span:first-child { color: var(--text-secondary); text-transform: capitalize; }
.strategy-bar-track { height: 8px; background: var(--bg-card-subtle); border-radius: 9999px; overflow: hidden; }
.strategy-bar-fill { height: 100%; border-radius: 9999px; transition: width 0.4s ease; }
.strategy-bar-meta { font-size: 10px; color: var(--text-muted); }

/* ---- Greeks & exposure monitor */
.greeks-panel { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px; }

.greek-row { display: grid; grid-template-columns: 128px 1fr 78px; align-items: center; gap: 10px; }

.greek-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.greek-label .icon { color: var(--blue-600); }

.greek-track {
  position: relative;
  height: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 9999px;
}

.greek-band {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.08), rgba(2, 132, 199, 0.16));
  border-radius: 9999px;
}

.greek-marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--emerald-600);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
  transition: left 0.4s ease, background 0.3s ease;
}

.greek-fill { height: 100%; border-radius: 9999px; transition: width 0.4s ease; }
.greek-fill.theta { background: var(--emerald-500); }
.greek-fill.stress { background: var(--amber-500); }
.greek-fill.cash { background: var(--blue-500); }

.greek-threshold {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 62.5%;
  width: 2px;
  background: var(--coral-600);
  opacity: 0.75;
  border-radius: 2px;
}

.greek-val { font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-align: right; color: var(--text-primary); }

/* ---- Journal toolbar (search + status filter + CSV export) */
.journal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.journal-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-muted);
}
.journal-search { border: none; background: transparent; outline: none; font-size: 11.5px; color: var(--text-primary); width: 150px; font-family: var(--font-sans); }

.journal-filter {
  border: 1px solid var(--border-light);
  background: var(--bg-card-subtle);
  border-radius: var(--radius-sm);
  font-size: 11px;
  padding: 4px 6px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

.journal-count-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px 0; }

/* ---- News headline filter */
.news-filter-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 16px 0;
  padding: 6px 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  color: var(--text-muted);
}
.news-filter-input { border: none; background: transparent; outline: none; font-size: 11.5px; width: 100%; color: var(--text-primary); font-family: var(--font-sans); }

/* ---- Deterministic Risk Gate: title left-aligned with shield icon */
.risk-gate-title { display: flex; align-items: center; gap: 8px; }
.risk-gate-title .icon { color: var(--emerald-600); flex-shrink: 0; }

/* ==========================================================================
   DARK THEME — variable overrides + hardcoded surface fixes
   ========================================================================== */
body.dark-theme {
  --bg-main: #0b1220;
  --bg-card: #111a2c;
  --bg-card-subtle: #182338;
  --bg-card-hover: #1c2a42;
  --border-light: #23324e;
  --border-focus: #33456a;
  --text-primary: #e6edf7;
  --text-secondary: #b9c5d9;
  --text-muted: #8b99b0;
  --text-dim: #64748b;
  --emerald-50: rgba(5, 150, 105, 0.16);
  --emerald-border: rgba(5, 150, 105, 0.4);
  --coral-50: rgba(225, 29, 72, 0.16);
  --coral-border: rgba(225, 29, 72, 0.4);
  --blue-50: rgba(2, 132, 199, 0.16);
  --blue-border: rgba(2, 132, 199, 0.45);
  --amber-50: rgba(217, 119, 6, 0.16);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 30px rgba(0, 0, 0, 0.55);
}

body.dark-theme .top-nav { background-color: var(--bg-card); }
body.dark-theme .data-table tr:hover { background-color: var(--bg-card-subtle); }
body.dark-theme .news-item { background: var(--bg-card); }
body.dark-theme .monitor-tile { background: var(--bg-card-subtle); border-color: var(--border-light); }
body.dark-theme .toast { background: var(--bg-card); }
body.dark-theme .audio-status-pill,
body.dark-theme .pill-badge { background: var(--bg-card); }
body.dark-theme .btn-sm-outline { background: var(--bg-card); }
body.dark-theme .btn-icon-only { background: var(--bg-card); }
body.dark-theme .modal-card { background: var(--bg-card); }
body.dark-theme .briefing-bar { background: linear-gradient(90deg, #101c33 0%, #0f2029 100%); border-bottom-color: var(--border-light); }
body.dark-theme .btn-audio-regen { background: var(--bg-card); }
body.dark-theme .tf-btn.active { background: var(--bg-card); }
body.dark-theme .auth-card { background: #111a2c; }
body.dark-theme .auth-tab.active { background: var(--bg-card-subtle); color: var(--text-primary); box-shadow: none; }
body.dark-theme .form-input:focus { background: var(--bg-card-subtle); }
body.dark-theme .greek-marker { background: #e6edf7; }

/* ==========================================================================
   RESPONSIVE REFINEMENTS
   ========================================================================== */
@media (max-width: 1180px) {
  .metrics-row { grid-template-columns: repeat(3, 1fr); }
  .agents-status-bar { flex-wrap: wrap; gap: 10px; }
  .agent-connector { display: none; }
  .main-content-split { grid-template-columns: 1fr; }
  .header-center-info { display: none; }
}

@media (max-width: 760px) {
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .attribution-grid { grid-template-columns: 1fr; }
  .greek-row { grid-template-columns: 96px 1fr 64px; }
  .volume-wrap { display: none; }
  .header-actions { flex-wrap: wrap; }
}
