/* =================================================================
   Trading Dashboard — Unified Design System
   style-guide.css — Master Stylesheet
   Version: 2.0 — Synced to production Set A tokens (2026-03-03)
   ================================================================= */

/* ── Legacy aliases (backward compat for dashboards using Set B token names) ── */
:root {
  --bg-card:     var(--card);
  --bg-card-alt: var(--card2);
  --bg-card2:    var(--card2);
  --text-dim:    var(--text2);
  --bullish:     var(--bull);
  --bullish-bg:  var(--bull-bg);
  --bearish:     var(--bear);
  --bearish-bg:  var(--bear-bg);
  --purple:      #a371f7;
  --purple-bg:   rgba(163, 113, 247, 0.15);
  --gold:        #ffd600;
  --gold-bg:     rgba(255, 214, 0, 0.12);
  --warn:        #f85149;
  --border-lt:   var(--border-light);
}

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

/* Ensure [hidden] attribute always wins over any display rule in author stylesheets.
   Without this, elements with display:flex/block/grid in CSS stay visible even when
   hidden is set via JS (e.g. modal-overlay, side-panel). */
[hidden] { display: none !important; }

/* ── Core Design Tokens (Set A — matches all production dashboards) ── */
:root {
  /* Backgrounds */
  --bg:      #0f1117;
  --card:    #1a1d27;
  --card2:   #22263a;

  /* Text */
  --text:    #e1e4eb;
  --text2:   #8b90a0;

  /* Borders */
  --border:  #2a2e3f;

  /* Signal Colors */
  --bull:    #FF9800;
  --bull-bg: rgba(255, 152, 0, 0.13);
  --bear:    #2196F3;
  --bear-bg: rgba(33, 150, 243, 0.13);

  --green:   #3fb950;
  --red:     #f85149;
  --yellow:  #ffd600;
  --yellow-bg: rgba(255, 214, 0, 0.10);
  --blue:    #448aff;
  --blue-bg: rgba(68, 138, 255, 0.10);

  /* ── Extended Tokens (design preview components only) ── */
  --bg-hover:     rgba(136, 152, 170, 0.08);
  --text-faint:   #484f58;
  --border-light: #30363d;
  --grey:         #484f58;
  --grey-bg:      rgba(72, 79, 88, 0.20);

  /* Typography */
  --font: 'Roboto Mono', 'Courier New', monospace;
  --text-xs:   0.7rem;
  --text-sm:   0.8rem;
  --text-md:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Radius */
  --radius-sm:   3px;
  --radius:      6px;
  --radius-lg:   8px;
  --radius-pill: 9999px;

  /* Layout */
  --header-h: 48px;
  --nav-h:    40px;
}

/* ── Base ───────────────────────────────────────────────────────── */
html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* Scrollbar */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Selection */
::selection {
  background: rgba(68, 138, 255, 0.3);
  color: var(--text);
}


/* =================================================================
   1. HEADER BAR
   Fixed top bar — title left, market status + timestamp right
   ================================================================= */
.td-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
}

.td-header-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.td-header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* Market status: Live / Closed */
.td-market-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.td-market-status.live {
  color: var(--bull);
  background: var(--bull-bg);
}

.td-market-status.live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bull);
  box-shadow: 0 0 6px rgba(255, 152, 0, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

.td-market-status.closed {
  color: var(--text-faint);
  background: var(--grey-bg);
}

.td-market-status.closed .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

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


/* =================================================================
   2. NAVIGATION BAR
   Fixed below header — dashboard links grouped by market
   ================================================================= */
.td-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 var(--sp-4);
  height: var(--nav-h);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.td-nav::-webkit-scrollbar { height: 0; }

.td-nav-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 var(--sp-3);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.td-nav-group:last-child { border-right: none; }

.td-nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  padding-right: var(--sp-2);
  flex-shrink: 0;
}

