/* ========== PREMIUM VARIABLES ========== */
:root {
    --bg-0: #020205; /* Deep rich black */
    --bg-1: #0A0A10;
    --bg-2: #12121C;
    --bg-3: #1B1B29;
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.15);
    --text: #A0A5B5;
    --text-dim: #656A7A;
    --text-bright: #FFFFFF;
    --accent: #5E6AD2;
    --accent-hover: #7E8CFF;
    --green: #00E676;
    --green-dim: rgba(0, 230, 118, 0.12);
    --green-hover: #00C853;
    --red: #FF3D71;
    --red-dim: rgba(255, 61, 113, 0.12);
    --red-hover: #E33664;
    --orange: #FFB74D;
    --font: 'Outfit', 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Roboto Mono', monospace;
    --radius: 12px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    --glow: 0 0 20px rgba(94, 106, 210, 0.4);
    --glass-bg: rgba(10, 10, 16, 0.65);
    --glass-border: rgba(255, 255, 255, 0.06);
}

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

body {
    color-scheme: dark;
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

.mono { 
    font-family: var(--mono); 
    font-variant-numeric: tabular-nums; 
}
.accent { color: var(--accent); }
.r { text-align: right; }
.hidden { display: none !important; }

/* ========== APP FRAME ========== */
.app {
    display: grid;
    grid-template-rows: 48px 1fr;
    height: 100vh;
    overflow: hidden;
}
#mount-terminal, #mount-bank, #mount-mf, #mount-ipo, #mount-realestate, #mount-settings, #mount-syndicate, #mount-options, #mount-customize {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    grid-row: 2 / 4;
    grid-column: 1 / -1;
    pointer-events: none;
}
#mount-terminal > *, #mount-bank > *, #mount-mf > *, #mount-ipo > *, #mount-realestate > *, #mount-settings > *, #mount-syndicate > *, #mount-options > *, #mount-customize > * {
    pointer-events: auto;
}
#mount-terminal .main-grid {
    flex: 1;
    min-height: 0;
}

/* ========== TOP BAR ========== */
.topbar {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 100;
}

.topbar-brand {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    min-width: 200px;
}

.topbar-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.stat { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.stat-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); white-space: nowrap; }
.stat-val { font-size: 13px; font-weight: 600; color: var(--text-bright); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 180px;
    justify-content: flex-end;
}

.ctrl-btn {
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 12px;
}
.ctrl-btn:hover { background: var(--bg-3); color: var(--text); }
.ctrl-btn.on { background: var(--accent); color: #fff; }
.ctrl-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }


/* ========== MAIN GRID ========== */
.main-grid {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    overflow: hidden;
    gap: 16px;
    padding: 16px 16px 0 16px;
}

/* ========== WATCHLIST ========== */
.watchlist-panel {
    background: var(--bg-1);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sec-header {
    height: 40px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-bright);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-1);
    flex-shrink: 0;
    gap: 8px;
}

.sec-header i { color: var(--accent); }

.wl-head {
    display: flex;
    padding: 6px 14px;
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
}
.wl-h-sym { flex: 1.5; }
.wl-h-ltp { flex: 1; text-align: right; }
.wl-h-chg { flex: 0.8; text-align: right; }

.wl-body {
    flex: 1;
    overflow-y: auto;
    contain: strict;
}

.wl-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: all 0.15s ease;
}
.wl-row:hover { background: var(--bg-2); transform: translateX(2px); }
.wl-row.active {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent);
    padding-left: 11px;
}
.wl-row .wl-sym { flex: 1.5; font-weight: 600; color: var(--text-bright); font-size: 12px; }
.wl-row .wl-ltp { flex: 1; text-align: right; font-family: var(--mono); font-size: 12px; }
.wl-row .wl-chg { flex: 0.8; text-align: right; font-family: var(--mono); font-size: 11px; }

.up { color: var(--green); }
.dn { color: var(--red); }

/* ========== CENTER PANEL ========== */
.center-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-1);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden;
}

