/* ===== NIFTY Options Dashboard — Zerodha-Inspired Dark Theme ===== */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-card-hover: #1a4a7a;
    --bg-depth-row: rgba(255,255,255,0.03);
    --bg-depth-row-alt: rgba(255,255,255,0.06);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-muted: #666;
    --green: #00b894;
    --green-bg: rgba(0,184,148,0.1);
    --red: #e74c3c;
    --red-bg: rgba(231,76,60,0.1);
    --blue: #3498db;
    --orange: #f39c12;
    --border: #2a3a5e;
    --execution-chart-height: clamp(520px, 62vh, 760px);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    overflow-x: hidden;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.spot-price {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-dot.connected { background: var(--green); animation: pulse 2s infinite; }
.status-dot.disconnected { background: var(--red); }

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

.expiry-badge {
    background: var(--bg-card);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--orange);
    border: 1px solid var(--orange);
}

/* ===== ATM LABEL ===== */
.atm-bar {
    text-align: center;
    padding: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.atm-bar strong { color: var(--orange); font-family: var(--font-mono); }

/* ===== NIFTY EXECUTION CHART ===== */
.execution-chart-section {
    margin: 12px 15px 18px;
    border: 1px solid rgba(52, 152, 219, 0.28);
    border-radius: 8px;
    background: #0b1224;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.execution-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid rgba(120, 144, 180, 0.18);
    flex-wrap: wrap;
}

.execution-cockpit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 12px;
    align-items: stretch;
    padding: 12px;
}

.execution-chart-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(120, 144, 180, 0.16);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(8, 14, 28, 0.78);
}

.execution-decision-rail {
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto auto auto auto auto;
    gap: 10px;
    align-content: start;
}

.execution-decision-card {
    border: 1px solid rgba(120, 144, 180, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.64);
    overflow: hidden;
}

.execution-decision-card.ce {
    border-color: rgba(0, 184, 148, 0.38);
}

.execution-decision-card.pe {
    border-color: rgba(231, 76, 60, 0.38);
}

.execution-decision-card.wait,
.execution-decision-card.mixed {
    border-color: rgba(245, 194, 107, 0.28);
}

.execution-card-label {
    padding: 8px 10px 0;
    color: #8fa5c2;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.execution-chart-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: #d7e2f1;
    margin-bottom: 3px;
}

.execution-chart-subtitle {
    color: #8fa5c2;
    font-size: 12px;
}

.execution-chart-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-timeframe-btn {
    min-width: 42px;
    height: 28px;
    border: 1px solid rgba(120, 144, 180, 0.34);
    border-radius: 6px;
    background: rgba(15, 52, 96, 0.72);
    color: #d7e2f1;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.chart-timeframe-btn.active {
    border-color: var(--blue);
    background: rgba(52, 152, 219, 0.22);
    color: #ffffff;
}

.chart-timeframe-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.execution-chart-meta {
    display: flex;
    gap: 10px 14px;
    flex-wrap: wrap;
    padding: 8px 14px;
    color: #9fb3c8;
    font-size: 12px;
    border-bottom: 1px solid rgba(120, 144, 180, 0.12);
}

.execution-chart-meta span {
    white-space: nowrap;
}

.execution-chart-meta b {
    color: #ffffff;
    font-family: var(--font-mono);
}

.execution-chart-trend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 14px;
}

.execution-trend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(120, 144, 180, 0.24);
    background: rgba(23, 33, 58, 0.74);
    color: #d7e2f1;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.execution-trend-chip::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8fa5c2;
}

.execution-trend-chip.vwap::before {
    background: #f1c40f;
}

.execution-trend-chip.ema20::before {
    background: #7aa2ff;
}

.execution-trend-chip.bullish {
    border-color: rgba(0, 184, 148, 0.42);
    color: #b9f5e8;
}

.execution-trend-chip.bearish {
    border-color: rgba(231, 76, 60, 0.42);
    color: #ffd0cc;
}

.execution-flow-ribbon {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding: 10px;
    color: #9fb3c8;
    font-size: 12px;
}

.execution-flow-ribbon .execution-card-label {
    width: 100%;
    padding: 0;
}

.execution-flow-ribbon b {
    color: #ffffff;
    font-family: var(--font-mono);
}

