﻿/* ============================================================================
   Panel Viewer 2 - Mobile Styles
   Version: 1.0.0
   Optimized: Phase 1 - CSS Extraction
   ============================================================================ */

/* ============================================================================
   CSS Variables (Theme)
   ============================================================================ */
:root {
    --bg: #121212;
    --card: #1e1e1e;
    --panel: #0f0f0f;
    --panel2: #141414;
    --muted: #9aa6b2;
    --border: #2e2e2e;
    --ask: #ff6b6b;
    --bid: #61d36b;
    --text: #eaeaea;
    --primary: #2979ff;
    --neutral: #3d4858;
    --price-size: 28px;
    --entry-size: 19px;
    --last-a-size: 26px; /* default Last A price size */
    --last-a-grade-size: 11px; /* default Last A grade badge size */
    --grade-size: 11px;
}

/* ============================================================================
   Base Styles
   ============================================================================ */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    padding: 8px; /* Standard mobile padding */
    padding-bottom: 80px; /* Space for bottom nav */
    user-select: none;
    -webkit-user-select: none;
}

/* Journal Quick Add Button */
.btn-quick-add {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 4px; /* slightly rounded square */
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: var(--muted);
    font-size: 14px;
    line-height: 1; /* Center vertically */
    font-weight: 700;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-quick-add:active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================================================
   Layout
   ============================================================================ */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 8px;
    width: 100%;
    /* ✅ FIX: Constrain width on desktop to maintain mobile aspect ratio */
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* ✅ CRITICAL FIX: Prevent flex children (like .zone) from forcing width */
    min-width: 0;
    box-sizing: border-box; /* Ensure padding is included in width */
}

/* Blue separators between main blocks */
.card > div {
    border-top: 1px solid rgba(41, 121, 255, 0.35);
    margin-top: 8px;
    padding-top: 8px;
}
.card > div:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* ============================================================================
   Replay Banner
   ============================================================================ */
#replayBanner {
    display: none;
    text-align: center;
    background: linear-gradient(135deg, #ffc107, #ff8f00);
    color: #000;
    font-weight: 900;
    font-size: 14px;
    letter-spacing: 1px;
    padding: 6px;
    border-radius: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    text-transform: uppercase;
}

/* ============================================================================
   Pressure Indicator
   ============================================================================ */
.pressureTitle {
    font-size: 15px;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 10px;
    text-align: center;
    color: #fff;
    width: 100%;
    margin-bottom: 4px; /* ✅ AJOUTÉ: Espacement sous le titre de pression */
}

.pressureTitle span.sub {
    display: block;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.75;
    margin-top: 2px;
}