.chart-topbar {
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ct-left { display: flex; flex-direction: column; flex-shrink: 0; justify-content: center; }
.ct-symbol { font-size: 22px; font-weight: 800; color: var(--text-bright); line-height: 1.1; letter-spacing: -0.02em; }
.ct-name { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Fixed UI Things for overflow */
.ct-right { 
    text-align: right; 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0; 
    justify-content: center; 
    min-width: 0; 
    max-width: 320px; 
    margin-left: 16px; 
    /* Removed border-left and padding-left! */
}

.ct-price { 
    font-size: 26px; 
    font-weight: 800; 
    letter-spacing: -0.02em; 
    color: var(--text-bright); 
    line-height: 1.1; 
    font-variant-numeric: tabular-nums; 
}

.ct-change, .ct-prev-close { 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; /* Truncates long text with '...' */
    width: 100%; 
}

.ct-change { font-size: 13px; font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ct-prev-close { font-size: 11px; color: var(--text-dim); margin-top: 2px; font-variant-numeric: tabular-nums; }

.ct-chart-type {
    display: flex; 
    gap: 12px; 
    align-items: center;
    flex: 1;             /* Take up all available middle space */
    min-width: 0;        /* CRITICAL: Allows flexbox to scroll its contents */
    overflow-x: auto;    /* Enable horizontal scrolling */
    overflow-y: hidden;
    padding: 10px 12px; /* The '24px' adds empty space after the Analytics button */
    
    /* Hide scrollbar for a clean UI but keep scroll functionality */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
/* .ct-chart-type::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera
} 
*/

.segmented-control {
    display: flex;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    padding: 0;
    gap: 0;
    transform: perspective(500px) rotateX(5deg);
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0; /* CRITICAL: Never shrink, force the parent to scroll! */
}
.segmented-control:hover {
    transform: perspective(500px) rotateX(2deg);
}
.tf-btn, .chart-type-btn {
    background: linear-gradient(to bottom, white, grey);
    border: none;
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    border-radius: 0;
    white-space: nowrap;
    transform-style: preserve-3d;
}
.tf-btn span, .chart-type-btn span, .tf-btn i, .chart-type-btn i {
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateZ(2px);
}
.segmented-control button:first-child {
    border-radius: 20px 0 0 20px;
}
.segmented-control button:last-child {
    border-radius: 0 20px 20px 0;
}
.tf-btn:hover, .chart-type-btn:hover {
    box-shadow:
      0 0 8px rgba(0, 0, 0, 0.1) inset,
      0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 1;
}
.tf-btn:hover span, .chart-type-btn:hover span, .tf-btn:hover i, .chart-type-btn:hover i {
    transform: translateZ(8px) scale(1.05);
}
.tf-btn:active span, .chart-type-btn:active span, .tf-btn:active i, .chart-type-btn:active i {
    transform: translateZ(0px) scale(0.95);
}

/* Active Middle */
.tf-btn.active, .chart-type-btn.active {
    box-shadow:
      0 0 5px #2ecc71 inset,
      0 2px 8px rgba(46, 204, 113, 0.3),
      0 0 10px rgba(22, 128, 76, 0.3) inset;
    background: linear-gradient(150deg, #eafaf1, #7bdc8d);
    color: #1a934c;
    z-index: 2;
}

/* Active First */
.segmented-control button:first-child.active {
    box-shadow:
      0 0 5px rgb(26, 123, 208) inset,
      0 2px 8px rgba(0, 47, 255, 0.3),
      0 0 10px rgba(1, 14, 89, 0.3) inset;
    background: linear-gradient(150deg, #ffffff, #a3c4f3);
    color: #1a7bd0;
}

/* Active Last */
.segmented-control button:last-child.active {
    box-shadow:
      0 0 5px #9b59b6 inset,
      0 2px 8px rgba(155, 89, 182, 0.3),
      0 0 10px rgba(105, 39, 105, 0.3) inset;
    background: linear-gradient(150deg, #f4ecf7, #d291bc);
    color: #8e44ad;
}


.chart-container {
    flex: 1;
    padding: 12px 16px 8px;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    background: var(--bg-0);
    border-radius: 4px;
}

/* ========== CHART GRID CONTAINER (Multi-Layout) ========== */
#chart-grid-container {
    flex: 1;
    min-height: 0;
    position: relative;
    display: grid;
    gap: 6px;
}
.chart-grid-1x {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}
.chart-grid-2x {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}
.chart-grid-4x {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.chart-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-0);
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 0;
}
.chart-panel canvas {
    flex: 1 !important;
    width: 100% !important;
    min-height: 0 !important;
    background: var(--bg-0) !important;
    border-radius: 0 !important;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 11px;
}
.panel-ticker-select {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-bright);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    flex: 1;
    max-width: 130px;
}
.panel-tf-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.panel-tf-btn:hover { background: var(--bg-3); color: var(--text); }
.panel-tf-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.panel-price-ind {
    font-size: 11px;
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
    font-weight: 700;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-2);
}
.panel-price-ind.up { color: var(--green); }
.panel-price-ind.dn { color: var(--red); }

.panel-trade-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.panel-trade-btn:hover { opacity: 0.8; }

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.pulse-anim { animation: pulse-border 0.5s ease-out; }

/* ========== DRAWING TOOLBAR ========== */
.drawing-toolbar {
    position: absolute;
    left: 20px;
    top: 20px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: var(--bg-1);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 6px 5px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.draw-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
}
.draw-btn:hover {
    background: var(--bg-3);
    color: var(--text-bright);
    transform: scale(1.08);
}
.draw-btn.active {
    background: rgba(59, 130, 246, 0.18);
    color: var(--accent);
    box-shadow: 0 0 0 1.5px var(--accent);
}
.draw-btn.draw-clear { color: var(--red); }
.draw-btn.draw-clear:hover { background: var(--red-dim); color: var(--red); }
.draw-sep {
    width: 20px;
    height: 1px;
    background: var(--border);
    margin: 2px 0;
    border-radius: 1px;
}

/* ========== SUB-CHART CONTAINER (RSI / MACD) ========== */
#sub-chart-container {
    height: 112px;
    flex-shrink: 0;
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: height 0.2s ease;
}
.sub-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 10px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
#sub-chart-label { color: var(--accent); }
.sub-chart-ref { font-size: 9px; color: var(--text-dim); font-weight: 400; letter-spacing: 0; text-transform: none; }
#sub-chart-container canvas {
    flex: 1;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    background: var(--bg-0) !important;
    border-radius: 0 !important;
}

/* ========== LAYOUT SELECTOR ========== */
.layout-selector {
    border: 1px solid var(--border) !important;
    border-radius: 20px;
    overflow: visible;
}

/* ========== NEWS PANEL ========== */
.news-panel {
    height: 185px;
    border-top: 1px solid var(--border);
    background: var(--bg-1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.news-header {
    height: 32px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-bright);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.news-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.news-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px;
}

.news-item {
    display: flex;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.5;
    background: var(--bg-2);
    border-left: 3px solid var(--border);
}
.news-item.positive { border-left-color: var(--green); background: var(--green-dim); }
.news-item.negative { border-left-color: var(--red); background: var(--red-dim); }

.news-time {
    color: var(--text-dim);
    font-size: 10px;
    white-space: nowrap;
    min-width: 40px;
}

/* ========== ORDER PANEL ========== */
.order-panel {
    background: var(--bg-1);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.badge {
    background: var(--bg-3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.order-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.o-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}
.o-tab:hover { color: var(--text); background: var(--bg-2); }
.o-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.order-form {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.fg { display: flex; flex-direction: column; gap: 5px; }
.fg label {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.fc {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-bright);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border 0.15s;
}
.fc:focus { border-color: var(--accent); }
.fc option { background: var(--bg-1); color: var(--text); }
.fc:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.field-note {
    color: var(--text-dim);
    font-size: 10px;
    line-height: 1.4;
}

.qty-big { 
    font-size: 24px; 
    font-weight: 700; 
    padding: 12px 16px; 
    background: var(--bg-0);
    border: none !important;
    border-bottom: 2px solid var(--border) !important;
    border-radius: 8px 8px 0 0 !important;
    text-align: right;
    transition: all 0.2s ease;
}
.qty-big:focus {
    background: var(--bg-2);
    border-bottom-color: var(--accent) !important;
}

.presets {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.preset, .preset-opt {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 16px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--mono);
    font-weight: 600;
}
.preset:hover, .preset-opt:hover {
    border-color: var(--accent);
    background: var(--bg-3);
    color: var(--text-bright);
    transform: translateY(-1px);
}

.toggle-row {
    display: flex;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.toggle {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
}
.toggle.active {
    background: var(--bg-3);
    color: var(--text-bright);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid var(--border-light);
}

.order-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    color: var(--text-dim);
}
.order-meta .mono { color: var(--text-bright); }
.border-top { border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 4px; }

.order-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* UIVERSE 3D BUTTON BASE */
.uiverse-btn {
  all: unset;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  position: relative;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    -0.15em -0.15em 0.15em -0.075em rgba(5, 5, 5, 0.25),
    0.0375em 0.0375em 0.0675em 0 rgba(5, 5, 5, 0.1);
  transition: transform 0.2s ease, opacity 0.2s;
}

.order-actions .uiverse-btn {
  flex: 1;
}

.uiverse-btn::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: calc(100% + 0.3em);
  height: calc(100% + 0.3em);
  top: -0.15em;
  left: -0.15em;
  border-radius: inherit;
  background: linear-gradient(
    -135deg,
    rgba(5, 5, 5, 0.5),
    transparent 20%,
    transparent 100%
  );
  filter: blur(0.0125em);
  opacity: 0.25;
  mix-blend-mode: multiply;
}

.uiverse-btn .button-outer {
  position: relative;
  z-index: 1;
  border-radius: inherit;
  width: 100%;
  height: 100%;
  transition: box-shadow 300ms ease;
  will-change: box-shadow;
  box-shadow:
    0 0.05em 0.05em -0.01em rgba(5, 5, 5, 1),
    0 0.01em 0.01em -0.01em rgba(5, 5, 5, 0.5),
    0.15em 0.3em 0.1em -0.01em rgba(5, 5, 5, 0.25);
}

.uiverse-btn:hover .button-outer {
  box-shadow:
    0 0 0 0 rgba(5, 5, 5, 1),
    0 0 0 0 rgba(5, 5, 5, 0.5),
    0 0 0 0 rgba(5, 5, 5, 0.25);
}

.uiverse-btn .button-inner {
  position: relative;
  z-index: 1;
  border-radius: inherit;
  padding: 12px 16px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    box-shadow 300ms ease,
    clip-path 250ms ease,
    background-image 250ms ease,
    transform 250ms ease;
  will-change: box-shadow, clip-path, background-image, transform;
  overflow: clip;
  clip-path: inset(0 0 0 0 round var(--radius));
}

.uiverse-btn:hover .button-inner {
  clip-path: inset(
    clamp(1px, 0.0625em, 2px) clamp(1px, 0.0625em, 2px)
      clamp(1px, 0.0625em, 2px) clamp(1px, 0.0625em, 2px) round var(--radius)
  );
}

.uiverse-btn .button-inner span {
  position: relative;
  z-index: 4;
  font-family: inherit;
  font-weight: 700;
  color: white;
  transition: transform 250ms ease;
  display: flex;
  align-items: center;
  gap: 6px;
  will-change: transform;
  text-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px;
  user-select: none;
}

.uiverse-btn:hover .button-inner span {
  transform: scale(0.975);
}

.uiverse-btn:active .button-inner {
  transform: scale(0.975);
}

.uiverse-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ORDER ACTIONS CONTAINER & BUTTON ENHANCEMENTS */
.order-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 12px;
  width: 100%;
}

.order-actions .uiverse-btn,
.order-actions button {
  flex: 1;
  width: 100%;
  margin: 0;
}

/* GREEN / BUY */
.btn-buy { background-color: var(--green); }
.btn-buy .button-inner {
  background-image: linear-gradient(135deg, var(--green), var(--green-hover));
  box-shadow:
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    -0.05em -0.05em 0.05em 0 inset rgba(5, 5, 5, 0.25),
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    0 0 0.05em 0.2em inset rgba(255, 255, 255, 0.25),
    0.025em 0.05em 0.1em 0 inset rgba(255, 255, 255, 1),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.25),
    -0.075em -0.25em 0.25em 0.1em inset rgba(5, 5, 5, 0.25);
}
.btn-buy:hover .button-inner {
  box-shadow:
    0.1em 0.15em 0.05em 0 inset rgba(5, 5, 5, 0.4),
    -0.025em -0.03em 0.05em 0.025em inset rgba(5, 5, 5, 0.3),
    0.25em 0.25em 0.2em 0 inset rgba(5, 5, 5, 0.3),
    0 0 0.05em 0.5em inset rgba(255, 255, 255, 0.15),
    0 0 0 0 inset rgba(255, 255, 255, 1),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.25),
    -0.075em -0.12em 0.2em 0.1em inset rgba(5, 5, 5, 0.25);
}

/* RED / SELL */
.btn-sell { background-color: var(--red); }
.btn-sell .button-inner {
  background-image: linear-gradient(135deg, var(--red), var(--red-hover));
  box-shadow:
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    -0.05em -0.05em 0.05em 0 inset rgba(5, 5, 5, 0.25),
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    0 0 0.05em 0.2em inset rgba(255, 255, 255, 0.25),
    0.025em 0.05em 0.1em 0 inset rgba(255, 255, 255, 1),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.25),
    -0.075em -0.25em 0.25em 0.1em inset rgba(5, 5, 5, 0.25);
}
.btn-sell:hover .button-inner {
  box-shadow:
    0.1em 0.15em 0.05em 0 inset rgba(5, 5, 5, 0.4),
    -0.025em -0.03em 0.05em 0.025em inset rgba(5, 5, 5, 0.3),
    0.25em 0.25em 0.2em 0 inset rgba(5, 5, 5, 0.3),
    0 0 0.05em 0.5em inset rgba(255, 255, 255, 0.15),
    0 0 0 0 inset rgba(255, 255, 255, 1),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.25),
    -0.075em -0.12em 0.2em 0.1em inset rgba(5, 5, 5, 0.25);
}