.execution-flow-state {
    width: 100%;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(120, 144, 180, 0.24);
    background: rgba(23, 33, 58, 0.74);
    color: #d7e2f1;
    font-weight: 800;
    text-align: center;
}

.execution-flow-ribbon.ce .execution-flow-state {
    border-color: rgba(0, 184, 148, 0.46);
    color: #b9f5e8;
}

.execution-flow-ribbon.pe .execution-flow-state {
    border-color: rgba(231, 76, 60, 0.46);
    color: #ffd0cc;
}

.execution-flow-ribbon.mixed .execution-flow-state {
    border-color: rgba(245, 194, 107, 0.55);
    color: #ffe0a3;
}

.execution-flow-ribbon.wait .execution-flow-state {
    color: #bfcfff;
}

.execution-bias-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
    padding: 12px;
    background: rgba(10, 17, 32, 0.86);
}

.execution-bias-state-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    color: #8fa5c2;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.execution-bias-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 124px;
    min-height: 38px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(245, 194, 107, 0.52);
    background: rgba(245, 194, 107, 0.12);
    color: #ffe0a3;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0;
    white-space: nowrap;
}

.execution-bias-cue {
    min-height: 28px;
    padding: 7px 9px;
    border-radius: 6px;
    background: rgba(120, 144, 180, 0.10);
    color: #d7e2f1;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.execution-bias-panel.ce .execution-bias-state {
    border-color: rgba(0, 184, 148, 0.54);
    background: rgba(0, 184, 148, 0.12);
    color: #b9f5e8;
}

.execution-bias-panel.pe .execution-bias-state {
    border-color: rgba(231, 76, 60, 0.54);
    background: rgba(231, 76, 60, 0.12);
    color: #ffd0cc;
}

.execution-bias-reasons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px 12px;
    color: #9fb3c8;
    font-size: 12px;
    line-height: 1.35;
}

.execution-bias-reasons span {
    min-width: 0;
}

.execution-bias-reasons b {
    color: #ffffff;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.execution-structure-card,
.execution-position-card {
    padding: 10px;
}

.execution-structure-stance {
    display: block;
    margin-top: 7px;
    color: #d7e2f1;
    font-size: 13px;
    font-weight: 900;
}

.execution-structure-card.ce .execution-structure-stance,
.execution-position-card.profit .execution-position-head strong {
    color: #b9f5e8;
}

.execution-structure-card.pe .execution-structure-stance,
.execution-position-card.loss .execution-position-head strong {
    color: #ffd0cc;
}

.execution-structure-card.wait .execution-structure-stance,
.execution-position-card.flat .execution-position-head strong {
    color: #ffe0a3;
}

.execution-position-card.open .execution-position-head strong {
    color: #d7e2f1;
}

.execution-structure-grid,
.execution-position-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    margin-top: 9px;
    color: #9fb3c8;
    font-size: 12px;
    line-height: 1.3;
}

.execution-structure-grid b,
.execution-position-grid b,
.execution-position-head span {
    color: #ffffff;
    font-family: var(--font-mono);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.execution-position-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
}

.execution-position-head strong {
    font-size: 13px;
    font-weight: 900;
}

.execution-position-head span {
    font-size: 12px;
    text-align: right;
}

.execution-position-trigger {
    grid-column: 1 / -1;
}

.execution-chart-shell {
    position: relative;
    flex: 1;
    min-height: var(--execution-chart-height);
    height: var(--execution-chart-height);
}

.execution-chart {
    width: 100%;
    height: 100%;
}

.execution-chart-zones-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.execution-chart-zone {
    position: absolute;
    border-top: 1px solid;
    border-bottom: 1px solid;
    opacity: 0.52;
}

.execution-chart-zone-support {
    border-color: rgba(0, 184, 148, 0.58);
    background: rgba(0, 184, 148, 0.06);
}

.execution-chart-zone-resistance {
    border-color: rgba(231, 76, 60, 0.58);
    background: rgba(231, 76, 60, 0.06);
}

.execution-chart-zone.broken {
    opacity: 0.22;
    border-style: dashed;
}

.execution-chart-zone.tested:not(.broken) {
    opacity: 0.62;
}