.pressureTitle.buy {
    background: linear-gradient(120deg, #1b5e20, #2e7d32, #61d36b);
}

.pressureTitle.sell {
    background: linear-gradient(120deg, #7f1d1d, #b71c1c, #ff6b6b);
}

.pressureTitle.iso {
    background: linear-gradient(120deg, #37474f, #455a64, #607d8b);
}

/* ============================================================================
   Pressure Gauge
   ============================================================================ */
.gaugeWrap {
    margin: 0; 
    padding: 3px; 
    border-radius: 14px; 
    background: #141414; 
    border: 1px solid rgba(255,255,255,0.08);
    position: relative; /* Ensures absolute children are relative to this */
}

.biasBar {
    height: 16px; 
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    position: relative;
    /* Border is now on the wrapper */
    border: none;
}

.biasSell {
    background: linear-gradient(90deg, #7f1d1d, var(--ask));
    height: 100%;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: inset -1px 0 3px rgba(0, 0, 0, 0.3);
}

.biasBuy {
    background: linear-gradient(90deg, var(--bid), #1b5e20);
    height: 100%;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: inset 1px 0 3px rgba(0, 0, 0, 0.3);
}

.biasMid {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    transform: translateX(-50%);
    z-index: 2;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

/* The label needs to be inside the gauge bar area, centered */
.biasLabel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px; 
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 10px;
    pointer-events: none; /* Let clicks pass through */
    z-index: 5;
    /* Styles matching index-html provided inline styles */
    /* font-weight: 700; color: #fff; etc are inherited or set below */
}

/* Remove or hide the external biasDetails */
#biasDetails {
    display: none; /* Hide the external text */
}

.biasMidLabel {
    position: absolute;
    left: 50%;
    bottom: -14px;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--muted);
    font-weight: 700;
    opacity: 0.7;
    pointer-events: none;
}

/* ============================================================================
   Price Display
   ============================================================================ */

/* Unified financial-grade block title styling */
.blockTitle {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    padding: 8px 12px 8px 14px;
    margin: 4px 0 6px;
    /* Use transparent dark bg to match journal header */
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    justify-content: flex-start;
    text-align: left;
}

/* ? NEW: Collapsible block title (for TP blocks) */
.blockTitle[onclick] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    justify-content: flex-start;
    text-align: left;
}

.collapseIcon {
    font-size: 14px;
    transition: transform 0.2s ease;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 0;
    position: absolute;
    right: 12px;
}

.blockTitle[onclick]:active {
    transform: scale(0.98);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* Accent bar for quick identification (finance dashboards use strong left accents) */
.blockTitle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    background: linear-gradient(180deg, #2979ff, #1559c0);
}

/* Optional icon support when an inline <span class="icon"> is present */
.blockTitle .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: 900;
    color: #b3d4ff;
    background: rgba(41, 121, 255, 0.12);
    border: 1px solid rgba(41, 121, 255, 0.35);
    border-radius: 50%;
}

/* Contextual variants for ASK/BID/Neutral blocks */
.blockTitle.ask::before { background: linear-gradient(180deg, #ff6b6b, #c13f3f); }
.blockTitle.bid::before { background: linear-gradient(180deg, #61d36b, #2e7d32); }
.blockTitle.neutral::before { background: linear-gradient(180deg, #9aa6b2, #3d4858); }

/* Compact title for nested zones (e.g., tables) */
.zone .blockTitle,
.domPanel .blockTitle {
    font-size: 12px;
    padding: 7px 10px 7px 14px;
    margin-bottom: 4px;
    justify-content: flex-start;
    text-align: left;
}

.priceRow {
    display: grid;
    /* Increased from 70px/85px to 120px to fit larger text */
    grid-template-columns: 1fr 120px 1fr;
    gap: 4px;
    align-items: stretch;
}

.priceBox {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 40px 8px 8px; /* Increased right padding to shift content left and avoid overlap with Grade Chip */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease; /* Smooth transition for highlight */
}

/* ✅ NEW: VWAP Proximity Highlight (Yellow) */
.priceBox.vwap-prox {
    border-color: #ffd700 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.1) !important;
    /* Optional: Slight yellow tint background ensuring readability */
    /* background: rgba(255, 215, 0, 0.05); */
    animation: vwapPulse 2s infinite;
}

/* Also ensure the main price text turns yellow for better visibility */
.priceBox.vwap-prox .mainPrice {
    color: #ffd700 !important;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* ── be-card VWAP proximity — prix en jaune uniquement (même couleur que le VWAP) ── */
.be-card.vwap-prox .mainPrice.ask,
.be-card.vwap-prox .mainPrice.bid,
.be-price.vwap-price-yellow {
    color: #ffeb3b !important;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.55) !important;
}

@keyframes vwapPulse {
    0%   { box-shadow: 0 0 18px rgba(255, 215, 0, 0.45), inset 0 0 8px rgba(255,215,0,0.07); }
    50%  { box-shadow: 0 0 28px rgba(255, 215, 0, 0.65), inset 0 0 12px rgba(255,215,0,0.12); }
    100% { box-shadow: 0 0 18px rgba(255, 215, 0, 0.45), inset 0 0 8px rgba(255,215,0,0.07); }
}

.priceBox .mainPrice {
    font-size: var(--price-size);
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    transition: font-size 0.2s ease;
    /* ✅ NEW: Ensure price stays centered in the padded box */
    width: 100%;
    text-align: center;
}

.priceBox .sizeTag {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.85;
    margin-top: 3px;
    white-space: nowrap;
    /* ✅ NEW: Ensure size tag stays centered in the padded box */
    width: 100%;
    text-align: center;
}

.priceBox.super .mainPrice {
    text-shadow: 0 0 14px currentColor;
}

.priceBox .mainPrice.ask,
.priceBox .mainPrice.bid {
    font-weight: 900;
    text-shadow: 0 0 10px currentColor;
}

.ask {
    color: var(--ask);
}

.bid {
    color: var(--bid);
}

/* ============================================================================
   Center Box (Current Price)
   ============================================================================ */
.box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    position: relative;
}

.centerBox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    min-width: 120px;
}

.centerBox .label {
    font-size: 8px;
    color: var(--muted);
    font-weight: 700;
}

.nowPrice {
    font-size: 24px;
    font-weight: 900;
    white-space: nowrap;
}

/* ✅ NEW: make the 2 decimals smaller in CURRENT price */
.nowPrice .intPart {
    font-size: 1em;
}

.nowPrice .decPart {
    font-size: 0.72em;
    opacity: 0.95;
    vertical-align: baseline;
}

.nowPrice.up {
    color: var(--bid);
}

.nowPrice.down {
    color: var(--ask);
}

/* TP Display */
.tpDisplayCenter {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
    margin-top: 0;
}

.tpDisplayCenter .tpLabel {
    margin-right: 3px;
    text-transform: uppercase;
    font-weight: 700;
}

.tpDisplayCenter .tpValue {
    font-weight: 900;
    font-size: 17px;
    color: var(--primary); /* Default to primary blue */
}

/* ============================================================================
   Price Box Badges
   ============================================================================ */
.touchChip {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
}

.nextChip {
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 8px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================================
   TP Priority Pill (Best Entry)
   ============================================================================ */
/* Centralized TP Display */
.tpDisplayCenter {
    text-align: center;
    font-size: 10px;
    line-height: 1.2;
    padding: 2px 4px;
    border-radius: 6px;
    background: rgba(41, 121, 255, 0.1);
    border: 1px solid rgba(41, 121, 255, 0.3);
    color: var(--primary);
    white-space: nowrap;
}

.tpDisplayCenter .tpLabel {
    font-weight: 700;
    opacity: 0.85;
    margin-right: 2px;
}

.tpDisplayCenter .tpValue {
    font-weight: 900;
}

.tpPill {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    letter-spacing: 0.5px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

.tpPill.ask {
    border-color: rgba(255, 107, 107, 0.4);
    background: rgba(255, 107, 107, 0.15);
    color: #ffe3e3;
}

.tpPill.bid {
    border-color: rgba(97, 211, 107, 0.4);
    background: rgba(97, 211, 107, 0.15);
    color: #e7ffe9;
}

.tpPill .tpLabel {
    opacity: 0.85;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 9px;
}

/* Color only TP numeric values inside the pill (HTML should wrap them with .tpValue) */
.tpPill .tpValue {
    font-weight: 900;
    font-size: 11px;
}

.tpPill.ask .tpValue {
    color: #ff8a8a;
    text-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

.tpPill.bid .tpValue {
    color: #8aff96;
    text-shadow: 0 0 8px rgba(97, 211, 107, 0.4);
}

/* ============================================================================
   Grade Badges
   ============================================================================ */
.gradeChip {
    position: absolute;
    bottom: 3px;
    right: 3px;
    font-size: var(--grade-size, 12px);
    font-weight: 800;
    padding: 4px 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #0f1215;
    display: none;
    transition: font-size 0.2s ease, padding 0.2s ease;
}

.gradeChip.A {
    background: #052e0e;
    color: #7cff8a;
    border-color: #2e7d32;
    display: block;
    box-shadow: 0 0 10px rgba(97, 211, 107, 0.4);
}

/* ? FIX: Classes pour A+, A++ et A+++ avec sélecteurs basés sur les clés JavaScript */
/* A+ */
.gradeChip.Aplus {
    background: linear-gradient(135deg, #052e0e, #0f4d19);
    color: #eaffea;
    border-color: #2fb858;
    display: block;
    box-shadow: 0 0 16px rgba(47, 184, 88, 0.5);
}

/* A++ */
.gradeChip.Aplus2 {
    background: linear-gradient(135deg, #052e0e, #146622);
    color: #ffffff;
    border-color: #3ff07f;
    display: block;
    box-shadow: 0 0 22px rgba(63, 240, 127, 0.6);
    font-size: calc(var(--grade-size, 12px) * 1.15);
    padding: 5px 10px;
}

/* A+++ */
.gradeChip.Aplus3 {
    background: linear-gradient(135deg, #052e0e, #1a802b);
    color: #ffffff;
    border-color: #5dffb0;
    display: block;
    box-shadow: 0 0 30px rgba(93, 255, 176, 0.7), 0 0 50px rgba(93, 255, 176, 0.3);
    font-size: var(--grade-size, 12px);
    padding: 4px 8px;
    animation: pulse-glow 2s infinite;
    font-weight: 900;
    letter-spacing: 0.3px;
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(93, 255, 176, 0.8), 0 0 40px rgba(93, 255, 176, 0.4); 
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(93, 255, 176, 1.0), 0 0 60px rgba(93, 255, 176, 0.6); 
        transform: scale(1.03);
    }
}

.gradeChip.B {
    background: #2e1c05;
    color: #ffcc80;
    border-color: #ff9800;
    display: block;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.4);
}

.gradeChip.C {
    background: #2e0a0a;
    color: #ffcdd2;
    border-color: #f44336;
    display: block;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.4);
}

.gradeChip.D {
    background: #1a1a1a;
    color: #9e9e9e;
    border-color: #424242;
    display: block;
    box-shadow: none;
    opacity: 0.7;
}

/* ============================================================================
   DOM Tables
   ============================================================================ */
.domPanel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zone {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    
    /* ✅ FIX: Prevent zone from overflowing the card if content is wide */
    max-width: 100%;
    /* Ensure box model includes padding in width calc */
    box-sizing: border-box; 
    overflow-x: hidden; /* Hide overflow or 'auto' for scroll */
}

.zone h4 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(135deg, #1e2832, #2a3642); /* ✅ Gradient gris-bleu foncé */
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08); /* ✅ Bordure subtile */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /* ✅ Ombre douce */
}

table.dom {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--entry-size);
    table-layout: fixed;
}

table.dom th {
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    padding: 2px 3px;
    border-bottom: 1px solid #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure columns remain visible (incl. the new Avg column) */
#sellTable th,
#buyTable th {
    min-width: 0;
}

#sellTable th:nth-child(1),
#buyTable th:nth-child(1) { width: 8%; }
#sellTable th:nth-child(2),
#buyTable th:nth-child(2) { width: 22%; }
#sellTable th:nth-child(3),
#buyTable th:nth-child(3) { width: 18%; }
#sellTable th:nth-child(4),
#buyTable th:nth-child(4) { width: 16%; }
#sellTable th:nth-child(5),
#buyTable th:nth-child(5) { width: 18%; }
#sellTable th:nth-child(6),
#buyTable th:nth-child(6) { width: 18%; }

table.dom td {
    padding: 2px 3px;
    border-bottom: 1px solid #1b1b1b;
}

table.dom td:first-child {
    position: relative;
    width: 24px;
    min-width: 24px;
    line-height: calc(var(--entry-size));
}

.hl {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 3px;
    font-weight: 600;
}

/* ============================================================================
   Metadata
   ============================================================================ */
.meta {
    color: var(--muted);
    font-size: 9px;
    text-align: center;
    padding: 3px;
}

/* ============================================================================
   Settings Panel
   ============================================================================ */
.settingsToggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

.settingsToggle:active {
    background: #1a1a1a;
}

.settingsPanel {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 6px;
}

.settingsPanel.open {
    display: flex;
}

.settingsRow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.settingsRow label {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    min-width: 60px;
}

.settingsRow input,
.settingsRow select {
    padding: 6px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0f0f0f;
    color: #eaeaea;
    font-size: 12px;
    flex: 1;
    min-width: 0;
}

.settingsRow input[type="range"] {
    flex: 2;
    min-width: 80px;
}

.settingsRow input[type="password"] {
    flex: 1;
    min-width: 0;
}

/* ============================================================================
   Bottom Navigation
   ============================================================================ */
.bottomNav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 9999;
}

.bottomNavItem {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}

.bottomNavItem.active {
    color: var(--primary);
    background: rgba(41, 121, 255, 0.05);
    border-top: 2px solid var(--primary);
}

.bottomNavItem.danger {
    color: var(--ask);
    background: transparent;
    border: none;
    cursor: pointer;
}

body.hasBottomNav {
    padding-bottom: 80px; /* Ensure content is scrollable above nav */
}

/* ============================================================================
   Action Buttons
   ============================================================================ */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--panel);
    color: var(--text);
    font-weight: 800;
    font-size: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    flex: 1;
    min-width: 80px;
    max-width: 130px;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.96);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

/* Start Button - Green Glow */
.btn-start {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.15), rgba(22, 163, 74, 0.05));
    border-color: rgba(22, 163, 74, 0.5);
    color: #4ade80;
    box-shadow: 0 0 15px rgba(22, 163, 74, 0.15);
}
.btn-start:active {
    background: rgba(22,163,74,0.2);
}

/* Stop Button - Red Glow */
.btn-stop {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(220, 38, 38, 0.05));
    border-color: rgba(220, 38, 38, 0.5);
    color: #f87171;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.15);
}
.btn-stop:active {
    background: rgba(220, 38, 38, 0.2);
}

/* Refresh/Login/Apply - Blue Glow */
.btn-refresh, .btn-login {
    background: linear-gradient(135deg, rgba(41, 121, 255, 0.15), rgba(41, 121, 255, 0.05));
    border-color: rgba(41, 121, 255, 0.5);
    color: #60a5fa;
    box-shadow: 0 0 15px rgba(41, 121, 255, 0.15);
}
.btn-refresh:active, .btn-login:active {
    background: rgba(41, 121, 255, 0.2);
}

/* Logout - Neutral/Brown */
.btn-logout {
    background: linear-gradient(135deg, rgba(120, 120, 120, 0.15), rgba(120, 120, 120, 0.05));
    border-color: rgba(120, 120, 120, 0.5);
    color: #d1d5db;
}

/* Replay - Amber Glow */
.btn-replay {
    background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(251,191,36,0.07));
    border: 1px solid rgba(251,191,36,0.55);
    color: #fbbf24;
    font-weight: 900;
    letter-spacing: 0.5px;
    box-shadow: 0 0 18px rgba(251,191,36,0.2);
    transition: all 0.15s ease;
}
.btn-replay:hover {
    background: linear-gradient(135deg, rgba(251,191,36,0.26), rgba(251,191,36,0.12));
    box-shadow: 0 0 24px rgba(251,191,36,0.3);
}
.btn-replay:active {
    background: rgba(251,191,36,0.28);
    transform: scale(0.98);
}

/* Replay Controls (Rew, Pause, Fwd) */
.btn-replay-ctrl {
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--muted);
    flex: 0.5;
    min-width: 50px;
    padding: 10px 8px;
    font-size: 11px;
    box-shadow: none;
    border-radius: 10px;
}
.btn-replay-ctrl:active {
    background: var(--panel2);
    color: var(--text);
    border-color: var(--primary);
}