.td-nav-link {
  font-size: var(--text-xs);
  color: var(--text-faint);
  padding: var(--sp-1) 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.td-nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

.td-nav-link.active {
  color: var(--blue);
  background: var(--blue-bg);
}


/* =================================================================
   CONTENT AREA
   Offset for fixed header + nav
   ================================================================= */
.td-content {
  padding-top: calc(var(--header-h) + var(--nav-h) + var(--sp-6));
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
  padding-bottom: var(--sp-8);
}


/* =================================================================
   3. MARKET GROUP BADGE
   Pill showing NSE F&O / US / MCX
   ================================================================= */
.badge-market {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.badge-market.nse {
  color: var(--blue);
  background: var(--blue-bg);
  border: 1px solid rgba(68, 138, 255, 0.2);
}

.badge-market.us {
  color: var(--bull);
  background: var(--bull-bg);
  border: 1px solid rgba(255, 152, 0, 0.2);
}

.badge-market.mcx {
  color: var(--yellow);
  background: var(--yellow-bg);
  border: 1px solid rgba(255, 214, 0, 0.2);
}


/* =================================================================
   4. STRATEGY BADGE
   Pill showing Intraday / Positional
   ================================================================= */
.badge-strategy {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-strategy.intraday {
  color: #f0883e;
  background: rgba(240, 136, 62, 0.15);
  border: 1px solid rgba(240, 136, 62, 0.2);
}

.badge-strategy.positional {
  color: #a371f7;
  background: rgba(163, 113, 247, 0.15);
  border: 1px solid rgba(163, 113, 247, 0.2);
}


/* =================================================================
   5. DATA TABLE
   Alternating rows, sticky headers, right-aligned numbers
   ================================================================= */
.td-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.td-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
  white-space: nowrap;
}

/* Sticky column headers */
.td-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  color: var(--text2);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 2px solid var(--border-light);
  text-align: left;
  user-select: none;
}

.td-table thead th.num { text-align: right; }

/* Body cells */
.td-table tbody td {
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.td-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.td-table tbody td.symbol {
  font-weight: 700;
  color: var(--text);
}

/* Alternating row shading */
.td-table tbody tr:nth-child(even) td {
  background: var(--card2);
}

/* Hover */
.td-table tbody tr:hover td {
  background: var(--bg-hover);
}

/* Signal cell colors */
.td-table .signal-buy  { color: var(--bull); font-weight: 700; }
.td-table .signal-sell { color: var(--bear);   font-weight: 700; }

/* Row-level highlights */
.td-table tbody tr.row-super td   { background: rgba(255, 214, 0, 0.07) !important; }
.td-table tbody tr.row-aligned td { background: rgba(255, 152, 0, 0.07)  !important; }
.td-table tbody tr.row-against td { background: rgba(33, 150, 243, 0.07)  !important; }

/* Collision state — inline badges and row tints */
.collision-aligned       { color: var(--green);      background: rgba(63, 185, 80, 0.10); }
.collision-amplified     { color: var(--bull);        background: var(--bull-bg); }
.collision-dampened      { color: var(--text2);       background: var(--grey-bg); }
.collision-inverted      { color: var(--bear);        background: var(--bear-bg); }
.collision-indeterminate { color: var(--yellow);      background: var(--yellow-bg); }

/* Row-level tints (table rows, signal cards) */
.td-table tbody tr.collision-aligned td       { background: rgba(63, 185, 80, 0.06)  !important; }
.td-table tbody tr.collision-amplified td     { background: rgba(255, 152, 0, 0.08)  !important; }
.td-table tbody tr.collision-dampened td      { background: rgba(72, 79, 88, 0.10)   !important; }
.td-table tbody tr.collision-inverted td      { background: rgba(33, 150, 243, 0.08) !important; }
.td-table tbody tr.collision-indeterminate td { background: rgba(255, 214, 0, 0.05)  !important; }

/* Signal card left-border variants */
.signal-card.collision-aligned       { border-left-color: var(--green); }
.signal-card.collision-amplified     { border-left-color: var(--bull); }
.signal-card.collision-dampened      { border-left-color: var(--grey); }
.signal-card.collision-inverted      { border-left-color: var(--bear); }
.signal-card.collision-indeterminate { border-left-color: var(--yellow); }

/* Sortable column indicator */
.td-table thead th.sortable { cursor: pointer; }
.td-table thead th.sortable:hover { color: var(--text); }
.td-table thead th.sortable::after {
  content: ' \2195';
  color: var(--text-faint);
  font-size: 0.6rem;
}
.td-table thead th.sort-asc::after  { content: ' \2191'; color: var(--blue); }
.td-table thead th.sort-desc::after { content: ' \2193'; color: var(--blue); }


/* =================================================================
   6. SIGNAL CARD
   Compact card for fired signals — symbol, type, entry, SL, target
   ================================================================= */
.signal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

.signal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--grey);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.signal-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.signal-card.buy  { border-left-color: var(--bull); }
.signal-card.sell { border-left-color: var(--bear); }

.signal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.signal-card-symbol {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

.signal-card-type {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.signal-card-type.buy  { color: var(--bull); background: var(--bull-bg); }
.signal-card-type.sell { color: var(--bear);   background: var(--bear-bg); }

.signal-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-2);
}

.signal-card-field {
  display: flex;
  flex-direction: column;
}

.signal-card-label {
  font-size: var(--text-xs);
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.signal-card-value {
  font-size: var(--text-base);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.signal-card-value.entry  { color: var(--text); }
.signal-card-value.sl     { color: var(--bear); }
.signal-card-value.target { color: var(--bull); }

.signal-card-meta {
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text2);
  display: flex;
  justify-content: space-between;
}


/* =================================================================
   6b. DUAL-ENGINE CONFIDENCE BARS
   Shows Engine 1 (catalyst) and Engine 2 (mechanics) confidence
   side by side as thin horizontal fill bars.
   Usage:
     <div class="engine-bar-wrap">
       <span class="engine-bar-label">E1</span>
       <div class="engine-bar cat">
         <div class="engine-bar-fill" style="width:72%"></div>
       </div>
       <span class="engine-bar-label">E2</span>
       <div class="engine-bar mech">
         <div class="engine-bar-fill" style="width:58%"></div>
       </div>
     </div>
   ================================================================= */
.engine-bar-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.engine-bar-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text2);
  white-space: nowrap;
  flex-shrink: 0;
}