/* Standalone button fallback without uiverse-btn structure */
button.btn-buy:not(.uiverse-btn), button.btn-sell:not(.uiverse-btn) {
  height: 44px;
  border-radius: var(--radius, 10px);
  padding: 0 16px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
  border: 1px solid transparent;
}

button.btn-buy:not(.uiverse-btn) {
  background: linear-gradient(135deg, #00E676 0%, #00C853 100%);
  color: #020205;
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

button.btn-buy:not(.uiverse-btn):hover {
  background: linear-gradient(135deg, #33eb91 0%, #00E676 100%);
  box-shadow: 0 6px 20px rgba(0, 230, 118, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

button.btn-sell:not(.uiverse-btn) {
  background: linear-gradient(135deg, #FF3D71 0%, #E33664 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(255, 61, 113, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button.btn-sell:not(.uiverse-btn):hover {
  background: linear-gradient(135deg, #ff648d 0%, #FF3D71 100%);
  box-shadow: 0 6px 20px rgba(255, 61, 113, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

/* WHITE/GREEN / BUY CASH */
.btn-buy-cash { background-color: var(--green-dim); font-size: 11px; margin-right: 5px; }
.btn-buy-cash .button-inner {
  padding: 6px 10px;
  background-image: linear-gradient(135deg, #ffffff, #e6e6e6);
  box-shadow:
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    -0.05em -0.05em 0.05em 0 inset rgba(5, 5, 5, 0.1),
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    0 0 0.05em 0.2em inset rgba(16, 185, 129, 0.25),
    0.025em 0.05em 0.1em 0 inset rgba(16, 185, 129, 0.5),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.8),
    -0.075em -0.25em 0.25em 0.1em inset rgba(5, 5, 5, 0.1);
}
.btn-buy-cash:hover .button-inner {
  box-shadow:
    0.1em 0.15em 0.05em 0 inset rgba(5, 5, 5, 0.15),
    -0.025em -0.03em 0.05em 0.025em inset rgba(5, 5, 5, 0.1),
    0.25em 0.25em 0.2em 0 inset rgba(5, 5, 5, 0.1),
    0 0 0.05em 0.5em inset rgba(16, 185, 129, 0.15),
    0 0 0 0 inset rgba(255, 255, 255, 1),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.8),
    -0.075em -0.12em 0.2em 0.1em inset rgba(5, 5, 5, 0.1);
}
.btn-buy-cash .button-inner span { color: var(--green); text-shadow: none; font-weight: 600; }

/* WHITE/ORANGE / MORTGAGE */
.btn-mortgage { background-color: rgba(245, 158, 11, 0.2); font-size: 11px; }
.btn-mortgage .button-inner {
  padding: 6px 10px;
  background-image: linear-gradient(135deg, #ffffff, #e6e6e6);
  box-shadow:
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    -0.05em -0.05em 0.05em 0 inset rgba(5, 5, 5, 0.1),
    0 0 0 0 inset rgba(5, 5, 5, 0.1),
    0 0 0.05em 0.2em inset rgba(245, 158, 11, 0.25),
    0.025em 0.05em 0.1em 0 inset rgba(245, 158, 11, 0.5),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.8),
    -0.075em -0.25em 0.25em 0.1em inset rgba(5, 5, 5, 0.1);
}
.btn-mortgage:hover .button-inner {
  box-shadow:
    0.1em 0.15em 0.05em 0 inset rgba(5, 5, 5, 0.15),
    -0.025em -0.03em 0.05em 0.025em inset rgba(5, 5, 5, 0.1),
    0.25em 0.25em 0.2em 0 inset rgba(5, 5, 5, 0.1),
    0 0 0.05em 0.5em inset rgba(245, 158, 11, 0.15),
    0 0 0 0 inset rgba(255, 255, 255, 1),
    0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.8),
    -0.075em -0.12em 0.2em 0.1em inset rgba(5, 5, 5, 0.1);
}
.btn-mortgage .button-inner span { color: #f59e0b; text-shadow: none; font-weight: 600; }

.short-info {
    font-size: 10px;
    color: var(--text-dim);
    padding: 8px 10px;
    background: var(--bg-2);
    border-radius: 4px;
    border-left: 3px solid var(--orange);
    line-height: 1.5;
}
.short-info i { color: var(--orange); margin-right: 4px; }

/* SL / Target row */
.sl-target-row {
    display: flex;
    gap: 8px;
    padding: 8px 14px 0;
}
.sl-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sl-field label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sl-field .fc {
    padding: 5px 8px;
    font-size: 11px;
}
.sl-hint {
    font-size: 10px;
    color: var(--orange);
    padding: 4px 14px 8px;
    opacity: 0.75;
}
.sl-hint i { margin-right: 4px; }

/* ========== POSITION CARD ========== */
.pos-card {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
}
.pos-card-head {
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
}
.pos-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}
.pc-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    background: var(--bg-1);
}
.pc-label { font-size: 10px; color: var(--text-dim); }
.pc-val { font-size: 14px; font-weight: 600; color: var(--text-bright); }
.pc-pnl { grid-column: 1 / -1; }
.pc-pnl .pc-val { font-size: 18px; }

/* ========== BOTTOM BAR ========== */
.bottom-bar {
    height: 130px;
    flex-shrink: 0;
    background: var(--bg-1);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(128, 128, 128, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 4px;
    gap: 2px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid rgba(128, 128, 128, 0.2);
    z-index: 1000;
}
body.light .bottom-tabs, body.theme-sepia .bottom-tabs {
    background: rgba(128, 128, 128, 0.08);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.b-tab {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 24px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.b-tab:hover { color: var(--text); background: rgba(128, 128, 128, 0.08); }
.b-tab.active { 
    color: var(--text-bright); 
    background: var(--bg-2); 
    border-color: var(--border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.b-tab i { font-size: 11px; }

/* Close All button floats right */
.b-tab.export-csv-btn {
    margin-left: auto;
    color: var(--green);
    border-bottom-color: transparent !important;
}
.b-tab.export-csv-btn:hover { background: rgba(0,200,83,0.08); color: var(--green); }

.b-tab.close-all-btn {
    color: var(--red);
    border-bottom-color: transparent !important;
}
.b-tab.close-all-btn:hover { background: rgba(255,23,68,0.08); color: var(--red); }

.table-area {
    flex: 1;
    overflow-y: auto;
}

.dtable {
    width: 100%;
    border-collapse: collapse;
}
.dtable th, .dtable td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.dtable th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--bg-2);
    position: sticky;
    top: 0;
    z-index: 2;
    letter-spacing: 0.3px;
}
.dtable td {
    font-family: var(--mono);
    font-size: 12px;
}
.dtable tbody tr:hover { background: var(--bg-2); }
.dtable .sym-cell { font-family: var(--font); font-weight: 600; color: var(--text-bright); }
.dtable .side-long { color: var(--green); font-weight: 600; }
.dtable .side-short { color: var(--red); font-weight: 600; }

/* Close position inline button */
.btn-close-pos {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font);
    transition: 0.15s;
    white-space: nowrap;
}
.btn-close-pos:hover { background: var(--red); color: #fff; }

.btn-cancel-order {
    background: transparent;
    border: 1px solid var(--orange);
    color: var(--orange);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font);
    transition: 0.15s;
    white-space: nowrap;
}
.btn-cancel-order:hover { background: var(--orange); color: #fff; }

.empty {
    text-align: center;
    color: var(--text-dim);
    padding: 24px !important;
    font-family: var(--font);
    font-style: italic;
}

/* ========== TOASTS ========== */
.toast-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99999;
    pointer-events: none;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    box-shadow: var(--shadow);
    animation: toastIn 0.25s ease-out;
    pointer-events: auto;
    font-size: 12px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
.toast-title { font-weight: 600; color: var(--text-bright); }
.toast-msg { color: var(--text-dim); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== NEW DAY OVERLAY ========== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.overlay-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 36px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.ov-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.ov-title { font-size: 20px; font-weight: 700; color: var(--text-bright); margin-bottom: 6px; }
.ov-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }
.ov-sub span { color: var(--accent); font-weight: 600; }

.ov-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.ov-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-2);
}
.ov-stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }
.ov-stat-val { font-size: 15px; font-weight: 600; color: var(--text-bright); margin-top: 2px; }

.ov-expiry-info {
    font-size: 11px;
    color: var(--orange);
    padding: 8px 12px;
    background: rgba(255, 145, 0, 0.08);
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid rgba(255, 145, 0, 0.2);
}
.ov-expiry-info i { margin-right: 4px; }

.ov-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s;
    margin-bottom: 12px;
}
.ov-btn:hover { background: var(--accent-hover); }

.ov-hint {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ========== CLICKABLE STAT ========== */
.stat.clickable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.stat.clickable:hover {
    background: var(--bg-3);
}

/* ========== SETTINGS MODAL ========== */
.settings-card {
    max-width: 460px;
}
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    text-align: left;
}
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.settings-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-bright);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.settings-label i {
    color: var(--accent);
    margin-right: 6px;
    width: 14px;
    text-align: center;
}
.cash-input-row {
    display: flex;
    align-items: center;
    gap: 0;
}
.cash-prefix {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-right: none;
    padding: 8px 12px;
    border-radius: var(--radius) 0 0 var(--radius);
    font-weight: 700;
    color: var(--text-bright);
    font-size: 14px;
}
.cash-input-row .fc {
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}
.cash-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cash-preset {
    padding: 6px 12px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.15s;
    font-family: var(--mono);
    font-weight: 500;
}
.cash-preset:hover {
    border-color: var(--accent);
    background: rgba(41, 98, 255, 0.1);
    color: var(--accent);
}
.settings-warning {
    font-size: 11px;
    color: var(--orange);
    padding: 10px 12px;
    background: rgba(255, 145, 0, 0.08);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 145, 0, 0.2);
    line-height: 1.5;
}
.settings-warning i {
    margin-right: 4px;
}
.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ov-btn-secondary {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
}
.ov-btn-secondary:hover {
    background: var(--bg-3);
    border-color: var(--border-light);
}

.of-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 15px; }
.o-tab { flex: 1; padding: 10px; background: none; border: none; color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.o-tab:hover { color: var(--text-bright); }
.o-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* ========== GREEKS BOX ========== */
.greeks-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
    padding: 10px;
    background: var(--bg-1);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.greek-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.g-lbl {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
}
.g-val {
    font-size: 11px;
    color: var(--text-bright);
    transition: color 0.15s;
}
.g-val.flash-up { color: var(--green); }
.g-val.flash-dn { color: var(--red); }

/* ========== PRESETS & BUTTONS ========== */

/* ========== SENTIMENT INDICATOR ========== */
#market-sentiment {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}
#market-sentiment i {
    font-size: 10px;
}

/* ========== CIRCUIT BADGE ========== */
.circuit-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    margin-left: 4px;
    animation: circuitPulse 0.6s ease-in-out;
}
.circuit-badge.uc {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green);
}
.circuit-badge.lc {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red);
}
@keyframes circuitPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== VOLUME BAR ========== */
.vol-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}
.vol-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.3s;
}