/* Specific override for Stop Replay to match danger theme */
#btnStopReplay {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(220, 38, 38, 0.05)) !important;
    border-color: rgba(220, 38, 38, 0.5) !important;
    color: #f87171 !important;
}

/* ============================================================================
   Status Bar
   ============================================================================ */
.status {
    font-size: 10px;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 6px;
    background: #181c20;
    border: 1px solid #23282d;
    color: #8ab6ff;
    text-align: center;
    display: none; /* hidden: status is now communicated via the SYSTEM STATUS title */
}

.status.ok {
    color: #7cff8a;
    background: #13261b;
    border-color: #255a37;
}

.status.err {
    color: #ff7a7a;
    background: #2a1818;
    border-color: #703d3d;
}

/* ============================================================================
   Debug Panel
   ============================================================================ */
.debugPanel {
    display: none;
    background: #0f0f0f;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    color: #9ee2ff;
    font-size: 10px;
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
}

.debugPanel.open {
    display: block;
}

/* ============================================================================
   Tooltips
   ============================================================================ */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--muted);
    background: #252a30;
    border: 1px solid var('--border');
    border-radius: 50%;
    cursor: pointer;
    margin-left: 3px;
    vertical-align: middle;
    -webkit-tap-highlight-color: transparent;
}

.tooltip-icon:hover,
.tooltip-icon.active {
    color: var(--primary);
    border-color: #ffb300;
}

.tooltip-text {
    visibility: hidden;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1e24;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 10px;
    white-space: normal;
    max-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1a1e24 transparent transparent transparent;
}

.tooltip-wrapper:hover .tooltip-text,
.tooltip-wrapper.active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ============================================================================
   Login Panel
   ============================================================================ */
.loginPanel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 6px;
}

.loginPanel.hidden {
    display: none;
}

.loginPanel h3 {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.loginRow {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loginRow input {
    padding: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0f0f0f;
    color: #eaeaea;
    font-size: 14px;
    width: 100%;
}

.loginRow input::placeholder {
    color: #666;
}

.loginActions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ============================================================================
   User Info Bar
   ============================================================================ */
.userInfo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 6px;
}

.userInfo.hidden {
    display: none;
}

.userInfo .email {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.userInfo .logoutBtn {
    font-size: 10px;
}

/* ============================================================================
   Main Entry TP Blocks (Best Entry / Last A)
   ============================================================================ */

.mainTPPanel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mainTPCard {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    position: relative;
    overflow: hidden;
    min-height: 86px;
}

.mainTPCard.ask {
    /* Match Best Entry (neutral) */
    background: var(--panel);
    border-color: var(--border);
}

.mainTPCard.bid {
    /* Match Best Entry (neutral) */
    background: var(--panel);
    border-color: var(--border);
}

.mainTPPrimary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.mainTPValues {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    text-align: center;
}

.mainTPValue.level {
    font-size: 18px;
    font-weight: 900;
    line-height: 1.05;
    white-space: nowrap;
}

.mainTPValue.ticks {
    font-size: 11px;
    font-weight: 800;
    opacity: 0.95;
    white-space: nowrap;
}

.mainTPValue.dollars {
    font-size: 12px;
    font-weight: 900;
    opacity: 0.95;
    white-space: nowrap;
}

.mainTPCard.ask .mainTPValue.level,
.mainTPCard.ask .mainTPValue.ticks,
.mainTPCard.ask .mainTPValue.dollars {
    color: var(--ask);
}

.mainTPCard.bid .mainTPValue.level,
.mainTPCard.bid .mainTPValue.ticks,
.mainTPCard.bid .mainTPValue.dollars {
    color: var(--bid);
}

.mainTPSecondary {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mainTPLine {
    display: grid;
    grid-template-columns: 34px 1fr 50px 64px;
    gap: 6px;
    align-items: center;
    font-size: 10px;
    padding: 4px 6px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.mainTPLineLabel {
    font-weight: 900;
    color: var(--muted);
}

.mainTPLineLevel,
.mainTPLineTicks,
.mainTPLineDollars {
    font-weight: 800;
    white-space: nowrap;
}

.mainTPCard.ask .mainTPLineLevel,
.mainTPCard.ask .mainTPLineTicks,
.mainTPCard.ask .mainTPLineDollars {
    color: #ffe3e3;
}

.mainTPCard.bid .mainTPLineLevel,
.mainTPCard.bid .mainTPLineTicks,
.mainTPCard.bid .mainTPLineDollars {
    color: #e7ffe9;
}

/* ============================================================================
   Memory Cards (Last A) - New Two-Column v2 Design
   ============================================================================ */

/* The JS injects detailed card-level CSS via _ensureMemV2Css().
   These rules handle the panel/column shell and legacy compat. */

.memPanel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}

.mem-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Keep legacy .memCard hidden — data lives in hidden slots, display via .mem-v2-card */
.memCard {
    display: none !important;
}

/* ============================================================================
   Replay Time Selection Panel
   ============================================================================ */
.replayPanel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    margin-top: 8px;
    /* ? Animation d'ouverture fluide */
    animation: slideDown 0.3s ease-out;
    transform-origin: top;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.replayPanel h4 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-align: center;
}

.replayRow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    padding: 8px 10px;
}

.replayLabel {
    font-size: 9px;
    font-weight: 700;
    color: rgba(154,166,178,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 40px;
    white-space: nowrap;
}

.replayInput {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid rgba(251,191,36,0.25);
    border-radius: 8px;
    background: rgba(10,13,20,0.8);
    color: #eaeaea;
    font-size: 13px;
    font-weight: 700;
    box-sizing: border-box;
}

/* ? FIX: Style pour les inputs datetime-local pour meilleure visibilité */
.replayInput[type="datetime-local"] {
    color: #eaeaea;
    background: rgba(10,13,20,0.8);
    border: 1px solid rgba(251,191,36,0.25);
}

/* ? Ensure internal datetime picker components are visible */
.replayInput[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.replayInput[type="datetime-local"]::-webkit-datetime-edit {
    color: #eaeaea;
}

.replayInput[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
    background: transparent;
}

.replayInput[type="datetime-local"]::-webkit-datetime-edit-text {
    color: #9aa6b2;
    padding: 0 2px;
}

.replayInput[type="datetime-local"]::-webkit-datetime-edit-month-field,
.replayInput[type="datetime-local"]::-webkit-datetime-edit-day-field,
.replayInput[type="datetime-local"]::-webkit-datetime-edit-year-field,
.replayInput[type="datetime-local"]::-webkit-datetime-edit-hour-field,
.replayInput[type="datetime-local"]::-webkit-datetime-edit-minute-field {
    color: #eaeaea;
    background: transparent;
}

.replayInput[type="datetime-local"]:focus {
    border-color: rgba(251,191,36,0.7);
    box-shadow: 0 0 0 2px rgba(251,191,36,0.15);
    outline: none;
}

/* Force inputs in the replay bloc to never overflow their flex container */
#replayPanel input,
#replayPanel select {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Shield-style blocs manage their own spacing — cancel .card > div overrides */
#bestEntryBlock,
#entryChartBlock,
#lastABlock,
#domBlock,
#replayPanel {
    border-top: none !important;
    margin-top: 8px !important;
    padding-top: 0 !important;
}

.btn-pick {
    background: linear-gradient(135deg, #ffc107, #ff8f00);
    border: 1px solid #ff8f00;
    color: #000;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-pick:active {
    transform: scale(0.95);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

.btn-preset {
    background: rgba(251,191,36,0.07);
    border: 1px solid rgba(251,191,36,0.3);
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
    letter-spacing: 0.3px;
}

.btn-preset:hover {
    background: rgba(251,191,36,0.14);
    border-color: rgba(251,191,36,0.55);
}

.btn-preset:active {
    background: rgba(251,191,36,0.22);
    color: #fff;
    border-color: #fbbf24;
    transform: scale(0.95);
}

/* ============================================================================
   Wall Badges
   ============================================================================ */
.wallBadge {
    display: inline-block;
    margin-left: 4px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 800;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.08);
    color: #ffd54f;
}

/* Wall chip in DOM tables - replaces index number */
table.dom .wallChip {
    display: inline-block;
    font-size: calc(var(--entry-size));
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    text-shadow: 0 0 8px currentColor;
    letter-spacing: 0.5px;
}

table.dom .wallChip.ask {
    background: rgba(255, 204, 102, 0.2);
    color: #ffcc66;
    border-color: #3a2a18;
    box-shadow: 0 0 6px rgba(255, 204, 102, 0.4);
}

table.dom .wallChip.bid {
    background: rgba(154, 209, 255, 0.2);
    color: #9ad1ff;
    border-color: #183a52;
}

/* Wall chip in price boxes */
.wallChip {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: calc(var(--entry-size));
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #1a1e24;
    color: #ffd54f;
    pointer-events: none;
}

.wallChip.ask {
    background: #2a1f12;
    color: #ffcc66;
    border-color: #3a2a18;
}

.wallChip.bid {
    background: #121f2a;
    color: #9ad1ff;
    border-color: #183a52;
}

.wallChipBox {
    position: absolute;
    bottom: 3px;
    left: 3px;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 204, 102, 0.15);
    color: #ffcc66;
    display: none;
    pointer-events: none;
}

.wallChipBox.show {
    display: block;
}

.wallChipBox.ask {
    background: rgba(255, 204, 102, 0.15);
    color: #ffcc66;
    border-color: #3a2a18;
}

.wallChipBox.bid {
    background: rgba(154, 209, 255, 0.15);
    color: #9ad1ff;
    border-color: #183a52;
}

/* Match pill for Extended Entry (indicates same price as Main Entry) */
.matchPill {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    /* Changed to Bright Pink/Fuchsia to distinguish from Ask Wall (Amber) and Bid Wall (Blue) */
    background: rgba(255, 64, 129, 0.25);
    color: #ff80ab;
    display: none;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 5px rgba(255, 64, 129, 0.3);
}

/* Distinct pill for Extended Entry (indicates DIFFERENT price from Main Entry) */
.distinctPill {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 8px;
    border: 1px solid #7c4dff;
    /* High visibility Purple/Violet for 'Extended' */
    background: #6200ea;
    color: #ffffff;
    display: none;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 8px rgba(98, 0, 234, 0.7);
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    animation: distinctPulse 2s infinite;
}

@keyframes distinctPulse {
    0% { transform: scale(1); box-shadow: 0 0 8px rgba(98, 0, 234, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 12px rgba(124, 77, 255, 0.9); }
    100% { transform: scale(1); box-shadow: 0 0 8px rgba(98, 0, 234, 0.7); }
}

.gradeChip .trendMarker {
    display: inline-block;
    font-size: 0.6em;
    vertical-align: super;
    margin-left: 1px;
    opacity: 0.9;
    font-weight: 900;
    line-height: 0;
    position: relative;
    top: -0.2em;
}

/* ============================================================================
   Memory blocks (Last 3 Grade A)
   ============================================================================ */

/* Wall chip inside memory cards (matches Best Entry wall chip behavior) */
.memWallChip {
    position: absolute;
    left: 6px;
    bottom: 6px;
    font-size: 11px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.08);
    display: none;
    pointer-events: none;
    letter-spacing: 0.2px;
}

.memWallChip.ask {
    background: #2a1f12;
    color: #ffcc66;
    border-color: #3a2a18;
}

.memWallChip.bid {
    background: #121f2a;
    color: #9ad1ff;
    border-color: #183a52;
}

/* Memory cards grade badge (Last 3 A or better) */
.memBadge {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    font-weight: 900;
    font-size: var(--last-a-grade-size, 11px);
    padding: 4px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #0f1215;
    color: #ffffff;
    display: none;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    z-index: 2;
    text-align: center;
    min-width: 30px;
}

/* Ensure dynamically injected gradeChip also follows this positioning */
.memCard .gradeChip {
    right: 6px !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.memBadge.A {
    background: #052e0e;
    color: #7cff8a;
    border-color: #2e7d32;
    display: inline-block;
    box-shadow: 0 0 10px rgba(97, 211, 107, 0.4);
}

.memBadge.Aplus {
    background: linear-gradient(135deg, #052e0e, #0f4d19);
    color: #eaffea;
    border-color: #2fb858;
    display: inline-block;
    box-shadow: 0 0 16px rgba(47, 184, 88, 0.5);
}

.memBadge.Aplus2 {
    background: linear-gradient(135deg, #052e0e, #146622);
    color: #ffffff;
    border-color: #3ff07f;
    display: inline-block;
    box-shadow: 0 0 22px rgba(63, 240, 127, 0.6);
}

.memBadge.Aplus3 {
    background: linear-gradient(135deg, #052e0e, #1a802b);
    color: #ffffff;
    border-color: #5dffb0;
    display: inline-block;
    box-shadow: 0 0 30px rgba(93, 255, 176, 0.7), 0 0 50px rgba(93, 255, 176, 0.3);
    animation: pulse-glow 2s infinite;
    letter-spacing: 0.2px;
}

.memBadge.B {
    background: #2e1c05;
    color: #ffcc80;
    border-color: #ff9800;
    display: inline-block;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.4);
}

.memBadge.C {
    background: #2e0a0a;
    color: #ffcdd2;
    border-color: #f44336;
    display: inline-block;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.4);
}

.zone h4 {
    text-align: center;
}

/* Hide Best Entry touch/next chips (we don't use them) */
.priceBox .touchChip,
.priceBox .nextChip,
#touchAsk,
#touchBid,
#nextAsk,
#nextBid {
    display: none !important;
}

/* ============================================================================
   Bottom Navigation (Global)
   ============================================================================ */

body.hasBottomNav {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* Ensure page content can scroll behind a fixed bottom nav, instead of being cut off */
body.hasBottomNav .card {
    max-height: none;
    overflow-y: visible;
}

.bottomNav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;

    display: flex;
    gap: 8px; /* Increased gap for better separation */

    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(18, 18, 18, 0.95); /* Darker, more opaque background */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border-top: 1px solid var(--border); /* Use theme border */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5); /* Stronger shadow for separation */
}

.bottomNavItem {
    flex: 1 1 0;
    min-width: 0;

    border: 1px solid var(--border);
    background: var(--panel); /* Match panel background */
    color: var(--muted); /* Muted text by default */
    font-weight: 700;
    font-size: 10px; /* Fixed legible size */
    padding: 8px 4px;
    border-radius: 12px; /* Softer corners */
    text-decoration: none;
    text-align: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    min-height: 48px; /* Taller touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    transition: all 0.2s ease; /* Smooth transitions */
}

.bottomNavItem:active {
    transform: scale(0.96);
    background: var(--panel2);
}

.bottomNavItem.active {
    border-color: rgba(41, 121, 255, 0.5);
    background: linear-gradient(135deg, rgba(41, 121, 255, 0.15), rgba(41, 121, 255, 0.05));
    color: #fff; /* White text for active */
    box-shadow: 0 0 12px rgba(41, 121, 255, 0.25); /* Glow effect */
    text-shadow: 0 0 8px rgba(41, 121, 255, 0.5);
}

.bottomNavItem.danger {
    background: rgba(183, 28, 28, 0.1);
    border-color: rgba(183, 28, 28, 0.3);
    color: #ff6b6b;
}

.bottomNavItem.danger:active {
    background: rgba(183, 28, 28, 0.2);
}

/* ============================================================================
   Form Controls (Dark theme)
   ============================================================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    background: #0f1215;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}

input::placeholder,
textarea::placeholder {
    color: rgba(154, 166, 178, 0.8);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(41, 121, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.18);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(234, 234, 234, 0.7);
    border-color: rgba(255, 255, 255, 0.10);
    -webkit-text-fill-color: rgba(234, 234, 234, 0.7);
    opacity: 1;
}

/* Make select arrow visible on dark backgrounds */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(234, 234, 234, 0.6) 50%),
        linear-gradient(135deg, rgba(234, 234, 234, 0.6) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(1em + 2px),
        calc(100% - 13px) calc(1em + 2px);
    background-size:
        5px 5px,
        5px 5px;
    background-repeat: no-repeat;
    padding-right: 28px;
}

/* iOS/Safari: keep native picker icon readable */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.85;
}

