/* ── DailyTrader — Clean Design System ────────────────────────────────────── */
:root {
  --sidebar-w:     216px;
  --header-h:      52px;
  --font:          'Inter', 'Segoe UI', system-ui, sans-serif;
  --radius:        8px;
  --radius-lg:     12px;
}

/* ── Dark Theme (default) ────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:       #000000;
  --bg-surface:    #0c0c0c;
  --bg-card:       #141414;
  --bg-elevated:   #1c1c1c;
  --bg-hover:      #242424;
  --border:        rgba(255,255,255,0.1);
  --border-bright: rgba(255,255,255,0.2);
  --accent:        #00d4ff;
  --accent-dim:    rgba(0,212,255,0.1);
  --accent-glow:   rgba(0,212,255,0.3);
  --purple:        #8b5cf6;
  --purple-dim:    rgba(139,92,246,0.12);
  --green:         #22c55e;
  --green-dim:     rgba(34,197,94,0.12);
  --red:           #f43f5e;
  --red-dim:       rgba(244,63,94,0.12);
  --orange:        #f97316;
  --orange-dim:    rgba(249,115,22,0.12);
  --yellow:        #eab308;
  --yellow-dim:    rgba(234,179,8,0.12);
  --text:          #fafafa;
  --text-muted:    #a1a1aa;
  --text-subtle:   #52525b;
  --shadow:        0 8px 40px rgba(0,0,0,0.8), 0 1px 3px rgba(0,0,0,0.6);
  --shadow-sm:     0 2px 12px rgba(0,0,0,0.5);
  --shadow-accent: 0 0 32px rgba(0,212,255,0.1);
  color-scheme: dark;
}

/* ── Light Theme ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:       #f5f5f7;
  --bg-surface:    #ffffff;
  --bg-card:       #ffffff;
  --bg-elevated:   #f0f0f2;
  --bg-hover:      #e8e8ec;
  --border:        rgba(0,0,0,0.1);
  --border-bright: rgba(0,0,0,0.18);
  --accent:        #0088cc;
  --accent-dim:    rgba(0,136,204,0.08);
  --accent-glow:   rgba(0,136,204,0.15);
  --purple:        #7c3aed;
  --purple-dim:    rgba(124,58,237,0.08);
  --green:         #16a34a;
  --green-dim:     rgba(22,163,74,0.08);
  --red:           #dc2626;
  --red-dim:       rgba(220,38,38,0.08);
  --orange:        #ea580c;
  --orange-dim:    rgba(234,88,12,0.08);
  --yellow:        #ca8a04;
  --yellow-dim:    rgba(202,138,4,0.08);
  --text:          #1a1a1a;
  --text-muted:    #6b7280;
  --text-subtle:   #9ca3af;
  --shadow:        0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm:     0 1px 6px rgba(0,0,0,0.06);
  --shadow-accent: 0 0 24px rgba(0,136,204,0.06);
  color-scheme: light;
}

/* ── Nav Icons (SVG-based, no emojis) ────────────────────────────────────── */
.nav-icon, .bn-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.7;
  vertical-align: middle;
}
.bn-icon { width: 20px; height: 20px; }
.active .nav-icon, .active .bn-icon { opacity: 1; }

