/* ========== VARIABLES ========== */
:root {
    --bg-0: #0b0b0f;
    --bg-1: #12121a;
    --bg-2: #1a1a26;
    --bg-3: #222233;
    --border: #2a2a3a;
    --border-light: #333348;
    --text: #c8cad0;
    --text-dim: #6b7080;
    --text-bright: #eeeef2;
    --accent: #2962ff;
    --accent-hover: #1e50d8;
    --green: #00c853;
    --green-dim: rgba(0, 200, 83, 0.12);
    --green-hover: #00a846;
    --red: #ff1744;
    --red-dim: rgba(255, 23, 68, 0.12);
    --red-hover: #d50032;
    --orange: #ff9100;
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 6px;
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

body.light {
    --bg-0: #f0f2f5;
    --bg-1: #ffffff;
    --bg-2: #f7f8fa;
    --bg-3: #ebedf0;
    --border: #d4d6dc;
    --border-light: #c0c4cc;
    --text: #1a1a2e;
    --text-dim: #666b80;
    --text-bright: #0a0a12;
    --accent: #2962ff;
    --accent-hover: #1e50d8;
    --green: #00a846;
    --green-dim: rgba(0, 168, 70, 0.08);
    --green-hover: #008c3a;
    --red: #d50032;
    --red-dim: rgba(213, 0, 50, 0.08);
    --red-hover: #b8002a;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
    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); }
.accent { color: var(--accent); }
.r { text-align: right; }
.hidden { display: none !important; }

/* ========== APP FRAME ========== */
.app {
    display: grid;
    grid-template-rows: 48px 28px 1fr 180px;
    height: 100vh;
    overflow: hidden;
}

/* ========== 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;
}

.stat { display: flex; flex-direction: column; align-items: center; }
.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; }
.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; }

/* ========== FX RATES BAR ========== */
.fx-bar {
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    height: 28px;
    font-size: 11px;
    flex-shrink: 0;
    overflow: hidden;
}
.fx-label {
    color: var(--text-dim);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-right: 4px;
}
.fx-label i { color: var(--accent); margin-right: 4px; }
.fx-item { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.fx-cur { color: var(--text-dim); font-size: 11px; }
.fx-eq { color: var(--text-dim); font-size: 10px; }
.fx-val { color: var(--accent); font-size: 12px; font-weight: 600; }
.fx-unit { color: var(--text-dim); font-size: 11px; }
.fx-sep { width: 1px; height: 14px; background: var(--border); flex-shrink: 0; }
.fx-hint {
    color: var(--text-dim);
    font-size: 10px;
    margin-left: auto;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fx-hint i { margin-right: 3px; }

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

/* ========== WATCHLIST ========== */
.watchlist-panel {
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    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: background 0.1s;
}
.wl-row:hover { background: var(--bg-2); }
.wl-row.active {
    background: rgba(41, 98, 255, 0.08);
    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-0);
    overflow: hidden;
}

.chart-topbar {
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ct-left { display: flex; flex-direction: column; }
.ct-symbol { font-size: 18px; font-weight: 700; color: var(--text-bright); line-height: 1.2; }
.ct-name { font-size: 11px; color: var(--text-dim); }
.ct-right { text-align: right; display: flex; flex-direction: column; }
.ct-price { font-size: 22px; font-weight: 700; }
.ct-change { font-size: 12px; }
.ct-prev-close { font-size: 11px; opacity: 0.75; margin-top: 2px; }
.ct-chart-type { display: flex; gap: 4px; align-items: center; }
.ct-type-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.tf-btn {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.04em;
    font-family: 'JetBrains Mono', monospace;
}
.tf-btn:hover { background: var(--bg-3); color: var(--text); }
.tf-btn.active { background: var(--bg-3); color: var(--text-bright); border-color: var(--accent); }
.chart-type-btn {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}
.chart-type-btn:hover { background: var(--bg-3); color: var(--text); }
.chart-type-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
/* Scale buttons use orange accent to distinguish from chart-type buttons */
.chart-type-btn.scale-btn.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}
.chart-type-btn.scale-btn { font-size: 10px; padding: 4px 8px; }

.chart-container {
    flex: 1;
    padding: 12px 16px 8px;
    position: relative;
    min-height: 0;
    contain: layout style;
}

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

/* ========== 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-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.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;
}

.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); }

.qty-big { font-size: 18px; font-weight: 600; padding: 10px; }

.presets {
    display: flex;
    gap: 6px;
}
.preset, .preset-opt {
    flex: 1;
    padding: 5px;
    background: var(--bg-3);
    border: 1px solid transparent;
    color: var(--text);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.15s;
    font-family: var(--mono);
}
.preset:hover, .preset-opt:hover {
    border-color: var(--accent);
    background: var(--bg-2);
}

.toggle-row { display: flex; gap: 6px; }
.toggle {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-dim);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: 0.15s;
}
.toggle.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.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;
}

.btn-buy, .btn-sell {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.15s;
}
.btn-buy { background: var(--green); }
.btn-buy:hover:not(:disabled) { background: var(--green-hover); }
.btn-sell { background: var(--red); }
.btn-sell:hover:not(:disabled) { background: var(--red-hover); }
.btn-buy:disabled, .btn-sell:disabled { opacity: 0.35; cursor: not-allowed; }

.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 {
    background: var(--bg-1);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bottom-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.b-tab {
    padding: 8px 20px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.b-tab:hover { color: var(--text); background: var(--bg-2); }
.b-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.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; }

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

/* ========== TOASTS ========== */
.toast-box {
    position: fixed;
    bottom: 200px;
    left: 280px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: var(--bg-1);
    border: 1px solid var(--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(--bg-1);
    border: 1px solid var(--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: 5px; height: 5px; }
::-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);
}

/* ========== 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-comm   { background: rgba(255,214,0,0.2);  color: #ffd600; border: 1px solid rgba(255,214,0,0.4); }

/* ========== NEWS MARKET FILTER ========== */
.news-market-filters {
    display: flex;
    gap: 3px;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
}
.news-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);
}
.news-mf-btn:hover { border-color: var(--accent); color: var(--accent); }
.news-mf-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.nmf-nasdaq, .nmf-sse, .nmf-tse, .nmf-comm { cursor: pointer; }
.nmf-war.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #000;
}
.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(41,98,255,0.15);  color: #6ea5ff; border: 1px solid rgba(41,98,255,0.35); }
.nmb-sse    { background: rgba(255,82,82,0.15);   color: #ff8080; border: 1px solid rgba(255,82,82,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-war    { background: rgba(255,62,0,0.20);    color: #ff6e40; border: 1px solid rgba(255,62,0,0.45); }
.news-item .news-mkt-badge { margin-right: 2px; }

/* ========== LIGHT MODE ADJUSTMENTS ========== */
body.light .wlm-nasdaq { background: rgba(41,98,255,0.1); color: #2962ff; }
body.light .wlm-sse    { background: rgba(213,0,50,0.1);  color: #c62828; }
body.light .wlm-tse    { background: rgba(245,124,0,0.1); color: #e65100; }
body.light .wlm-comm   { background: rgba(245,177,0,0.1); color: #f57f17; }
body.light .nmb-nse    { color: #00a846; }
body.light .nmb-nasdaq { color: #2962ff; }
body.light .nmb-sse    { color: #c62828; }
body.light .nmb-tse    { color: #e65100; }
body.light .nmb-comm   { color: #f57f17; }
body.light .nmb-war    { color: #b71c1c; }