.execution-chart-zone-label {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(11, 18, 36, 0.84);
    color: #d7e2f1;
    font-size: 11px;
    font-weight: 700;
    line-height: 15px;
    white-space: nowrap;
    box-shadow: 0 0 0 1px rgba(120, 144, 180, 0.18);
}

.execution-chart-edge-label {
    position: absolute;
    bottom: 2px;
    z-index: 4;
    display: none;
    transform: translateX(-50%);
    padding: 2px 6px;
    border-radius: 4px;
    background: #17213a;
    color: #d7e2f1;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 0 0 1px rgba(120, 144, 180, 0.24);
}

.execution-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8fa5c2;
    background: rgba(11, 18, 36, 0.86);
    font-size: 13px;
}

.execution-premium-panel {
    background: rgba(15, 23, 42, 0.64);
}

.execution-premium-summary {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding: 10px;
    color: #9fb3c8;
    font-size: 12px;
    cursor: pointer;
    list-style: none;
}

.execution-premium-summary::-webkit-details-marker {
    display: none;
}

.execution-premium-summary b {
    color: #ffffff;
    font-family: var(--font-mono);
}

.execution-premium-toggle {
    margin-left: auto;
    padding: 2px 7px;
    border: 1px solid rgba(120, 144, 180, 0.26);
    border-radius: 6px;
    color: #d7e2f1;
    font-size: 11px;
    font-weight: 800;
}

.execution-premium-panel[open] .execution-premium-toggle {
    border-color: rgba(52, 152, 219, 0.48);
    color: #ffffff;
}

.execution-premium-signal.ce {
    color: #b9f5e8;
}

.execution-premium-signal.pe {
    color: #ffd0cc;
}

.execution-premium-signal.mixed {
    color: #ffe0a3;
}

.execution-premium-signal.neutral {
    color: #bfcfff;
}

.execution-premium-shell {
    position: relative;
    min-height: 136px;
    height: 136px;
    border-top: 1px solid rgba(120, 144, 180, 0.12);
}

.execution-premium-chart {
    width: 100%;
    height: 100%;
}

.execution-premium-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8fa5c2;
    background: rgba(11, 18, 36, 0.82);
    font-size: 12px;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .execution-cockpit-grid {
        grid-template-columns: 1fr;
    }

    .execution-decision-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
    }

    .execution-bias-panel,
    .execution-position-card,
    .execution-premium-panel {
        grid-column: 1 / -1;
    }

    .execution-bias-reasons {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 700px) {
    :root {
        --execution-chart-height: clamp(420px, 58vh, 620px);
    }

    .execution-cockpit-grid {
        padding: 8px;
    }

    .execution-decision-rail {
        grid-template-columns: 1fr;
    }

    .execution-chart-meta span {
        white-space: normal;
    }

    .execution-bias-reasons {
        grid-template-columns: 1fr;
    }
}

/* ===== TRADE REVIEW ===== */
.trade-review-section {
    margin: 0 15px 18px;
    border: 1px solid rgba(120, 144, 180, 0.20);
    border-radius: 8px;
    background: rgba(11, 18, 36, 0.72);
    overflow: hidden;
}

.trade-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(120, 144, 180, 0.16);
    flex-wrap: wrap;
}

.trade-review-header h2 {
    color: #d7e2f1;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 3px;
}

.trade-review-subtitle {
    color: #8fa5c2;
    font-size: 12px;
}

.trade-review-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 3px;
    border: 1px solid rgba(120, 144, 180, 0.20);
    border-radius: 8px;
    background: rgba(8, 14, 28, 0.82);
}

.trade-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #9fb3c8;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.trade-tab.active {
    border-color: rgba(52, 152, 219, 0.42);
    background: rgba(52, 152, 219, 0.18);
    color: #ffffff;
}

.trade-tab-count {
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(120, 144, 180, 0.18);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 11px;
    text-align: center;
}

.trade-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(120, 144, 180, 0.12);
}

.trade-summary-card {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(120, 144, 180, 0.18);
    border-left-width: 3px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.64);
}

.trade-summary-card.today {
    border-left-color: #f39c12;
}

.trade-summary-card.total {
    border-left-color: #00b894;
}

.trade-summary-card.open {
    border-left-color: #e74c3c;
}