/* ========== WATCHLIST SECTOR TAG ========== */
.wl-sector {
    font-size: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ========== WATCHLIST SEARCH ========== */
.wl-search-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
    position: relative;
}
.wl-search-icon {
    position: absolute;
    left: 20px;
    font-size: 10px;
    color: var(--text-dim);
    pointer-events: none;
    z-index: 1;
}
.wl-search-input {
    width: 100%;
    background: var(--bg-1);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px 6px 28px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 12px;
    outline: none;
    transition: border 0.15s;
}
.wl-search-input::placeholder { color: var(--text-dim); font-size: 11px; }
.wl-search-input:focus { border-color: var(--accent); }
.wl-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-dim);
    font-size: 11px;
    font-style: italic;
}
.wl-stock-count {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    padding: 1px 6px;
    background: var(--bg-3);
    border-radius: 10px;
    margin-left: auto;
}

/* ========== PRICE FLASH ANIMATIONS ========== */
@keyframes flashUp {
    0%   { background: rgba(0, 200, 83, 0.25); }
    100% { background: transparent; }
}
@keyframes flashDn {
    0%   { background: rgba(255, 23, 68, 0.25); }
    100% { background: transparent; }
}
.flash-up { animation: flashUp 0.55s ease-out; will-change: background; }
.flash-dn { animation: flashDn 0.55s ease-out; will-change: background; }

/* ========== CHART CROSSHAIR CURSOR ========== */
.chart-container canvas { cursor: crosshair; }

/* ========== VOLUME BAR SEPARATOR ========== */
.vol-divider {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 0;
}

/* ========== NIFTY / SENSEX DISPLAY ========== */
#nifty-value, #sensex-value {
    font-size: 13px;
}