.engine-bar {
  height: 4px;
  border-radius: 2px;
  flex: 1;
  background: var(--border);
  overflow: hidden;
}

.engine-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Engine 1 — Catalyst (WHY) → orange/bull */
.engine-bar.cat .engine-bar-fill  { background: var(--bull); }

/* Engine 2 — Mechanics (HOW) → blue/bear */
.engine-bar.mech .engine-bar-fill { background: var(--bear); }

/* Confidence value labels (optional, shown next to bar) */
.engine-bar-value {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  flex-shrink: 0;
  min-width: 26px;
  text-align: right;
}

.engine-bar.cat  + .engine-bar-value { color: var(--bull); }
.engine-bar.mech + .engine-bar-value { color: var(--bear); }


/* =================================================================
   7. STATUS BADGE
   Three states: Active (green), No Signal (grey), Error (red)
   ================================================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.active     { color: var(--bull);      background: var(--bull-bg); }
.status-badge.active .dot { background: var(--bull); }

.status-badge.none       { color: var(--text-faint);  background: var(--grey-bg); }
.status-badge.none .dot  { background: var(--text-faint); }

.status-badge.error      { color: var(--bear);          background: var(--bear-bg); }
.status-badge.error .dot { background: var(--bear); }


/* =================================================================
   7b. LAYER HEALTH GRID
   Compact grid for engine_health.html — shows all 21 layers at a
   glance. Each cell is a small tile with layer ID + status dot.
   Auto-wraps: 15 catalyst tiles then 6 mechanics tiles.
   Usage:
     <div class="layer-grid">
       <div class="layer-grid-section">
         <div class="layer-grid-heading">Engine 1 — Catalyst</div>
         <div class="layer-grid-cells">
           <div class="layer-cell ok">
             <span class="layer-cell-dot"></span>
             <span class="layer-cell-id">L06</span>
             <span class="layer-cell-name">Econ</span>
           </div>
           <div class="layer-cell stale">...</div>
           <div class="layer-cell tripped">...</div>
         </div>
       </div>
     </div>
   ================================================================= */
.layer-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.layer-grid-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.layer-grid-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
}

.layer-grid-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

/* Individual layer tile */
.layer-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-family: var(--font);
  transition: border-color 0.15s, background 0.15s;
}

.layer-cell:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}