.trade-summary-label {
    display: block;
    margin-bottom: 5px;
    color: #8fa5c2;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.trade-summary-card strong {
    display: block;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.2;
}

.trade-summary-card span:last-child {
    display: block;
    margin-top: 5px;
    color: #9fb3c8;
    font-size: 12px;
}

.trade-summary-card b {
    color: #ffffff;
    font-family: var(--font-mono);
}

.runner-shadow-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.runner-shadow-metric {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(120, 144, 180, 0.18);
    border-left-width: 3px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.64);
}

.runner-shadow-metric.favorable {
    border-left-color: #00b894;
}

.runner-shadow-metric.risk {
    border-left-color: #e74c3c;
}

.runner-shadow-metric.flow {
    border-left-color: #3498db;
}

.runner-shadow-metric.sr {
    border-left-color: #f39c12;
}

.runner-shadow-metric span,
.runner-shadow-metric small {
    display: block;
    color: #8fa5c2;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.runner-shadow-metric strong {
    display: block;
    margin: 4px 0 3px;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.2;
}

.runner-shadow-metric small {
    color: #9fb3c8;
    font-weight: 700;
    text-transform: none;
}

.runner-shadow-metric b {
    color: #ffffff;
    font-family: var(--font-mono);
}

.trade-tab-panel {
    padding: 12px 14px 14px;
}

.trade-tab-panel[hidden] {
    display: none;
}

.trade-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    color: #9fb3c8;
    flex-wrap: wrap;
}

.trade-table-toolbar strong {
    color: #d7e2f1;
    font-size: 13px;
    font-weight: 900;
}

.trade-table-toolbar span {
    margin-left: 8px;
    color: #8fa5c2;
    font-size: 12px;
}

.trade-table-toolbar b {
    color: #ffffff;
    font-family: var(--font-mono);
}

.trade-close-all-btn,
.trade-toggle-btn {
    min-height: 30px;
    border: 1px solid rgba(231, 76, 60, 0.44);
    border-radius: 6px;
    background: rgba(231, 76, 60, 0.14);
    color: #ffd0cc;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 12px;
}

.trade-toggle-btn {
    border-color: rgba(0, 184, 148, 0.44);
    background: rgba(0, 184, 148, 0.12);
    color: #b9f5e8;
}

.trade-table-wrapper {
    overflow: auto;
    border: 1px solid rgba(120, 144, 180, 0.14);
    border-radius: 8px;
    background: rgba(8, 14, 28, 0.68);
}

.trade-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.trade-table-closed {
    min-width: 1040px;
}

.runner-shadow-table {
    min-width: 1220px;
}

.trade-table thead {
    background: rgba(15, 23, 42, 0.84);
}

.trade-table th,
.trade-table td {
    padding: 8px 7px;
    border-bottom: 1px solid rgba(120, 144, 180, 0.12);
    color: #d7e2f1;
    font-size: 12px;
    text-align: left;
    vertical-align: middle;
}