.icon-briefing { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-checklist { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-plans { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-journal { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-calendar { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-news { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z'/%3E%3Cpath d='M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z'/%3E%3Cpath d='M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-chat { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-pnlcard { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='18' rx='2'/%3E%3Cpath d='M7 15l3-4 3 2 4-5'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='18' rx='2'/%3E%3Cpath d='M7 15l3-4 3 2 4-5'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }
.icon-settings { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E") center/contain no-repeat; background-color: currentColor; }

/* ── Theme Toggle ────────────────────────────────────────────────────────── */
.theme-toggle { display: flex; align-items: center; justify-content: center; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .sidebar { background: var(--bg-surface); border-right-color: var(--border); }
[data-theme="light"] .login-card { box-shadow: var(--shadow); }

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

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border: none;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ── Login Page ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 35%, rgba(0,200,255,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 45% at 85% 70%, rgba(124,58,237,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
}

.login-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow), var(--shadow-accent);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-group input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: rgba(0,200,255,0.4);
  box-shadow: 0 0 0 3px rgba(0,200,255,0.07);
}

.form-group input::placeholder { color: var(--text-subtle); }

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #000000;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius);
  letter-spacing: 0.2px;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 8px;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); opacity: 1; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.login-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(244,63,94,0.25);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  display: none;
}

.login-tab-row {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 10px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.login-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── App Layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}

.nav-section-label {
  padding: 12px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

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

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

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

.nav-item .nav-icon {
  font-size: 15px;
  width: 19px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
}

.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #05050f;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.user-role { font-size: 11px; color: var(--text-muted); }

.btn-icon {
  background: none;
  color: var(--text-muted);
  padding: 5px;
  border-radius: 6px;
  font-size: 13px;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); background: var(--bg-elevated); }

/* ── Main Content ───────────────────────────────────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.live-clock {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(34,197,94,0.6);
  animation: pulse 2.5s ease-in-out infinite;
}

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

.content-area { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  border: 1px solid transparent;
  cursor: pointer;
  letter-spacing: -0.1px;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(0,200,255,0.18);
}
.btn-accent:hover {
  background: rgba(0,200,255,0.14);
  border-color: rgba(0,200,255,0.3);
}

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-bright);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(244,63,94,0.2);
}
.btn-danger:hover { background: rgba(244,63,94,0.18); }

/* ── Badge ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
}
.badge-high    { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(244,63,94,0.2); }
.badge-medium  { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(249,115,22,0.2); }
.badge-low     { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(234,179,8,0.2); }
.badge-holiday { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.badge-green   { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(34,197,94,0.2); }
.badge-purple  { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(124,58,237,0.2); }

/* ── Trade Plan ─────────────────────────────────────────────────────────────── */
.trade-plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.plan-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,200,255,0.15);
  border-radius: var(--radius);
  padding: 4px 11px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.plan-list { display: flex; flex-direction: column; gap: 4px; }

.plan-item {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.plan-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}
.plan-item.active {
  background: var(--bg-elevated);
  border-color: var(--border-bright);
}

.plan-item-info { flex: 1; min-width: 0; }
.plan-item-subject { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-item-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.plan-summary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}
.plan-summary h1, .plan-summary h2, .plan-summary h3 { color: var(--accent); margin: 16px 0 8px; }
.plan-summary h1:first-child, .plan-summary h2:first-child { margin-top: 0; }
.plan-summary p { margin: 8px 0; color: var(--text); }
.plan-summary ul, .plan-summary ol { padding-left: 20px; }
.plan-summary li { margin: 4px 0; }
.plan-summary strong { color: var(--text); font-weight: 600; }
.plan-summary code { background: var(--bg-card); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; color: var(--accent); }
.plan-summary hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── News Feed ──────────────────────────────────────────────────────────────── */
.news-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: 100%; }

.feed-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.username-list { flex: 1; overflow-y: auto; padding: 8px; }

.username-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.username-item:hover { background: var(--bg-hover); }
.username-handle { font-size: 13px; color: var(--text); font-weight: 500; }
.username-handle span { color: var(--text-muted); font-weight: 400; }

.add-username-form {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.add-username-form input {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.add-username-form input:focus { border-color: rgba(0,200,255,0.35); }
.add-username-form input::placeholder { color: var(--text-subtle); }

.tweet-feed { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.tweet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 0.12s;
}
.tweet-card:hover { border-color: var(--border-bright); }

.tweet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tweet-author { display: flex; align-items: center; gap: 8px; }
.tweet-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.tweet-display-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tweet-username { font-size: 12px; color: var(--text-muted); }
.tweet-time { font-size: 11px; color: var(--text-subtle); }
.tweet-text { font-size: 13px; color: var(--text); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.tweet-footer { margin-top: 10px; }

/* ── Calendar ───────────────────────────────────────────────────────────────── */
.calendar-layout { display: flex; flex-direction: column; gap: 24px; }

.event-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.event-section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.event-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.event-table th { text-align: left; padding: 5px 12px; font-size: 10px; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.5px; }

.event-row { background: var(--bg-card); transition: background 0.12s; }
.event-row:hover { background: var(--bg-elevated); }
.event-row td { padding: 9px 12px; font-size: 13px; color: var(--text); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.event-row td:first-child { border-left: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius); }
.event-row td:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; }

.event-row.high-impact td:first-child   { border-left: 2px solid var(--red); }
.event-row.medium-impact td:first-child { border-left: 2px solid var(--orange); }
.event-row.low-impact td:first-child    { border-left: 2px solid var(--yellow); }

.event-name { font-weight: 500; }
.event-currency { font-size: 11px; font-weight: 700; color: var(--accent); }
.event-time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.event-actual { color: var(--green); font-weight: 600; }
.event-forecast, .event-previous { color: var(--text-muted); }

/* ── Settings ───────────────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 13px; font-weight: 500; color: var(--text); }
.settings-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.gmail-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.gmail-connect-btn:hover { border-color: var(--border-bright); color: var(--accent); }
.gmail-connect-btn.connected { border-color: rgba(34,197,94,0.3); color: var(--green); background: var(--green-dim); }

/* ── Settings v2 ─────────────────────────────────────────────────────────── */
.stg-page {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 880px;
}

.stg-header { margin-bottom: -8px; }

.stg-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.stg-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Sections */
.stg-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stg-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stg-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.stg-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Team table */
.stg-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stg-table-head {
  display: grid;
  grid-template-columns: 1fr 100px 110px 120px 160px;
  gap: 8px;
  padding: 0 16px;
  height: 36px;
  align-items: center;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.stg-th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stg-table-row {
  display: grid;
  grid-template-columns: 1fr 100px 110px 120px 160px;
  gap: 8px;
  padding: 0 16px;
  height: 52px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.stg-table-row:last-child { border-bottom: none; }
.stg-table-row:hover { background: var(--bg-hover); }

.stg-td-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stg-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.stg-you-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.2px;
}

.stg-role-select {
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.1s;
}

.stg-role-select:hover:not(:disabled) { border-color: var(--border-bright); }
.stg-role-select:disabled { opacity: 0.5; cursor: default; }

.stg-td-joined {
  font-size: 12px;
  color: var(--text-muted);
}

.stg-td-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  white-space: nowrap;
}

.stg-remove-btn { color: var(--text-muted) !important; }
.stg-remove-btn:hover { color: var(--red) !important; background: var(--red-dim) !important; }

/* Integration cards */
.stg-integrations {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stg-integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stg-int-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.stg-int-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.stg-int-gmail { background: rgba(234,67,53,0.15); color: #ea4335; }
.stg-int-x     { background: rgba(255,255,255,0.08); color: var(--text); }
.stg-int-ai    { background: var(--accent-dim); color: var(--accent); }
.stg-int-cal   { background: rgba(249,115,22,0.15); color: var(--orange); }

.stg-int-meta { flex: 1; min-width: 0; }

.stg-int-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.stg-int-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.stg-int-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.stg-status-on  { background: rgba(34,197,94,0.12); color: var(--green); }
.stg-status-off { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.stg-int-body { padding: 4px 0; }

.stg-int-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  gap: 12px;
}

.stg-int-row-border { border-top: 1px solid var(--border); margin-top: 2px; padding-top: 10px; }

.stg-int-value {
  font-size: 12px;
  color: var(--text-subtle);
  font-weight: 500;
}

/* X account list within integration card */
.stg-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  gap: 10px;
  transition: background 0.1s;
}

.stg-account-row:hover { background: var(--bg-hover); }

.stg-account-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stg-account-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.stg-account-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.stg-account-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0;
}

.stg-empty {
  padding: 14px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Empty States ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── Loading ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-muted); gap: 10px; font-size: 13px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  animation: toastIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 360px;
}
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(244,63,94,0.3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── Session Timer Strip ────────────────────────────────────────────────────── */
.briefing-session-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.timer-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
  transition: border-color 0.3s, background 0.3s, opacity 0.3s, transform 0.3s;
  position: relative;
}

.timer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  min-height: 20px;
}

.timer-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.timer-tag-prep { background: rgba(99,102,241,0.15); color: #818cf8; }
.timer-tag-data { background: rgba(255,180,0,0.12); color: #ffb400; }
.timer-tag-open { background: rgba(0,212,255,0.12); color: var(--accent); }
.timer-tag-key  { background: rgba(255,100,50,0.12); color: #ff8a50; }
.timer-tag-wait { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.timer-tag-go   { background: rgba(34,197,94,0.12); color: var(--green); }
.timer-tag-close { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.timer-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.timer-box.active {
  border-color: rgba(0,212,255,0.3);
  background: rgba(0,212,255,0.06);
  transform: scale(1.02);
}
.timer-box.active .timer-status { color: var(--accent); }

.timer-box.next {
  border-color: rgba(255,180,0,0.2);
  background: rgba(255,180,0,0.04);
}
.timer-box.next .timer-status { color: #ffb400; }

.timer-box.passed { opacity: 0.35; }
.timer-box.passed .timer-status { color: var(--text-subtle); }

.timer-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.timer-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.timer-countdown {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
}

.timer-box.next .timer-countdown { color: #ffb400; }
.timer-box.passed .timer-countdown { color: var(--text-subtle); }
.timer-note { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Briefing Grid ──────────────────────────────────────────────────────────── */
.briefing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.briefing-grid .card.full-width { grid-column: 1 / -1; }

/* ── Structured Plan ────────────────────────────────────────────────────────── */
.structured-plan { display: flex; flex-direction: column; gap: 10px; }

.plan-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
}

.plan-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 9px;
}

.key-levels-section .key-levels-body strong { color: var(--text); }
.setups-section .plan-section-title { margin-bottom: 11px; }

.setup-cards { display: flex; flex-direction: column; gap: 8px; }

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

.setup-card-primary {
  border-color: rgba(0,200,255,0.25);
}

.setup-card-title {
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.setup-card-primary .setup-card-title {
  color: var(--accent);
  background: rgba(0,200,255,0.06);
}

.setup-card-body {
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.setup-field {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.setup-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding-top: 2px;
  min-width: 76px;
}

.setup-value { color: var(--text); flex: 1; }

.bull-section .plan-section-title { color: var(--green); }
.bear-section .plan-section-title { color: var(--red); }
.reminders-section .plan-section-title { color: var(--yellow); }

/* ── Journal Table ──────────────────────────────────────────────────────────── */
.journal-summary-bar {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.journal-summary-bar .stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}

.journal-summary-bar .stat:last-child { border-right: none; }

.journal-summary-bar .stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.journal-summary-bar .stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.journal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
}

.journal-table th {
  text-align: left;
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.journal-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.journal-table td:first-child {
  border-left: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
}

.journal-table td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.journal-table tr:hover td { background: var(--bg-elevated); }

.pnl-positive { color: var(--green); font-weight: 700; }
.pnl-negative { color: var(--red);   font-weight: 700; }
.pnl-zero     { color: var(--text-muted); }

.direction-long  { color: var(--green); font-weight: 700; }
.direction-short { color: var(--red);   font-weight: 700; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal-card.modal-wide { max-width: 720px; }

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

.modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-group input, .field-group select, .field-group textarea {
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.field-group input:focus, .field-group select:focus, .field-group textarea:focus {
  border-color: rgba(0,200,255,0.35);
  box-shadow: 0 0 0 3px rgba(0,200,255,0.06);
}

.field-group select option { background: var(--bg-elevated); }
.field-group input::placeholder, .field-group textarea::placeholder { color: var(--text-subtle); }

/* ── Bias / Direction Buttons ───────────────────────────────────────────────── */
.bias-btn-group { display: flex; gap: 6px; }

.bias-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: all 0.12s;
  text-align: center;
}

.bias-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-bright); }

.bias-btn.active.bull, .bias-btn.active.long, .bias-btn.active.win {
  background: var(--green-dim);
  border-color: rgba(34,197,94,0.3);
  color: var(--green);
}

.bias-btn.active.bear, .bias-btn.active.short, .bias-btn.active.loss {
  background: var(--red-dim);
  border-color: rgba(244,63,94,0.3);
  color: var(--red);
}

.bias-btn.active.neutral {
  background: var(--accent-dim);
  border-color: rgba(0,200,255,0.2);
  color: var(--accent);
}

.bias-btn.active.breakeven {
  background: var(--yellow-dim);
  border-color: rgba(234,179,8,0.25);
  color: var(--yellow);
}

/* ── Checklist View ─────────────────────────────────────────────────────────── */
.checklist-view { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.checklist-row {
  display: flex;
  gap: 10px;
  padding: 10px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.cl-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 86px;
  padding-top: 2px;
}

.cl-val { color: var(--text); flex: 1; }

.bias-bull    { color: var(--green);  font-weight: 700; }
.bias-bear    { color: var(--red);    font-weight: 700; }
.bias-neutral { color: var(--accent); font-weight: 700; }

/* ── Checklist History ──────────────────────────────────────────────────────── */
.checklist-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  gap: 12px;
}

.checklist-history-item:hover {
  border-color: var(--border-bright);
  background: var(--bg-hover);
}

/* ── Two-column layouts ─────────────────────────────────────────────────────── */
.two-col-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - var(--header-h) - 48px);
}
.two-col-sidebar { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.two-col-sidebar-sm { width: 260px; }
.two-col-detail { flex: 1; overflow: hidden; }
.two-col-detail-scroll { flex: 1; overflow-y: auto; }

/* ── Table scroll wrapper ────────────────────────────────────────────────────── */
.table-scroll-wrapper { flex: 1; overflow: auto; }

/* ── Form grids ──────────────────────────────────────────────────────────────── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Topbar Mobile User Menu ─────────────────────────────────────────────────── */
.topbar-user-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.topbar-avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: calc(var(--header-h) - 4px);
  right: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 200px;
  padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 300;
}
.mobile-menu.open { display: block; }

.mobile-menu-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.mobile-menu-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.mobile-menu-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mobile-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.mobile-menu-item:hover { background: var(--bg-hover); }

.mobile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.mobile-menu-logout {
  color: var(--red);
}

/* ── Bottom Nav (mobile) ─────────────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-btn {
  flex: 1;
  min-width: 48px;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.12s;
  white-space: nowrap;
  text-transform: uppercase;
}
.bottom-nav-btn .bn-icon { font-size: 20px; line-height: 1; display: block; margin-bottom: 1px; }
.bottom-nav-btn .bn-label { display: block; }
.bottom-nav-btn.active { color: var(--accent); }
.bottom-nav-btn:hover { color: var(--text); background: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .briefing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .news-layout { grid-template-columns: 1fr; }
  .feed-sidebar { max-height: 220px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .topbar-user-btn { display: block; }
  .content-area { padding: 14px 14px calc(64px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 14px; position: relative; }
  .live-clock { display: none; }
  .two-col-layout { flex-direction: column; height: auto; }
  .two-col-sidebar, .two-col-sidebar-sm { width: 100%; max-height: 200px; flex-shrink: 0; }
  .two-col-detail { min-height: 300px; overflow: visible; }
  .two-col-detail-scroll { overflow: visible; }
  #plan-detail.card { height: auto !important; }
  .briefing-session-strip { grid-template-columns: repeat(2, 1fr); }
  .journal-summary-bar { display: grid; grid-template-columns: repeat(4, 1fr); }
  .journal-summary-bar .stat { border-right: none; border-bottom: 1px solid var(--border); align-items: center; text-align: center; padding: 10px; }
  .journal-summary-bar .stat-value { font-size: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card { max-width: 100%; width: 100%; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow-y: auto; }
  .modal-card.modal-wide { max-width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-row { flex-wrap: wrap; }
  .settings-row > *:last-child { margin-top: 4px; }
  .stg-integrations { grid-template-columns: 1fr; }
  .stg-table-head, .stg-table-row { grid-template-columns: 1fr 80px 100px 100px 120px; }
  .stg-table-head { display: none; }
  .stg-table-row { grid-template-columns: 1fr auto; height: auto; padding: 12px 14px; gap: 6px; }
  .stg-td-role, .stg-td-joined { display: none; }
  .stg-td-actions { grid-column: 2; grid-row: 1; }
  .table-scroll-wrapper { -webkit-overflow-scrolling: touch; }
  .event-table th, .event-table td { padding: 8px 10px; font-size: 12px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; min-height: 36px; }
  #toast-container { bottom: calc(64px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .toast { max-width: 100%; }
  .card { padding: 14px; }
  .login-card { padding: 32px 20px; }
  .journal-topbar { flex-direction: column; gap: 10px; align-items: stretch; }
  .journal-topbar > div { justify-content: space-between; }
  .equity-chart-card { display: none; }
  .cal-stat-pill { padding: 8px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
  .briefing-session-strip { grid-template-columns: repeat(2, 1fr); }
  .journal-summary-bar { grid-template-columns: repeat(2, 1fr); }
  .content-area { padding: 10px 10px calc(64px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 14px; }
  .card-title { font-size: 13px; }
}

/* ── Economic Calendar ───────────────────────────────────────────────────────── */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.cal-sync-label { font-size: 11px; color: var(--text-subtle); }

.cal-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cal-filter-select {
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.cal-filter-select:focus { border-color: rgba(0,200,255,0.35); outline: none; }
.cal-filter-select option { background: var(--bg-elevated); }

.cal-days { display: flex; flex-direction: column; gap: 12px; }

.cal-day-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.cal-day-header.cal-day-today {
  background: rgba(0,200,255,0.06);
  border-bottom-color: rgba(0,200,255,0.12);
}

.cal-day-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  min-width: 36px;
}

.cal-day-header.cal-day-today .cal-day-name { color: var(--accent); }
.cal-day-date { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.cal-today-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  background: var(--accent);
  color: #06060f;
  border-radius: 100px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.cal-day-count { margin-left: auto; font-size: 11px; color: var(--text-subtle); }

.cal-table { width: 100%; border-collapse: collapse; }
.cal-thead-row { background: var(--bg-surface); }

.cal-th {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cal-row { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.cal-row:last-child { border-bottom: none; }
.cal-row:hover { background: var(--bg-hover); }

.cal-td { padding: 9px 12px; font-size: 12px; color: var(--text); vertical-align: middle; white-space: nowrap; }
.cal-time { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 70px; }
.cal-ccy { display: flex; align-items: center; gap: 5px; font-weight: 600; min-width: 58px; }
.cal-impact-cell { width: 20px; text-align: center; padding: 9px 6px; }

.cal-impact-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  vertical-align: middle;
}
.cal-impact-dot.high    { background: var(--red);    box-shadow: 0 0 5px rgba(244,63,94,0.5); }
.cal-impact-dot.medium  { background: var(--orange);  box-shadow: 0 0 5px rgba(249,115,22,0.5); }
.cal-impact-dot.low     { background: var(--yellow);  box-shadow: 0 0 4px rgba(234,179,8,0.4); }
.cal-impact-dot.holiday { background: var(--text-subtle); }

.cal-name { white-space: normal; min-width: 160px; }
.cal-num { text-align: right; font-variant-numeric: tabular-nums; min-width: 60px; }
.cal-muted { color: var(--text-muted); }
.cal-actual-val { color: var(--green); font-weight: 600; }
.cal-released-none { color: var(--text-subtle); font-size: 11px; }
.cal-dash { color: var(--text-subtle); }

.cal-row-past .cal-time        { color: var(--text-subtle); }
.cal-row-past .cal-ccy span    { color: var(--text-muted); }
.cal-row-past .cal-impact-dot  { opacity: 0.3; }
.cal-row-past .cal-name        { color: var(--text-muted); }
.cal-row-past .cal-num         { color: var(--text-subtle); }
.cal-row-past .cal-actual-val  { color: var(--green); }
.cal-row-past .cal-dash        { color: var(--border); }
.cal-row-past:hover            { background: rgba(255,255,255,0.02) !important; }

.cal-past-mark {
  display: inline-block;
  margin-left: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  opacity: 0.75;
}

@media (max-width: 768px) {
  .cal-toolbar { flex-direction: column; align-items: flex-start; }
  .cal-filters { width: 100%; }
  .cal-filter-select { flex: 1; min-width: 90px; }
  .cal-th:nth-child(6), .cal-th:nth-child(7),
  .cal-td:nth-child(6), .cal-td:nth-child(7) { display: none; }
  .cal-name { min-width: 120px; }
}

/* ── Equity Curve Chart ──────────────────────────────────────────────────────── */
.equity-chart-card { flex-shrink: 0; padding: 14px 16px; }

.equity-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.equity-chart-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.equity-chart-sub {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.equity-chart-wrap { height: 130px; position: relative; }

/* ── AI Chat ─────────────────────────────────────────────────────────────────── */
.chat-layout {
  display: flex;
  gap: 14px;
  height: calc(100vh - var(--header-h) - 48px);
  min-height: 0;
}

.chat-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.chat-session-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-session-item {
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.chat-session-item:hover { background: var(--bg-hover); border-color: var(--border); }

.chat-session-active {
  background: rgba(0,200,255,0.06);
  border-color: rgba(0,200,255,0.18) !important;
  cursor: default;
}
.chat-session-active:hover { background: rgba(0,200,255,0.06); }

.chat-session-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 3px;
}

.chat-session-preview {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  line-height: 1.4;
}

.chat-session-date { font-size: 10px; color: var(--text-subtle); }

.chat-session-empty {
  font-size: 12px;
  color: var(--text-subtle);
  text-align: center;
  padding: 28px 12px;
  line-height: 1.7;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 16px;
  scroll-behavior: smooth;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 60px 24px;
  gap: 10px;
}
.chat-welcome-icon { font-size: 36px; margin-bottom: 6px; opacity: 0.8; }
.chat-welcome p { font-size: 15px; color: var(--text); margin: 0; font-weight: 500; }
.chat-welcome-sub { font-size: 13px; color: var(--text-muted) !important; font-weight: 400 !important; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 12px;
  max-width: 540px;
}

.chat-suggestion-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.12s;
}
.chat-suggestion-btn:hover {
  border-color: rgba(0,200,255,0.3);
  color: var(--accent);
  background: var(--accent-dim);
}

.chat-message { display: flex; max-width: 78%; }
.chat-message-user { align-self: flex-end; }
.chat-message-assistant { align-self: flex-start; }

.chat-message-user .chat-bubble {
  background: rgba(0,200,255,0.09);
  border: 1px solid rgba(0,200,255,0.16);
  color: var(--text);
  border-radius: 16px 16px 3px 16px;
  padding: 10px 15px;
  font-size: 14px;
  line-height: 1.55;
}

.chat-message-assistant .chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 16px 16px 16px 3px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.65;
  max-width: 100%;
}

.chat-bubble h1, .chat-bubble h2, .chat-bubble h3 {
  color: var(--accent);
  margin: 12px 0 5px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.chat-bubble h1:first-child,
.chat-bubble h2:first-child,
.chat-bubble h3:first-child { margin-top: 0; }
.chat-bubble p   { margin: 5px 0; }
.chat-bubble ul, .chat-bubble ol { padding-left: 18px; margin: 5px 0; }
.chat-bubble li  { margin: 3px 0; }
.chat-bubble strong { color: var(--text); font-weight: 600; }
.chat-bubble code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: var(--accent);
}
.chat-bubble hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.chat-cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1s step-end infinite;
  font-weight: 700;
  margin-left: 2px;
}

.chat-thinking {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}
.chat-dots::after {
  content: '';
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  overflow-y: hidden;
  max-height: 140px;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.chat-input:focus {
  border-color: rgba(0,200,255,0.3);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,200,255,0.05);
}
.chat-input::placeholder { color: var(--text-subtle); }

.chat-send-btn  { border-radius: 9px; padding: 10px 18px; align-self: flex-end; flex-shrink: 0; }
.chat-clear-btn { border-radius: 9px; padding: 10px 12px; align-self: flex-end; flex-shrink: 0; font-size: 12px; }

@media (max-width: 768px) {
  .chat-layout { flex-direction: column; height: auto; }
  .chat-sidebar { width: 100%; max-height: 160px; }
  .chat-session-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 6px; gap: 6px; }
  .chat-session-item { flex-shrink: 0; max-width: 180px; }
  .chat-container { min-height: calc(100vh - var(--header-h) - 260px); }
  .chat-message { max-width: 92%; }
}

/* ── P&L Calendar ────────────────────────────────────────────────────────────── */
.pnl-cal-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.journal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  padding: 5px 14px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  transition: all 0.12s;
}

.view-toggle-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.view-toggle-btn:hover:not(.active) { color: var(--text); }

.cal-month-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 150px;
  text-align: center;
}

.cal-stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cal-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  min-width: 90px;
  gap: 3px;
  flex: 1;
}

.cal-stat-pill span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.cal-stat-pill strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.cal-stat-win strong  { color: var(--green); }
.cal-stat-loss strong { color: var(--red); }

.cal-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-dow-row > div {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.12s, background 0.12s;
}

.cal-cell[onclick] { cursor: pointer; }
.cal-cell[onclick]:hover { border-color: var(--border-bright); }

.cal-empty {
  background: transparent;
  border-color: transparent;
}

.cal-weekend {
  background: var(--bg-surface);
  opacity: 0.45;
}

.cal-future { opacity: 0.35; }

.cal-today {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.cal-win {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.28);
}
.cal-win:hover { background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.45); }

.cal-loss {
  background: rgba(244,63,94,0.1);
  border-color: rgba(244,63,94,0.28);
}
.cal-loss:hover { background: rgba(244,63,94,0.16); border-color: rgba(244,63,94,0.45); }

.cal-be {
  border-color: rgba(255,255,255,0.14);
}

.cal-day-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-subtle);
  line-height: 1;
}

.cal-today .cal-day-num {
  color: var(--accent);
  font-weight: 700;
}

.cal-day-pnl {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: auto;
}

.cal-win  .cal-day-pnl { color: var(--green); }
.cal-loss .cal-day-pnl { color: var(--red); }
.cal-be   .cal-day-pnl { color: var(--text-muted); }

.cal-day-trades {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
}

/* Day detail panel */
.cal-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

#cal-day-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 4px;
}

#cal-day-detail:empty { display: none; }

/* ── P&L Card Page ────────────────────────────────────────────────────────── */
.pnl-page { display: grid; grid-template-columns: 380px 1fr; gap: 24px; height: calc(100vh - var(--header-h) - 48px); }
.pnl-form-panel { display: flex; flex-direction: column; gap: 16px; }
.pnl-preview-panel { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.pnl-canvas-wrap { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 400px; }
.pnl-canvas-wrap canvas { border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,0.4); max-width: 100%; }
.pnl-actions { display: flex; gap: 8px; justify-content: center; }
.pnl-history-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.pnl-history-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color 0.15s; }
.pnl-history-item:hover { border-color: var(--accent); }
.pnl-history-item .pnl-hist-date { font-size: 13px; font-weight: 600; color: var(--text); }
.pnl-history-item .pnl-hist-total { font-size: 13px; font-weight: 700; }
.pnl-history-item .pnl-hist-meta { font-size: 11px; color: var(--text-muted); }
.pnl-firm-row { display: flex; gap: 12px; align-items: end; }
.pnl-firm-row .form-group { flex: 1; }
.pnl-firm-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

@media (max-width: 900px) {
  .pnl-page { grid-template-columns: 1fr; height: auto; }
}