.layer-cell-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-cell-id {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.layer-cell-name {
  font-size: 0.6rem;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── State: OK ── */
.layer-cell.ok {
  border-color: rgba(63, 185, 80, 0.25);
}
.layer-cell.ok .layer-cell-dot {
  background: var(--green);
  box-shadow: 0 0 4px rgba(63, 185, 80, 0.5);
}

/* ── State: STALE (no signal within 3× half-life) ── */
.layer-cell.stale {
  border-color: rgba(255, 214, 0, 0.25);
  background: rgba(255, 214, 0, 0.04);
}
.layer-cell.stale .layer-cell-dot {
  background: var(--yellow);
}
.layer-cell.stale .layer-cell-id {
  color: var(--yellow);
}

/* ── State: TRIPPED (circuit breaker open) ── */
.layer-cell.tripped {
  border-color: rgba(33, 150, 243, 0.3);
  background: rgba(33, 150, 243, 0.06);
}
.layer-cell.tripped .layer-cell-dot {
  background: var(--bear);
  animation: pulse 2s ease-in-out infinite;
}
.layer-cell.tripped .layer-cell-id {
  color: var(--bear);
}


/* =================================================================
   8. REFRESH TIMER
   "Last updated: 2 min ago" countdown text
   ================================================================= */
.refresh-timer {
  font-size: var(--text-xs);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

.refresh-timer .timer-icon {
  opacity: 0.6;
}

.refresh-timer.stale {
  color: var(--yellow);
}

.refresh-timer.error {
  color: var(--bear);
}


/* =================================================================
   SECTION DIVIDERS (for preview / multi-section pages)
   ================================================================= */
.td-section {
  margin-bottom: var(--sp-8);
}

.td-section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.td-section-desc {
  font-size: var(--text-sm);
  color: var(--text2);
  margin-bottom: var(--sp-4);
}


/* =================================================================
   UTILITY CLASSES
   ================================================================= */

/* Text colors */
.text-bull   { color: var(--bull)   !important; }
.text-bear   { color: var(--bear)   !important; }
.text-yellow { color: var(--yellow) !important; }
.text-blue   { color: var(--blue)   !important; }
.text-dim    { color: var(--text2)  !important; }
.text-faint  { color: var(--text-faint) !important; }

/* Subtle backgrounds */
.bg-bull   { background: var(--bull-bg) !important; }
.bg-bear   { background: var(--bear-bg) !important; }
.bg-yellow { background: var(--yellow-bg) !important; }
.bg-blue   { background: var(--blue-bg)   !important; }

/* Layout */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

/* Typography */
.fw-bold  { font-weight: 700; }
.fw-semi  { font-weight: 600; }
.right    { text-align: right; }
.center   { text-align: center; }
.nowrap   { white-space: nowrap; }
.tabnum   { font-variant-numeric: tabular-nums; }
.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }

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

/* Cards (generic) */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

/* Inline code / value highlight */
.val {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.val.up   { color: var(--bull); }
.val.down { color: var(--bear); }

/* Change percentage badge */
.change-pct {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}
.change-pct.up   { color: var(--bull); background: var(--bull-bg); }
.change-pct.down { color: var(--bear);   background: var(--bear-bg); }


/* =================================================================
   9. ANALYSIS CARDS
   Bordered info rows used inside modals — label + body text
   ================================================================= */
.analysis-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--grey);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.analysis-card-label {
  font-weight: 700;
  margin-right: 6px;
}

/* Blue variant — trend, anchor, breakout */
.analysis-card.card-blue {
  border-left-color: var(--bear);
}
.analysis-card.card-blue .analysis-card-label {
  color: var(--bear);
}

/* Orange variant — ORB, range */
.analysis-card.card-orange {
  border-left-color: var(--bull);
}
.analysis-card.card-orange .analysis-card-label {
  color: var(--bull);
}

/* Yellow variant — alert rows, buzz */
.analysis-card.card-yellow {
  border-left-color: #f0c040;
  background: rgba(240, 192, 64, 0.08);
}
.analysis-card.card-yellow .analysis-card-label {
  color: #f0c040;
}

/* Purple variant — patterns, clusters */
.analysis-card.card-purple {
  border-left-color: #a78bfa;
}
.analysis-card.card-purple .analysis-card-label {
  color: #a78bfa;
}

/* Green variant — confirmed signals only */
.analysis-card.card-green {
  border-left-color: #3fb950;
}
.analysis-card.card-green .analysis-card-label {
  color: #3fb950;
}


/* =================================================================
   10. STAT BAR
   Row of metric boxes — LTP, Change, Boxes, Buzz, Columns
   ================================================================= */
.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.stat-box {
  background: var(--card2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 100px;
  text-align: center;
  flex: 1;
}

.stat-box-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.stat-box-value.highlight {
  color: var(--bull);
}

.stat-box-value.up {
  color: var(--bull);
}

.stat-box-value.down {
  color: var(--bear);
}

.stat-box-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-top: 2px;
}


/* =================================================================
   11. P&F CHART GRID
   Grid of square cells — X (orange), O (blue), empty (invisible)
   ================================================================= */
.pnf-grid {
  display: inline-grid;
  gap: 2px;
  background: var(--bg);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pnf-cell {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.pnf-cell.x-cell {
  border: 1px solid var(--bull);
  color: var(--bull);
  border-radius: 2px;
}

.pnf-cell.o-cell {
  border: 1px solid var(--bear);
  color: var(--bear);
  border-radius: 2px;
}

.pnf-cell.empty {
  border: none;
  color: transparent;
}

.pnf-col-labels {
  display: inline-grid;
  gap: 2px;
  padding: 4px var(--sp-3) 0;
}

.pnf-col-label {
  width: 22px;
  text-align: center;
  font-size: 11px;
  color: var(--text2);
  font-family: var(--font);
}


/* =================================================================
   12. NEWS FEED
   List of news items below chart — headline + source/date
   ================================================================= */
.news-feed {
  max-width: 640px;
}

.news-feed-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-bottom: var(--sp-3);
}

.news-item {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}

.news-item:last-child {
  border-bottom: none;
}

.news-item-headline {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  line-height: 1.5;
}

.news-item-headline:hover {
  text-decoration: underline;
  color: var(--text);
}

.news-item-meta {
  font-size: 11px;
  color: var(--text2);
  margin-top: 3px;
}


/* =================================================================
   13. MODAL BOX
   Popup over dashboard — overlay, close btn, title, body, actions
   ================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  position: relative;
}

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

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-body {
  padding: var(--sp-5);
  font-size: var(--text-md);
  color: var(--text);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

.modal-btn {
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 7px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.modal-btn.cancel {
  background: transparent;
  color: var(--text2);
  border-color: var(--border-light);
}

.modal-btn.cancel:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-btn.confirm {
  background: var(--bull);
  color: #000;
  border-color: var(--bull);
}

.modal-btn.confirm:hover {
  background: #ffad33;
}


/* =================================================================
   14. TOOLTIP
   Small hover label above element — dark bg, white text, arrow down
   ================================================================= */
.td-tooltip-wrap {
  position: relative;
  display: inline-block;
}

.td-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--border-light);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  pointer-events: none;
  z-index: 150;
  transition: opacity 0.15s, visibility 0.15s;
}

/* Down-pointing arrow */
.td-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border-light);
}