.trade-table th {
    color: #8fa5c2;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.trade-table td.numeric,
.trade-table th.numeric {
    text-align: right;
    font-family: var(--font-mono);
}

.trade-table td.profit {
    color: #b9f5e8;
    font-weight: 900;
}

.trade-table td.loss {
    color: #ffd0cc;
    font-weight: 900;
}

.trade-table td.neutral {
    color: #ffe0a3;
    font-weight: 900;
}

.trade-table td small {
    display: block;
    margin-top: 2px;
    color: #8fa5c2;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
}

.trade-table td.center,
.trade-table th.center {
    text-align: center;
}

.trade-table .trade-symbol {
    color: #ffffff;
    font-weight: 800;
}

.trade-row.buy .trade-symbol {
    color: #b9f5e8;
}

.trade-row.sell .trade-symbol {
    color: #ffd0cc;
}

.trade-row.empty td,
.trade-row.error td {
    color: #8fa5c2;
    text-align: center;
    padding: 18px 8px;
}

.trade-row.error td {
    color: #ffb4ae;
}

.runner-shadow-status,
.runner-shadow-pill,
.runner-shadow-side {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid rgba(120, 144, 180, 0.24);
    border-radius: 999px;
    background: rgba(120, 144, 180, 0.12);
    color: #d7e2f1;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.runner-shadow-status.completed,
.runner-shadow-pill.good {
    border-color: rgba(0, 184, 148, 0.38);
    background: rgba(0, 184, 148, 0.12);
    color: #b9f5e8;
}

.runner-shadow-status.running,
.runner-shadow-pill.watch {
    border-color: rgba(245, 194, 107, 0.38);
    background: rgba(245, 194, 107, 0.12);
    color: #ffe0a3;
}

.runner-shadow-status.incomplete,
.runner-shadow-pill.bad {
    border-color: rgba(231, 76, 60, 0.38);
    background: rgba(231, 76, 60, 0.12);
    color: #ffd0cc;
}

.runner-shadow-pill.muted {
    color: #9fb3c8;
}

.runner-shadow-side {
    min-width: 34px;
    margin-left: 6px;
    padding-inline: 6px;
}

.runner-shadow-side.ce {
    border-color: rgba(0, 184, 148, 0.34);
    color: #b9f5e8;
}

.runner-shadow-side.pe {
    border-color: rgba(231, 76, 60, 0.34);
    color: #ffd0cc;
}

.runner-shadow-window span,
.runner-shadow-window small {
    display: block;
    white-space: nowrap;
}

.runner-shadow-window small {
    margin-top: 2px;
    color: #8fa5c2;
    font-size: 10px;
}

.trade-marker-badge,
.trade-env-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(120, 144, 180, 0.22);
    background: rgba(120, 144, 180, 0.10);
    color: #d7e2f1;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.trade-marker-badge.buy.ce,
.trade-marker-badge.sell.profit {
    border-color: rgba(0, 184, 148, 0.42);
    color: #b9f5e8;
}

.trade-marker-badge.buy.pe,
.trade-marker-badge.sell.loss {
    border-color: rgba(231, 76, 60, 0.42);
    color: #ffd0cc;
}

.trade-marker-badge.sell.neutral {
    border-color: rgba(245, 194, 107, 0.42);
    color: #ffe0a3;
}

.sr-audit-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sr-audit-row td {
    padding: 8px 6px;
    vertical-align: middle;
}

.sr-audit-time {
    color: #d7e2f1;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.sr-tf-chip,
.sr-side-chip,
.sr-decision-chip,
.sr-reason-chip,
.sr-signal-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    border-radius: 999px;
    border: 1px solid rgba(120, 144, 180, 0.24);
    background: rgba(120, 144, 180, 0.10);
    color: #d7e2f1;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    padding: 2px 7px;
    white-space: nowrap;
}

.sr-signal-cell {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.sr-signal-code {
    border-color: rgba(109, 213, 250, 0.38);
    color: #bdeeff;
}

.sr-side-chip.ce {
    border-color: rgba(0, 184, 148, 0.44);
    color: #b9f5e8;
}

.sr-side-chip.pe {
    border-color: rgba(231, 76, 60, 0.44);
    color: #ffd0cc;
}

.sr-decision-chip.placed,
.sr-decision-chip.emitted {
    border-color: rgba(0, 184, 148, 0.42);
    color: #b9f5e8;
}

.sr-decision-chip.skipped {
    border-color: rgba(245, 194, 107, 0.42);
    color: #ffe0a3;
}

.sr-reason-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
}

.sr-reason-cell span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-reason-chip.guard,
.sr-reason-chip.budget,
.sr-reason-chip.loss {
    border-color: rgba(245, 194, 107, 0.42);
    color: #ffe0a3;
}

.sr-reason-chip.emitted {
    border-color: rgba(0, 184, 148, 0.42);
    color: #b9f5e8;
}

.sr-reason-chip.regime,
.sr-reason-chip.active {
    border-color: rgba(109, 213, 250, 0.38);
    color: #bdeeff;
}

.trade-env-badge.dry {
    color: #d7e2f1;
}

.trade-env-badge.live {
    border-color: rgba(0, 184, 148, 0.42);
    color: #b9f5e8;
}

.trade-action-btn {
    min-height: 26px;
    border: 1px solid rgba(231, 76, 60, 0.44);
    border-radius: 6px;
    background: rgba(231, 76, 60, 0.14);
    color: #ffd0cc;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
}

.trade-view-only {
    color: #8fa5c2;
    font-size: 11px;
    font-weight: 700;
}

.trade-trigger-cell {
    max-width: 260px;
    color: #bfcfff;
}

.trade-expand-section {
    text-align: center;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .trade-summary-grid,
    .runner-shadow-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .trade-review-header,
    .trade-review-tabs {
        width: 100%;
    }

    .trade-tab {
        flex: 1;
        justify-content: center;
    }
}

/* ===== MAIN GRID: CE LEFT | PE RIGHT ===== */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    padding: 10px;
    max-width: 1400px;
    margin: 0 auto;
}

.panel-header {
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid;
}

.panel-header.ce { color: var(--green); border-color: var(--green); }
.panel-header.pe { color: var(--red); border-color: var(--red); }

/* ===== STRIKE CARD ===== */
.strike-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin: 5px;
    overflow: hidden;
    transition: border-color 0.3s;
}

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