/* SYSTEM STATUS (dynamic) */
#systemStatusTitle{
  transition: background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease, filter .25s ease;
}

#systemStatusTitle.status-ok{
  color:#eaffef;
  background:linear-gradient(120deg,#0f3d20,#167a3e,#1ee06b);
  border:1px solid rgba(97,211,107,.55);
  box-shadow:0 0 18px rgba(97,211,107,.35), 0 6px 18px rgba(0,0,0,.35);
}

#systemStatusTitle.status-warn{
  color:#fff4e6;
  background:linear-gradient(120deg,#4a2a00,#c26a00,#ff9800);
  border:1px solid rgba(255,152,0,.55);
  box-shadow:0 0 18px rgba(255,152,0,.25), 0 6px 18px rgba(0,0,0,.35);
}

#systemStatusTitle.status-bad{
  color:#ffecec;
  background:linear-gradient(120deg,#4a1010,#b71c1c,#ff3b3b);
  border:1px solid rgba(255,107,107,.60);
  box-shadow:0 0 18px rgba(255,107,107,.35), 0 6px 18px rgba(0,0,0,.35);
}

/* New System Status Card
   ============================================================================ */
.system-status-card {
background: rgba(18, 18, 18, 0.95);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 8px;
    position: relative; /* ✅ Added for absolute logo positioning */
    min-height: 48px; /* ✅ Increased height for a more imposing logo */
}

.status-indicator-box {
    display: flex;
    flex-direction: column; /* Stack top row and potential bottom content if needed, but mainly for profile layout */
    align-items: flex-start;
    gap: 2px;
}

.status-top-row {
    display: flex;
    align-items: center;
    gap: 8px; /* Spacing between dot and profile header */
}

/* ✅ NEW: User Profile (Avatar + Email + Disconnect) */
.status-user-profile {
    display: flex;
    flex-direction: column; /* Stack header (avatar+btn) and email vertically */
    align-items: flex-start;
    gap: 2px;
    margin-left: 2px;
}

.status-profile-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-avatar {
    width: 24px; /* Slightly larger for better visibility */
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
}

.status-user-info {
    /* Removed or reset if previously used, new structure uses direct children */
    display: none; 
}

.status-email {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted); /* Muted color for email */
    /* Remove text truncation for full email as requested */
    white-space: nowrap; 
    line-height: 1.1;
    margin-left: 2px; /* Slight offset to align with avatar visually if needed */
}

/* Logout Button (Small power icon) */
.status-logout-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.status-logout-btn:hover {
    color: #ff6b6b;
}

.status-logout-btn:active {
    transform: scale(0.9);
}