.td-tooltip-wrap:hover .td-tooltip {
  visibility: visible;
  opacity: 1;
}


/* =================================================================
   15. NOTIFICATION POPUP
   Bottom-right alert — success / error / info, auto-dismiss 5s
   ================================================================= */
.notification-stack {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 250;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--sp-3);
}

.notification {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: var(--card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--grey);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: notif-in 0.25s ease-out;
}

@keyframes notif-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.notification-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notification-content {
  flex: 1;
}

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

.notification-msg {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
}

.notification-dismiss {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

.notification-dismiss:hover {
  color: var(--text);
}

/* Success (bullish orange) */
.notification.success {
  border-left-color: var(--bull);
}
.notification.success .notification-icon {
  color: var(--bull);
}

/* Error (bearish blue) */
.notification.error {
  border-left-color: var(--bear);
}
.notification.error .notification-icon {
  color: var(--bear);
}

/* Info (grey) */
.notification.info {
  border-left-color: var(--text2);
}
.notification.info .notification-icon {
  color: var(--text2);
}

/* Progress bar for auto-dismiss */
.notification-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 0 var(--radius);
  animation: notif-progress 5s linear forwards;
}

.notification.success .notification-progress { background: var(--bull); }
.notification.error .notification-progress   { background: var(--bear); }
.notification.info .notification-progress    { background: var(--text2); }

@keyframes notif-progress {
  from { width: 100%; }
  to   { width: 0; }
}

.notification {
  position: relative;
  overflow: hidden;
}