.strike-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
}

.strike-label {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
}

.strike-ltp {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    transition: color 0.3s;
}

.strike-ltp.flash-up {
    animation: flashGreen 0.4s ease-out;
}

.strike-ltp.flash-down {
    animation: flashRed 0.4s ease-out;
}

@keyframes flashGreen {
    0% { background: var(--green-bg); }
    100% { background: transparent; }
}

@keyframes flashRed {
    0% { background: var(--red-bg); }
    100% { background: transparent; }
}

.strike-change {
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: 3px;
}

.strike-change.up { color: var(--green); background: var(--green-bg); }
.strike-change.down { color: var(--red); background: var(--red-bg); }

/* ===== OHLC + META ROW ===== */
.strike-meta {
    display: flex;
    gap: 10px;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    flex-wrap: wrap;
}

.strike-meta span { white-space: nowrap; }
.strike-meta .label { color: var(--text-muted); }

/* ===== DEPTH TABLE ===== */
.depth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    font-family: var(--font-mono);
    font-size: 12px;
}

.depth-side {
    padding: 0;
}

.depth-side-header {
    text-align: center;
    padding: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.depth-side-header.bid { color: var(--green); background: var(--green-bg); }
.depth-side-header.ask { color: var(--red); background: var(--red-bg); }

.depth-row {
    display: grid;
    grid-template-columns: 1fr 1fr 0.6fr;
    padding: 2px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.depth-row:nth-child(even) { background: var(--bg-depth-row-alt); }

.depth-row .qty { text-align: right; }
.depth-row .price { text-align: center; font-weight: 500; }
.depth-row .orders { text-align: center; color: var(--text-muted); font-size: 10px; }

.depth-row.bid .price { color: var(--green); }
.depth-row.ask .price { color: var(--red); }

.depth-labels {
    display: grid;
    grid-template-columns: 1fr 1fr 0.6fr;
    padding: 2px 6px;
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.depth-labels span:first-child { text-align: right; }
.depth-labels span:nth-child(2) { text-align: center; }
.depth-labels span:last-child { text-align: center; }

/* Total row */
.depth-total {
    display: flex;
    justify-content: space-between;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-top: 1px solid var(--border);
}

.depth-total.bid { color: var(--green); }
.depth-total.ask { color: var(--red); }

/* ===== ORDER BUTTONS ===== */
.order-buttons {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    border-top: 1px solid var(--border);
}

.order-buttons button {
    flex: 1;
    padding: 5px 0;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.order-buttons button:hover { opacity: 0.85; }
.order-buttons button:active { transform: scale(0.97); }

.btn-buy { background: var(--green); color: #fff; }
.btn-sell { background: var(--red); color: #fff; }
.btn-gtt { background: var(--orange); color: #fff; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 380px;
    max-width: 90vw;
    padding: 20px;
}

.modal h3 {
    font-size: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal h3 .close-btn {
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    background: none;
    border: none;
}

.modal-field {
    margin-bottom: 10px;
}

.modal-field label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-field input,
.modal-field select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.modal-field input:focus,
.modal-field select:focus {
    outline: none;
    border-color: var(--blue);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.modal-actions .btn-confirm-buy { background: var(--green); color: #fff; }
.modal-actions .btn-confirm-sell { background: var(--red); color: #fff; }
.modal-actions .btn-cancel { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border); }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 12px;
    color: #fff;
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== LOADING STATE ===== */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 800px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
    .peak-grid {
        grid-template-columns: 1fr;
    }
    .header {
        flex-direction: column;
        gap: 8px;
    }
}

/* ===== PEAK ORDERS SECTION ===== */

.peak-orders-section {
    padding: 0 15px 20px;
}

.peak-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0 8px;
    border-top: 2px solid var(--border);
    margin-top: 10px;
}

.peak-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--orange);
}

.peak-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    flex: 1;
}

.btn-reset-peaks {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid var(--red);
    color: var(--red);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-reset-peaks:hover {
    background: rgba(231, 76, 60, 0.3);
}

.peak-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.peak-table-wrapper {
    overflow-x: auto;
}

.peak-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 11px;
}

.peak-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.peak-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 6px 8px;
    text-align: right;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.peak-table th:first-child {
    text-align: left;
}

.peak-table th:last-child {
    text-align: center;
}

.peak-table th.bid-col {
    color: var(--green);
}

.peak-table th.ask-col {
    color: var(--red);
}

.peak-table td {
    padding: 5px 8px;
    text-align: right;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    white-space: nowrap;
}

.peak-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.peak-actions-cell {
    min-width: 200px;
    text-align: center !important;
}

.peak-action-buttons {
    display: grid;
    grid-template-columns: 42px 58px 42px 42px;
    gap: 4px;
    justify-content: center;
    align-items: center;
}

.peak-live-profit-field {
    width: 58px;
    height: 24px;
    display: grid;
    grid-template-columns: 1fr 12px;
    align-items: center;
    border: 1px solid rgba(0, 184, 148, 0.45);
    border-radius: 4px;
    background: rgba(0, 184, 148, 0.10);
    overflow: hidden;
}

.peak-live-profit-input {
    width: 100%;
    min-width: 0;
    height: 22px;
    border: 0;
    outline: none;
    background: transparent;
    color: #7ff5d6;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-align: right;
    padding: 0 2px 0 4px;
}

.peak-live-profit-input:disabled {
    opacity: 0.45;
    cursor: wait;
}

.peak-live-profit-field span {
    color: #7ff5d6;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
}

.peak-action-btn {
    min-width: 42px;
    height: 24px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.15s, transform 0.15s, border-color 0.15s;
}

.peak-action-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.peak-action-btn:disabled {
    opacity: 0.45;
    cursor: wait;
}

.peak-action-btn.buy-paper {
    background: rgba(243, 156, 18, 0.22);
    border-color: rgba(243, 156, 18, 0.70);
    color: #ffd28a;
}

.peak-action-btn.buy-live {
    background: rgba(0, 184, 148, 0.22);
    border-color: rgba(0, 184, 148, 0.70);
    color: #7ff5d6;
}

.peak-action-btn.sell {
    background: rgba(231, 76, 60, 0.22);
    border-color: rgba(231, 76, 60, 0.70);
    color: #ffaaa1;
}

.peak-table tbody tr {
    background: var(--bg-card);
    transition: background 0.15s;
}

.peak-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.peak-table tbody tr.atm-row {
    background: rgba(243, 156, 18, 0.1);
    border-left: 3px solid var(--orange);
}

.peak-bid-price {
    color: var(--green);
    font-weight: 700;
}

.peak-ask-price {
    color: var(--red);
    font-weight: 700;
}

.peak-time {
    color: #bfcfff; /* brighten from var(--text-muted) to a light blue */
    font-size: 10px;
}

.peak-ltp {
    color: var(--blue);
    font-weight: 600;
}

.peak-oi {
    color: var(--text-secondary);
}

.peak-oi-change {
    font-weight: 700;
}

.peak-oi-change.positive {
    color: var(--green);
}

.peak-oi-change.negative {
    color: var(--red);
}

.peak-oi-change.neutral {
    color: var(--text-muted);
}

.peak-oi-change-pct {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 600;
}

/* Flash animation for new peaks */
@keyframes peak-flash {
    0% { background: rgba(243, 156, 18, 0.4); }
    100% { background: transparent; }
}

.peak-new {
    animation: peak-flash 1.5s ease-out;
}

