/* ============================================
   EliteXMercado — Professional Trading Terminal
   Dark theme inspired by Bloomberg / TradingView
   ============================================ */

:root {
  /* Backgrounds — pure dark grayscale */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0c;
  --bg-tertiary: #111114;
  --bg-card: #0e0e11;
  --bg-card-hover: #16161a;
  --bg-elevated: #18181c;
  --bg-input: #1a1a1f;

  /* Borders */
  --border: #1f1f24;
  --border-light: #2a2a31;
  --border-strong: #3a3a44;

  /* Text */
  --text-primary: #f5f5f7;
  --text-secondary: #a8a8b3;
  --text-muted: #6e6e78;
  --text-faint: #4a4a52;

  /* Accent palette */
  --accent: #00b4d8;
  --accent-hover: #00d4ff;
  --accent-dim: rgba(0, 180, 216, 0.15);
  --accent-soft: rgba(0, 180, 216, 0.06);

  /* Semantic colors */
  --green: #22c55e;
  --green-bright: #4ade80;
  --green-dim: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-bright: #f87171;
  --red-dim: rgba(239, 68, 68, 0.15);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.15);
  --orange: #f97316;
  --purple: #a855f7;

  /* Asset colors */
  --nq-accent: #5b8def;
  --nq-accent-soft: rgba(91, 141, 239, 0.08);
  --nq-border: rgba(91, 141, 239, 0.25);

  --es-accent: #f59e0b;
  --es-accent-soft: rgba(245, 158, 11, 0.08);
  --es-border: rgba(245, 158, 11, 0.25);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Radius & shadows */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);

  /* Transitions */
  --t-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── HEADER ─── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-left, .header-right { display: flex; align-items: center; gap: 14px; }
.header-center { display: flex; align-items: center; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.logo-icon {
  color: var(--accent);
  font-size: 1.3rem;
  filter: drop-shadow(0 0 6px rgba(0, 180, 216, 0.4));
}

.logo-text { color: var(--text-primary); font-weight: 600; }
.accent { color: var(--accent); }

.logo-tag {
  font-size: 0.62rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 1.5px;
  border: 1px solid rgba(0, 180, 216, 0.25);
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 100px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

.status-dot.loading { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: pulse 0.5s infinite; }
.status-dot.error { background: var(--red); box-shadow: 0 0 6px var(--red); animation: none; }

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

.user-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.user-email {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-base);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red-bright);
  background: var(--red-dim);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  color: #000;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all var(--t-base);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.3), 0 4px 12px rgba(0, 180, 216, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.5), 0 6px 20px rgba(0, 180, 216, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-small {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-base);
}

.btn-small:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn-cal-refresh {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-base);
  flex-shrink: 0;
  margin-left: auto;
}

.btn-cal-refresh:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ─── TIMELINE ─── */

.timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  height: 44px;
}

.timeline-date-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-date-nav {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-base);
}

.btn-date-nav:hover { border-color: var(--accent); color: var(--accent); }
.btn-date-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-date-nav:disabled:hover { border-color: var(--border); color: var(--text-secondary); }

.date-picker {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-base);
  color-scheme: dark;
  height: 26px;
}

.date-picker:hover { border-color: var(--accent); }
.date-picker:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }

.btn-date-today {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 180, 216, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-base);
  display: inline-flex;
  align-items: center;
  height: 26px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.btn-date-today:hover { background: var(--accent); color: #000; }

.timeline-separator {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.timeline-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.timeline-items {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
}

.timeline-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.timeline-item {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-base);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.timeline-item:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.timeline-item.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.timeline-item.bullish { border-left: 3px solid var(--green); }
.timeline-item.bearish { border-left: 3px solid var(--red); }
.timeline-item.neutral { border-left: 3px solid var(--yellow); }

.timeline-item .provider-badge {
  font-size: 0.58rem;
  opacity: 0.6;
  margin-left: 4px;
  text-transform: uppercase;
}

/* ─── ROLLOVER BANNER ─── */

.rollover-banner {
  display: none;
  background: linear-gradient(90deg, #b91c1c, #dc2626, #b91c1c);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 1000;
  animation: rollover-pulse 2s ease-in-out infinite;
}

@keyframes rollover-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* ─── 3-COLUMN MAIN LAYOUT ─── */

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 0;
  height: calc(100vh - 56px - 44px - 60px);
  overflow: hidden;
  background: var(--bg-primary);
}

.col {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.col-nq { border-right: 1px solid var(--border); }
.col-center { border-right: 1px solid var(--border); }

.col-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  padding: 8px 0;
  border-radius: var(--radius);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.nq-title {
  background: var(--nq-accent-soft);
  color: var(--nq-accent);
  border: 1px solid var(--nq-border);
}

.es-title {
  background: var(--es-accent-soft);
  color: var(--es-accent);
  border: 1px solid var(--es-border);
}

/* ─── CARDS ─── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color var(--t-base);
}

.card:hover { border-color: var(--border-light); }

.card-header {
  padding: 8px 12px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

/* NQ Cards */
.nq-card {
  border-color: var(--nq-border);
}

.nq-card:hover {
  border-color: rgba(91, 141, 239, 0.45);
}

.nq-header {
  color: var(--nq-accent);
  border-bottom-color: var(--nq-border);
  background: var(--nq-accent-soft);
}

/* ES Cards */
.es-card {
  border-color: var(--es-border);
}

.es-card:hover {
  border-color: rgba(245, 158, 11, 0.45);
}

.es-header {
  color: var(--es-accent);
  border-bottom-color: var(--es-border);
  background: var(--es-accent-soft);
}

/* ─── DIRECTION CARD ─── */

.direction-display {
  padding: 14px 16px 10px;
  text-align: center;
}

.direction-arrow {
  font-size: 2.3rem;
  line-height: 1;
  margin-bottom: 6px;
  transition: all 0.5s;
  filter: drop-shadow(0 0 8px currentColor);
}

.direction-arrow.bullish { color: var(--green); }
.direction-arrow.bearish { color: var(--red); }
.direction-arrow.neutral { color: var(--yellow); }

.direction-label {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  margin-bottom: 10px;
}

.direction-label.bullish { color: var(--green); }
.direction-label.bearish { color: var(--red); }
.direction-label.neutral { color: var(--yellow); }

.confidence-bar {
  height: 5px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
}

.confidence-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s ease, background 0.5s;
  background: var(--accent);
  box-shadow: 0 0 8px currentColor;
}

.confidence-fill.high { background: var(--green); }
.confidence-fill.medium { background: var(--yellow); }
.confidence-fill.low { background: var(--red); }

.confidence-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.direction-summary {
  padding: 0 14px 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── EXPANSION CARD ─── */

.expansion-content { padding: 12px; }

.expansion-loading {
  padding: 16px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
}

.exp-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.exp-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.exp-pct {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.exp-bar-container {
  height: 6px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 12px;
}

.exp-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s ease, background 0.5s;
}

.exp-main-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.exp-value-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  text-align: center;
}

.exp-value-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
  font-weight: 600;
}

.exp-value-num {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.exp-value-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.exp-hl-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-secondary);
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.exp-hl-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

.exp-averages { margin-top: 6px; }

.exp-avg-title {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
  font-weight: 600;
}

.exp-avg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.exp-avg-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: baseline;
  gap: 4px;
  padding: 5px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
}

.exp-avg-label {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 600;
}

.exp-avg-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.72rem;
}

.exp-avg-ticks {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.6rem;
}

.exp-weighted-row {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}

.exp-weighted-row strong {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
}

/* ─── SESSION BREAKDOWN ─── */

.exp-sessions { margin-top: 10px; margin-bottom: 4px; }

.exp-sessions-title {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 7px;
  font-weight: 600;
}