.status-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 52px; /* ✅ Significantly increased size */
    width: auto;
    object-fit: contain;
    /* ✅ Blend mode to remove black background from the logo */
    mix-blend-mode: screen; 
    filter: brightness(1.1) contrast(1.1); /* Slight pop */
    z-index: 10;
    pointer-events: none;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff6b6b; /* Default disconnected */
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    /* Ensure it doesn't collapse if container is small */
    flex-shrink: 0;
}

.connection-dot.connected {
    background-color: #61d36b;
    box-shadow: 0 0 8px rgba(97, 211, 107, 0.5);
}

.connection-dot.warning {
    background-color: #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
}

.connection-text {
    font-size: 14px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.mode-badges {
    display: flex;
    gap: 6px;
}

.status-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
}

.status-badge.live {
    background: rgba(97, 211, 107, 0.15);
    color: #61d36b;
    border-color: rgba(97, 211, 107, 0.3);
}

.status-badge.replay {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   GAMIFIED TOP HEADER — redesign
   ═══════════════════════════════════════════════════════════ */
.system-status-card {
    background: linear-gradient(135deg, #090d14 0%, #0d1520 60%, #091018 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 230, 118, 0.18);
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 4px 24px rgba(0,0,0,0.5), 0 0 32px rgba(0,230,118,0.04);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    position: relative;
}
/* top accent line */
.system-status-card::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(0,230,118,0.6) 30%, rgba(41,182,246,0.6) 70%, transparent 100%);
}

/* ── Main header row ─────────────────────────────── */
.status-main-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 8px 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
    min-height: 54px;
    cursor: pointer;
}

/* left zone */
.status-indicator-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.status-top-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* User profile block */
.status-user-profile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    margin-left: 2px;
}

.status-profile-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(0,230,118,0.4);
    box-shadow: 0 0 6px rgba(0,230,118,0.2);
}

.status-user-info { display: none; }

.status-email {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    line-height: 1.1;
    letter-spacing: 0.3px;
}

/* Logout button */
.status-logout-btn {
    background: rgba(255,58,58,0.08);
    border: 1px solid rgba(255,58,58,0.25);
    border-radius: 5px;
    color: rgba(255,100,100,0.8);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 2px 7px;
    line-height: 1.4;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
}
.status-logout-btn::before {
    content: '⏻';
    font-size: 10px;
}
.status-logout-btn:hover {
    background: rgba(255,58,58,0.18);
    border-color: rgba(255,58,58,0.5);
    color: #ff6b6b;
    box-shadow: 0 0 8px rgba(255,58,58,0.2);
}
.status-logout-btn:active { transform: scale(0.94); }

/* center: logo */
.status-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: screen;
    filter: brightness(1.15) drop-shadow(0 0 6px rgba(0,230,118,0.25));
    pointer-events: none;
    justify-self: center;
    /* remove old absolute positioning */
    position: static;
    left: auto;
    top: auto;
    transform: none;
}

/* right zone: datetime + freshness */
.status-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.status-datetime {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
}

.status-freshness-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-fresh-label {
    font-size: 8px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.status-fresh-value {
    font-size: 10px;
    font-weight: 900;
    color: #00e676;
}

/* Telegram icon in top-right corner */
.status-tg-icon {
    display: none; /* shown by JS when Telegram configured */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(41,182,246,0.15);
    border: 1.5px solid rgba(41,182,246,0.35);
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(41,182,246,0.15);
    transition: all 0.2s;
    flex-shrink: 0;
}
.status-tg-icon:hover {
    background: rgba(41,182,246,0.25);
    box-shadow: 0 0 12px rgba(41,182,246,0.3);
}

/* ── Sub-row: symbol / status / badges ───────────── */
.status-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px 8px;
    gap: 6px;
    background: rgba(0,0,0,0.25);
}

/* Connection dot */
.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ff6b6b;
    box-shadow: 0 0 6px rgba(255,107,107,0.5);
    transition: background-color 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}
.connection-dot.connected {
    background-color: #00e676;
    box-shadow: 0 0 8px rgba(0,230,118,0.6);
    animation: dot-pulse 2s ease-in-out infinite;
}
.connection-dot.warning {
    background-color: #ffc107;
    box-shadow: 0 0 8px rgba(255,193,7,0.5);
}
@keyframes dot-pulse {
    0%,100% { box-shadow: 0 0 6px rgba(0,230,118,0.5); }
    50%      { box-shadow: 0 0 12px rgba(0,230,118,0.9); }
}

.connection-text {
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* System message area */
#systemMessageArea {
    background: rgba(0,230,118,0.05);
    border: 1px solid rgba(0,230,118,0.12);
    border-radius: 20px;
    padding: 3px 10px;
}

/* Mode/Live badges */
.mode-badges {
    display: flex;
    gap: 5px;
}

.status-badge {
    font-size: 9px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-badge.live {
    background: rgba(0,230,118,0.12);
    color: #00e676;
    border-color: rgba(0,230,118,0.35);
    box-shadow: 0 0 8px rgba(0,230,118,0.15);
    animation: badge-live-pulse 2.5s ease-in-out infinite;
}
@keyframes badge-live-pulse {
    0%,100% { box-shadow: 0 0 6px rgba(0,230,118,0.15); }
    50%      { box-shadow: 0 0 14px rgba(0,230,118,0.35); }
}
.status-badge.replay {
    background: rgba(255,193,7,0.12);
    color: #ffc107;
    border-color: rgba(255,193,7,0.35);
}
.status-badge.premium {
    background: rgba(41,121,255,0.12);
    color: #82b4ff;
    border-color: rgba(41,121,255,0.35);
    box-shadow: 0 0 8px rgba(41,121,255,0.15);
}
.status-badge.free {
    background: rgba(255,152,0,0.12);
    color: #ffcc80;
    border-color: rgba(255,152,0,0.3);
}
.status-badge.delayed {
    background: rgba(255,152,0,0.12);
    color: #ffcc80;
    border-color: rgba(255,152,0,0.35);
}

.info-item {
    display: flex;
    flex-direction: row; /* Changed from column to row */
    align-items: baseline; /* Align text baselines */
    gap: 4px; /* Spacing between label and value */
    flex: 1;
    white-space: nowrap;
}

.info-item:first-child { justify-content: flex-start; }
.info-item:nth-child(2) { justify-content: center; }
.info-item:last-child { justify-content: flex-end; }

.info-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 0; /* Removed bottom margin */
}

.info-label::after {
    content: ":";
    color: var(--muted);
    margin-left: 1px;
}

.info-value {
    font-size: 11px;
    font-weight: 700;
    color: #eaeaea;
    font-family: monospace; /* For tabular numbers */
}

#statusSymbol {
    color: var(--primary);
    font-weight: 900;
}

#statusFreshness.stale {
    color: #ff6b6b;
}

/* ✅ NEW: System Message Area (Moved from inline HTML) */
.system-message-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    padding-bottom: 0px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    min-height: 24px;
}

#systemMessageText {
    flex: 1;
    text-align: center;
}

/* ============================================================================
   News Carousel
   ============================================================================ */
/* ============================================================================
   News Card (High Impact) - New Design
   ============================================================================ */
.news-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: linear-gradient(135deg, #1a1f2b 0%, #0f1319 100%);
    border: 1px solid rgba(255, 59, 59, 0.35);
    border-left: 4px solid #ff3b3b;
    border-radius: 10px;
    margin-top: 6px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(255, 59, 59, 0.15);
    min-height: 80px;
    position: relative;
}

/* Alert mode (imminent) */
.news-card.alert-mode {
    border-color: #ff0000;
    box-shadow: 0 0 28px rgba(255, 0, 0, 0.55), inset 0 0 40px rgba(255, 0, 0, 0.18);
    animation: pulse-alert 1.0s infinite alternate;
}

@keyframes pulse-alert {
    0% {
        border-color: rgba(255, 59, 59, 0.6);
        box-shadow: 0 0 18px rgba(255, 59, 59, 0.35), inset 0 0 25px rgba(255, 50, 50, 0.12);
    }
    100% {
        border-color: #ff0000;
        box-shadow: 0 0 50px rgba(255, 0, 0, 0.85), inset 0 0 60px rgba(255, 0, 0, 0.4);
    }
}

/* Left zone: ECG + label */
.news-icon-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 10px 10px 4px;
    min-width: 80px;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 59, 59, 0.06);
}

.news-alert-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.news-ecg-line {
    opacity: 0.75;
}

.news-card.alert-mode .news-ecg-line polyline {
    animation: ecg-draw 1.5s linear infinite;
}

@keyframes ecg-draw {
    0% { stroke-dashoffset: 200; }
    100% { stroke-dashoffset: 0; }
}

.news-section-label {
    font-size: 8px;
    font-weight: 900;
    color: rgba(255, 100, 100, 0.8);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
}

/* News event count badge — kept for any legacy references */
.news-count-badge {
    display: none; /* replaced by news-meta-events column */
}

.news-count-num,
.news-count-sub {
    display: none;
}

/* ── Events meta column ──────────────────────────────────────── */
.news-meta-events {
    min-width: 56px;
    gap: 4px !important;
    background: rgba(255, 59, 59, 0.05);
}

/* Large total number */
.news-event-total {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    color: #ff6b6b;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

/* HIGH / MEDIUM breakdown row */
.news-event-breakdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.news-evt-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.4px;
    padding: 1px 5px;
    border-radius: 8px;
    white-space: nowrap;
    width: 100%;
    justify-content: center;
}