/* ========== WATCHLIST MARKET FILTER ========== */
.wl-market-filters {
    display: flex;
    gap: 3px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.wl-mf-btn {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-3);
    color: var(--text-dim);
    cursor: pointer;
    transition: 0.15s;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-family: var(--mono);
}
.wl-mf-btn:hover { border-color: var(--accent); color: var(--accent); }
.wl-mf-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ========== WATCHLIST MARKET BADGE ========== */
.wl-mkt-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    padding: 0px 4px;
    border-radius: 3px;
    margin-left: 4px;
    font-family: var(--mono);
    vertical-align: middle;
}
.wlm-nasdaq { background: rgba(41,98,255,0.2); color: #6ea5ff; border: 1px solid rgba(41,98,255,0.4); }
.wlm-sse    { background: rgba(255,82,82,0.2);  color: #ff8080; border: 1px solid rgba(255,82,82,0.4); }
.wlm-tse    { background: rgba(255,145,0,0.2);  color: #ffc46e; border: 1px solid rgba(255,145,0,0.4); }
.wlm-hkex   { background: rgba(213,0,249,0.2);  color: #e040fb; border: 1px solid rgba(213,0,249,0.4); }
.wlm-eu     { background: rgba(140,158,255,0.2);color: #b3c4ff; border: 1px solid rgba(140,158,255,0.4); }
.wlm-comm   { background: rgba(255,214,0,0.2);  color: #ffd600; border: 1px solid rgba(255,214,0,0.4); }
.wlm-crypto { background: rgba(247,147,26,0.2); color: #f7931a; border: 1px solid rgba(247,147,26,0.4); }
.wlm-fx     { background: rgba(0,229,255,0.2);  color: #00e5ff; border: 1px solid rgba(0,229,255,0.4); }

/* ========== NEWS MARKET FILTER ========== */
.news-market-filters {
    display: flex;
    gap: 8px;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-1);
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
}
.news-mf-btn {
    font-size: 9px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(to bottom, white, grey);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: var(--mono);
    transform: perspective(500px) rotateX(5deg);
    transform-style: preserve-3d;
}
.news-mf-btn span, .news-mf-btn i {
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateZ(2px);
}
.news-mf-btn:hover {
    transform: perspective(500px) rotateX(0deg) translateY(-2px);
    box-shadow:
      0 0 8px rgba(0, 0, 0, 0.1) inset,
      0 4px 6px rgba(0, 0, 0, 0.2);
}
.news-mf-btn:hover span, .news-mf-btn:hover i {
    transform: translateZ(10px) scale(1.1);
}
.news-mf-btn:active {
    transform: perspective(500px) rotateX(2deg) translateY(1px);
}
.news-mf-btn:active span, .news-mf-btn:active i {
    transform: translateZ(1px) scale(0.95);
}
.news-mf-btn.active {
    box-shadow:
      0 0 5px #2ecc71 inset,
      0 2px 8px rgba(46, 204, 113, 0.3),
      0 0 10px rgba(22, 128, 76, 0.3) inset;
    background: linear-gradient(150deg, #eafaf1, #7bdc8d);
    color: #1a934c;
}
.news-mf-btn.active.nmf-nasdaq {
    box-shadow: 0 0 5px #5c6bc0 inset, 0 2px 8px rgba(92, 107, 192, 0.3), 0 0 10px rgba(50, 60, 120, 0.3) inset;
    background: linear-gradient(150deg, var(--bg-3), rgba(92, 107, 192, 0.2));
    color: #8c9eff;
}
.news-mf-btn.active.nmf-eu {
    box-shadow: 0 0 5px #ab47bc inset, 0 2px 8px rgba(171, 71, 188, 0.3), 0 0 10px rgba(100, 40, 120, 0.3) inset;
    background: linear-gradient(150deg, var(--bg-3), rgba(171, 71, 188, 0.2));
    color: #e1bee7;
}
.news-mf-btn.active.nmf-sse {
    box-shadow: 0 0 5px #ef5350 inset, 0 2px 8px rgba(239, 83, 80, 0.3), 0 0 10px rgba(150, 30, 30, 0.3) inset;
    background: linear-gradient(150deg, var(--bg-3), rgba(239, 83, 80, 0.2));
    color: #ffcdd2;
}
.nmf-nasdaq, .nmf-sse, .nmf-tse, .nmf-comm, .nmf-crypto, .nmf-fx { cursor: pointer; }
.nmf-war.active {
    box-shadow: 0 0 5px var(--orange) inset, 0 5px 15px rgba(255, 152, 0, 0.4), 0 0 15px rgba(150, 80, 0, 0.4) inset;
    background: linear-gradient(150deg, var(--bg-3), rgba(255, 152, 0, 0.2));
    color: var(--orange);

}
.nmf-war:hover { border-color: var(--orange); color: var(--orange); }

/* ========== NEWS MARKET BADGE ========== */
.news-mkt-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 3px;
    font-family: var(--mono);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
    text-transform: uppercase;
}
.nmb-nse    { background: rgba(0,200,83,0.15);   color: #00c853; border: 1px solid rgba(0,200,83,0.35); }
.nmb-nasdaq { background: rgba(92,107,192,0.15); color: #7986cb; border: 1px solid rgba(92,107,192,0.35); }
.nmb-eu { background: rgba(142,36,170,0.15); color: #ba68c8; border: 1px solid rgba(142,36,170,0.35); }
.nmb-sse    { background: rgba(229,57,53,0.15);   color: #ef5350; border: 1px solid rgba(229,57,53,0.35); }
.nmb-tse    { background: rgba(255,145,0,0.15);   color: #ffc46e; border: 1px solid rgba(255,145,0,0.35); }
.nmb-comm   { background: rgba(255,214,0,0.15);   color: #ffd600; border: 1px solid rgba(255,214,0,0.35); }
.nmb-crypto { background: rgba(247,147,26,0.15);  color: #f7931a; border: 1px solid rgba(247,147,26,0.35); }
.nmb-fx     { background: rgba(0,229,255,0.15);   color: #00e5ff; border: 1px solid rgba(0,229,255,0.35); }
.nmb-war    { background: rgba(255,62,0,0.20);    color: #ff6e40; border: 1px solid rgba(255,62,0,0.45); }
.nmb-global { background: rgba(100,100,100,0.20); color: #b0bec5; border: 1px solid rgba(100,100,100,0.45); }
.news-item .news-mkt-badge { margin-right: 2px; }

/* ========== LIGHT MODE ADJUSTMENTS ========== */
body.light .wlm-nasdaq, body.theme-sepia .wlm-nasdaq { background: rgba(41,98,255,0.1); color: #2962ff; }
body.light .wlm-sse, body.theme-sepia .wlm-sse    { background: rgba(213,0,50,0.1);  color: #c62828; }
body.light .wlm-tse, body.theme-sepia .wlm-tse    { background: rgba(245,124,0,0.1); color: #e65100; }
body.light .wlm-hkex, body.theme-sepia .wlm-hkex  { background: rgba(170,0,255,0.1); color: #aa00ff; }
body.light .wlm-eu, body.theme-sepia .wlm-eu      { background: rgba(83,109,254,0.1); color: #3d5afe; }
body.light .wlm-comm, body.theme-sepia .wlm-comm   { background: rgba(245,177,0,0.1); color: #f57f17; }
body.light .wlm-crypto, body.theme-sepia .wlm-crypto { background: rgba(247,147,26,0.1); color: #d67a00; }
body.light .wlm-fx, body.theme-sepia .wlm-fx     { background: rgba(0,184,212,0.1); color: #0097a7; }
body.light .nmb-nse, body.theme-sepia .nmb-nse    { color: #00a846; }
body.light .nmb-nasdaq, body.theme-sepia .nmb-nasdaq { color: #2962ff; }
body.light .nmb-eu, body.theme-sepia .nmb-eu     { color: #7b1fa2; }
body.light .nmb-sse, body.theme-sepia .nmb-sse    { color: #c62828; }
body.light .nmb-tse, body.theme-sepia .nmb-tse    { color: #e65100; }
body.light .nmb-comm, body.theme-sepia .nmb-comm   { color: #f57f17; }
body.light .nmb-crypto, body.theme-sepia .nmb-crypto { color: #d67a00; }
body.light .nmb-fx, body.theme-sepia .nmb-fx     { color: #0097a7; }
/* ========== MARKET DEPTH (L2) ========== */
.l2-depth {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.l2-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}
.l2-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.l2-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.l2-row-head, .l2-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}
.l2-row-head {
    color: var(--text-dim);
    font-weight: 500;
    padding-bottom: 2px;
    border-bottom: 1px dashed var(--border);
}
.l2-row {
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s, transform 0.1s;
    border-radius: 2px;
}
.l2-row:hover {
    background: var(--bg-3);
}
.l2-row:active {
    transform: scale(0.97);
}
.l2-ratio-bar {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--border);
    margin-top: 4px;
}
.l2-ratio-bid {
    background: var(--green);
    transition: width 0.3s ease;
}
.l2-ratio-ask {
    background: var(--red);
    transition: width 0.3s ease;
}
.l2-ratio-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-dim);
}
#l2-bid-pct { color: var(--green); }
#l2-ask-pct { color: var(--red); }

/* ========== RESPONSIVE LAYOUT ========== */
@media (max-width: 1180px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .app {
        min-height: 100vh;
        height: auto;
        grid-template-rows: auto auto auto auto;
        overflow: visible;
    }

    .topbar {
        flex-wrap: wrap;
        height: auto;
        min-height: 48px;
        padding: 8px 12px;
        gap: 8px 12px;
    }

    .topbar-brand {
        min-width: auto;
    }

    .topbar-stats {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .topbar-controls {
        min-width: auto;
        margin-left: auto;
    }


    .main-grid {
        grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
        grid-template-areas:
            "watch center"
            "order order";
        overflow: visible;
    }

    .watchlist-panel { grid-area: watch; min-height: 480px; }
    .center-panel { grid-area: center; min-height: 620px; }
    .order-panel {
        grid-area: order;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: none;
    }

    .order-form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .order-actions,
    .short-info,
    .pos-card,
    .sl-target-row,
    .sl-hint {
        grid-column: 1 / -1;
    }

    .bottom-bar {
        min-height: 220px;
    }
}

@media (max-width: 760px) {
    .main-grid {
        display: flex;
        flex-direction: column;
    }

    .watchlist-panel,
    .center-panel,
    .order-panel {
        min-height: auto;
        border-left: none;
        border-right: none;
    }

    .watchlist-panel {
        height: 320px;
    }

    .chart-topbar {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .ct-chart-type {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .chart-container {
        height: 320px;
        flex: none;
    }

    .news-panel {
        height: 220px;
    }

    .order-form {
        grid-template-columns: 1fr;
    }

    .bottom-tabs {
        overflow-x: auto;
    }

    .b-tab {
        flex-shrink: 0;
        padding: 8px 14px;
    }

    .table-area {
        overflow: auto;
    }

    .dtable {
        min-width: 760px;
    }

    .toast-box {
        left: 12px;
        right: 12px;
        bottom: 16px;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }
    }


/* ========== PREMIUM ADDITIONS ========== */
.aurora-bg {
    position: fixed;
    inset: -50%;
    background: radial-gradient(circle at 50% 50%, var(--accent) 0%, transparent 40%),
                radial-gradient(circle at 80% 20%, var(--green) 0%, transparent 30%);
    opacity: 0.04;
    z-index: -1;
    animation: aurora-spin 40s linear infinite;
    pointer-events: none;
}
@keyframes aurora-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.flash-up { animation: flashGreen 0.4s ease-out; }
.flash-dn { animation: flashRed 0.4s ease-out; }

@keyframes flashGreen {
    0% { background-color: var(--green); color: #fff; }
    100% { background-color: transparent; }
}
@keyframes flashRed {
    0% { background-color: var(--red); color: #fff; }
    100% { background-color: transparent; }
}

.wl-spark {
    width: 40px;
    height: 20px;
    margin-right: 12px;
    opacity: 0.8;
}

.chart-time-selector {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    background: rgba(30, 32, 38, 0.35); /* More transparent */
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 3px;
    gap: 2px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    z-index: 10;
}
body.light .chart-time-selector, body.theme-sepia .chart-time-selector {
    background: rgba(255, 255, 255, 0.35); /* More transparent */
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}
.chart-time-selector .tf-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font);
}
.chart-time-selector .tf-btn:hover {
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.05);
}
body.light .chart-time-selector .tf-btn:hover, body.theme-sepia .chart-time-selector .tf-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}
.chart-time-selector .tf-btn.active {
    background: rgba(41, 98, 255, 0.1);
    color: var(--text-bright);
    border: 1px solid var(--accent);
    box-shadow: 0 2px 8px rgba(41, 98, 255, 0.15);
}

body.light .chart-time-selector .tf-btn.active, body.theme-sepia .chart-time-selector .tf-btn.active {
    background: rgba(41, 98, 255, 0.08);
    color: var(--accent);
}

/* --- View Switcher --- */
.chart-view-lengths {
    display: flex;
    gap: 2px;
}
.chart-interval-selector {
    display: flex;
    align-items: center;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 10px;
    color: var(--text-dim);
}
body.light .chart-interval-selector, body.theme-sepia .chart-interval-selector {
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}
/* Custom Dropdown Styling */
.custom-dropdown {
    position: relative;
    cursor: pointer;
    user-select: none;
}
.dropdown-selected {
    display: flex;
    align-items: center;
    color: var(--text-bright);
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}
.dropdown-selected:hover {
    background: rgba(255, 255, 255, 0.1);
}
body.light .dropdown-selected, body.theme-sepia .dropdown-selected {
    color: var(--text-dark);
}
body.light .dropdown-selected:hover, body.theme-sepia .dropdown-selected:hover {
    background: rgba(0, 0, 0, 0.05);
}
.dropdown-options {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    display: none;
    flex-direction: column;
    min-width: 50px;
    z-index: 100;
    overflow: hidden;
    padding: 4px;
}
body.light .dropdown-options, body.theme-sepia .dropdown-options {
    background: var(--bg-1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.custom-dropdown.open .dropdown-options {
    display: flex;
}
.dropdown-option {
    padding: 6px 12px;
    color: var(--text);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
    transition: all 0.2s;
}
.dropdown-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-bright);
}
body.light .dropdown-option:hover, body.theme-sepia .dropdown-option:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-dark);
}
.dropdown-option.active {
    background: rgba(41, 98, 255, 0.15);
    color: var(--accent);
}
.dropdown-option.disabled {
    opacity: 0.3;
    pointer-events: none;
}


#view-terminal {
    display: contents;
}

#view-terminal.hidden,
#view-terminal.hidden > * {
    display: none !important;
}

#view-bank, #view-realestate, #view-settings, #view-syndicate, #view-mf, #view-ipo, #view-customize {
    grid-row: 2 / 4;
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    background: var(--bg-0);
    z-index: 150;
    overflow-y: auto;
}

/* --- Dalal Bank --- */
#view-bank, #view-realestate, #view-settings, #view-syndicate {
    height: 100%;
    overflow: hidden;
}

.bank-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}
.bank-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.bank-card {
    background: var(--bg-1);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.bank-card-full { grid-column: 1 / -1; }

.cibil-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.cibil-circle {
    position: relative;
    width: 160px;
    height: 160px;
    filter: drop-shadow(0 0 10px rgba(41, 98, 255, 0.2));
}
.cibil-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cibil-bg { fill: none; stroke: var(--bg-2); stroke-width: 8; }
.cibil-fg { 
    fill: none; 
    stroke: var(--accent); 
    stroke-width: 8; 
    stroke-linecap: round;
    stroke-dasharray: 283; /* 2 * pi * r (r=45) = 282.7 */
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s;
}
.cibil-val {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 32px; font-weight: 700; color: var(--text-bright); font-family: var(--mono);
}
.cibil-status { font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.loan-quote {
    background: var(--bg-2);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    border: 1px solid var(--border);
}

.table-wrap {
    overflow-y: auto;
}

/* Switch Container */
.switch-container {
  position: relative;
  width: 75px;
  height: 30px;
  background: var(--bg-3);
  border-radius: 25px;
  box-shadow:
    inset -4px -4px 8px rgba(255, 255, 255, 0.05),
    inset 4px 4px 8px rgba(0, 0, 0, 0.2);
}

/* Hidden Checkbox */
.toggle-checkbox {
  display: none;
}

/* Switch Label (Interactive Area) */
.switch {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateY(-50%);
  border-radius: 25px;
  overflow: hidden;
  cursor: pointer;
}

/* Toggle Button */
.theme-toggle {
  position: absolute;
  width: 40px;
  height: 25px;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 25px;
  top: 2.5px;
  left: 2.5px;
  box-shadow:
    -2px -2px 4px rgba(255, 255, 255, 0.05),
    2px 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 5px;
}

/* LED Light */
.led {
  width: 5px;
  height: 5px;
  background: grey;
  border-radius: 50%;
  box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease-in-out;
}

/* Active State for Toggle (ON) */
.toggle-checkbox:checked + .switch .theme-toggle {
  left: 32.5px;
  background: linear-gradient(145deg, var(--bg-3), var(--bg-2));
  box-shadow:
    -2px -2px 4px rgba(255, 255, 255, 0.05),
    2px 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-checkbox:checked + .switch .led {
  background: rgb(25, 178, 14);
  box-shadow: 0 0 7px 2px rgb(25, 178, 14);
}

/* Hover Effect */
.switch:hover .theme-toggle {
  box-shadow:
    -2px -2px 6px rgba(255, 255, 255, 0.08),
    2px 2px 6px rgba(0, 0, 0, 0.3);
}

/* Playback Speed Buttons */
.playback-btn {
  --width: 44px;
  --height: 30px;
  --padding: 4px;
  --border-radius: 8px;
  --dot-size: 5px;
  --btn-color: var(--bg-2);
  --hue: 200deg; /* blue for normal play */
  --animation-duration: 1.2s;

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--width);
  height: var(--height);
  border-radius: var(--border-radius);
  background-color: transparent !important;
  box-shadow:
    1px 1px 2px 0 rgba(255,255,255,0.05),
    2px 2px 2px rgba(0,0,0,0.1) inset,
    2px 2px 4px rgba(0,0,0,0.1) inset,
    2px 2px 8px rgba(0,0,0,0.1) inset;
  perspective: 150px;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.05s linear, transform 0.05s linear;
  border: none;
  outline: none;
  padding: 0;
  margin-right: 4px;
}

#btn-freeze { --hue: 190; }  /* Cyan/ice for freeze */
#btn-play { --hue: 120; }    /* Green for play */
#btn-fast { --hue: 30; }     /* Orange for fast */

/* Freeze button: spin animation when active */
#btn-freeze.on .btn-txt i {
  animation: freeze-spin 3s linear infinite;
}
@keyframes freeze-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.playback-btn .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 2 * var(--padding));
  height: calc(100% - 2 * var(--padding));
  border-radius: calc(var(--border-radius) - var(--padding));
  border: none;
  cursor: pointer;
  background: linear-gradient(rgba(255,255,255,0.05), rgba(0,0,0,0.1)), var(--btn-color);
  box-shadow:
    1px 1px 2px -1px rgba(255,255,255,0.1) inset,
    0 2px 1px rgba(0,0,0,0.1),
    0 4px 2px rgba(0,0,0,0.1);
  transition: transform 0.15s cubic-bezier(0.25, 1.5, 0.5, 1.5), box-shadow 0.15s ease, filter 0.15s ease;
  z-index: 2;
  position: relative;
}

.playback-btn .btn-txt {
  font-size: 11px;
  color: var(--text-dim);
  filter: drop-shadow(0 -1px 0px rgba(0,0,0,0.5));
  transition: opacity 0.2s ease, color 0.2s ease;
}

.playback-btn.on .btn-txt {
    color: var(--text-bright);
}

.playback-btn .dot {
  position: absolute;
  top: 50%;
  right: 5px;
  width: var(--dot-size);
  aspect-ratio: 1/1;
  border-radius: 50%;
  background-color: hsla(var(--hue), 0%, 50%, 0.1);
  border: 1px solid hsla(var(--hue), 0%, 60%, 0.6);
  box-shadow:
    1px 1px 2px -1px rgba(255,255,255,0.1) inset,
    0 2px 1px rgba(0,0,0,0.1);
  pointer-events: none;
  z-index: 3;
  transform: translateY(-50%);
  transition: all 0.15s ease;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.8) translateY(-50%); opacity: 0.4; }
  50% { transform: scale(1.3) translateY(-50%); opacity: 1; }
}

.playback-btn.on .dot {
  animation: pulse var(--animation-duration) ease-in-out infinite;
  background-color: hsl(var(--hue), 90%, 50%);
  box-shadow:
    0 0 4px 1px hsl(var(--hue), 100%, 50%),
    0 0 8px 2px hsla(var(--hue), 100%, 60%, 0.4);
}

.playback-btn:hover .btn { transform: translate3d(0, -1px, 1px); }
.playback-btn:active .btn, .playback-btn.on .btn {
  transform: translate3d(0, 1px, -1px);
  box-shadow:
    1px 1px 2px 0 rgba(255,255,255,0.1),
    1px 1px 2px rgba(0,0,0,0.1) inset,
    0 0 10px 1px hsla(var(--hue), 50%, 50%, 0.2) inset;
}

/* Logo Gradient Button */
.gradient-button {
  position: relative;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 700;
  color: white;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 50px;
  overflow: hidden;
  transition: transform 0.2s ease;
  margin-left: -8px; 
}

.gradient-button:hover {
  transform: scale(1.03);
}

.gradient-button::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    #ff6b6b,
    #4ecdc4,
    #45b7d1,
    #96ceb4,
    #feca57,
    #ff9ff3,
    #ff6b6b
  );
  z-index: -2;
  filter: blur(10px);
  transform: rotate(0deg);
  transition: transform 1.5s ease-in-out;
}

.gradient-button:hover::before {
  transform: rotate(180deg);
}

.gradient-button::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--bg-1);
  border-radius: 48px;
  z-index: -1;
  filter: blur(2px);
}

.gradient-text {
  color: transparent;
  background: conic-gradient(
    from 0deg,
    #ff6b6b,
    #4ecdc4,
    #45b7d1,
    #96ceb4,
    #feca57,
    #ff9ff3,
    #ff6b6b
  );
  background-clip: text;
  -webkit-background-clip: text;
  filter: hue-rotate(0deg);
  display: inline-block;
}

.gradient-button:hover .gradient-text {
  animation: hue-rotating 2s linear infinite;
}

.gradient-button:active {
  transform: scale(0.99);
}

@keyframes hue-rotating {
  to {
    filter: hue-rotate(360deg);
  }
}


/* ========== ANALYTICS PANEL ========== */
.analytics-container {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--bg-0);
}
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.analytics-card {
    background: var(--bg-1);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.analytics-card.full-width {
    grid-column: 1 / -1;
}
.analytics-card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.analytics-card h3 i {
    color: var(--accent);
    margin-right: 6px;
}
.analytics-chart-wrapper {
    height: 250px;
    position: relative;
    width: 100%;
}
.data-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 12px;
}
.data-row:last-child { border-bottom: none; }
.data-label { color: var(--text-dim); font-weight: 500;}
.data-value { font-weight: 600; color: var(--text-bright); font-family: var(--mono); }
 
 
/* Custom HTML Tooltip */
#custom-tooltip {
  position: absolute;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  pointer-events: none;
  transition: opacity 0.1s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  opacity: 0;
  font-size: 13px;
  min-width: 220px;
  backdrop-filter: blur(10px);
}

.tooltip-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  color: var(--text-bright);
}
.tooltip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-family: var(--mono);
}
.tooltip-row {
  display: flex;
  justify-content: space-between;
}
.tooltip-label {
  color: var(--text-dim);
}
.tooltip-val {
  font-weight: 500;
  color: var(--text-bright);
}
.tooltip-val.bull {
  color: var(--green);
}
.tooltip-val.bear {
  color: var(--red);
}
.tooltip-footer {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}
.tooltip-pct {
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
}
.tooltip-pct.bull {
  background: var(--green-dim);
  color: var(--green);
}
.tooltip-pct.bear {
  background: var(--red-dim);
  color: var(--red);
}

 / *   = = = = = = = = = = = = = = = = = = = =   C U S T O M   S E T T I N G S   U I   = = = = = = = = = = = = = = = = = = = =   * / 
 . c u s t o m - s l i d e r   { 
         - w e b k i t - a p p e a r a n c e :   n o n e ; 
         w i d t h :   1 0 0 % ; 
         h e i g h t :   6 p x ; 
         b o r d e r - r a d i u s :   3 p x ; 
         b a c k g r o u n d :   v a r ( - - b g - 3 ) ; 
         o u t l i n e :   n o n e ; 
         m a r g i n :   1 0 p x   0 ; 
 } 
 . c u s t o m - s l i d e r : : - w e b k i t - s l i d e r - t h u m b   { 
         - w e b k i t - a p p e a r a n c e :   n o n e ; 
         a p p e a r a n c e :   n o n e ; 
         w i d t h :   1 8 p x ; 
         h e i g h t :   1 8 p x ; 
         b o r d e r - r a d i u s :   5 0 % ; 
         b a c k g r o u n d :   v a r ( - - a c c e n t ) ; 
         c u r s o r :   p o i n t e r ; 
         b o x - s h a d o w :   0   0   5 p x   r g b a ( 0 , 0 , 0 , 0 . 2 ) ; 
         t r a n s i t i o n :   t r a n s f o r m   0 . 1 s ; 
 } 
 . c u s t o m - s l i d e r : : - w e b k i t - s l i d e r - t h u m b : h o v e r   { 
         t r a n s f o r m :   s c a l e ( 1 . 2 ) ; 
 } 
 
 . t o g g l e - s w i t c h   { 
         p o s i t i o n :   r e l a t i v e ; 
         d i s p l a y :   i n l i n e - b l o c k ; 
         w i d t h :   4 4 p x ; 
         h e i g h t :   2 4 p x ; 
 } 
 . t o g g l e - s w i t c h   i n p u t   { 
         o p a c i t y :   0 ; 
         w i d t h :   0 ; 
         h e i g h t :   0 ; 
 } 
 . t s - s l i d e r   { 
         p o s i t i o n :   a b s o l u t e ; 
         c u r s o r :   p o i n t e r ; 
         t o p :   0 ; 
         l e f t :   0 ; 
         r i g h t :   0 ; 
         b o t t o m :   0 ; 
         b a c k g r o u n d - c o l o r :   v a r ( - - b g - 3 ) ; 
         t r a n s i t i o n :   . 3 s ; 
         b o r d e r - r a d i u s :   2 4 p x ; 
 } 
 . t s - s l i d e r : b e f o r e   { 
         p o s i t i o n :   a b s o l u t e ; 
         c o n t e n t :   \ 
 
 \ ; 
         h e i g h t :   1 8 p x ; 
         w i d t h :   1 8 p x ; 
         l e f t :   3 p x ; 
         b o t t o m :   3 p x ; 
         b a c k g r o u n d - c o l o r :   w h i t e ; 
         t r a n s i t i o n :   . 3 s ; 
         b o r d e r - r a d i u s :   5 0 % ; 
         b o x - s h a d o w :   0   1 p x   3 p x   r g b a ( 0 , 0 , 0 , 0 . 3 ) ; 
 } 
 i n p u t : c h e c k e d   +   . t s - s l i d e r   { 
         b a c k g r o u n d - c o l o r :   v a r ( - - g r e e n ) ; 
 } 
 i n p u t : c h e c k e d   +   . t s - s l i d e r : b e f o r e   { 
         t r a n s f o r m :   t r a n s l a t e X ( 2 0 p x ) ; 
 } 
 
 
 
 . t h e m e - b t n   { 
         p a d d i n g :   8 p x   1 2 p x ; 
         b a c k g r o u n d :   v a r ( - - b g - 2 ) ; 
         b o r d e r :   1 p x   s o l i d   v a r ( - - b o r d e r ) ; 
         c o l o r :   v a r ( - - t e x t ) ; 
         b o r d e r - r a d i u s :   v a r ( - - r a d i u s ) ; 
         c u r s o r :   p o i n t e r ; 
         f o n t - s i z e :   1 3 p x ; 
         t r a n s i t i o n :   a l l   0 . 2 s ; 
         t e x t - a l i g n :   c e n t e r ; 
 } 
 . t h e m e - b t n : h o v e r   { 
         b a c k g r o u n d :   v a r ( - - b g - 3 ) ; 
         b o r d e r - c o l o r :   v a r ( - - b o r d e r - l i g h t ) ; 
 } 
 . t h e m e - b t n . a c t i v e   { 
         b a c k g r o u n d :   v a r ( - - a c c e n t ) ; 
         c o l o r :   w h i t e ; 
         b o r d e r - c o l o r :   v a r ( - - a c c e n t ) ; 
         b o x - s h a d o w :   0   0   1 0 p x   r g b a ( 0 , 0 , 0 , 0 . 2 ) ; 
 } 
 
 
 

/* ==================== CUSTOM SETTINGS UI ==================== */
.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-3);
    outline: none;
    margin: 10px 0;
}
.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}
.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.ts-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-3);
    transition: .3s;
    border-radius: 24px;
}
.ts-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input:checked + .ts-slider {
    background-color: var(--green);
}
input:checked + .ts-slider:before {
    transform: translateX(20px);
}


.theme-btn {
    padding: 8px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-align: center;
}
.theme-btn:hover {
    background: var(--bg-3);
    border-color: var(--border-light);
}
.theme-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}



/* ==================== CUSTOM SETTINGS UI ==================== */
.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-3);
    outline: none;
    margin: 10px 0;
}
.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}
.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.ts-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-3);
    transition: .3s;
    border-radius: 24px;
}
.ts-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input:checked + .ts-slider {
    background-color: var(--green);
}
input:checked + .ts-slider:before {
    transform: translateX(20px);
}


.theme-btn, .font-btn {
    padding: 8px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-align: center;
}
.theme-btn:hover, .font-btn:hover {
    background: var(--bg-3);
    border-color: var(--border-light);
}
.theme-btn.active, .font-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

/* ==================== GLOBAL FONTS OVERRIDES ==================== */
button, input, select, textarea { font-family: inherit; }

body.font-outfit { --font: 'Outfit', -apple-system, sans-serif; --mono: 'Outfit', sans-serif; }
body.font-inter { --font: 'Inter', -apple-system, sans-serif; --mono: 'Inter', sans-serif; }
body.font-roboto-mono { --font: 'Roboto Mono', monospace; --mono: 'Roboto Mono', monospace; }
body.font-space-grotesk { --font: 'Space Grotesk', -apple-system, sans-serif; --mono: 'Space Grotesk', sans-serif; }


body.font-playfair { --font: 'Playfair Display', serif; --mono: 'Playfair Display', serif; }
body.font-poppins { --font: 'Poppins', -apple-system, sans-serif; --mono: 'Poppins', sans-serif; }
body.font-ibm-plex { --font: 'IBM Plex Sans', -apple-system, sans-serif; --mono: 'IBM Plex Mono', monospace; }



body.font-jetbrains { --font: 'JetBrains Mono', monospace; --mono: 'JetBrains Mono', monospace; }


/* =========================================================================
   MOBILE RESPONSIVENESS (<= 768px)
   Inspired by modern broker apps (Zerodha, Groww)
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. App Layout Changes */
    body {
        overflow-y: auto !important;
    }
    .app {
        display: block !important;
        height: auto !important;
        min-height: 100vh;
        overflow-y: visible !important;
        padding-bottom: 80px; /* Space for action bar */
    }
    
    .main-grid {
        display: flex !important;
        flex-direction: column !important;
        padding: 12px !important;
        gap: 16px !important;
    }
    
    /* Terminal section at the bottom of the scroll */
    .bottom-bar {
        display: flex !important;
        position: static !important;
        height: auto !important;
        padding: 0 12px 20px 12px !important;
        overflow: visible !important;
    }
    
    /* Un-fix the floating desktop tabs so they sit naturally */
    .bottom-tabs {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        justify-content: flex-start !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 12px;
    }
    .b-tab {
        flex: 1 1 calc(33.333% - 8px);
        text-align: center;
        justify-content: center;
        padding: 8px 4px !important;
    }

    /* 2. Topbar Adjustments */
    .topbar {
        padding: 0 12px;
        gap: 8px;
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-0);
        border-bottom: 1px solid var(--border);
    }
    .topbar-stats {
        display: none !important; /* Hide stats on small screens to save space */
    }
    .topbar-controls {
        margin-left: auto;
    }
    .mobile-menu-btn {
        display: none !important; /* Watchlist is inline now */
    }

    /* 3. Watchlist Inline Panel */
    .watchlist-panel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 400px !important; /* Fixed height inner scroll */
        z-index: 10;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }

    /* 4. Chart / Center Panel */
    .center-panel {
        flex: none;
        width: 100%;
        display: flex;
        flex-direction: column;
        overflow: visible;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--bg-1);
    }
    .chart-topbar {
        flex-wrap: wrap;
        padding: 12px;
        gap: 12px;
        border-bottom: 1px solid var(--border);
    }
    .ct-left {
        width: 100%;
        justify-content: space-between;
    }
    .ct-right {
        width: 100%;
        justify-content: space-between;
        font-size: 12px;
    }
    .ct-chart-type {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .chart-container {
        flex: none;
        height: 350px;
    }

    /* 5. Order Entry Bottom Sheet (Right Sidebar) */
    .order-panel {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        height: 85vh;
        z-index: 1100;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-0);
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
        padding: 20px;
        padding-bottom: 40px; /* Space for soft keyboards */
        overflow-y: auto;
    }
    .order-panel.sheet-open {
        bottom: 0;
    }
    .order-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 5px;
        background: var(--border-light);
        border-radius: 3px;
        margin: 0 auto 20px auto;
    }

    /* 6. Mobile Action Bar */
    .mobile-action-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 64px;
        background: var(--bg-1);
        border-top: 1px solid var(--border);
        padding: 10px 16px;
        gap: 16px;
        z-index: 900;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
    .mobile-action-btn {
        flex: 1;
        border: none;
        border-radius: 12px;
        font-size: 16px;
        font-weight: 700;
        color: #fff;
        text-transform: uppercase;
        letter-spacing: 1px;
        cursor: pointer;
        transition: opacity 0.2s;
    }
    .mobile-action-btn:active {
        opacity: 0.8;
    }
    .action-buy {
        background: var(--green);
        box-shadow: 0 4px 12px rgba(38, 166, 154, 0.3);
    }
    .action-sell {
        background: var(--red);
        box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3);
    }

    .table-area {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.dtable {
min-width: 600px; /* Force scroll on small screens */
}
/* Sub-views responsive */
.bank-container, .re-container, .ipoc-container, .syndicate-grid {
grid-template-columns: 1fr !important;
display: flex !important;
flex-direction: column !important;
padding: 10px !important;
}
.mf-grid, .mf-funds {
grid-template-columns: 1fr !important;
}
/* Analytics overlay full screen on mobile */
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .news-market-filters {
        flex-wrap: wrap;
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
    .mobile-action-bar {
        display: none !important;
    }
}

/* ==================== SYNDICATE CRATE REVEAL ANIMATIONS ==================== */
@keyframes crateRevealIn {
    0%   { opacity: 0; transform: scale(0.6) translateY(40px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes crateRewardIn {
    0%   { opacity: 0; transform: scale(0.7) translateY(20px); }
    60%  { transform: scale(1.05) translateY(-5px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cratePulse {
    0%   { transform: scale(1);    box-shadow: 0 0 30px currentColor, 0 0 60px currentColor; }
    100% { transform: scale(1.06); box-shadow: 0 0 50px currentColor, 0 0 100px currentColor; }
}

@keyframes crateParticle {
    0%   { top: 110%; opacity: 0.7; }
    50%  { opacity: 0.5; }
    100% { top: -10%;  opacity: 0; }
}

@keyframes crateShake {
    0%, 100% { transform: rotate(0deg); }
    20%  { transform: rotate(-6deg) scale(1.05); }
    40%  { transform: rotate(6deg) scale(1.08); }
    60%  { transform: rotate(-4deg) scale(1.05); }
    80%  { transform: rotate(4deg) scale(1.03); }
}

/* ==================== MARKET FREEZE HUD ==================== */
.freeze-hud {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.freeze-hud.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px) scale(0.97);
}
.freeze-hud:not(.hidden) {
  pointer-events: auto;
}
.freeze-hud-inner {
  background: linear-gradient(135deg, rgba(8, 24, 36, 0.97) 0%, rgba(0, 30, 50, 0.97) 100%);
  border: 1px solid rgba(100, 216, 255, 0.35);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(100, 216, 255, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(100, 216, 255, 0.08) inset;
  padding: 18px 22px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.freeze-hud-icon {
  font-size: 28px;
  color: #64d8ff;
  filter: drop-shadow(0 0 8px rgba(100, 216, 255, 0.8));
  animation: freeze-hud-spin 4s linear infinite;
  margin-bottom: 2px;
}
@keyframes freeze-hud-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.freeze-hud-label {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 800;
  color: #64d8ff;
  text-transform: uppercase;
  opacity: 0.85;
}
.freeze-hud-timer {
  font-size: 36px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(100, 216, 255, 0.6), 0 0 40px rgba(100, 216, 255, 0.3);
  line-height: 1.1;
  font-family: 'Outfit', monospace;
}
.freeze-hud-sub {
  font-size: 11px;
  color: rgba(100, 216, 255, 0.6);
  text-align: center;
  margin-top: 2px;
}
.freeze-hud-cancel {
  margin-top: 10px;
  background: rgba(100, 216, 255, 0.1);
  border: 1px solid rgba(100, 216, 255, 0.3);
  color: #64d8ff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  letter-spacing: 0.5px;
}
.freeze-hud-cancel:hover {
  background: rgba(100, 216, 255, 0.2);
  border-color: rgba(100, 216, 255, 0.6);
}

/* Custom Bot Studio */
.bot-studio-modal {
  max-width: 1200px;
  width: 95%;
  height: 85vh;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.studio-layout {
  display: flex;
  flex: 1;
  gap: 1.5rem;
  overflow: hidden;
  height: calc(100% - 20px);
}
.studio-sidebar {
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 1.5rem;
}
.saved-bots-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.saved-bots-list li {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.saved-bots-list li:hover {
  background: rgba(255, 255, 255, 0.1);
}
.saved-bots-list li.active {
  border-color: var(--primary);
  background: rgba(0, 255, 255, 0.1);
}
.studio-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}
.code-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.code-editor {
  flex: 1;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  background: #111;
  color: #00ffcc;
  border: 1px solid rgba(0, 255, 255, 0.2);
  padding: 1rem;
  resize: none;
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre;
}
.code-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
}
.bot-console {
  background: #000;
  border: 1px solid #333;
  padding: 0.75rem;
  border-radius: 6px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: #aaa;
  height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.studio-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Option Chain Styles */
.oc-table th, .oc-table td {
  padding: 6px;
  border: 1px solid var(--border);
}
.oc-row:hover {
  background: var(--bg-2);
}
.oc-row.itm-call td.call-col {
  background: rgba(0, 230, 118, 0.05);
}
.oc-row.itm-put td.put-col {
  background: rgba(255, 23, 68, 0.05);
}
.oc-strike {
  font-weight: bold;
  background: var(--bg-1);
}
.oc-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  transition: all 0.2s;
  width: 100%;
}
.oc-btn.bid:hover {
  background: rgba(255, 23, 68, 0.2);
  border-color: #ff1744;
  color: #ff1744;
}
.oc-btn.ask:hover {
  background: rgba(0, 230, 118, 0.2);
  border-color: #00e676;
  color: #00e676;
}

/* Custom Bot Studio Styles */
#custom-bot-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bot-studio-modal {
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border-radius: 12px;
    padding: 20px;
}

.studio-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.studio-sidebar {
    width: 240px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding-right: 15px;
}

.bot-list-item {
    padding: 10px 12px;
    background: var(--bg-1);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s ease;
}

.bot-list-item:hover {
    background: var(--bg-2);
    border-color: rgba(255, 255, 255, 0.1);
}

.bot-list-item.active {
    background: rgba(0, 210, 255, 0.1);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.studio-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-left: 5px;
}

/* CodeMirror Overrides for Bot Studio */
.CodeMirror {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 14px !important;
    min-height: 400px !important;
    height: 100% !important;
    background: #272822; /* Monokai default bg */
}
.CodeMirror-scroll {
    min-height: 400px !important;
    height: 100% !important;
}

#custom-bot-console {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    padding: 12px;
    height: 150px;
    overflow-y: auto;
    font-size: 12px;
    font-family: var(--mono);
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-bottom: 0;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.circuit-badge { padding: 2px 4px; border-radius: 3px; color: #fff; font-size: 8px; font-weight: bold; margin-left: 5px; vertical-align: middle; }
@media (min-width: 769px) { .mobile-only-btn { display: none !important; } }