.exp-sessions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.exp-session-col {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.exp-session-header {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.exp-session-time {
  font-size: 0.56rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 2px;
}

.exp-session-hl {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.exp-session-hl strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.7rem;
}

.exp-session-range {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.exp-session-range-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.exp-session-range-ticks {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}

.exp-session-na {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

/* ─── CONTRACT & PRICE CARD ─── */

.contract-content { padding: 12px; }

.contract-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.contract-price-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
}

.contract-price-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.contract-price-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-top: 2px;
}

.contract-price-change {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
}

.contract-price-change.up { color: var(--green); }
.contract-price-change.down { color: var(--red); }

.contract-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
}

.contract-name { display: flex; flex-direction: column; gap: 2px; }
.contract-name-label { font-size: 0.56rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.contract-name-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

.contract-rollover { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.contract-rollover-label { font-size: 0.56rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.contract-rollover-val { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; }

.contract-rollover-val.soon { color: var(--yellow); }
.contract-rollover-val.today { color: var(--red); font-weight: 800; }
.contract-rollover-val.ok { color: var(--green); }

/* ─── VOLATILITY CARD ─── */

.volatility-content { padding: 12px; }

.vol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.vol-grid.vol-grid-full { grid-template-columns: 1fr; }

.vol-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color var(--t-base);
}

.vol-item:hover { border-color: var(--border-light); }

.vol-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vol-tf-label { font-size: 0.7rem; font-weight: 700; color: var(--text-primary); letter-spacing: 0.3px; }
.vol-tf-bars { font-size: 0.56rem; color: var(--text-muted); font-family: var(--font-mono); }

.vol-ema-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2px;
}

.vol-ema-val { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 700; }
.vol-ema-pts { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-muted); }

.vol-sma-row { font-family: var(--font-mono); font-size: 0.58rem; color: var(--text-muted); }

.vol-delta { font-size: 0.56rem; font-weight: 600; margin-left: 4px; }
.vol-delta.up { color: var(--green); }
.vol-delta.down { color: var(--red); }

.vol-2m  .vol-ema-val { color: #d4d4d8; }
.vol-5m  .vol-ema-val { color: #38bdf8; }
.vol-15m .vol-ema-val { color: #fbbf24; }
.vol-60m .vol-ema-val { color: #c084fc; }
.vol-1d  .vol-ema-val { color: var(--accent); }

.vol-legend {
  margin-top: 8px;
  font-size: 0.56rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

/* ─── CALENDAR ─── */

.calendar-date {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 400;
}

.calendar-loading {
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
}

.calendar-body { display: flex; flex-direction: column; }

.cal-event {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.cal-event:last-child { border-bottom: none; }

.cal-event-main {
  display: grid;
  grid-template-columns: 72px 18px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  transition: background 0.2s;
}

.cal-event-main:hover { background: var(--bg-card-hover); }
.cal-event.past { opacity: 0.4; }
.cal-event.soon-10 { background: rgba(234, 179, 8, 0.06); }
.cal-event.soon-5  { background: rgba(239, 68, 68, 0.08); }
.cal-event.soon-1  { background: rgba(239, 68, 68, 0.18); animation: blink-event 0.8s infinite; }

@keyframes blink-event {
  0%, 100% { background: rgba(239, 68, 68, 0.18); }
  50%       { background: rgba(239, 68, 68, 0.05); }
}

.cal-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.cal-time.past { color: var(--text-muted); }

.cal-impact-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-impact-dot.high   { background: var(--red); box-shadow: 0 0 6px var(--red); }
.cal-impact-dot.medium { background: var(--yellow); box-shadow: 0 0 4px var(--yellow); }
.cal-impact-dot.low    { background: var(--text-muted); }
.cal-impact-dot.holiday{ background: var(--accent); box-shadow: 0 0 4px var(--accent); }

.cal-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.cal-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-country { font-size: 0.62rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }

.cal-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 80px;
}

.cal-forecast, .cal-previous, .cal-actual {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  white-space: nowrap;
}

.cal-forecast { color: var(--text-muted); }
.cal-previous { color: var(--text-muted); }
.cal-actual   { color: var(--accent); font-weight: 700; }

.cal-countdown {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
  min-width: 60px;
  text-align: center;
}

.cal-countdown.upcoming { background: var(--accent-dim); color: var(--accent); }
.cal-countdown.soon-10 { background: var(--yellow-dim); color: var(--yellow); }
.cal-countdown.soon-5 { background: rgba(239,68,68,0.2); color: var(--red); }
.cal-countdown.soon-1 { background: var(--red); color: #fff; animation: pulse-countdown 0.5s infinite; }

@keyframes pulse-countdown {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.cal-countdown.past { background: transparent; color: var(--text-muted); }

.cal-countdown.polling {
  background: rgba(234, 179, 8, 0.2);
  color: var(--yellow);
  animation: pulse-polling 2s ease-in-out infinite;
  font-size: 0.58rem;
  min-width: 80px;
}

@keyframes pulse-polling {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.cal-countdown.result-positive { background: var(--green-dim); color: var(--green-bright); font-size: 0.6rem; font-weight: 700; }
.cal-countdown.result-negative { background: var(--red-dim); color: var(--red-bright); font-size: 0.6rem; font-weight: 700; }
.cal-countdown.result-neutral { background: var(--accent-dim); color: var(--accent); font-size: 0.6rem; font-weight: 700; }

.cal-event.result-positive { background: rgba(34, 197, 94, 0.06); border-left: 3px solid var(--green); opacity: 1; }
.cal-event.result-negative { background: rgba(239, 68, 68, 0.06); border-left: 3px solid var(--red); opacity: 1; }
.cal-event.result-neutral { background: rgba(0, 180, 216, 0.04); border-left: 3px solid var(--accent); opacity: 1; }

.cal-event.cal-result-flash { animation: result-flash 0.6s ease-out 3; }

@keyframes result-flash {
  0%   { filter: brightness(1); }
  50%  { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

.cal-actual-impact { font-weight: 800; font-size: 0.78rem; }

.cal-expand-icon { font-size: 0.7rem; color: var(--text-muted); margin-right: 2px; transition: transform 0.2s; }

.cal-desc {
  display: none;
  padding: 12px 14px 14px 104px;
  background: var(--accent-soft);
  border-top: 1px dashed var(--border);
  flex-direction: column;
  gap: 8px;
}

.cal-desc.open { display: flex; }
.cal-desc-main { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }
.cal-desc-logic { font-size: 0.74rem; color: var(--text-muted); line-height: 1.5; border-left: 2px solid var(--accent-dim); padding-left: 10px; }
.cal-desc-dirs { display: flex; gap: 18px; flex-wrap: wrap; }
.cal-dir { font-size: 0.74rem; display: flex; gap: 5px; }
.cal-dir span:first-child { color: var(--text-muted); }
.cal-desc-nq-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.cal-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ─── ALARM TOAST ─── */

.alarm-toast {
  position: fixed;
  top: 70px;
  right: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--red);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slide-in-right 0.3s ease;
  max-width: 340px;
}

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

.alarm-toast .alarm-icon { font-size: 1.2rem; }
.alarm-toast .alarm-text { font-size: 0.82rem; line-height: 1.4; }
.alarm-toast .alarm-text strong { color: var(--red); display: block; margin-bottom: 2px; }
.alarm-toast .alarm-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; margin-left: auto; padding: 0 4px;
}
.alarm-toast .alarm-close:hover { color: var(--text-primary); }

/* ─── MARKET DATA GRID — preserve % color logic ─── */

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
  background: var(--bg-primary);
  padding: 4px;
}

.market-loading {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: var(--radius);
}

.market-item {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.market-item:hover {
  transform: translateY(-1px);
  border-color: var(--border-light);
}

.market-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
}

/* % color tiers — gradient from red → yellow → green */
.market-item.pct-very-negative {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.18), var(--bg-tertiary) 70%);
  border-color: rgba(220, 38, 38, 0.3);
}
.market-item.pct-very-negative::before { background: #dc2626; box-shadow: 0 0 8px #dc2626; }

.market-item.pct-negative {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.14), var(--bg-tertiary) 70%);
  border-color: rgba(234, 88, 12, 0.25);
}
.market-item.pct-negative::before { background: #ea580c; }

.market-item.pct-slightly-negative {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.1), var(--bg-tertiary) 70%);
  border-color: rgba(217, 119, 6, 0.2);
}
.market-item.pct-slightly-negative::before { background: #d97706; }

.market-item.pct-neutral {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.08), var(--bg-tertiary) 70%);
  border-color: rgba(234, 179, 8, 0.18);
}
.market-item.pct-neutral::before { background: #eab308; }

.market-item.pct-slightly-positive {
  background: linear-gradient(135deg, rgba(101, 163, 13, 0.1), var(--bg-tertiary) 70%);
  border-color: rgba(101, 163, 13, 0.2);
}
.market-item.pct-slightly-positive::before { background: #65a30d; }

.market-item.pct-positive {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.14), var(--bg-tertiary) 70%);
  border-color: rgba(22, 163, 74, 0.25);
}
.market-item.pct-positive::before { background: #16a34a; }

.market-item.pct-very-positive {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.18), var(--bg-tertiary) 70%);
  border-color: rgba(0, 255, 136, 0.35);
}
.market-item.pct-very-positive::before { background: #00ff88; box-shadow: 0 0 8px #00ff88; }

.market-item-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.market-item-price {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.market-item-change {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.market-item-change.pct-very-negative { color: #fca5a5; }
.market-item-change.pct-negative { color: #fdba74; }
.market-item-change.pct-slightly-negative { color: #fcd34d; }
.market-item-change.pct-neutral { color: #facc15; }
.market-item-change.pct-slightly-positive { color: #bef264; }
.market-item-change.pct-positive { color: #86efac; }
.market-item-change.pct-very-positive { color: #00ff88; text-shadow: 0 0 10px rgba(0, 255, 136, 0.5); }

.market-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.market-item-volume {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.market-section-header {
  grid-column: 1 / -1;
  padding: 7px 12px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.market-section-header:first-child { margin-top: 0; }

/* ─── ANALYSIS SECTION ─── */

.analysis-section {
  padding: 14px;
  background: var(--bg-primary);
}

.analysis-card { flex-shrink: 0; }

.analysis-meta {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.analysis-body {
  padding: 24px 28px;
  line-height: 1.75;
}

.analysis-body h2 {
  color: var(--accent);
  font-size: 1.15rem;
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.analysis-body h2:first-child { margin-top: 0; }

.analysis-body h3 {
  color: var(--text-primary);
  font-size: 1rem;
  margin: 18px 0 10px;
  font-weight: 600;
}

.analysis-body p {
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.analysis-body strong { color: var(--text-primary); font-weight: 600; }

.analysis-body ul, .analysis-body ol {
  margin: 10px 0 14px 22px;
  color: var(--text-secondary);
}

.analysis-body li { margin-bottom: 6px; font-size: 0.92rem; }

.analysis-body code {
  font-family: var(--font-mono);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

.analysis-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  margin: 14px 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

/* ─── EMPTY STATE ─── */

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 18px; opacity: 0.6; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 10px; font-size: 1.1rem; font-weight: 600; }
.empty-state p { font-size: 0.88rem; margin-bottom: 6px; }

/* ─── LOADING OVERLAY ─── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
}

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

.loading-content { text-align: center; padding: 40px; }

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 22px;
  animation: spin 0.8s linear infinite;
  filter: drop-shadow(0 0 10px var(--accent));
}

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

.loading-content h3 { color: var(--text-primary); margin-bottom: 10px; font-size: 1.1rem; font-weight: 600; }
.loading-content p { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 18px; }

.loading-bar {
  width: 260px;
  height: 4px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 100px;
  width: 0%;
  transition: width 0.5s;
  animation: loading-progress 30s ease-out forwards;
  box-shadow: 0 0 8px var(--accent);
}

@keyframes loading-progress {
  0% { width: 0%; }
  10% { width: 15%; }
  30% { width: 35%; }
  50% { width: 50%; }
  70% { width: 65%; }
  90% { width: 80%; }
  100% { width: 90%; }
}

.result-toast {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0, 180, 216, 0.2);
}

/* ─── MUTED ─── */

.muted { color: var(--text-muted); font-size: 0.85rem; }

/* ─── SCROLLBAR ─── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── RESPONSIVE ─── */

@media (max-width: 1400px) {
  .main-grid { grid-template-columns: 1fr 1.2fr 1fr; }
}

@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: 1fr 1fr;
    height: auto;
  }
  .col-es { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .main-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .col { border-right: none !important; border-bottom: 1px solid var(--border); }
}