.news-evt-pill--high {
    background: rgba(255, 59, 59, 0.18);
    border: 1px solid rgba(255, 59, 59, 0.45);
    color: #ff6b6b;
}

.news-evt-pill--med {
    background: rgba(255, 160, 64, 0.14);
    border: 1px solid rgba(255, 160, 64, 0.4);
    color: #ffa040;
}

.news-evt-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.news-evt-dot--high { background: #ff4040; box-shadow: 0 0 4px rgba(255,64,64,0.7); }
.news-evt-dot--med  { background: #ffa040; box-shadow: 0 0 4px rgba(255,160,64,0.6); }

/* Dim pills when count is 0 */
.news-evt-pill--high[data-zero="1"],
.news-evt-pill--med[data-zero="1"] {
    opacity: 0.3;
}

/* Alert mode: brighten the events column */
.news-card.alert-mode .news-event-total {
    color: #ff3333;
    text-shadow: 0 0 8px rgba(255,51,51,0.6);
}
.news-card.alert-mode .news-evt-pill--high {
    background: rgba(255, 0, 0, 0.28);
    border-color: #ff0000;
}

/* Middle: event content */
.news-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 10px;
    gap: 5px;
    overflow: hidden;
}

.news-event-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.news-currency-flag {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}

.news-currency-flag-img {
    width: 28px;
    height: 20px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

.news-currency-flag-text {
    font-size: 11px;
    font-weight: 900;
    color: #aaa;
    letter-spacing: 0.5px;
}

.news-title {
    font-size: 13px;
    font-weight: 800;
    color: #eaeaea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.news-upcoming-badge {
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(41, 121, 255, 0.2);
    color: var(--primary);
    border: 1px solid rgba(41, 121, 255, 0.4);
    white-space: nowrap;
}

.news-card.alert-mode .news-upcoming-badge {
    background: rgba(255, 59, 59, 0.2);
    color: #ff8080;
    border-color: rgba(255, 59, 59, 0.5);
}

.news-event-desc {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-volatility-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-volatility-icon {
    font-size: 11px;
}

.news-volatility-text {
    font-size: 9px;
    font-weight: 900;
    color: #ffa040;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.news-volatility-hint {
    font-size: 9px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right: meta columns */
.news-meta {
    display: flex;
    align-items: stretch;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
}

.news-meta-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 8px;
    gap: 3px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 54px;
}

.news-meta-col:first-child {
    border-left: none;
}

.news-meta-head {
    font-size: 7px;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
}

.news-sched-time {
    font-size: 18px;
    font-weight: 900;
    color: #eaeaea;
    line-height: 1;
    letter-spacing: 0.5px;
}

.news-today-badge {
    font-size: 8px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
}

.news-countdown {
    font-family: monospace;
    font-size: 15px;
    font-weight: 900;
    color: #ff4040;
    line-height: 1;
    letter-spacing: 1px;
    white-space: nowrap;
}

.news-card.alert-mode .news-countdown {
    color: #ff2020;
    text-shadow: 0 0 10px rgba(255, 32, 32, 0.8);
}

.news-hms-label {
    font-size: 7px;
    color: var(--muted);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Impact bars */
.news-impact-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
}

.news-bar {
    width: 5px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.3s;
}

.news-bar:nth-child(1) { height: 7px; }
.news-bar:nth-child(2) { height: 10px; }
.news-bar:nth-child(3) { height: 13px; }
.news-bar:nth-child(4) { height: 16px; }
.news-bar:nth-child(5) { height: 18px; }

.news-bar.active { background: #ff4040; }
.news-bar.active-medium { background: #ffa040; }

.news-impact-label {
    font-size: 7px;
    font-weight: 900;
    color: #ff6060;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
    white-space: nowrap;
}

.news-impact-label.medium { color: #ffa040; }
.news-impact-label.low { color: var(--muted); }

/* Chevron on card when expanded */
.news-card--expanded {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

/* ── News block wrapper ─────────────────────────────────────────────────── */
/* When the card sits inside #newsBlock, remove its top margin and the
   outer border-radius so the header bar and card form a single unit. */
#newsBlock .news-card {
    margin-top: 0;
    border-radius: 0;
    border-top: none;
}

/* The expand panel that lives inside #newsCardBody needs its own bottom radius */
#newsBlock .news-expand-panel {
    border-radius: 0 0 10px 10px;
}

/* ── News Expand Panel ──────────────────────────────────────────────────── */
.news-expand-panel {
    background: linear-gradient(135deg, #151b25 0%, #0c1018 100%);
    border: 1px solid rgba(255, 59, 59, 0.30);
    border-top: none;
    border-radius: 0 0 10px 10px;
    margin-top: 0;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}

.nep-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    background: rgba(255, 59, 59, 0.06);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: 9px;
    font-weight: 900;
    color: rgba(255,255,255,0.65);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nep-header-count {
    margin-left: auto;
    background: rgba(255,59,59,0.15);
    border: 1px solid rgba(255,59,59,0.35);
    color: #ff7070;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.nep-close-btn {
    margin-left: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    padding: 2px 7px;
    cursor: pointer;
    line-height: 1;
    font-family: inherit;
    flex-shrink: 0;
}

.nep-list {
    display: flex;
    flex-direction: column;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.nep-list::-webkit-scrollbar { width: 4px; }
.nep-list::-webkit-scrollbar-track { background: transparent; }
.nep-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.nep-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.nep-row:last-child { border-bottom: none; }
.nep-row:hover { background: rgba(255,255,255,0.03); }
.nep-row--next { background: rgba(255,59,59,0.06); }
.nep-row--imminent { background: rgba(255,100,0,0.08); }
.nep-row--live { background: rgba(255,0,0,0.12); animation: pulse-alert 1s infinite alternate; }

.nep-rank {
    font-size: 8px;
    font-weight: 900;
    color: rgba(255,255,255,0.25);
    min-width: 16px;
    flex-shrink: 0;
}

.nep-impact-bars {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 14px;
    flex-shrink: 0;
}

.nep-bar {
    width: 3px;
    border-radius: 1px;
    background: rgba(255,255,255,0.10);
}
.nep-bar:nth-child(1) { height: 5px; }
.nep-bar:nth-child(2) { height: 7px; }
.nep-bar:nth-child(3) { height: 9px; }
.nep-bar:nth-child(4) { height: 11px; }
.nep-bar:nth-child(5) { height: 14px; }
.nep-bar--on { /* color set inline from JS */ }

.nep-pill {
    font-size: 7px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid transparent;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
}

.nep-currency {
    font-size: 8px;
    font-weight: 900;
    color: rgba(255,255,255,0.50);
    min-width: 26px;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.nep-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nep-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.nep-day-badge {
    font-size: 7px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.40);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.nep-day-badge--tomorrow {
    background: rgba(255,213,79,0.10);
    border-color: rgba(255,213,79,0.30);
    color: #ffd54f;
}

.nep-time {
    font-size: 10px;
    font-weight: 900;
    color: rgba(255,255,255,0.65);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nep-countdown {
    font-size: 9px;
    font-weight: 900;
    color: rgba(255,255,255,0.40);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 30px;
    text-align: right;
}

.nep-countdown--live {
    color: #ff3b3b;
    animation: pulse-alert 0.8s infinite alternate;
}

.nep-countdown--imminent {
    color: #ff9800;
}

.news-expand-empty {
    padding: 14px;
    text-align: center;
    font-size: 10px;
    color: var(--muted);
}

/* HOW TO button inside news icon zone */
.news-howto-btn {
    background: rgba(255,59,59,0.10);
    border: 1px solid rgba(255,59,59,0.30);
    border-radius: 4px;
    color: rgba(255,255,255,0.55);
    font-size: 9px;
    font-weight: 900;
    padding: 2px 5px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    flex-shrink: 0;
}

.news-howto-btn:hover {
    background: rgba(255,59,59,0.20);
    color: #fff;
}

.news-tap-hint {
    font-size: 7px;
    font-weight: 700;
    color: rgba(255,255,255,0.22);
    letter-spacing: 0.8px;
    text-align: center;
    text-transform: uppercase;
}



/* match-last-a: no longer used — highlight is card-level only */


/* ============================================================================
   Extended Panels (Compact View)
   ============================================================================ */
/* Reduce vertical size and prominence of EXT panels as requested */
#extendedAskPanel .priceBox,
#extendedBidPanel .priceBox {
    min-height: 50px;
    padding: 4px 36px 4px 6px;
}

#extendedAskPanel .mainPrice,
#extendedBidPanel .mainPrice {
    font-size: 18px; /* Smaller than main 28px */
}

#extendedAskPanel .sizeTag,
#extendedBidPanel .sizeTag {
    font-size: 9px;
    margin-top: 1px;
}

#extendedAskPanel .gradeChip,
#extendedBidPanel .gradeChip {
    transform: scale(0.8);
    transform-origin: bottom right;
    bottom: 2px;
    right: 2px;
}

/* Ensure the center label fits the new height */
#extendedAskPanel .centerBox,
#extendedBidPanel .centerBox {
    padding: 4px;
    justify-content: center;
}

/* ✅ NEW: Left-side stamp for numbering + age (Last A) */
.memStamp {
    position: absolute;
    left: 6px;
    top: 6px; /* Top aligned */
    transform: none; /* Remove vertical center */
    
    min-width: 34px;
    height: 28px;
    padding: 0 4px;
    
    border-radius: 8px;
    font-size: 15px;
    font-weight: 900;
    
    /* Colors - keep existing logic but maybe subtler border */
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(41, 121, 255, 0.12);
    color: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2); /* Subtle shadow for depth */
}

/* Text-only colors for grade classes when used without .gradeChip background */
.A { color: #7cff8a; }
.Aplus { color: #eaffea; } /* Or a specific green for A+ text */
.Aplus2 { color: #ffffff; } /* A++ usually white text on green bg, maybe keep white or light green? */
.Aplus3 { color: #ffffff; } /* A+++ */

/* Support Float Widget (Generic) */
.support-float {
    position: fixed; /* Default fallback */
    width: 30px;
    height: 30px;
    /* Default position */
    top: 12px;
    right: 12px;
    background-color: #444; /* Default Dark Grey */
    color: #FFF;
    border-radius: 50%;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.1s ease, background-color 0.3s ease, box-shadow 0.3s ease; /* Faster transform for dragging */
    cursor: grab; /* Indicate draggable */
    user-select: none;
    touch-action: none; /* Prevent scrolling while dragging on mobile */
}

/* ══════════════════════════════════════════════
   MARKET CLOSED OVERLAY
══════════════════════════════════════════════ */
.mco-card {
    background: #12181f;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 24px 18px 18px;
    text-align: center;
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.mco-lock-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}
.mco-title {
    font-size: 22px;
    font-weight: 900;
    color: #ff4d4d;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.mco-subtitle {
    font-size: 12px;
    color: #888;
    line-height: 1.6;
    margin-bottom: 16px;
}
.mco-next-open {
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.mco-next-label {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.mco-next-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
}
.mco-next-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.mco-countdown-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}
.mco-countdown {
    font-size: 38px;
    font-weight: 900;
    color: #ff4d4d;
    letter-spacing: 3px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 4px;
}
.mco-subtitle {
    font-size: 12px;
    color: #888;
    line-height: 1.6;
    margin-bottom: 16px;
    word-break: break-word;
}
.mco-next-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.mco-countdown-units {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 300px;
    margin: 4px auto 0;
    font-size: 9px;
    color: #555;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.mco-countdown-units span {
    text-align: center;
    padding: 0 2px;
}
.mco-actions-card {
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 14px 12px;
    margin-bottom: 12px;
}
.mco-actions-title {
    font-size: 11px;
    font-weight: 800;
    color: #3b82f6;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.mco-actions-row {
    display: flex;
    justify-content: space-around;
    gap: 8px;
}
.mco-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
}
.mco-action-label {
    font-size: 11px;
    font-weight: 800;
}
.mco-action-desc {
    font-size: 9px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}
.mco-tagline {
    font-size: 11px;
    color: #444;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Section header MARKET CLOSED badge */
.mco-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,58,58,0.12);
    border: 1px solid rgba(255,58,58,0.35);
    color: #ff4d4d;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
}

/* Grabbing state */
.support-float:active {
    cursor: grabbing;
    transform: scale(0.95); /* Slight press effect */
}

/* Pulse Animation for new users/visibility */
@keyframes bloom-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.support-float.pulse {
    animation: bloom-pulse 2s infinite;
}

/* Platform Colors */
.support-float.whatsapp {
    background-color: #25d366;
}
.support-float.whatsapp:hover {
    background-color: #128c7e;
    transform: scale(1.1);
}

.support-float.telegram {
    background-color: #0088cc;
}
.support-float.telegram:hover {
    background-color: #0077b5;
    transform: scale(1.1);
}

.support-float.messenger {
    background-color: #0084ff;
}
.support-float.messenger:hover {
    background-color: #006bcf;
    transform: scale(1.1);
}

/* When inside the status card, it sticks to it BUT keeps absolute */
.system-status-card .support-float {
    position: absolute;
    /* Initial position relative to card */
    top: 10px;
    right: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 100;
}

.support-icon {
    width: 16px;
    height: 16px;
    fill: white;
    pointer-events: none; /* Ensure clicks go to the link */
}

/* ============================================================================
   AI Confidence Check
   ============================================================================ */
.btn-ai-check {
    background: linear-gradient(135deg, #6366f1, #4f46e5); /* Indigo style AI */
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
}

.btn-ai-check:active {
    transform: scale(0.95);
    box-shadow: 0 1px 5px rgba(99, 102, 241, 0.2);
}

.btn-ai-check.loading {
    opacity: 0.7;
    pointer-events: none;
    background: #333;
    background: linear-gradient(135deg, #444, #333);
}

#aiConfidenceResult {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* AI Mini Button (Top Right of Price Box) */
.btn-ai-mini {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    font-size: 18px !important;
    font-family: 'Segoe UI Emoji', 'Noto Color Emoji', 'Apple Color Emoji', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
/* When inside the new absolute container, override to static so they stack vertically */
.be-card > div > .btn-ai-mini,
.be-card > div > .btn-admin-tg-send {
    position: static !important;
    width: 26px !important;
    height: 26px !important;
    font-size: 16px !important;
}

.btn-ai-mini:active {
    transform: scale(0.9);
}

.btn-ai-mini.loading {
    animation: spinAi 1s linear infinite;
    pointer-events: none;
    opacity: 0.7;
    border-color: var(--primary);
}

@keyframes spinAi {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Color variations for specific sides */
.btn-ai-mini.ask {
    border-color: rgba(255, 82, 82, 0.3);
    color: #ff8a80;
    background: rgba(40, 20, 20, 0.9);
}
.btn-ai-mini.ask:hover {
    border-color: rgba(255, 82, 82, 0.6);
    background: rgba(60, 30, 30, 1);
}

.btn-ai-mini.bid {
    border-color: rgba(105, 240, 174, 0.3);
    color: #b9f6ca;
    background: rgba(20, 40, 25, 0.9);
}
.btn-ai-mini.bid:hover {
    border-color: rgba(105, 240, 174, 0.6);
    background: rgba(30, 60, 40, 1);
}

/* Admin manual Telegram send button (shown only for admins, below AI button) */
.btn-admin-tg-send {
    position: absolute;
    top: 40px;
    right: 4px;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px;
    background: rgba(20, 30, 60, 0.9);
    border: 1px solid rgba(41, 121, 255, 0.4);
    color: #90caf9;
    font-size: 18px !important;
    font-family: 'Segoe UI Emoji', 'Noto Color Emoji', 'Apple Color Emoji', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.btn-admin-tg-send:active {
    transform: scale(0.9);
}
.btn-admin-tg-send:hover {
    border-color: rgba(41, 121, 255, 0.8);
    background: rgba(30, 50, 100, 1);
}
.btn-admin-tg-send.ask {
    border-color: rgba(255, 82, 82, 0.4);
    color: #ff8a80;
    background: rgba(40, 15, 15, 0.9);
}
.btn-admin-tg-send.ask:hover {
    border-color: rgba(255, 82, 82, 0.8);
    background: rgba(70, 20, 20, 1);
}
.btn-admin-tg-send.bid {
    border-color: rgba(105, 240, 174, 0.4);
    color: #b9f6ca;
    background: rgba(15, 40, 20, 0.9);
}
.btn-admin-tg-send.bid:hover {
    border-color: rgba(105, 240, 174, 0.8);
    background: rgba(20, 60, 30, 1);
}

/* ============================================================================
   Replay Interface Styles
   ============================================================================ */
.replay-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    margin: 0;
    cursor: pointer;
}

.replay-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    margin-top: -5px; /* Centers thumb on 4px track: (4 - 14)/2 = -5 */
}

.replay-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Firefox support */
.replay-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.replay-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Active state */
.replay-slider:active::-webkit-slider-thumb {
    transform: scale(1.1);
    background: #fff;
    border-color: var(--primary);
}

/* ============================================================================
   Exec & Spoof Badges (Upper Left) - Enforce Visibility
   ============================================================================ */
.topLeftPills {
    position: absolute;
    top: 2px;
    left: 4px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
    z-index: 20;
    pointer-events: none;
}
/* When used at the bottom of a be-card, reset top to auto */
.be-card .topLeftPills {
    top: auto;
    bottom: 6px;
    left: 6px;
    right: 52px;
    flex-direction: row;
}

.gradeChip.exec {
    position: static !important; /* Stack in flex container */
    display: inline-block !important; /* Override default display:none */
    background: rgba(156, 39, 176, 0.15); /* Purple tint */
    border: 1px solid rgba(156, 39, 176, 0.4);
    color: #ce93d8;
    box-shadow: 0 0 8px rgba(156, 39, 176, 0.2);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
    transform: none !important; /* Reset any scaling */
}

/* Ensure spoof banner is visible if added */
.spoof-alert-banner {
    position: static !important;
    display: block !important;
    background: rgba(255, 23, 68, 0.95);
    border: 1px solid #ff1744;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 6px rgba(255, 23, 68, 0.4);
    animation: flashRed 1.5s infinite ease-in-out;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ============================================================================
   Best Entry Cards (Redesign — Reference Image Match)
   ============================================================================ */

/* Main side card (SELL / BUY) */
.be-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    overflow: visible;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-height: 200px;
    gap: 5px;
}

.be-card--ask {
    border-color: rgba(255, 82, 82, 0.5);
    box-shadow: 0 0 12px rgba(255, 82, 82, 0.15);
    z-index: 2;
    position: relative;
}

.be-card--bid {
    border-color: rgba(97, 211, 107, 0.5);
    box-shadow: 0 0 12px rgba(97, 211, 107, 0.15);
    z-index: 2;
    position: relative;
}

/* Highlighted / super state */
.be-card--ask.super {
    border-color: rgba(255, 82, 82, 0.85) !important;
    box-shadow: 0 0 22px rgba(255, 82, 82, 0.5), inset 0 0 12px rgba(255, 82, 82, 0.08) !important;
}
.be-card--bid.super {
    border-color: rgba(97, 211, 107, 0.85) !important;
    box-shadow: 0 0 22px rgba(97, 211, 107, 0.5), inset 0 0 12px rgba(97, 211, 107, 0.08) !important;
}

/* Secondary (extended) card variant */
.be-card--secondary {
    min-height: 60px;
    opacity: 0.85;
    border-style: dashed;
}

/* Absorption Decision Card */
.absorption-decision-card {
    --abs-accent: var(--bid);
    --abs-accent-soft: rgba(97, 211, 107, 0.12);
    --abs-border: rgba(97, 211, 107, 0.45);
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.96), var(--abs-accent-soft));
    border: 1px solid var(--abs-border);
    border-radius: 8px;
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 60px;
    height: 100%;
    padding: 6px 8px;
    box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.02), 0 0 12px color-mix(in srgb, var(--abs-accent) 20%, transparent);
    overflow: hidden;
}

.absorption-decision-card--success {
    --abs-accent: var(--bid);
    --abs-accent-soft: rgba(97, 211, 107, 0.12);
    --abs-border: rgba(97, 211, 107, 0.45);
}

.absorption-decision-card--warning {
    --abs-accent: #fbbf24;
    --abs-accent-soft: rgba(251, 191, 36, 0.12);
    --abs-border: rgba(251, 191, 36, 0.45);
}

.absorption-decision-card--danger {
    --abs-accent: #ff7043;
    --abs-accent-soft: rgba(255, 112, 67, 0.14);
    --abs-border: rgba(255, 112, 67, 0.52);
}

.absorption-decision-card__header {
    color: rgba(154, 166, 178, 0.72);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.9px;
    line-height: 1;
    text-transform: uppercase;
}

.absorption-decision-card__badge {
    color: var(--abs-accent);
    border: 1px solid var(--abs-border);
    border-radius: 999px;
    background: var(--abs-accent-soft);
    padding: 2px 6px;
    font-size: 7px;
    line-height: 1;
    white-space: nowrap;
}

.absorption-decision-card__main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: end;
}

.absorption-decision-card__verdict {
    color: var(--abs-accent);
    font-size: clamp(24px, 7vw, 42px);
    font-weight: 900;
    letter-spacing: 0.8px;
    line-height: 0.9;
    text-shadow: 0 0 14px color-mix(in srgb, var(--abs-accent) 62%, transparent);
    white-space: nowrap;
}

.absorption-decision-card__subtitle {
    color: var(--abs-accent);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-top: 3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.absorption-decision-card__risk {
    text-align: right;
}

.absorption-decision-card__risk-label {
    color: rgba(154, 166, 178, 0.68);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.absorption-decision-card__risk-value {
    color: var(--abs-accent);
    font-size: 22px;
    font-weight: 900;
    line-height: 0.95;
    margin-top: 2px;
}

.absorption-decision-card__risk-value--success {
    color: var(--bid);
}

.absorption-decision-card__risk-value--lime {
    color: #cddc39;
}

.absorption-decision-card__risk-value--warning {
    color: #fbbf24;
}

.absorption-decision-card__risk-value--danger {
    color: #ff7043;
}

.absorption-decision-card__bar-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.absorption-decision-card__bar-label {
    color: rgba(154, 166, 178, 0.56);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.4px;
    line-height: 1;
    text-transform: uppercase;
}

.absorption-decision-card__bar {
    position: relative;
    flex: 1;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(97, 211, 107, 0.95), rgba(251, 191, 36, 0.95), rgba(255, 107, 107, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45);
}

.absorption-decision-card__marker {
    position: absolute;
    top: 50%;
    left: var(--abs-risk-pct, 0%);
    width: 8px;
    height: 13px;
    border-radius: 999px;
    background: var(--abs-accent);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 10px color-mix(in srgb, var(--abs-accent) 72%, transparent);
    transform: translate(-50%, -50%);
}

.absorption-decision-card__footer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(234, 234, 234, 0.74);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.45px;
    line-height: 1;
    margin-top: 5px;
    padding-top: 5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.absorption-decision-card__footer-main {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-weight: 900;
}

.absorption-decision-card__footer-level {
    position: absolute;
    right: 0;
    max-width: 34%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(234, 234, 234, 0.58);
    font-size: 7px;
    font-weight: 800;
    opacity: 0.75;
}

.absorption-decision-card--compact .absorption-decision-card__footer-level {
    display: none;
}

/* Top row: direction badge (left) + buttons (right) */
.be-card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

/* Direction badge (SELL / BUY) — small pill top-left */
.be-dir-badge {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 5px 14px;
    border-radius: 8px;
    text-transform: uppercase;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.be-dir-badge--ask {
    background: rgba(255, 82, 82, 0.25);
    color: var(--ask);
    border: 1px solid rgba(255, 82, 82, 0.60);
}
.be-dir-badge--bid {
    background: rgba(97, 211, 107, 0.25);
    color: var(--bid);
    border: 1px solid rgba(97, 211, 107, 0.60);
}

/* Large price inside be-card */
.be-price {
    font-size: clamp(26px, 6.5vw, 40px);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    width: 100%;
    text-shadow: 0 0 20px currentColor;
    white-space: nowrap;
    padding: 4px 4px;
    box-sizing: border-box;
}

/* Smaller price for secondary cards */
.be-price-sm {
    font-size: clamp(14px, 3vw, 20px);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    width: 100%;
    white-space: nowrap;
}

/* Size pills row  e.g.  ( 54 , 3.8x , 32% , +29% ) */
.be-size-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    padding: 0 2px;
}
.be-size-pills .spill {
    padding: 1px 5px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    white-space: nowrap;
}
.be-size-pills.ask .spill { color: var(--ask); border-color: rgba(255,82,82,0.25); }
.be-size-pills.bid .spill { color: var(--bid); border-color: rgba(97,211,107,0.25); }

/* Confidence + grade wrapper: confidence bar on the left, grade circle on the right */
.be-conf-wrap {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
}

.be-conf-wrap > #aiConfBar_ask,
.be-conf-wrap > #aiConfBar_bid {
    flex: 1;
    min-width: 0;
    margin-top: 0 !important;
    align-self: stretch;
}

/* Grade circle inside .be-conf-wrap */
.be-conf-wrap > .gradeChip {
    position: static !important;
    transform: none !important;
    flex-shrink: 0;
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    border-radius: 50% !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    padding: 0 !important;
    text-align: center;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-width: 3px !important;
    letter-spacing: 0 !important;
    z-index: 5;
    align-self: center;
}

/* Bottom bar: wall chip + tracking pills on one line */
.be-card-bottom-row {
    display: flex;
    align-items: center;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.10);
    padding-top: 6px;
    margin-top: 4px;
    min-height: 28px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.be-card-bottom-row .wallChipBox {
    position: static !important;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 900;
    padding: 3px 6px;
    border-radius: 8px;
}
.be-card-bottom-row .topLeftPills {
    position: static !important;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    flex: 1;
    align-items: center;
    overflow: hidden;
    justify-content: space-around;
}
/* Pipe separators between tracking pills */
.be-card-bottom-row .topLeftPills [data-betrack]:not(:first-child)::before {
    content: '|';
    color: rgba(255,255,255,0.20);
    font-size: 12px;
    margin: 0 5px;
    font-weight: 300;
}

/* Center stats card adjustments */
.be-center {
    min-height: 200px;
    background: rgba(20,24,36,0.97) !important;
    border-color: rgba(255,255,255,0.10) !important;
    box-shadow: none !important;
    overflow: visible;
    min-width: 0;
    word-break: break-all;
}

/* Confidence bar inside .be-conf-wrap — full width, no extra padding */
#aiConfBar_ask,
#aiConfBar_bid {
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px !important;
    border-radius: 10px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
    justify-content: center;
}

/* Robot / admin buttons in top row (not absolute anymore) */
.be-card-top-row .btn-ai-mini,
.be-card-top-row .btn-admin-tg-send {
    position: static !important;
    width: 26px !important;
    height: 26px !important;
    font-size: 16px !important;
}

/* ── Shared section-header pill buttons ────────────────────────────────────
   .sec-btn-how   = amber "? HOW TO" pill
   .sec-btn-toggle = blue  "▲ COLLAPSE / ▼ EXPAND" pill
   Both share the same height, font, and corner radius so they sit
   flush next to each other and match the DOM-EDGE SHIELD controls.
──────────────────────────────────────────────────────────────────────────── */
.sec-btn-how,
.sec-btn-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: inherit;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.6px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.18s;
    flex-shrink: 0;
}

.sec-btn-how {
    background: rgba(255,193,7,0.10);
    border: 1px solid rgba(255,193,7,0.45);
    color: #ffd54f;
}
.sec-btn-how:hover { background: rgba(255,193,7,0.22); }

.sec-btn-toggle {
    background: rgba(41,121,255,0.07);
    border: 1px solid rgba(41,121,255,0.30);
    color: #4f9eff;
}
.sec-btn-toggle:hover { background: rgba(41,121,255,0.18); }

/* Replay variant — amber accent to match its border theme */
#replayPanel .sec-btn-toggle {
    background: rgba(251,191,36,0.07);
    border: 1px solid rgba(251,191,36,0.30);
    color: #fbbf24;
}
#replayPanel .sec-btn-toggle:hover { background: rgba(251,191,36,0.18); }

/* Section header row — title left, actions right */
.sec-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}
.sec-header-left {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
}
.sec-header-left span {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1.4px;
    color: #e6edf3;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sec-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}
