:root {
    --bg-light: #f1f3f9;
    --card-bg: rgba(255, 255, 255, 0.9);
    --border-light: rgba(0, 0, 0, 0.05);
    --text-primary: #101828;
    --text-secondary: #475467;
    --neon-cyan: #06b6d4;
    --neon-pink: #f43f5e;
    --success: #12b76a;
    --danger: #f04438;
    --sidebar-bg: #ffffff;
    --sidebar-text: #101828;
    --accent: #2e90fa;
    --shadow-sm: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
    --shadow-xl: 0 20px 24px -4px rgba(16, 24, 40, 0.08), 0 8px 8px -4px rgba(16, 24, 40, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    z-index: 1000;
    border-right: 1px solid var(--border-light);
}

.sidebar.sidebar-hidden {
    margin-left: -260px;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: var(--neon-cyan);
    color: white;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
}

.logo-icon.logo-image {
    background: #ffffff;
    overflow: hidden;
    padding: 2px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.14);
}

.logo-icon.logo-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 6px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
}

nav {
    flex-grow: 1;
}

.nav-item {
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: 0.2s;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item.active,
.nav-item:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.user-profile img {
    width: 40px;
    border-radius: 50%;
}

.user-info .user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info .user-status {
    font-size: 0.75rem;
    color: #10b981;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    min-width: 0;
    /* padding: 24px; */
    display: flex;
    flex-direction: column;
    /* gap: 24px; */
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    margin-bottom: 0;
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
    animation: fadeIn 0.4s ease-out;
    align-self: flex-start;
    min-height: 100%;
}

.main-content.nbs-full-width {
    max-width: 100%;
    overflow-x: hidden;
    padding-left: 10px;
    padding-right: 10px;
    gap: 2px;
}

.content-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    justify-content: flex-start;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Two-Row Header ───────────────────────────────────── */
.top-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0 4px;
    border-bottom: 1px solid var(--border-light);
}

.header-row {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Row 1: Hamburger + tiny index tickers */
.header-row-1 {
    gap: 12px;
}

.index-tickers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.ticker-item {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.ticker-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ticker-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ticker-change {
    font-size: 0.62rem;
    font-weight: 600;
}

.ticker-sep {
    color: var(--border-light);
    font-size: 0.65rem;
    opacity: 0.5;
    user-select: none;
}

/* Row 2: Full-width metrics strip */
.header-row-2 {
    width: 100%;
    justify-content: flex-end;
}

.metrics-strip {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.025);
    border-radius: 6px;
    padding: 3px 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.metric-chip {
    display: flex;
    align-items: baseline;
    gap: 3px;
    padding: 0 8px;
    white-space: nowrap;
}

.mc-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mc-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mc-divider {
    width: 1px;
    height: 14px;
    background: var(--border-light);
    flex-shrink: 0;
}

/* legacy kept for JS refs that still use these */
.header-inline-stats {
    display: none;
}

.left-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Row 1 ── hamburger */


.hw-settings {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.65;
}

.hw-settings:hover {
    opacity: 1;
}

.inline-sep {
    color: var(--text-secondary);
    opacity: 0.35;
    font-size: 0.75rem;
}

.inline-divider {
    width: 1px;
    height: 18px;
    background: var(--border-light);
    margin: 0 4px;
    display: inline-block;
    vertical-align: middle;
}



.left-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hamburger-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.sidebar-header .sidebar-close-btn {
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 1.2rem;
    display: none;
    /* Hidden on desktop */
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@media (max-width: 992px) {
    .sidebar-header .sidebar-close-btn {
        display: flex;
    }
}

.search-wrapper {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    outline: none;
    box-shadow: var(--shadow-sm);
}

.search-results {
    position: absolute;
    top: 55px;
    left: 0;
    width: 100%;
    min-width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    /* Ensure it stays above everything */
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-light);
}

.search-item {
    padding: 2px;
    cursor: pointer;
}

.searching,
.no-results {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.no-results {
    color: var(--danger);
}

.search-item-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    transition: 0.2s;
}

.search-item-inner:hover {
    background: var(--bg-light);
}

.search-info {
    display: flex;
    flex-direction: column;
}

.search-symbol {
    font-weight: 700;
    color: var(--text-primary);
}

.search-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.add-symbol-btn {
    background: var(--accent);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.market-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-change {
    font-size: 0.72rem;
    font-weight: 600;
}

.up {
    color: var(--success);
}

.down {
    color: var(--danger);
}

.sidebar-auth {
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-login {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

/* Cards & Glassmorphism */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-xl);
}

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    justify-content: flex-start;
    margin-top: 0;
    /* Space between main card and bottom panels if any */
    animation: fadeIn 0.3s ease-out;
}

.tab-content.hidden {
    display: none;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.admin-source-ip-control {
    display: inline-flex;
    min-width: 220px;
    align-items: center;
    gap: 6px;
}

.admin-source-ip-control input {
    width: 132px;
    height: 34px;
    padding: 6px 9px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.admin-source-ip-control input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
    outline: none;
}

.admin-source-ip-save {
    height: 34px;
    padding: 5px 10px !important;
    font-size: 0.72rem !important;
}

.trade-book-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.trade-summary-card {
    padding: 18px 20px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 5px 16px rgba(16, 24, 40, 0.05);
}

.trade-summary-card span {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.trade-summary-card strong {
    color: var(--text-primary);
    font-size: 1.25rem;
}

.trade-summary-card.buy strong {
    color: var(--success);
}

.trade-summary-card.sell strong {
    color: var(--danger);
}

.trade-book-card {
    overflow: hidden;
    border: 1px solid #e4e7ec;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.07);
}

.trade-book-header p {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.trade-book-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px 150px;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid #eaecf0;
    background: #f9fafb;
}

.trade-book-filters input,
.trade-book-filters select {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.trade-book-filters input:focus,
.trade-book-filters select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

#trades-table {
    min-width: 1050px;
}

#trades-table th {
    white-space: nowrap;
}

#trades-table td {
    font-variant-numeric: tabular-nums;
}

.trade-symbol-cell {
    color: var(--text-primary);
    font-weight: 700;
}

.trade-order-number {
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
}

.trade-mode-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 800;
    text-transform: uppercase;
}

.trade-mode-badge.live {
    background: #ecfdf3;
    color: #027a48;
}

.trade-mode-badge.paper {
    background: #fff7ed;
    color: #c2410c;
}

.trade-book-message-row td {
    padding: 42px 20px !important;
    color: var(--text-secondary);
    text-align: center;
}

.trade-book-message-row strong,
.trade-book-message-row span {
    display: block;
}

.trade-book-message-row strong {
    margin-bottom: 6px;
    color: var(--text-primary);
}

.trade-book-message-row.error strong {
    color: var(--danger);
}

@media (max-width: 900px) {
    .trade-book-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trade-book-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .trade-book-summary {
        grid-template-columns: 1fr;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 5;
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    font-weight: 500;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

.paper {
    background: #fff9e6;
    color: #b54708;
}

.pulse {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

.call {
    background: #d1fae5;
    color: #065f46;
}

.put {
    background: #fee2e2;
    color: #991b1b;
}

.btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    transition: 0.2s;
}

.btn-buy {
    background: #e0fcf9;
    color: var(--neon-cyan);
    margin-right: 5px;
}

.btn-buy:hover {
    background: var(--neon-cyan);
    color: white;
}

.btn-sell {
    background: #fff1f2;
    color: var(--neon-pink);
}

.btn-sell:hover {
    background: var(--neon-pink);
    color: white;
}

.btn-remove {
    background: #f1f3f9;
    color: var(--text-secondary);
}

.btn-remove:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* Top Summary Panels */
.top-summary-panels {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 16px;
}

.top-summary-panels .card {
    flex: 0 1 400px;
    /* Max 400px, but can shrink */
    min-width: 300px;
    padding: 16px 20px;
    /* More compact padding */
}

.risk-stats {
    display: flex;
    justify-content: space-between;
}

.risk-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.risk-item span:first-child {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.risk-item .val {
    font-size: 1.1rem;
    font-weight: 700;
}

.pnl-display {
    text-align: center;
}

.pnl-value {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.pnl-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    width: 450px;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.symbol-info {
    margin-bottom: 20px;
}

.symbol-name {
    font-size: 1.3rem;
    font-weight: 800;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    outline: none;
}

.form-actions {
    display: flex;
    gap: 12px;
}

.btn.large {
    flex: 1;
    padding: 14px;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 5px solid var(--accent);
    margin-top: 10px;
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
        margin-left: 0;
    }

    .sidebar.sidebar-hidden {
        margin-left: 0;
        transform: translateX(-100%);
    }

    .top-summary-panels {
        grid-template-columns: 1fr;
    }
}

/* Strategy Page Styles */
.strategy-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.strategy-form-card {
    width: 100%;
    position: relative;
    z-index: 20;
    padding: 0;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e4e7ec;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

.strategy-table-card {
    width: 100%;
    position: relative;
    z-index: 10;
    padding: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e4e7ec;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

.strategy-form {
    --strategy-row-columns: 105px 80px 85px 65px 80px 70px 90px 80px 90px 80px 132px 70px 75px 55px 318px;
    --strategy-control-height: 27px;
    display: flex;
    flex-direction: column;
    /* gap: 8px; */
    padding: 2px 9px 2px;
    overflow-x: auto;
    scrollbar-color: #d0d5dd transparent;
    scrollbar-width: thin;
}

.strategy-form-header {
    display: grid;
    grid-template-columns: var(--strategy-row-columns);
    align-items: end;
    justify-items: center;
    gap: 3px;
    min-width: 1600px;
    padding: 0 6px;
    color: #667085;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

#strategy-rows-container {
    min-width: 1600px;
}

/* Row layout */
.sf-row {
    position: relative;
    display: grid;
    grid-template-columns: var(--strategy-row-columns);
    align-items: center;
    gap: 3px;
    min-width: 1600px;
    padding: 1px 6px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fcfcfd;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    animation: strategyRowEnter 0.22s ease-out;
}

@keyframes strategyRowEnter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.strategy-row-loading {
    border-color: #d6e4ff;
    background: #f8fbff;
}

.strategy-row-loading .sf-group input,
.strategy-row-loading .sf-group select,
.strategy-row-loading .compact-select-btn,
.strategy-row-loading .strategy-builder-sl-control {
    position: relative;
    overflow: hidden;
    border-color: #dbe7fb;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.72) 48%, rgba(255, 255, 255, 0) 100%),
        #eef5ff;
    background-size: 220% 100%, 100% 100%;
    color: #7a8aa0;
    animation: strategyLoadingSweep 1.2s ease-in-out infinite;
}

.strategy-row-loading .sf-order-buttons .sf-btn {
    opacity: 0.58;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.strategy-row-loading .sf-order-buttons .sf-btn:hover {
    transform: none;
    box-shadow: none;
}

@keyframes strategyLoadingSweep {
    0% {
        background-position: 180% 0, 0 0;
    }

    100% {
        background-position: -80% 0, 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sf-row,
    .strategy-row-loading .sf-group input,
    .strategy-row-loading .sf-group select,
    .strategy-row-loading .compact-select-btn,
    .strategy-row-loading .strategy-builder-sl-control {
        animation: none;
    }
}

/* .sf-row+.sf-row {
    margin-top: 12px;
} */

.strat-symbol-search.fixed-underlying {
    /* background: #f3f4f6; */
    color: #111827;
    font-weight: 700;
    cursor: default;
}

.strategy-row-setting {
    margin-bottom: 24px;
}

.strategy-builder-card {
    overflow: hidden;
    border: 1px solid #e4e7ec;
    box-shadow: 0 14px 34px rgba(16, 24, 40, 0.07);
}

.strategy-builder-header {
    padding: 20px 24px 14px;
}

.strategy-builder-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 850;
}

.strategy-builder-header p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 650;
}

.strategy-builder-table-wrap {
    overflow-x: auto;
    padding: 0 16px 16px;
}

.strategy-builder-table {
    width: 100%;
    min-width: 1980px;
    border-collapse: collapse;
    table-layout: fixed;
    border: 1px solid #d0d5dd;
    background: #fff;
}

.strategy-builder-table tbody tr.sf-row {
    display: table-row;
    min-width: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.strategy-builder-table th,
.strategy-builder-table td {
    height: 42px;
    padding: 6px;
    border: 1px solid #d0d5dd;
    color: var(--text-primary);
    text-align: center;
    vertical-align: middle;
}

.strategy-builder-table th {
    background: #f8fafc;
    color: #344054;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1.15;
}

.strategy-builder-table input,
.strategy-builder-table select {
    width: 100%;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 750;
    text-align: center;
    outline: none;
}

.strategy-builder-table select {
    cursor: pointer;
    text-align-last: center;
}

.strategy-builder-symbol-search {
    width: 100%;
    max-width: none;
}

.strategy-builder-symbol-search .strat-search-results {
    top: calc(100% + 4px);
    min-width: 240px;
    text-align: left;
}

.strategy-builder-table input:focus,
.strategy-builder-table select:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.strategy-builder-row-tools {
    display: flex;
    margin-top: 10px;
    gap: 8px;
}

.strategy-builder-row-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 32px;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.strategy-builder-row-btn.add {
    background: linear-gradient(135deg, #2e90fa, #1570ef);
    box-shadow: 0 8px 18px rgba(46, 144, 250, 0.28);
}

.strategy-builder-row-btn.remove {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
}

.strategy-builder-row-btn:hover,
.strategy-builder-row-btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.strategy-builder-action-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(32px, 1fr));
    justify-content: center;
    gap: 5px;
}

.strategy-builder-action-btn {
    height: 26px;
    min-width: 0;
    border: 0;
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 850;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.strategy-builder-action-green {
    background: #16a34a;
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.2);
}

.strategy-builder-action-red {
    background: #dc2626;
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.2);
}

.strategy-builder-action-btn:hover,
.strategy-builder-action-btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.strategy-builder-table tbody tr.strategy-row-running td {
    background: rgba(22, 163, 74, 0.06);
}

.strategy-builder-table th:nth-child(1),
.strategy-builder-table td:nth-child(1) {
    width: 120px;
}

.strategy-builder-table th:nth-child(2),
.strategy-builder-table td:nth-child(2) {
    width: 170px;
}

.strategy-builder-table th:nth-child(3),
.strategy-builder-table td:nth-child(3) {
    width: 140px;
}

.strategy-builder-table th:nth-child(4),
.strategy-builder-table td:nth-child(4) {
    width: 220px;
}

.strategy-builder-table th:nth-child(5),
.strategy-builder-table td:nth-child(5),
.strategy-builder-table th:nth-child(6),
.strategy-builder-table td:nth-child(6),
.strategy-builder-table th:nth-child(8),
.strategy-builder-table td:nth-child(8),
.strategy-builder-table th:nth-child(11),
.strategy-builder-table td:nth-child(11),
.strategy-builder-table th:nth-child(13),
.strategy-builder-table td:nth-child(13),
.strategy-builder-table th:nth-child(14),
.strategy-builder-table td:nth-child(14),
.strategy-builder-table th:nth-child(15),
.strategy-builder-table td:nth-child(15),
.strategy-builder-table th:nth-child(16),
.strategy-builder-table td:nth-child(16),
.strategy-builder-table th:nth-child(18),
.strategy-builder-table td:nth-child(18) {
    width: 90px;
}

.strategy-builder-table th:nth-child(7),
.strategy-builder-table td:nth-child(7),
.strategy-builder-table th:nth-child(9),
.strategy-builder-table td:nth-child(9),
.strategy-builder-table th:nth-child(10),
.strategy-builder-table td:nth-child(10),
.strategy-builder-table th:nth-child(12),
.strategy-builder-table td:nth-child(12),
.strategy-builder-table th:nth-child(17),
.strategy-builder-table td:nth-child(17) {
    width: 110px;
}

.strategy-builder-table th:nth-child(19),
.strategy-builder-table td:nth-child(19) {
    width: 132px;
}

.strategy-builder-table th:nth-child(7),
.strategy-builder-table td:nth-child(7),
.strategy-builder-table th:nth-child(9),
.strategy-builder-table td:nth-child(9),
.strategy-builder-table th:nth-child(12),
.strategy-builder-table td:nth-child(12),
.strategy-builder-table th:nth-child(14),
.strategy-builder-table td:nth-child(14),
.strategy-builder-table th:nth-child(15),
.strategy-builder-table td:nth-child(15),
.strategy-builder-table th:nth-child(16),
.strategy-builder-table td:nth-child(16),
.strategy-builder-table th:nth-child(17),
.strategy-builder-table td:nth-child(17),
.strategy-builder-table th:nth-child(19),
.strategy-builder-table td:nth-child(19) {
    width: 90px;
}

.strategy-builder-table th:nth-child(8),
.strategy-builder-table td:nth-child(8),
.strategy-builder-table th:nth-child(10),
.strategy-builder-table td:nth-child(10),
.strategy-builder-table th:nth-child(11),
.strategy-builder-table td:nth-child(11),
.strategy-builder-table th:nth-child(13),
.strategy-builder-table td:nth-child(13),
.strategy-builder-table th:nth-child(18),
.strategy-builder-table td:nth-child(18) {
    width: 110px;
}

.strategy-builder-table th:nth-child(20),
.strategy-builder-table td:nth-child(20) {
    width: 132px;
}

.strategy-settings-card {
    overflow: hidden;
    border: 1px solid #e4e7ec;
    box-shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

.strategy-settings-header {
    padding: 28px 32px 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
}

.strategy-settings-header h3 {
    margin: 5px 0 6px;
    font-size: 1.55rem;
}

.strategy-settings-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.strategy-settings-eyebrow {
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.strategy-settings-body {
    padding: 28px 32px 32px;
}

.strategy-setting-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.strategy-setting-title>span {
    font-size: 0.95rem;
    font-weight: 700;
}

.strategy-setting-title small {
    color: var(--text-secondary);
}

.strategy-row-mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.strategy-row-mode-option {
    position: relative;
    display: flex;
    min-height: 190px;
    padding: 20px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(16, 24, 40, 0.04);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.strategy-row-mode-option:hover {
    border-color: #b2ccff;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
    transform: translateY(-1px);
}

.strategy-row-mode-option:has(input:checked) {
    border-color: var(--accent);
    background: linear-gradient(145deg, #fff 0%, #eef6ff 100%);
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.strategy-row-mode-option input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 2px 13px 0 0;
    accent-color: var(--accent);
}

.strategy-mode-content,
.strategy-mode-heading {
    display: block;
}

.strategy-mode-content {
    min-width: 0;
    flex: 1;
}

.strategy-mode-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.strategy-mode-heading strong {
    font-size: 1rem;
}

.strategy-mode-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: #eaf5ff;
    color: #1570ef;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.strategy-mode-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.strategy-mode-preview span {
    padding: 7px 9px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #f9fafb;
    color: #344054;
    font-size: 0.74rem;
    font-weight: 700;
}

.strategy-mode-preview span.is-empty {
    border-style: dashed;
    color: #667085;
    background: #fff;
}

.strategy-mode-content>small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
}

.strategy-settings-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid #eaecf0;
}

.strategy-settings-actions p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.strategy-settings-actions button {
    min-width: 210px;
}

.active-strategy-settings-card {
    margin-top: 24px;
    overflow: hidden;
    border: 1px solid #e4e7ec;
    box-shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

.active-strategy-column-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.active-strategy-select-all {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.active-strategy-select-all input,
.active-strategy-column-grid input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

#active-strategy-column-count {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
}

.active-strategy-column-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.active-strategy-column-grid label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 9px;
    background: #fff;
    color: #344054;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.active-strategy-column-grid label:has(input:checked) {
    border-color: #b2ccff;
    background: #f5f9ff;
    color: #175cd3;
}

.active-strategy-save-actions {
    margin-top: 22px;
}

.strategy-guide-card {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fcfcfd;
}

.strategy-guide-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.strategy-guide-heading h4 {
    margin-bottom: 4px;
    color: #101828;
    font-size: 0.95rem;
}

.strategy-guide-heading p {
    color: #667085;
    font-size: 0.76rem;
    line-height: 1.45;
}

.strategy-guide-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.strategy-guide-item {
    min-height: 86px;
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fff;
}

.strategy-guide-item strong {
    display: block;
    margin-bottom: 6px;
    color: #101828;
    font-size: 0.78rem;
}

.strategy-guide-item span {
    display: block;
    color: #475467;
    font-size: 0.72rem;
    line-height: 1.45;
}

.strategy-guide-item-wide {
    grid-column: span 3;
    min-height: auto;
}

.active-strategy-cleanup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 26px;
    padding: 20px;
    border: 1px solid #fecdca;
    border-radius: 12px;
    background: #fffbfa;
}

.active-strategy-cleanup h4 {
    margin-bottom: 5px;
    color: #912018;
    font-size: 0.92rem;
}

.active-strategy-cleanup p {
    color: #667085;
    font-size: 0.76rem;
}

.active-strategy-cleanup-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
}

.strategy-cleanup-btn {
    padding: 10px 14px;
    border: 1px solid #fda29b;
    border-radius: 8px;
    background: #fff;
    color: #b42318;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.strategy-cleanup-btn:hover {
    background: #fff1f0;
}

.strategy-cleanup-btn.danger {
    border-color: #d92d20;
    background: #d92d20;
    color: #fff;
}

.strategy-cleanup-btn.danger:hover {
    background: #b42318;
}

.browser-storage-settings-card {
    margin-bottom: 24px;
}

.browser-storage-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.browser-storage-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 118px;
    padding: 18px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
}

.browser-storage-action h4 {
    margin-bottom: 6px;
    color: #101828;
    font-size: 0.92rem;
}

.browser-storage-action p {
    color: #667085;
    font-size: 0.76rem;
    line-height: 1.45;
}

@media (max-width: 760px) {

    .strategy-settings-header,
    .strategy-settings-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .strategy-row-mode-options {
        grid-template-columns: 1fr;
    }

    .strategy-settings-actions,
    .strategy-setting-title {
        align-items: stretch;
        flex-direction: column;
    }

    .strategy-settings-actions button {
        width: 100%;
    }

    .active-strategy-column-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .strategy-guide-grid {
        grid-template-columns: 1fr;
    }

    .strategy-guide-item-wide {
        grid-column: span 1;
    }

    .active-strategy-cleanup,
    .active-strategy-cleanup-actions,
    .browser-storage-action {
        align-items: stretch;
        flex-direction: column;
    }

    .browser-storage-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .active-strategy-column-grid {
        grid-template-columns: 1fr;
    }
}

.sf-symbol-group {
    grid-column: 1 !important;
    grid-row: 1;
}

.sf-moneyness-group {
    grid-column: 2 !important;
    grid-row: 1;
}

.sf-expiry-group {
    grid-column: 3 !important;
    grid-row: 1;
}

.sf-call-group {
    grid-column: 7 !important;
    grid-row: 1;
}

.sf-call-group+.sf-ltp-group {
    grid-column: 8 !important;
    grid-row: 1;
}

.sf-quantity-group {
    grid-column: 4 !important;
    grid-row: 1;
}

.sf-capital-group {
    grid-column: 5 !important;
    grid-row: 1;
}

.sf-price-target-group {
    grid-column: 6 !important;
    grid-row: 1;
}

.sf-put-group {
    grid-column: 9 !important;
    grid-row: 1;
}

.sf-put-group+.sf-ltp-group {
    grid-column: 10 !important;
    grid-row: 1;
}

.sf-risk-group {
    grid-row: 1;
}

.strategy-builder-sl-control {
    display: grid;
    grid-template-columns: minmax(64px, 1fr) 58px;
    gap: 2px;
    width: 100%;
}

.strategy-builder-sl-control .strat-sl,
.strategy-builder-sl-control .strat-sl-mode {
    min-width: 0;
}

.strategy-builder-sl-control .strat-sl-mode {
    padding-left: 2px;
    padding-right: 2px;
    font-size: 0.68rem !important;
}

.sf-risk-group:nth-of-type(11) {
    grid-column: 11 !important;
}

.sf-risk-group:nth-of-type(12) {
    grid-column: 12 !important;
}

.sf-trail-type-group {
    grid-column: 13 !important;
    grid-row: 1;
}

.sf-interval-group {
    grid-column: 14 !important;
    grid-row: 1;
}

/* Generic group */
.sf-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sf-group label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.strategy-form-header span {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem !important;
    color: #667085;
    font-weight: 700;
    letter-spacing: 0.035em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
}

.sf-group input,
.sf-group select {
    width: 100%;
    height: var(--strategy-control-height);
    min-height: var(--strategy-control-height);
    padding: 0 0 !important;
    border-radius: 8px;
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #101828;
    font-size: 0.78rem !important;
    font-weight: 600;
    line-height: var(--strategy-control-height);
    outline: none;
    text-align: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sf-group select {
    padding-right: 3px !important;
    text-align-last: center;
}

.sf-group input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.sf-group input[type="number"]::-webkit-inner-spin-button,
.sf-group input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.hline-risk-popover {
    position: fixed;
    z-index: 9999;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 4px;
    align-items: center;
    padding: 5px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.hline-risk-popover select,
.hline-risk-popover input,
.hline-risk-popover button {
    height: 26px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    background: #fff;
    color: #101828;
    font-size: 0.74rem;
    font-weight: 700;
}

.hline-risk-popover select {
    min-width: 62px;
}

.hline-risk-popover input {
    width: 68px;
    padding: 0 6px;
    text-align: center;
}

.hline-risk-popover button {
    padding: 0 9px;
    border-color: #86efac;
    background: #ecfdf3;
    color: #067647;
    cursor: pointer;
}

.sf-symbol-group input,
.sf-quantity-group input,
.sf-capital-group input,
.sf-risk-group input,
.sf-group .ltp-input {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sf-group input:hover,
.sf-group select:hover {
    border-color: #98a2b3;
}

.sf-group input:focus,
.sf-group select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.sf-group input:disabled,
.sf-group select:disabled {
    background: #f2f4f7;
    color: #98a2b3;
    cursor: not-allowed;
}

.sf-group .ltp-input {
    /* border-color: #e4e7ec;
    background: #f9fafb !important; */
    color: #344054;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.compact-select-native {
    display: none !important;
}

.compact-select {
    position: relative;
    width: 100%;
    min-width: 76px;
}

.compact-select-btn {
    width: 100%;
    height: var(--strategy-control-height);
    min-height: var(--strategy-control-height);
    padding: 0 26px 0 10px;
    border-radius: 8px;
    border: 1px solid #d0d5dd;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
}

.sf-moneyness-group .compact-select-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 28px !important;
    text-align: center !important;
}

.compact-select-btn::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: translateY(-65%) rotate(45deg);
}

.compact-select-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    z-index: 3000;
    width: 100%;
    max-height: 132px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
    padding: 5px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.5) transparent;
}

.compact-select-menu::-webkit-scrollbar {
    width: 5px;
}

.compact-select-menu::-webkit-scrollbar-track {
    background: transparent;
}

.compact-select-menu::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.45);
    border-radius: 999px;
}

.compact-select-option {
    width: 100%;
    padding: 6px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.1;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.compact-select-option:hover,
.compact-select-option.active {
    background: #3b82f6;
    color: #ffffff;
}

/* Small group (row 2) */
.sf-group-sm {
    flex: 0.8 1 80px;
    min-width: 80px;
}

/* Extra-small group — Symbol, Expiry, Strike in row 1 */
.sf-group-xs {
    flex: 1 1 100px;
    min-width: 100px;
}

/* Call/Put side blocks */
.sf-option-side {
    flex: 1.5 1 170px;
    min-width: 170px;
}

.sf-option-row {
    display: flex;
    gap: 6px;
}

.sf-option-row .strike-select {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    padding: 9px 6px;
}

.sf-option-row .qty-mini {
    width: 62px;
    flex: none;
    font-size: 0.8rem;
    padding: 9px 6px;
}

.ce-label {
    color: #027a48 !important;
    font-weight: 700 !important;
}

.pe-label {
    color: #b42318 !important;
    font-weight: 700 !important;
}

.market-trade-strike-open-label {
    cursor: pointer;
    user-select: none;
}

.market-trade-strike-open-label:hover {
    text-decoration: underline;
}

.ltp-tag {
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f3f9;
    padding: 1px 5px;
    border-radius: 4px;
}

/* Buy/Sell action buttons */
.sf-actions {
    display: flex;
    position: relative;
    align-items: center;
    gap: 8px;
    grid-column: 15 !important;
    grid-row: 1;
    min-height: var(--strategy-control-height);
}

.sf-btn {
    min-width: 34px;
    height: var(--strategy-control-height);
    min-height: var(--strategy-control-height);
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.sf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 24, 40, 0.12);
}

.sf-btn:disabled {
    cursor: wait;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

.sf-btn-buy {
    border-color: #abefc6;
    background: #ecfdf3;
    color: #027a48;
}

.sf-btn-buy:hover {
    background: #d1fadf;
}

.sf-btn-sell {
    border-color: #fecdca;
    background: #fef3f2;
    color: #b42318;
}

.sf-btn-sell:hover {
    background: #fee4e2;
}

.sf-btn-exit {
    border-color: #fedf89;
    background: #fffaeb;
    color: #b54708;
}

.sf-btn-exit:hover {
    background: #fef0c7;
}

.sf-btn-exit-all {
    border-color: #d6bbfb;
    background: #f4f3ff;
    color: #5925dc;
}

.sf-btn-exit-all:hover {
    background: #ebe9fe;
}

.sf-actions-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.sf-order-buttons {
    display: grid;
    grid-template-columns: repeat(7, auto);
    gap: 4px;
}

.sf-row-controls {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.sf-row-btn {
    display: grid;
    width: 28px;
    height: var(--strategy-control-height);
    padding: 0;
    place-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #fff;
    color: #475467;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.sf-row-btn:hover {
    border-color: #84adff;
    background: #eff4ff;
    color: #175cd3;
}

.remove-row-btn {
    display: none;
}

.strategy-selection-header {
    margin: 0;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #eaecf0;
    gap: 16px;
}

.strategy-selection-header h3 {
    font-size: 1.15rem;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.strategy-selection-header p {
    margin-top: 4px;
    color: #667085;
    font-size: 0.78rem;
    font-weight: 400;
}

.strategy-ticket-label {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid #b2ddff;
    border-radius: 999px;
    background: #eff8ff;
    color: #175cd3;
    font-size: 0.7rem;
    font-weight: 700;
}



/* Monitor Styles */
.monitor-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px;
}

.monitor-item {
    text-align: center;
}

.monitor-item .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.monitor-item .value {
    font-size: 1.5rem;
    font-weight: 800;
}

#monitor-pnl.up {
    color: var(--success);
}

#monitor-pnl.down {
    color: var(--danger);
}

/* Segmented Control for Buy/Sell and Type */
.segmented-control {
    display: flex;
    background: #f1f3f9;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.segmented-control input {
    display: none !important;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.segmented-control input:checked+label {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

#opt-ce:checked+label {
    color: var(--success) !important;
    font-weight: 700;
}

#opt-pe:checked+label {
    color: var(--danger) !important;
    font-weight: 700;
}

#trade-buy:checked+label {
    background: var(--success) !important;
    color: white !important;
}

#trade-sell:checked+label {
    background: var(--danger) !important;
    color: white !important;
}

.full-width {
    width: 100%;
}

/* Active strategies table */
.strategy-table-header {
    margin: 0;
    padding: 5px 5px 5px;
    border-bottom: 1px solid #eaecf0;
    gap: 16px;
    flex-wrap: wrap;
}

.strategy-table-header h3 {
    font-size: 1.15rem;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.strategy-table-header p {
    margin-top: 4px;
    color: #667085;
    font-size: 0.78rem;
    font-weight: 400;
}

.strategy-count {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    background: #f9fafb;
    color: #344054;
    font-size: 0.72rem;
    font-weight: 700;
}

.strategy-global-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.strategy-global-trail {
    display: flex;
    align-items: center;
    gap: 6px;
}

.strategy-global-trail input {
    width: 112px;
    height: var(--strategy-control-height, 27px);
    min-height: var(--strategy-control-height, 27px);
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: #101828;
    padding: 0 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: var(--strategy-control-height, 27px);
    text-align: center;
    outline: none;
}

.strategy-global-trail input:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(132, 173, 255, 0.18);
}

.strategy-table-container {
    max-height: 360px;
    overflow: auto;
    scrollbar-color: #d0d5dd transparent;
    scrollbar-width: thin;
}

#active-strategies-table {
    min-width: 920px;
    table-layout: fixed;
    width: 100%;
}

#active-strategies-table th,
#active-strategies-table td {
    overflow: hidden;
    padding: 12px 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

#active-strategies-table th:nth-child(1),
#active-strategies-table td:nth-child(1) {
    width: 240px;
}

#active-strategies-table th:nth-child(2),
#active-strategies-table td:nth-child(2) {
    width: 120px;
}

#active-strategies-table th:nth-child(3),
#active-strategies-table td:nth-child(3) {
    width: 105px;
}

#active-strategies-table th:nth-child(4),
#active-strategies-table td:nth-child(4),
#active-strategies-table th:nth-child(5),
#active-strategies-table td:nth-child(5) {
    width: 105px;
}

#active-strategies-table th:nth-child(6),
#active-strategies-table td:nth-child(6),
#active-strategies-table th:nth-child(7),
#active-strategies-table td:nth-child(7) {
    width: 115px;
}

#active-strategies-table th:nth-child(8),
#active-strategies-table td:nth-child(8) {
    width: 230px;
}

#active-strategies-table th {
    top: 0;
    z-index: 6;
    background: #f8fafc;
    color: #475467;
    border-bottom: 1px solid #dfe3e8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

#active-strategies-table td {
    color: #344054;
    border-bottom-color: #eaecf0;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

#active-strategies-table tbody tr {
    position: relative;
    background: rgba(255, 255, 255, 0.84);
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

#active-strategies-table tbody tr.is-active {
    background: linear-gradient(90deg, rgba(236, 253, 243, 0.95), rgba(239, 248, 255, 0.72) 32%, #fff 72%);
    box-shadow: inset 3px 0 0 #12b76a;
}

#active-strategies-table tbody tr.is-active .strategy-symbol-cell {
    position: relative;
    padding-left: 22px;
}

#active-strategies-table tbody tr.is-active .strategy-symbol-cell::before {
    position: absolute;
    top: 50%;
    left: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #12b76a;
    box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.13);
    content: "";
    transform: translateY(-50%);
    animation: activeStrategyPulse 1.8s ease-in-out infinite;
}

#active-strategies-table tbody tr:not(.strategy-empty-row):hover {
    background: #f8fbff;
    box-shadow: inset 3px 0 0 var(--accent);
}

#active-strategies-table tbody tr.is-active:hover {
    background: linear-gradient(90deg, #e7f9ef, #edf6ff 38%, #f8fbff 78%);
    box-shadow: inset 3px 0 0 #0e9384;
}

#active-strategies-table .is-exited {
    background: #fcfcfd;
}

#active-strategies-table .is-rejected {
    background: #fffafa;
}

#active-strategies-table .is-pending {
    background: #fffcf5;
    box-shadow: inset 3px 0 0 #f79009;
}

#active-strategies-table .lots-cell {
    color: #101828;
    font-weight: 750;
    text-align: center;
}

@keyframes activeStrategyPulse {

    0%,
    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }

    50% {
        opacity: 0.55;
        transform: translateY(-50%) scale(0.8);
    }
}

.strategy-symbol-cell {
    min-width: 110px;
}

.strategy-symbol {
    position: relative;
    display: inline-flex;
    max-width: 230px;
    align-items: center;
    padding: 3px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #101828;
    font: inherit;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-align: left;
}

.strategy-symbol:hover,
.strategy-symbol:focus-visible,
.strategy-symbol.is-expanded {
    background: #eff4ff;
    color: #175cd3;
    outline: none;
}

.strategy-symbol-full {
    display: none;
}

.strategy-symbol:hover .strategy-symbol-short,
.strategy-symbol:focus-visible .strategy-symbol-short,
.strategy-symbol.is-expanded .strategy-symbol-short {
    display: none;
}

.strategy-symbol:hover .strategy-symbol-full,
.strategy-symbol:focus-visible .strategy-symbol-full,
.strategy-symbol.is-expanded .strategy-symbol-full {
    display: inline;
}

#active-strategies-table .is-exited .pnl-cell,
#active-strategies-table .is-exited .roi-cell {
    position: relative;
    padding-right: 20px;
}

#active-strategies-table .is-exited .pnl-cell::after,
#active-strategies-table .is-exited .roi-cell::after {
    position: absolute;
    right: 7px;
    color: #98a2b3;
    content: "•";
    font-size: 0.7rem;
}

.strategy-mode {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #fffaeb;
    color: #b54708;
    font-size: 0.62rem;
    font-weight: 700;
}

#active-strategies-table .badge {
    min-width: 30px;
    text-align: center;
    border-radius: 999px;
}

#active-strategies-table .pnl-cell,
#active-strategies-table .roi-cell {
    font-weight: 700;
}

.strategy-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.strategy-status::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-active {
    background: #ecfdf3;
    color: #027a48;
}

.status-closed {
    background: #fffaeb;
    color: #b54708;
}

.status-rejected {
    background: #fef3f2;
    color: #b42318;
}

.strategy-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 205px;
}

.strategy-action {
    height: var(--strategy-control-height, 27px);
    min-height: var(--strategy-control-height, 27px);
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: #344054;
    padding: 0 10px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: var(--strategy-control-height, 27px);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.strategy-action:hover {
    border-color: #84adff;
    background: #eff4ff;
    color: #175cd3;
}

.strategy-action-danger {
    border-color: #fecdca;
    color: #b42318;
}

.strategy-action-danger:hover {
    border-color: #f97066;
    background: #fef3f2;
    color: #b42318;
}

.strategy-empty-row td {
    padding: 42px 24px !important;
}

.strategy-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #667085;
    gap: 5px;
    text-align: center;
}

.strategy-empty-state strong {
    color: #344054;
    font-size: 0.85rem;
}

.strategy-empty-state span:last-child {
    font-size: 0.74rem;
    font-weight: 400;
}

.strategy-empty-icon {
    display: grid;
    width: 30px;
    height: 30px;
    margin-bottom: 3px;
    place-items: center;
    border-radius: 50%;
    background: #eff4ff;
    color: #175cd3;
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .strategy-selection-header {
        align-items: flex-start;
        padding: 18px;
    }

    .strategy-selection-header p {
        display: none;
    }

    .strategy-ticket-label {
        font-size: 0.64rem;
    }

    .strategy-form {
        padding: 14px;
    }

    .paper-mode-banner {
        margin: 14px 14px 0;
    }

    .strategy-table-header {
        align-items: flex-start;
        padding: 18px;
    }

    .strategy-global-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .strategy-table-header p {
        display: none;
    }
}

.icon-strategy:before {
    content: "🎯";
    margin-right: 10px;
}

/* ── Paper Trade Toggle (pill switch) ─────────────────────────── */
.paper-trade-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.pt-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
    white-space: nowrap;
}

.pt-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.pt-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.pt-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    transition: background 0.25s;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.pt-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.pt-switch input:checked+.pt-slider {
    background: #f59e0b;
    border-color: #d97706;
}

.pt-switch input:checked+.pt-slider::before {
    transform: translateX(20px);
    background: #fff;
}

.pt-state {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #aaa);
    min-width: 24px;
    transition: color 0.25s;
}

.pt-state.on {
    color: #f59e0b;
}

/* ── Paper Mode Active Banner ─────────────────────────────────── */
.paper-mode-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 20px 0;
    padding: 11px 14px;
    background: #fffaeb;
    border: 1px solid #fedf89;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #93370d;
    animation: none;
}

.paper-mode-banner strong {
    color: #7a2e0e;
    margin-right: 4px;
}

.paper-mode-icon {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: #f79009;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
}

@keyframes paperPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.75;
    }
}

/* Paper badge in order history table */
.badge-paper-trade {
    display: inline-block;
    padding: 2px 7px;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
    letter-spacing: 0.03em;
}

/* NBS UI (Excel style) */
/* =========================================================
   NBS PANEL — NO HORIZONTAL SCROLL
   FULL ROW VISIBLE IN SINGLE SCREEN
========================================================= */

#nbs-tab {
    width: 100%;
    overflow: visible;
    margin-top: 0;
    align-self: stretch;
}

/* =========================================================
   CARD
========================================================= */

#nbs-tab .card {
    width: 100%;
    padding: 4px;
    border-radius: 10px;
    overflow: visible;
    margin-top: 0;
}

/* =========================================================
   HEADER
========================================================= */

#nbs-tab .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

#nbs-tab .card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

#nbs-tab .card-header .btn {
    height: 22px;
    padding: 0 8px;
    font-size: 10px;
    border-radius: 5px;
}

/* =========================================================
   TABLE WRAPPER
========================================================= */

.nbs-grid-wrap {
    width: 100%;
    overflow-x: auto !important;
    margin-bottom: 12px;
}

/* =========================================================
   MAIN TABLE
========================================================= */

#nbs-config-table {
    width: 100%;
    min-width: 1250px;
    table-layout: fixed;
    border-collapse: collapse;
}

/* =========================================================
   HEADER
========================================================= */

#nbs-config-table th {
    padding: 6px 4px;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #cbd5e1;
}

/* =========================================================
   TD
========================================================= */

#nbs-config-table td {
    padding: 4px 3px;
    vertical-align: middle;
    white-space: nowrap;
}

/* =========================================================
   INPUTS
========================================================= */

#nbs-config-table input,
#nbs-config-table select {
    width: 100%;
    min-width: 100%;
    max-width: 100%;

    height: 28px;

    padding: 0 6px;

    font-size: 11px;
    line-height: 1.2;

    border-radius: 4px;
    box-sizing: border-box;
}

/* =========================================================
   YELLOW INPUT
========================================================= */

.nbs-input-yellow {
    background: #fff45c;
    border: 1px solid #9a8f28;
    color: #111827;
    font-weight: 600;
}

/* =========================================================
   READONLY
========================================================= */

.nbs-input-readonly {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #111827;
    font-weight: 700;
}

/* =========================================================
   LIVE LTP
========================================================= */

.nbs-live-ltp {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    font-weight: 700;
}

/* =========================================================
   COLUMN WIDTHS
========================================================= */

#nbs-config-table th:nth-child(1),
#nbs-config-table td:nth-child(1) {
    width: 7%;
}

#nbs-config-table th:nth-child(2),
#nbs-config-table td:nth-child(2) {
    width: 7%;
}

#nbs-config-table th:nth-child(3),
#nbs-config-table td:nth-child(3) {
    width: 5%;
}

#nbs-config-table th:nth-child(4),
#nbs-config-table td:nth-child(4) {
    width: 5%;
}

#nbs-config-table th:nth-child(5),
#nbs-config-table td:nth-child(5) {
    width: 4%;
}

#nbs-config-table th:nth-child(6),
#nbs-config-table td:nth-child(6) {
    width: 4%;
}

#nbs-config-table th:nth-child(7),
#nbs-config-table td:nth-child(7) {
    width: 7%;
}

#nbs-config-table th:nth-child(8),
#nbs-config-table td:nth-child(8) {
    width: 4%;
}

#nbs-config-table th:nth-child(9),
#nbs-config-table td:nth-child(9) {
    width: 7%;
}

#nbs-config-table th:nth-child(10),
#nbs-config-table td:nth-child(10) {
    width: 7%;
}

#nbs-config-table th:nth-child(11),
#nbs-config-table td:nth-child(11) {
    width: 6%;
}

#nbs-config-table th:nth-child(12),
#nbs-config-table td:nth-child(12) {
    width: 12%;
}

#nbs-config-table th:nth-child(13),
#nbs-config-table td:nth-child(13) {
    width: 5%;
}

#nbs-config-table th:nth-child(14),
#nbs-config-table td:nth-child(14) {
    width: 5%;
}

#nbs-config-table th:nth-child(15),
#nbs-config-table td:nth-child(15) {
    width: 5%;
}

#nbs-config-table th:nth-child(16),
#nbs-config-table td:nth-child(16) {
    width: 10%;
}

/* =========================================================
   MODE MULTI SELECT
========================================================= */

.nbs-mode {
    height: 28px !important;
    font-size: 10px !important;
    padding: 2px !important;
}

/* =========================================================
   IMMEDIATE ENTRY BUTTONS
========================================================= */

.nbs-action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    width: 100%;
}

.nbs-btn-buy,
.nbs-btn-sell,
.nbs-btn-close {
    height: 26px;
    padding: 0 4px;
    font-size: 10px;
    border-radius: 4px;
    line-height: 1;
    min-width: auto;
}

.nbs-btn-buy {
    background: #dcfce7;
    color: #166534;
}

.nbs-btn-sell {
    background: #fee2e2;
    color: #991b1b;
}

.nbs-btn-close {
    background: #e2e8f0;
    color: #334155;
}

/* =========================================================
   SECTION TITLES
========================================================= */

.nbs-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    border-left: 3px solid var(--primary);
    padding-left: 8px;
}

/* =========================================================
   ACTIVE BUTTON
========================================================= */

.nbs-entry-active {
    outline: 1px solid #0ea5e9;
}

/* =========================================================
   SUMMARY SECTION
========================================================= */

.nbs-bottom-summary-wrap,
.nbs-bottom-grid-wrap {
    margin-top: 6px;
    overflow-x: auto;
}

.nbs-bottom-summary-table,
#nbs-bottom-table {
    width: 100%;
    border-collapse: collapse;
}

.nbs-bottom-summary-table th,
.nbs-bottom-summary-table td,
#nbs-bottom-table th,
#nbs-bottom-table td {
    padding: 2px;
    font-size: 9px;
    white-space: nowrap;
}

.nbs-bottom-summary-table input,
#nbs-bottom-table input {
    height: 18px;
    font-size: 9px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media(max-width:1600px) {

    #nbs-config-table th {
        font-size: 10px;
    }

    #nbs-config-table input,
    #nbs-config-table select {
        font-size: 10px;
        height: 24px;
    }

    .nbs-mode {
        height: 24px !important;
        font-size: 9px !important;
    }

    .nbs-btn-buy,
    .nbs-btn-sell,
    .nbs-btn-close {
        font-size: 9px;
        height: 22px;
    }
}

/* Charts Dashboard Styles */
.charts-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    margin-top: 0;
}

/* Chart-only dark mode */
.charts-dashboard.chart-dark-mode {
    --card-bg: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-light: #334155;
    color: #cbd5e1;
    background: #0b1220;
}

.charts-dashboard.chart-dark-mode #trading-chart,
.charts-dashboard.chart-dark-mode .multi-chart-canvas,
.charts-dashboard.chart-dark-mode .chart-indicator-panel-wrap,
.charts-dashboard.chart-dark-mode .chart-layout-stage {
    background: #0f172a !important;
}

.charts-dashboard.chart-dark-mode .charts-control-card,
.charts-dashboard.chart-dark-mode .chart-container-card,
.charts-dashboard.chart-dark-mode .chart-option-chain-card,
.charts-dashboard.chart-dark-mode .chart-active-strategies-panel,
.charts-dashboard.chart-dark-mode .indicators-panel,
.charts-dashboard.chart-dark-mode .market-depth-panel,
.charts-dashboard.chart-dark-mode .primary-chart-pane,
.charts-dashboard.chart-dark-mode .multi-chart-pane {
    border-color: #263247;
    background: #111827;
    color: #cbd5e1;
}

.charts-dashboard.chart-dark-mode .chart-select,
.charts-dashboard.chart-dark-mode .chart-date-range-trigger,
.charts-dashboard.chart-dark-mode .chart-layout-trigger,
.charts-dashboard.chart-dark-mode .chart-panel-toggle,
.charts-dashboard.chart-dark-mode .chart-type-btn,
.charts-dashboard.chart-dark-mode .chart-calendar-nav,
.charts-dashboard.chart-dark-mode .chart-active-strategies-close {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .chart-select option {
    background: #172033;
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .control-group label,
.charts-dashboard.chart-dark-mode .chart-workspace-meta,
.charts-dashboard.chart-dark-mode .option-chain-status,
.charts-dashboard.chart-dark-mode .chart-active-strategies-header p {
    color: #94a3b8;
}

.charts-dashboard.chart-dark-mode .chart-tool-rail {
    border-color: #263247;
    background: #111827;
}

.charts-dashboard.chart-dark-mode .chart-left-tools,
.charts-dashboard.chart-dark-mode .chart-right-tools {
    border-color: #263247;
    background: #0f172a;
}

.charts-dashboard.chart-dark-mode .chart-type-menu,
.charts-dashboard.chart-dark-mode .chart-draw-menu-panel,
.charts-dashboard.chart-dark-mode .chart-date-range-popover,
.charts-dashboard.chart-dark-mode .chart-layout-menu {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
}

.charts-dashboard.chart-dark-mode .chart-layout-menu button {
    border-color: #334155;
    color: #cbd5e1;
}

.charts-dashboard.chart-dark-mode .chart-layout-menu button:hover,
.charts-dashboard.chart-dark-mode .chart-layout-menu button.active {
    background: #24324a;
    color: #93c5fd;
}

.charts-dashboard.chart-dark-mode .chart-ohlc-readout,
.charts-dashboard.chart-dark-mode .multi-chart-ohlc-readout,
.charts-dashboard.chart-dark-mode .multi-chart-header {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.92);
    color: #cbd5e1;
}

.charts-dashboard.chart-dark-mode .chart-ohlc-readout .ohlc-symbol,
.charts-dashboard.chart-dark-mode .chart-ohlc-readout .ohlc-time,
.charts-dashboard.chart-dark-mode .multi-chart-ohlc-readout .ohlc-symbol,
.charts-dashboard.chart-dark-mode .multi-chart-ohlc-readout .ohlc-time {
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .chart-ohlc-readout .ohlc-up,
.charts-dashboard.chart-dark-mode .multi-chart-ohlc-readout .ohlc-up {
    color: #4caf50;
}

.charts-dashboard.chart-dark-mode .chart-ohlc-readout .ohlc-down,
.charts-dashboard.chart-dark-mode .multi-chart-ohlc-readout .ohlc-down {
    color: #ff5252;
}

.charts-dashboard.chart-dark-mode .chart-layout-stage:not(.layout-1) .chart-pane-shell.chart-pane-selected {
    background-color: #111827;
}

.charts-dashboard.chart-dark-mode .chart-risk-summary-panel {
    border-color: #263247;
    background: #111827;
    color: #cbd5e1;
}

.charts-dashboard.chart-dark-mode .chart-risk-summary-value {
    border-color: #334155;
    background: #172033;
}

.charts-dashboard.chart-dark-mode .chart-risk-summary-header span {
    color: #94a3b8;
}

.charts-dashboard.chart-dark-mode .chart-active-strategies-header,
.charts-dashboard.chart-dark-mode .option-chain-header {
    border-color: #263247;
    background: linear-gradient(90deg, #172033, #111827);
}

.charts-dashboard.chart-dark-mode .chart-active-strategies-header h3,
.charts-dashboard.chart-dark-mode .option-chain-header h3,
.charts-dashboard.chart-dark-mode .multi-chart-title {
    color: #f8fafc;
}

.charts-dashboard.chart-dark-mode #chart-active-strategies-table th,
.charts-dashboard.chart-dark-mode .chart-option-chain-table th {
    border-color: #334155;
    background: #172033;
    color: #94a3b8;
}

.charts-dashboard.chart-dark-mode #chart-active-strategies-table td,
.charts-dashboard.chart-dark-mode .chart-option-chain-table td {
    border-color: #263247;
    background: #111827;
    color: #cbd5e1;
}

.charts-dashboard.chart-dark-mode .chart-panel-toggle[aria-pressed="true"],
.charts-dashboard.chart-dark-mode .option-aio-btn[aria-pressed="true"],
.charts-dashboard.chart-dark-mode .chart-dark-mode-toggle.active {
    border-color: #60a5fa;
    background: #2563eb;
    color: #fff;
}

.chart-dark-mode-toggle {
    min-width: 38px;
    font-size: 1rem;
    font-weight: 900;
}

.chart-controls-launcher {
    display: flex;
    justify-content: flex-end;
}

.chart-controls-toggle {
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 800;
}

.chart-controls-toggle[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.charts-control-card {
    position: relative;
    z-index: 30;
    padding: 16px 18px 18px;
    margin-top: 0;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    overflow: visible;
}

.charts-control-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
}

.charts-control-card .card-header {
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding: 4px 0 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.chart-workspace-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-workspace-mark {
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 1px solid #b2ddff;
    border-radius: 8px;
    background: #eff8ff;
}

.chart-workspace-mark span {
    width: 4px;
    border-radius: 2px 2px 0 0;
    background: #1570ef;
}

.chart-workspace-mark span:nth-child(1) {
    height: 8px;
}

.chart-workspace-mark span:nth-child(2) {
    height: 16px;
}

.chart-workspace-mark span:nth-child(3) {
    height: 12px;
}

.charts-control-card .card-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0;
}

.chart-workspace-meta {
    display: block;
    margin-top: 2px;
    color: #667085;
    font-size: 0.68rem;
    font-weight: 650;
}

.chart-type-buttons {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f2f4f7;
}

.chart-type-btn {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 850;
    transition: all 0.2s;
}

.chart-type-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 5px rgba(46, 144, 250, 0.22);
}

.chart-controls {
    display: grid;
    grid-template-columns: minmax(200px, 1.05fr) minmax(105px, 0.5fr) minmax(300px, 1.55fr) minmax(175px, 0.9fr) minmax(120px, 0.58fr) minmax(390px, auto);
    gap: 12px 14px;
    align-items: end;
    margin-top: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

.control-group label {
    font-size: 0.68rem;
    font-weight: 850;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.chart-select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.chart-select:hover {
    border-color: rgba(46, 144, 250, 0.45);
}

.chart-select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.chart-interval-group {
    min-width: 110px;
}

.chart-compact-select,
.chart-indicator-select {
    cursor: pointer;
    background-color: #fff;
}

.chart-date-range-group {
    min-width: 44px;
    align-self: end;
}

.chart-date-range {
    position: relative;
    width: 44px;
}

.chart-date-range-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.chart-date-range-trigger:hover,
.chart-date-range-trigger[aria-expanded="true"] {
    border-color: #2e90fa;
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.chart-date-range-icon {
    position: relative;
    width: 15px;
    height: 14px;
    margin-left: 0;
    border: 1.6px solid #475467;
    border-radius: 3px;
    flex: 0 0 auto;
}

.chart-date-range-icon::before {
    content: '';
    position: absolute;
    left: -1.6px;
    right: -1.6px;
    top: 3px;
    border-top: 1.6px solid #475467;
}

.chart-date-range-icon::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 3px;
    left: 2.4px;
    top: -3px;
    border-left: 1.6px solid #475467;
    border-right: 1.6px solid #475467;
}

.chart-date-range-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1200;
    width: 300px;
    padding: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 36px rgba(16, 24, 40, 0.18);
}

.chart-calendar-header {
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    align-items: center;
    margin-bottom: 10px;
    text-align: center;
}

.chart-calendar-header strong {
    color: #101828;
    font-size: 0.86rem;
    font-weight: 800;
}

.chart-calendar-nav {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #344054;
    font-size: 1.25rem;
    cursor: pointer;
}

.chart-calendar-nav:hover:not(:disabled) {
    border-color: #d0d5dd;
    background: #f2f4f7;
}

.chart-calendar-nav:disabled {
    color: #d0d5dd;
    cursor: not-allowed;
}

.chart-calendar-weekdays,
.chart-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.chart-calendar-weekdays {
    margin-bottom: 4px;
    color: #667085;
    font-size: 0.62rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.chart-calendar-weekdays span {
    padding: 4px 0;
}

.chart-calendar-day,
.chart-calendar-day-spacer {
    width: 100%;
    aspect-ratio: 1;
}

.chart-calendar-day {
    position: relative;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #344054;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.chart-calendar-day:hover:not(:disabled) {
    background: #eff8ff;
    color: #175cd3;
}

.chart-calendar-day.is-in-range {
    background: #eff8ff;
    color: #175cd3;
}

.chart-calendar-day.is-range-start,
.chart-calendar-day.is-range-end {
    border-radius: 7px;
    background: #2e90fa;
    color: #fff;
}

.chart-calendar-day.is-pending {
    box-shadow: inset 0 0 0 2px #1570ef;
}

.chart-calendar-day.is-today:not(.is-range-start):not(.is-range-end)::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #1570ef;
    transform: translateX(-50%);
}

.chart-calendar-day:disabled {
    color: #d0d5dd;
    cursor: not-allowed;
}

.chart-calendar-hint {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid #eaecf0;
    color: #667085;
    font-size: 0.65rem;
    font-weight: 650;
    text-align: center;
}

.chart-quick-filters {
    display: flex;
    gap: 6px;
    min-height: 38px;
    align-items: center;
}

.chart-range-btn {
    min-width: 42px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    font-size: 0.75rem;
}

.chart-range-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.chart-layout-group {
    min-width: 54px;
    align-self: end;
}

.chart-layout-select {
    min-width: 108px;
}

.chart-layout-picker {
    position: relative;
    width: 54px;
}

.chart-layout-trigger {
    display: flex;
    width: 54px;
    height: 36px;
    padding: 0 10px;
    align-items: center;
    gap: 7px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
}

.chart-layout-trigger.active,
.chart-layout-trigger:hover {
    border-color: var(--accent);
}

.chart-layout-caret {
    margin-left: auto;
    color: #667085;
    font-size: 0.9rem;
}

.chart-layout-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100;
    width: 58px;
    padding: 5px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(16, 24, 40, 0.18);
}

.chart-layout-menu.hidden {
    display: none;
}

.chart-layout-menu button {
    display: flex;
    width: 100%;
    min-height: 46px;
    padding: 7px 9px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-bottom: 1px solid #eaecf0;
    border-radius: 5px;
    background: transparent;
    color: #344054;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 750;
}

.chart-layout-menu button:last-child {
    border-bottom: 0;
}

.chart-layout-menu button:hover,
.chart-layout-menu button.active {
    background: #eff8ff;
    color: #175cd3;
}

.chart-layout-menu .layout-icon {
    width: 24px;
    height: 20px;
}

.chart-layout-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
}

.chart-layout-btn {
    width: 36px;
    height: 34px;
    min-width: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    color: var(--text-primary);
}

.chart-layout-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.layout-icon {
    width: 18px;
    height: 16px;
    display: block;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    position: relative;
}

.layout-icon-2::before {
    content: "";
    position: absolute;
    top: -1.5px;
    bottom: -1.5px;
    left: 50%;
    border-left: 1.5px solid currentColor;
}

.layout-icon-3::before {
    content: "";
    position: absolute;
    top: -1.5px;
    bottom: -1.5px;
    left: 56%;
    border-left: 1.5px solid currentColor;
}

.layout-icon-3::after {
    content: "";
    position: absolute;
    left: 56%;
    right: -1.5px;
    top: 50%;
    border-top: 1.5px solid currentColor;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 0 18px;
    height: 40px;
}

.btn-primary:hover {
    background: #1e4bd2;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.chart-action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 40px;
    padding: 7px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.028);
}

.chart-panel-toggle {
    min-width: 46px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chart-draw-menu {
    position: relative;
}

.chart-draw-star {
    min-width: 34px;
    width: 34px;
    padding: 0;
    font-size: 1rem;
    color: var(--accent);
}

.chart-draw-star.drawing-tool-exit {
    border-color: #f04438;
    background: #fff1f0;
    color: #d92d20;
    font-size: 1.25rem;
    line-height: 1;
}

.charts-dashboard.chart-dark-mode .chart-draw-star.drawing-tool-exit {
    border-color: #f97066;
    background: #3b171c;
    color: #fda29b;
}

.chart-draw-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(2, minmax(84px, 1fr));
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    min-width: 190px;
}

.chart-draw-menu-panel .chart-panel-toggle {
    justify-content: center;
    min-width: 84px;
    height: 34px;
}

/* Trading workspace layout */
.charts-control-card {
    padding: 2px 7px;
    border-color: #e4e7ec;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
}

.charts-control-card::before {
    display: none;
}

.charts-control-card .card-header {
    display: none;
}

.chart-workspace-mark {
    width: 30px;
    height: 30px;
    padding: 6px;
    border-radius: 6px;
}

.charts-control-card .card-header h3 {
    font-size: 0.9rem;
}

.chart-workspace-meta {
    font-size: 0.62rem;
}

.chart-type-buttons {
    padding: 3px;
    border-radius: 6px;
}

.chart-type-btn {
    height: 30px;
    padding: 0 12px;
    border-radius: 5px;
    font-size: 0.72rem;
}

.chart-controls {
    grid-template-columns: minmax(180px, 300px) 72px 44px 44px 54px max-content minmax(230px, 1fr);
    gap: 8px;
    min-width: 850px;
    align-items: end;
}

.chart-controls .chart-date-range-group {
    min-width: 0;
}

.chart-controls .control-group {
    gap: 3px;
}

.chart-controls .control-group label {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
}

.chart-controls .chart-select {
    height: 36px;
    border-color: #d0d5dd;
    border-radius: 6px;
    box-shadow: none;
    font-size: 0.76rem;
}

.chart-controls .chart-interval-group {
    min-width: 72px;
    justify-content: flex-end;
    position: relative;
}

.chart-controls #chart-interval,
.chart-controls .chart-custom-interval {
    width: 72px;
    height: 36px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
}

.chart-controls #chart-interval {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    text-align-last: center;
}

.chart-controls #chart-interval:hover,
.chart-controls #chart-interval:focus,
.chart-controls .chart-custom-interval:hover,
.chart-controls .chart-custom-interval:focus {
    border: 0;
    outline: none;
    background: rgba(46, 144, 250, 0.08);
    box-shadow: none;
}

.chart-controls .chart-custom-interval {
    text-transform: uppercase;
}

.chart-indicators-group {
    min-width: 44px;
    justify-content: flex-end;
}

.chart-indicator-native {
    display: none;
}

.chart-indicator-picker {
    position: relative;
    width: 44px;
}

.chart-indicator-trigger {
    display: inline-flex;
    width: 44px;
    height: 36px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.chart-indicator-trigger:hover,
.chart-indicator-trigger:focus-visible,
.chart-indicator-trigger.active {
    background: rgba(46, 144, 250, 0.1);
    color: var(--accent);
    outline: none;
}

.chart-indicator-trigger svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.chart-indicator-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    z-index: 80;
    width: 220px;
    max-height: 330px;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
}

.chart-indicator-menu button {
    display: flex;
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: left;
}

.chart-indicator-menu button::before {
    content: '';
    width: 14px;
    height: 9px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid transparent;
    border-radius: 50%;
    opacity: 0.65;
    transform: skewY(-22deg);
}

.chart-indicator-menu button:hover,
.chart-indicator-menu button.active {
    background: rgba(46, 144, 250, 0.1);
    color: var(--accent);
}

.chart-controls .chart-date-range {
    width: 44px;
}

.chart-controls .chart-date-range-trigger {
    width: 44px;
    height: 36px;
    border-color: #d0d5dd;
    border-radius: 6px;
    font-size: 0.76rem;
}

.chart-layout-buttons {
    min-height: 36px;
    gap: 4px;
}

.chart-layout-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 6px;
}

.chart-action-group {
    min-height: 36px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.chart-action-group .chart-panel-toggle,
.chart-action-group .btn-primary {
    height: 36px;
}

.chart-action-group .btn-primary {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
}

.chart-replay-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.chart-replay-controls.hidden {
    display: none !important;
}

.chart-replay-speed {
    width: 70px;
    min-width: 70px;
    height: 36px;
    padding: 0 24px 0 10px;
    font-size: 0.78rem;
    font-weight: 800;
}

.chart-replay-btn {
    min-width: 38px;
    width: 38px;
    padding: 0;
    font-size: 0.82rem;
}

.chart-replay-status {
    display: none;
}

.charts-dashboard .chart-container-card {
    padding: 8px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: #fff;
    box-shadow: none;
    overflow: visible;
}

.chart-tool-rail {
    position: relative;
    inset: auto;
    z-index: 18;
    display: flex;
    width: 100%;
    min-height: 38px;
    margin-bottom: 6px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    padding: 0 0 6px;
    border-right: 0;
    border-bottom: 1px solid #eaecf0;
}

.chart-tool-rail[hidden],
.chart-container-card > .chart-tool-rail[hidden] {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.chart-tool-rail.chart-tool-rail-inline {
    width: auto;
    min-width: 0;
    min-height: 36px;
    margin: 0;
    padding: 0;
    flex: 0 1 auto;
    flex-wrap: nowrap;
    gap: 5px;
    overflow: visible;
    border: 0;
    background: transparent;
}

.chart-tool-rail-inline .chart-type-rail-menu > .chart-panel-toggle {
    min-width: 36px;
    width: 36px;
    height: 32px;
    padding: 0;
}

.chart-type-rail-menu {
    position: relative;
}

.chart-candle-type-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chart-candle-icon {
    width: 18px;
    height: 18px;
    color: currentColor;
}

.chart-candle-icon path,
.chart-candle-icon rect {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-type-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 90;
    width: 142px;
    padding: 6px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.16);
}

.chart-type-menu.hidden {
    display: none;
}

.chart-type-menu .chart-type-buttons {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
}

.chart-type-menu .chart-type-btn {
    width: 100%;
    height: 32px;
    justify-content: flex-start;
    text-align: left;
}

.chart-tool-rail>.chart-panel-toggle,
.chart-tool-rail .chart-draw-star {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border-color: #d0d5dd;
    border-radius: 6px;
}

.chart-tool-rail>.option-aio-btn {
    font-size: 0.58rem;
    font-weight: 900;
}

.chart-tool-rail .chart-draw-menu-panel {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
}

.chart-container-card #trading-chart {
    border-radius: 0;
}

.chart-option-modal-open {
    overflow: hidden;
}

.chart-option-chain-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    padding: 28px;
    align-items: center;
    justify-content: center;
}

.chart-option-chain-modal.hidden {
    display: none;
}

.chart-option-chain-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(2px);
    cursor: default;
}

.chart-option-chain-card {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(920px, calc(100vw - 56px));
    height: min(720px, calc(100dvh - 56px));
    max-height: 720px;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--card-bg, #fff);
    box-shadow: 0 28px 80px rgba(2, 6, 23, 0.42);
}

.option-chain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 8px;
}

.option-chain-header h3 {
    margin: 0 0 3px;
    font-size: 1rem;
}

.option-chain-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-chain-close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.7rem;
    line-height: 1;
}

.option-chain-close:hover,
.option-chain-close:focus-visible {
    background: rgba(148, 163, 184, 0.16);
    color: var(--text-primary);
    outline: none;
}

.option-chain-status {
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.chart-panel-toggle[aria-pressed="true"],
.option-aio-btn[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.chart-market-trade-box {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 100%;
    margin: 2px 0 3px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: visible;
}

.chart-market-trade-box.hidden {
    display: none;
}

.chart-market-trade-body {
    padding: 3px 6px 4px;
    overflow-x: auto;
    overflow-y: visible;
}

.chart-market-trade-form {
    --strategy-row-columns: 95px 76px 90px 58px 80px 72px 92px 78px 92px 78px 132px 60px 78px 56px 250px;
    min-width: 1480px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 0.74rem;
}

.chart-market-trade-form #chart-market-trade-row {
    display: block;
}

.chart-market-trade-form .sf-row {
    margin: 0;
    gap: 4px;
    min-width: 1480px;
    padding: 1px 4px;
    border-radius: 7px;
    box-shadow: none;
}

.chart-market-trade-form .sf-row-controls {
    display: none !important;
}

.chart-market-trade-form .strategy-form-header,
.chart-market-trade-form .sf-row {
    column-gap: 4px;
}

.chart-market-trade-form .strategy-form-header {
    min-width: 1480px;
    padding: 0 4px;
}

.chart-market-trade-form .strategy-form-header {
    margin-bottom: 1px;
}

.chart-market-trade-form .strategy-form-header span {
    font-size: 0.6rem;
    line-height: 1;
}

.chart-market-trade-form .sf-group {
    gap: 2px;
}

.chart-market-trade-form .strategy-builder-sl-control {
    grid-template-columns: minmax(66px, 1fr) 60px;
}

.chart-market-trade-form .sf-group label,
.chart-market-trade-form .sf-actions-label {
    display: none;
}

.chart-market-trade-form input,
.chart-market-trade-form select,
.chart-market-trade-form .sf-symbol-input,
.chart-market-trade-form .sf-btn {
    min-height: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 0.74rem;
    padding: 2px 6px;
}

.chart-market-trade-form .strat-strike-type {
    display: block !important;
}

.chart-market-trade-form .sf-order-buttons {
    gap: 4px;
}

.chart-market-trade-form .sf-order-buttons .sf-btn {
    min-width: 34px;
    padding-inline: 6px;
}

.chart-market-trade-form .strat-symbol-search.fixed-underlying {
    cursor: default;
}

.charts-dashboard.chart-dark-mode .chart-market-trade-box {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.94);
    color: #cbd5e1;
}

.chart-risk-summary-panel {
    padding: 0 5px 5px;
    border: 1px solid #e4e7ec;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
    overflow: hidden;
}

.chart-risk-summary-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-top: 1px;
}

.chart-risk-summary-header,
.chart-risk-summary-values {
    display: grid;
    grid-template-columns: repeat(15, minmax(78px, 1fr));
    gap: 4px;
    min-width: 1200px;
}

.chart-risk-summary-header {
    align-items: end;
    padding: 0 0 1px;
}

.chart-risk-summary-header span {
    color: #667085;
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.chart-risk-summary-value {
    display: flex;
    height: 32px;
    min-height: 32px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    text-align: center;
}

.chart-risk-summary-value strong {
    color: #101828;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.chart-risk-summary-input {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: #101828;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.chart-risk-summary-input:focus {
    color: #175cd3;
}

.chart-risk-summary-value strong.up,
.chart-risk-summary-value .up {
    color: #16a34a;
}

.chart-risk-summary-value strong.down,
.chart-risk-summary-value .down {
    color: #ef4444;
}

.chart-risk-summary-header .chart-risk-ce {
    color: #15803d;
}

.chart-risk-summary-header .chart-risk-pe {
    color: #dc2626;
}

.chart-risk-summary-value.chart-risk-ce {
    border-color: #86efac;
    background: #dcfce7;
}

.chart-risk-summary-value.chart-risk-pe {
    border-color: #fecaca;
    background: #fee2e2;
}

.chart-risk-summary-value.chart-risk-pe strong,
.chart-risk-summary-value.chart-risk-pe .up,
.chart-risk-summary-value.chart-risk-pe .down {
    color: #991b1b !important;
}

.chart-risk-summary-value.chart-risk-ce strong,
.chart-risk-summary-value.chart-risk-ce .up,
.chart-risk-summary-value.chart-risk-ce .down {
    color: #14532d !important;
}

.chart-active-strategies-toggle {
    position: relative;
    min-width: 48px;
    font-weight: 900;
}

.chart-as-count {
    display: inline-flex;
    min-width: 17px;
    height: 17px;
    margin-left: 5px;
    padding: 0 4px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eaf2ff;
    color: #175cd3;
    font-size: 0.62rem;
    line-height: 1;
}

.chart-active-strategies-toggle[aria-pressed="true"] .chart-as-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.chart-active-strategies-panel {
    position: relative;
    z-index: 20;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
    flex-direction: column;
    overflow: hidden;
    align-self: stretch;
    border: 1px solid #d0d5dd;
    border-radius: 0 7px 7px 0;
    background: #fff;
    box-shadow: -8px 0 18px rgba(16, 24, 40, 0.08);
}

.chart-active-strategies-panel.hidden {
    display: none;
}

.chart-container-card.chart-as-sidebar-open {
    grid-template-columns: 34px minmax(0, 1fr) clamp(360px, 29vw, 520px) 34px;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}

.chart-container-card.chart-as-sidebar-open > .chart-tool-rail {
    grid-column: 1 / -1;
    grid-row: 1;
}

.chart-container-card.chart-as-sidebar-open > #chart-layout-stage {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
}

.chart-container-card.chart-as-sidebar-open > #chart-active-strategies-panel {
    grid-column: 3;
    grid-row: 2;
}

.chart-container-card.chart-as-sidebar-open > .chart-right-tools {
    grid-column: 4;
    grid-row: 2;
}

@media (max-width: 1180px) {
    .chart-container-card.chart-as-sidebar-open {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        grid-template-rows: auto minmax(420px, 1fr) minmax(220px, 38vh);
    }

    .chart-container-card.chart-as-sidebar-open > #chart-layout-stage {
        grid-column: 2;
        grid-row: 2;
    }

    .chart-container-card.chart-as-sidebar-open > #chart-active-strategies-panel {
        grid-column: 1 / -1;
        grid-row: 3;
        border-radius: 7px;
    }

    .chart-container-card.chart-as-sidebar-open > .chart-right-tools {
        grid-column: 3;
        grid-row: 2;
    }
}

.chart-active-strategies-header {
    display: flex;
    min-height: 24px;
    padding: 0 6px;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    border-bottom: 1px solid #eaecf0;
    background: linear-gradient(90deg, #eff8ff, #fff);
}

.chart-active-strategies-ea {
    height: 24px;
    min-width: 34px;
    border: 1px solid #f97316;
    border-radius: 6px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.chart-active-strategies-ea:hover {
    background: #ffedd5;
    border-color: #ea580c;
}

.chart-active-strategies-count {
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font-size: 0.72rem;
    font-weight: 800;
}

.chart-active-strategies-delete {
    width: 24px;
    height: 24px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fff5f5;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1;
}

.chart-active-strategies-delete:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
}

.chart-active-strategies-delete:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.chart-active-strategies-header h3 {
    margin: 0;
    color: #101828;
    font-size: 0.92rem;
}

.chart-active-strategies-header p {
    margin: 2px 0 0;
    color: #667085;
    font-size: 0.68rem;
}

.chart-active-strategies-close {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #667085;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.chart-active-strategies-close:hover {
    background: #f2f4f7;
    color: #101828;
}

.chart-active-strategies-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: scroll;
}

#chart-active-strategies-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: auto;
}

#chart-active-strategies-table th,
#chart-active-strategies-table td {
    padding: 0;
    overflow: hidden;
    border-bottom: 0;
    text-overflow: ellipsis;
    white-space: normal;
    font-size: 0.64rem;
    font-variant-numeric: tabular-nums;
}

#chart-active-strategies-table thead {
    display: none;
}

#chart-active-strategies-table tbody tr {
    height: auto;
}

#chart-active-strategies-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475467;
    font-size: 0.55rem;
    letter-spacing: 0.035em;
    text-align: left;
    text-transform: uppercase;
}

#chart-active-strategies-table .chart-as-card-cell {
    padding: 0;
}

#chart-active-strategies-table tbody tr.is-active {
    background: transparent;
    box-shadow: none;
}

#chart-active-strategies-table .strategy-mode {
    margin-top: 0;
}

#chart-active-strategies-table .strategy-mode-live {
    background: #ecfdf3;
    color: #027a48;
}

#chart-active-strategies-table .pnl-cell,
#chart-active-strategies-table .roi-cell {
    font-weight: 800;
}

#chart-active-strategies-table .strategy-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
}

#chart-active-strategies-table .strategy-action {
    height: 23px;
    min-height: 23px;
    min-width: 0;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 0.62rem;
    line-height: 23px;
}

#chart-active-strategies-table .strategy-symbol-cell {
    min-width: 0;
}

#chart-active-strategies-table .strategy-symbol {
    max-width: 100%;
    padding: 0;
    border-radius: 4px;
    font-size: 0.78rem;
}

#chart-active-strategies-table .strategy-symbol:hover,
#chart-active-strategies-table .strategy-symbol:focus-visible,
#chart-active-strategies-table .strategy-symbol.is-expanded {
    background: transparent;
}

.chart-as-card {
    margin: 0 0 7px;
    padding: 8px 9px;
    border-left: 3px solid #12b76a;
    border-bottom: 1px solid #eaecf0;
    background: linear-gradient(90deg, rgba(236, 253, 243, 0.9), #fff 55%);
}

.chart-as-card-top {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chart-as-card-top .strategy-symbol-cell {
    flex: 1 1 auto;
}

.chart-as-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 7px;
}

.chart-as-metric {
    min-width: 0;
    padding: 5px 6px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.76);
}

.chart-as-metric span {
    display: block;
    margin-bottom: 2px;
    color: #667085;
    font-size: 0.54rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.chart-as-sl-mode-select {
    width: 54px;
    height: 20px;
    padding: 0 4px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    background: #fff;
    color: #475467;
    font: inherit;
    font-size: 0.58rem;
    font-weight: 850;
    line-height: 18px;
    outline: none;
    text-transform: uppercase;
}

.chart-as-sl-mode-select:hover,
.chart-as-sl-mode-select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 2px rgba(46, 144, 250, 0.1);
}

.chart-as-metric strong {
    display: block;
    overflow: hidden;
    color: #344054;
    font-size: 0.68rem;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-as-metric.up strong,
.chart-as-metric.up {
    color: #027a48;
}

.chart-as-metric.down strong,
.chart-as-metric.down {
    color: #b42318;
}

.chart-strategy-empty-row td {
    padding: 18px !important;
}

.option-chain-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
}

.option-expiry-strip {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    gap: 7px;
    min-height: 62px;
    padding: 8px 16px 10px;
    overflow: hidden;
    align-items: stretch;
}

.option-comparison-controls {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 0 16px 10px;
    flex: 0 0 100%;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 7px;
    order: 3;
}

.option-comparison-controls label {
    display: grid;
    gap: 3px;
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 850;
    text-transform: uppercase;
}

.option-comparison-controls input[type="color"] {
    width: 42px;
    height: 32px;
    padding: 2px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.option-comparison-controls .btn {
    height: 32px;
    white-space: nowrap;
}

.option-comparison-controls .option-side-action {
    min-width: 84px;
    border-color: transparent;
    color: #fff;
    font-weight: 850;
}

.option-comparison-controls .option-call-action {
    background: #16a34a;
}

.option-comparison-controls .option-call-action:hover,
.option-comparison-controls .option-call-action:focus-visible {
    background: #15803d;
}

.option-comparison-controls .option-put-action {
    background: #dc2626;
}

.option-comparison-controls .option-put-action:hover,
.option-comparison-controls .option-put-action:focus-visible {
    background: #b91c1c;
}

.option-comparison-controls .option-new-charts-action {
    min-width: 112px;
    border-color: #111827;
    background: #111827;
    color: #fff;
    font-weight: 850;
}

.option-comparison-controls .option-new-charts-action:hover,
.option-comparison-controls .option-new-charts-action:focus-visible {
    background: #334155;
}

.option-comparison-controls button.option-candle-new-action.btn {
    min-width: 112px;
    border: 1px solid #7c3aed;
    background: #7c3aed;
    color: #fff;
    font-weight: 850;
}

.option-comparison-controls button.option-candle-new-action.btn:hover,
.option-comparison-controls button.option-candle-new-action.btn:focus-visible {
    background: #6d28d9;
}

.option-comparison-controls .btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.multi-symbol-btn {
    min-width: 40px;
    font-weight: 900;
}

.multi-symbol-card {
    width: min(680px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 40px));
}

.multi-symbol-table-wrap {
    max-height: 510px;
    overflow: auto;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.multi-symbol-search {
    display: grid;
    padding: 10px 16px 12px;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 850;
    text-transform: uppercase;
}

.multi-symbol-search input {
    width: 100%;
    height: 38px;
    padding: 7px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: none;
    outline: none;
}

.multi-symbol-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.multi-symbol-table {
    width: 100%;
    border-collapse: collapse;
}

.multi-symbol-table th,
.multi-symbol-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.76rem;
    text-align: left;
}

.multi-symbol-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--card-bg, #fff);
    color: var(--text-secondary);
    font-weight: 850;
}

.multi-symbol-table .multi-symbol-status-row td {
    padding: 24px 14px;
    color: var(--text-secondary);
    font-weight: 700;
    text-align: center;
}

.multi-symbol-table td:nth-child(2) small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 700;
}

.multi-symbol-table th:first-child,
.multi-symbol-table td:first-child,
.multi-symbol-table th:nth-child(3),
.multi-symbol-table td:nth-child(3),
.multi-symbol-table th:last-child,
.multi-symbol-table td:last-child {
    width: 82px;
    text-align: center;
}

.multi-symbol-color {
    width: 44px;
    height: 30px;
    padding: 2px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.multi-symbol-actions {
    display: flex;
    padding: 12px 16px;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.multi-symbol-actions > span {
    margin-right: auto;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 750;
}

.multi-symbol-existing-style {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
}

.multi-symbol-existing-style select {
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font-size: 0.74rem;
    font-weight: 800;
    outline: none;
}

.multi-symbol-actions .btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.charts-dashboard.chart-dark-mode .multi-symbol-table th {
    background: #111827;
}

.charts-dashboard.chart-dark-mode .multi-symbol-search input {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .multi-symbol-existing-style select {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .option-comparison-controls input[type="color"] {
    border-color: #334155;
    background: #172033;
}

.option-price-search {
    display: flex;
    width: 170px;
    flex: 0 0 170px;
    order: 2;
    padding: 8px 16px 10px 0;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
}

.option-price-search input {
    box-sizing: border-box;
    width: 100%;
    height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    outline: none;
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: none;
}

.option-price-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12);
}

.option-price-matches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-light);
    background: rgba(46, 144, 250, 0.035);
}

.option-price-matches.hidden {
    display: none;
}

.option-price-match {
    display: grid;
    min-width: 0;
    padding: 8px 12px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.option-price-match:hover,
.option-price-match:focus-visible {
    border-color: var(--accent);
    background: rgba(46, 144, 250, 0.09);
    outline: none;
}

.option-price-match span,
.option-price-match small,
.option-price-no-match {
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 700;
}

.option-price-match strong {
    overflow: hidden;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-price-match small {
    white-space: nowrap;
}

.option-price-no-match {
    padding: 10px;
    text-align: center;
}

.option-expiry-btn {
    box-sizing: border-box;
    flex: 0 1 84px;
    min-width: 0;
    min-height: 44px;
    padding: 7px 10px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.15;
}

.option-expiry-btn span {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 600;
}

.option-expiry-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.option-expiry-btn.active span {
    color: rgba(255, 255, 255, 0.8);
}

.option-chain-table-wrap {
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
    max-height: none;
    overflow: auto;
    border-top: 1px solid var(--border-light);
}

.chart-option-chain-table {
    width: 100%;
    table-layout: fixed;
}

.chart-option-chain-table th {
    top: 0;
    z-index: 4;
    padding: 8px 5px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
}

.chart-option-chain-table th,
.chart-option-chain-table td {
    box-sizing: border-box;
}

.chart-option-chain-table td {
    height: 40px;
    padding: 4px 10px;
    border-bottom: 1px solid var(--border-light);
    text-align: center;
}

.option-call-strike-heading,
.option-put-strike-heading,
.option-contract-strike {
    width: 14%;
    background: rgba(15, 23, 42, 0.055);
}

.option-contract-strike {
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.option-atm-heading,
.option-atm-cell {
    width: 12%;
    background: rgba(46, 144, 250, 0.055);
}

.option-atm-cell {
    padding-right: 3px !important;
    padding-left: 3px !important;
}

.option-atm-badge {
    display: inline-flex;
    min-width: 42px;
    padding: 4px 7px;
    align-items: center;
    justify-content: center;
    border: 1px solid #2e90fa;
    border-radius: 999px;
    background: #eff8ff;
    color: #175cd3;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.charts-dashboard.chart-dark-mode .option-atm-badge {
    border-color: #60a5fa;
    background: #172033;
    color: #93c5fd;
}

.charts-dashboard.chart-dark-mode .option-price-search input,
.charts-dashboard.chart-dark-mode .option-price-match {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
}

.option-atm-row .option-contract-strike {
    color: var(--accent);
}

.option-price-cell {
    width: 24%;
}

.option-select-heading,
.option-select-cell {
    width: 6%;
}

.option-select-cell {
    background: rgba(15, 23, 42, 0.025);
}

.option-chain-check {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.chart-option-chain-card.aio-closed .option-select-heading,
.chart-option-chain-card.aio-closed .option-select-cell {
    display: none;
}

.chart-option-chain-card.aio-closed .option-price-cell {
    width: 38%;
}

.option-price-cell.itm {
    background: rgba(46, 144, 250, 0.08);
}

.option-price-cell.otm {
    background: rgba(148, 163, 184, 0.04);
}

.option-contract-btn {
    width: 100%;
    min-height: 34px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 800;
}

.option-contract-btn:hover,
.option-contract-btn:focus-visible {
    border-color: var(--accent);
    background: rgba(46, 144, 250, 0.12);
    outline: none;
}

.option-contract-btn small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.61rem;
    font-weight: 600;
}

.option-contract-btn.selected {
    border-color: var(--accent);
    background: rgba(46, 144, 250, 0.16);
    color: var(--accent);
}

.option-chain-empty {
    padding: 22px !important;
    color: var(--text-secondary);
}

.option-atm-line {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 3;
    height: 1px;
    background: rgba(46, 144, 250, 0.8);
    pointer-events: none;
}

.option-atm-line span {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -50%);
    padding: 2px 6px;
    border: 1px solid rgba(46, 144, 250, 0.55);
    border-radius: 4px;
    background: #fff;
    color: #1d4ed8;
    font-size: 0.62rem;
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .chart-option-chain-modal {
        padding: 10px;
    }

    .chart-option-chain-card {
        width: calc(100vw - 20px);
        height: calc(100dvh - 20px);
        max-height: none;
        border-radius: 9px;
    }

    .option-chain-header {
        padding: 12px;
    }

    .option-expiry-strip {
        padding-right: 12px;
        padding-left: 12px;
    }

    .option-chain-filter-bar {
        display: block;
    }

    .option-price-search {
        box-sizing: border-box;
        width: 100%;
        padding: 0 12px 10px;
    }

    .option-price-matches {
        grid-template-columns: 1fr;
        padding-right: 12px;
        padding-left: 12px;
    }

    .chart-option-chain-table td {
        padding: 4px;
    }

    .option-expiry-btn {
        padding-right: 5px;
        padding-left: 5px;
    }

    .chart-option-chain-table th {
        font-size: 0.6rem;
    }

    .option-contract-strike {
        font-size: 0.68rem;
    }

    .option-atm-badge {
        min-width: 0;
        padding: 3px 5px;
        font-size: 0.56rem;
    }

    .option-contract-btn {
        padding: 3px;
        font-size: 0.76rem;
    }
}

.chart-container-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    padding: 0 8px 8px 0;
    position: relative;
}

.chart-container-card > .chart-tool-rail {
    grid-column: 1 / -1;
    grid-row: 1;
}

.chart-container-card > #chart-layout-stage {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
}

.charts-dashboard.chart-controls-collapsed .chart-container-card {
    height: var(--collapsed-chart-height, calc(100dvh - 118px));
    min-height: 500px;
}

.charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1,
.charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1 .primary-chart-pane {
    height: 100%;
    min-height: 0;
}

.charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1 .primary-chart-pane {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
}

.charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1 #trading-chart {
    height: 100% !important;
    min-height: 0;
}

.chart-layout-stage {
    display: grid;
    gap: 10px;
}

.chart-layout-stage.layout-1 {
    grid-template-columns: minmax(0, 1fr);
}

.chart-layout-stage.layout-2 {
    grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1fr);
    align-items: stretch;
    height: 620px;
    overflow: hidden;
}

.chart-layout-stage.layout-3 {
    grid-template-columns: minmax(0, 0.96fr) minmax(430px, 1fr);
    align-items: stretch;
    height: 620px;
    overflow: hidden;
}

.primary-chart-pane,
.multi-chart-pane {
    position: relative;
    min-width: 0;
}

.chart-pane-shell {
    border-radius: 8px;
    transition: outline-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.chart-layout-stage:not(.layout-1) .chart-pane-shell {
    outline: 1px solid rgba(148, 163, 184, 0.34);
    outline-offset: 2px;
    cursor: pointer;
}

.chart-layout-stage:not(.layout-1) .chart-pane-shell:hover {
    outline-color: rgba(46, 144, 250, 0.55);
}

.chart-layout-stage:not(.layout-1) .chart-pane-shell.chart-pane-selected {
    outline: none;
    background-color: #f8fbff;
    box-shadow:
        inset 0 0 0 2px var(--accent),
        0 0 0 4px rgba(46, 144, 250, 0.1);
    z-index: 1;
}

.multi-chart-grid {
    display: grid;
    gap: 10px;
    min-width: 0;
    min-height: 0;
}

.multi-chart-grid.hidden {
    display: none;
}

.multi-chart-grid.layout-2 {
    grid-template-columns: minmax(0, 1fr);
    height: 620px;
}

.multi-chart-grid.layout-3 {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, 305px);
    height: 620px;
}

.multi-chart-pane {
    height: 305px;
    min-height: 0;
    padding: 6px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    overflow: hidden;
}

.multi-chart-grid.layout-2 .multi-chart-pane {
    height: 620px;
}

.multi-chart-header {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    margin-bottom: 4px;
}

.multi-chart-header-shared-symbol {
    display: flex;
}

.multi-chart-symbol-select {
    flex: 1 1 auto;
    min-width: 0;
    height: 28px;
    padding: 3px 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: 11px;
    font-weight: 700;
}

.multi-chart-title {
    flex: 0 0 auto;
    max-width: 82px;
    height: 20px;
    padding: 0 4px;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-chart-pane .multi-chart-title,
.multi-chart-pane .multi-chart-interval-badge {
    display: none;
}

.multi-chart-interval-badge {
    flex: 0 0 auto;
    min-width: 32px;
    height: 22px;
    padding: 0 7px;
    border: 1px solid #b2ddff;
    border-radius: 6px;
    background: #eff8ff;
    color: #175cd3;
    font-size: 10px;
    font-weight: 850;
    line-height: 20px;
    text-align: center;
}

.multi-chart-ohlc-readout {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 23px;
    max-height: 44px;
    padding: 3px 6px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.88);
    color: #334155;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    pointer-events: none;
    overflow: visible;
}

.multi-chart-ohlc-readout .ohlc-symbol {
    color: #0f172a;
    font-weight: 800;
}

.multi-chart-ohlc-readout .ohlc-up {
    color: #0f8f7f;
}

.multi-chart-ohlc-readout .ohlc-down {
    color: #dc2626;
}

.multi-chart-ohlc-readout .ohlc-time {
    color: #334155;
    font-weight: 800;
}

.multi-chart-canvas {
    display: block;
    width: 100% !important;
    height: 244px !important;
    min-height: 0;
    max-height: 244px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.multi-chart-canvas.chart-is-dragging {
    cursor: grabbing;
}

.multi-chart-grid.layout-2 .multi-chart-canvas {
    height: 548px !important;
    max-height: 548px;
}

.chart-indicator-panel-wrap {
    position: relative;
    display: block;
    width: 100%;
    height: 150px;
    min-height: 100px;
    overflow: hidden;
    border-top: 1px solid var(--border-light);
    background: var(--card-bg, #fff);
}

.chart-indicator-panel-wrap.hidden {
    display: none;
}

#chart-indicator-panel,
.multi-chart-indicator-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
}

.multi-chart-indicator-wrap {
    height: 92px;
    min-height: 72px;
}

.multi-chart-pane.has-indicator-panel .multi-chart-canvas {
    height: 150px !important;
    max-height: 150px;
}

.multi-chart-grid.layout-2 .multi-chart-pane.has-indicator-panel .multi-chart-canvas {
    height: 440px !important;
    max-height: 440px;
}

.primary-chart-pane.has-indicator-panel .chart-bottom-navigation,
.multi-chart-pane.has-indicator-panel .chart-bottom-navigation {
    bottom: 118px;
}

.chart-ohlc-readout {
    position: absolute;
    top: 5px;
    left: 33px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 36px);
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.86);
    color: #334155;
    font-size: 11px;
    line-height: 1.35;
    pointer-events: none;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.chart-ohlc-readout .ohlc-symbol {
    color: #0f172a;
    font-weight: 700;
}

.chart-ohlc-readout .ohlc-up {
    color: #0f8f7f;
}

.chart-ohlc-readout .ohlc-down {
    color: #dc2626;
}

.chart-ohlc-readout .ohlc-time {
    color: #334155;
    font-weight: 700;
}

#trading-chart {
    display: block;
    width: 100% !important;
    height: 500px !important;
    min-height: 500px;
}

.chart-bottom-navigation {
    position: absolute;
    left: 50%;
    top: auto;
    bottom: 24px;
    z-index: 14;
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding: 3px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    transform: translate(-50%, 4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.primary-chart-pane:hover .chart-bottom-navigation,
.multi-chart-pane:hover .chart-bottom-navigation {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.chart-bottom-navigation button {
    display: inline-flex;
    width: 22px;
    height: 22px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.94);
    color: #344054;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.chart-bottom-navigation button:hover,
.chart-bottom-navigation button:focus-visible {
    border-color: #60a5fa;
    background: #2563eb;
    color: #f8fafc;
    outline: none;
}

.chart-left-tools,
.chart-right-tools {
    position: relative;
    grid-row: 2;
    z-index: 15;
    display: flex;
    min-width: 34px;
    height: 100%;
    padding: 4px 2px;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    background: #fff;
}

.chart-left-tools {
    grid-column: 1;
    overflow: visible;
    border-right: 1px solid #e4e7ec;
    box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}

.chart-right-tools {
    grid-column: 3;
    border-left: 1px solid #e4e7ec;
    box-shadow: -1px 0 0 rgba(15, 23, 42, 0.02);
}

.chart-side-tool-btn {
    position: relative;
    display: inline-flex;
    box-sizing: border-box;
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.96);
    color: #344054;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1;
}

.chart-side-tool-btn:hover,
.chart-side-tool-btn:focus-visible,
.chart-side-tool-btn.active {
    border-color: #60a5fa;
    background: #2563eb;
    color: #f8fafc;
    outline: none;
}

.chart-side-tool-btn .chart-as-count {
    position: absolute;
    top: -6px;
    right: -6px;
}

.chart-left-calendar-btn .chart-date-range-icon {
    width: 15px;
    height: 14px;
}

.chart-action-group.chart-action-group-left-moved {
    display: none;
}

.chart-controls.chart-controls-left-rail-mode {
    grid-template-columns: minmax(180px, 300px) 56px;
    min-width: 0;
    justify-content: flex-start;
}

.chart-left-tools .control-group,
.chart-left-tools .chart-indicators-group,
.chart-left-tools .chart-date-range-group,
.chart-left-tools .chart-layout-group {
    width: auto;
    min-width: 0;
    gap: 0;
}

.chart-left-tools .control-group label {
    display: none;
}

.chart-left-tools .chart-indicator-picker,
.chart-left-tools .chart-date-range,
.chart-left-tools .chart-layout-picker,
.chart-left-tools .chart-type-rail-menu,
.chart-left-tools .chart-draw-menu {
    position: relative;
    width: 28px;
}

.chart-left-tools .chart-indicator-trigger,
.chart-left-tools .chart-date-range-trigger,
.chart-left-tools .chart-layout-trigger,
.chart-left-tools .chart-panel-toggle,
.chart-left-tools .btn-primary,
.chart-left-tools .chart-replay-speed {
    box-sizing: border-box;
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    padding: 0;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.96);
    color: #344054;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1;
}

.chart-left-tools .chart-layout-caret {
    display: none;
}

.chart-left-tools .chart-indicator-trigger svg {
    width: 17px;
    height: 17px;
}

.chart-left-tools .chart-date-range-icon {
    width: 14px;
    height: 13px;
}

.chart-left-tools .chart-layout-trigger .layout-icon {
    width: 15px;
    height: 15px;
}

.chart-left-tools .chart-replay-controls {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chart-left-tools .chart-replay-controls.hidden {
    display: none !important;
}

.chart-left-tools #refresh-chart {
    font-size: 0;
}

.chart-left-tools #refresh-chart::before {
    content: "⟳";
    font-size: 0.72rem;
    font-weight: 900;
}

.chart-left-tools .chart-indicator-menu,
.chart-left-tools .chart-date-range-popover,
.chart-left-tools .chart-layout-menu,
.chart-left-tools .chart-type-menu,
.chart-left-tools .chart-draw-menu-panel {
    top: 0;
    right: auto;
    left: calc(100% + 8px);
}

.chart-left-tools .chart-date-range-popover {
    width: 260px;
}

.chart-left-tools .chart-layout-menu {
    min-width: 420px;
}

.chart-left-tools .chart-draw-menu-panel {
    grid-template-columns: repeat(2, minmax(84px, 1fr));
}

.charts-dashboard.chart-dark-mode .chart-left-tools .chart-indicator-trigger,
.charts-dashboard.chart-dark-mode .chart-left-tools .chart-date-range-trigger,
.charts-dashboard.chart-dark-mode .chart-left-tools .chart-layout-trigger,
.charts-dashboard.chart-dark-mode .chart-left-tools .chart-panel-toggle,
.charts-dashboard.chart-dark-mode .chart-left-tools .btn-primary,
.charts-dashboard.chart-dark-mode .chart-left-tools .chart-replay-speed {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .chart-side-tool-btn {
    border-color: #334155;
    background: #172033;
    color: #e2e8f0;
}

.charts-dashboard.chart-dark-mode .chart-side-tool-btn:hover,
.charts-dashboard.chart-dark-mode .chart-side-tool-btn:focus-visible,
.charts-dashboard.chart-dark-mode .chart-side-tool-btn.active {
    border-color: #60a5fa;
    background: #2563eb;
    color: #f8fafc;
}

.chart-layout-stage.layout-2 #trading-chart,
.chart-layout-stage.layout-3 #trading-chart {
    height: 586px !important;
    min-height: 586px;
}

@media (max-width: 1100px) {

    .chart-layout-stage.layout-2,
    .chart-layout-stage.layout-3 {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        overflow: visible;
    }

    .multi-chart-grid.layout-2,
    .multi-chart-grid.layout-3 {
        height: auto;
    }

    .multi-chart-grid.layout-3 {
        grid-template-rows: none;
    }
}

#oi-strike-chart {
    display: block;
    width: 100% !important;
    height: 300px !important;
    max-height: 300px;
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.indicator-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 12px;
    border-left: 3px solid var(--accent);
}

.indicator-card h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.indicator-values {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.indicator-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.indicator-label {
    color: var(--text-secondary);
}

.indicator-value {
    font-weight: 700;
    font-family: monospace;
}

.indicator-value.up {
    color: var(--success);
}

.indicator-value.down {
    color: var(--danger);
}

.oi-analysis-card {
    padding: 14px;
}

.oi-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.oi-date-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    font-size: 0.85rem;
}

.oi-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 5px;
}

.legend-color.call {
    background: #2ecc71;
}

.legend-color.put {
    background: #e74c3c;
}

.legend-color.oi-change {
    background: #f39c12;
}

.market-depth-card {
    padding: 14px;
}

.depth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.depth-asks h4,
.depth-bids h4 {
    font-size: 0.85rem;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-light);
}

.depth-asks h4 {
    color: var(--danger);
}

.depth-bids h4 {
    color: var(--success);
}

.depth-list {
    max-height: 300px;
    overflow-y: auto;
}

.depth-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.depth-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.depth-price {
    font-weight: 700;
}

.depth-quantity {
    color: var(--text-secondary);
}

.depth-asks .depth-price {
    color: var(--danger);
}

.depth-bids .depth-price {
    color: var(--success);
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1400px) {
    .chart-controls {
        grid-template-columns: minmax(180px, 300px) 56px 44px 44px 54px max-content minmax(230px, 1fr);
        min-width: 850px;
        align-items: end;
    }

    .chart-action-group {
        grid-column: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
}

/* Keep the complete toolbar as one unit on narrow screens instead of wrapping
   individual controls into scattered rows. */
@media (min-width: 769px) and (max-width: 900px) {
    .chart-controls {
        zoom: 0.85;
    }
}

@media (max-width: 768px) {
    .charts-control-card .card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-type-buttons {
        width: 100%;
    }

    .chart-type-btn {
        flex: 1;
    }

    .chart-controls {
        grid-template-columns: minmax(180px, 300px) 56px 44px 44px 54px max-content minmax(230px, 1fr);
        min-width: 850px;
        align-items: end;
    }

    .chart-interval-group {
        min-width: 0;
    }

    .chart-date-range-group {
        min-width: 0;
    }

    .control-group {
        width: auto;
    }

    .chart-action-group {
        grid-column: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .chart-controls {
        zoom: 0.7;
    }

    .charts-dashboard .chart-container-card {
        padding: 8px;
    }

    .chart-tool-rail {
        position: relative;
        inset: auto;
        width: 100%;
        min-height: 38px;
        margin-bottom: 8px;
        padding: 0 0 7px;
        flex-direction: row;
        justify-content: flex-start;
        border-right: 0;
        border-bottom: 1px solid #eaecf0;
    }

    .chart-tool-rail .chart-draw-menu-panel {
        top: calc(100% + 8px);
        right: 0;
        left: auto;
    }

    .chart-tool-rail .chart-type-menu {
        top: calc(100% + 8px);
        left: 0;
    }

    .chart-quick-filters {
        flex-wrap: wrap;
    }

    .btn-primary {
        width: 100%;
    }

    .depth-container {
        grid-template-columns: 1fr;
    }

    .indicators-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .chart-controls {
        zoom: 0.52;
    }
}

@media (max-width: 480px) {
    .chart-controls {
        zoom: 0.35;
    }
}

/* Excel View Table Styling */
.excel-monitor-card {
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    overflow: hidden;
}

.trading-excel-monitor {
    margin-top: 0;
    margin-bottom: 12px;
}

.excel-monitor-card .card-header {
    margin: 0 !important;
    /* padding: 18px 24px 14px; */
    border-bottom: 1px solid #eaecf0;
}

.excel-monitor-card .card-header h3 {
    margin: 0;
    color: #101828;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0;
}

.excel-grid-container {
    width: 100%;
    padding: 8px 20px 16px;
    overflow-x: auto;
    scrollbar-color: #d0d5dd transparent;
    scrollbar-width: thin;
}

.excel-grid-table {
    --excel-value-box-height: 28px;
    --excel-value-font-size: 11px;
    --excel-value-font-weight: 700;
    width: 100%;
    min-width: 1180px;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    overflow: hidden;
    background-color: #ffffff;
    color: #344054;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
    border: 0;
}

.excel-grid-table td {
    border: 0 !important;
    padding: 4px 5px !important;
    text-align: center !important;
    vertical-align: middle;
    font-weight: 650;
    white-space: nowrap;
    color: #344054 !important;
}

.excel-grid-table tr:last-child td {
    border-bottom: 0 !important;
}

.excel-grid-table td:last-child {
    border-right: 0 !important;
}

.excel-grid-table td.header-label {
    background-color: transparent !important;
    color: #344054 !important;
    font-weight: bold;
    text-align: center !important;
}

.excel-grid-table td.grey-bg {
    background-color: transparent !important;
    color: #667085 !important;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.excel-grid-table td.green-bg {
    background-color: transparent !important;
    color: #027a48 !important;
    font-weight: 800;
}

.excel-grid-table td.excel-status-error {
    color: #b42318 !important;
}

.excel-grid-table td.excel-running-active {
    background-color: transparent !important;
    color: #027a48 !important;
}

.excel-grid-table td.excel-running-stopped {
    background-color: transparent !important;
    color: #344054 !important;
}

.excel-grid-table td.yellow-bg {
    background-color: transparent !important;
    color: #93370d !important;
    font-weight: 800;
}

.excel-grid-table td.white-bg {
    background-color: transparent !important;
}

.excel-grid-table td:not(:empty):not(.yellow-bg) {
    font-size: var(--excel-value-font-size) !important;
    font-weight: var(--excel-value-font-weight);
}

.excel-grid-table .excel-cell-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    height: var(--excel-value-box-height);
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    padding: 0 6px;
    line-height: 1;
    white-space: nowrap;
}

.excel-grid-table td.green-bg .excel-cell-box,
.excel-grid-table td.excel-running-active .excel-cell-box {
    border-color: #abefc6;
    background: #f6fef9;
}

.excel-grid-table td.excel-status-error .excel-cell-box {
    border-color: #fecdca;
    background: #fffbfa;
}

.excel-grid-table input.excel-input {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    height: var(--excel-value-box-height);
    min-height: var(--excel-value-box-height);
    box-sizing: border-box;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px;
    background: #ffffff !important;
    color: #101828 !important;
    padding: 0 6px !important;
    text-align: center;
    font-weight: var(--excel-value-font-weight);
    font-family: inherit;
    font-size: var(--excel-value-font-size);
    line-height: var(--excel-value-box-height);
    margin: 0 auto !important;
    outline: none !important;
    box-shadow: none !important;
}

.excel-grid-table input.excel-input:focus {
    border-color: #84adff !important;
    box-shadow: 0 0 0 3px rgba(46, 144, 250, 0.12) !important;
}

/* Enhanced Chart Styles */
.no-data-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 10;
}

.chart-empty-state {
    position: absolute;
    inset: 0 0 44px 0;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    color: #344054;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.99));
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    z-index: 15;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.chart-empty-state.hidden {
    display: none;
}

.chart-empty-icon {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff4ff;
    border: 1px solid #d1e0ff;
    box-shadow: 0 10px 24px rgba(23, 92, 211, 0.12);
}

.chart-empty-icon::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #2e90fa;
    box-shadow: 0 0 0 7px rgba(46, 144, 250, 0.12);
}

.chart-empty-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: #101828;
    margin-bottom: 4px;
    text-align: center;
}

.chart-empty-message {
    max-width: 560px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #475467;
    text-align: center;
}

.chart-empty-meta {
    margin-top: 8px;
    font-size: 0.86rem;
    font-weight: 800;
    color: #175cd3;
}

#trading-chart {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

#trading-chart.chart-is-dragging {
    cursor: grabbing;
}

#trading-chart:focus-visible,
.multi-chart-canvas:focus-visible {
    outline: 2px solid rgba(46, 144, 250, 0.75);
    outline-offset: -2px;
}

/* Chart loading overlay */
.chart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 20;
}

.chart-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: chartSpinner 0.8s linear infinite;
}

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

/* Chart tooltip enhancements */
.chartjs-tooltip {
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-family: 'Inter', monospace;
}

/* Crosshair line for better visibility */
.chartjs-crosshair {
    stroke: var(--accent);
    stroke-width: 1;
    stroke-dasharray: 4, 4;
}

/* Volume bar styling */
.volume-bar-up {
    fill: rgba(38, 166, 154, 0.5);
}

.volume-bar-down {
    fill: rgba(239, 83, 80, 0.5);
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    .charts-dashboard.chart-controls-collapsed .chart-container-card {
        height: auto;
        min-height: 0;
    }

    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1,
    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1 .primary-chart-pane {
        height: auto;
    }

    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1 .primary-chart-pane {
        display: block;
    }

    #trading-chart,
    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-1 #trading-chart {
        height: 350px !important;
        min-height: 350px;
    }

    .chartjs-tooltip {
        font-size: 9px;
        padding: 4px 8px;
    }
}

/* Indicator panel enhancements */
.indicator-card {
    transition: all 0.2s ease;
}

.indicator-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.indicator-value {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Quick filter active state */
.chart-range-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Last update timestamp */
#chart-last-update {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Keep every desktop chart layout full-width and viewport-height. */
@media (min-width: 769px) {

    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-2,
    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-3 {
        height: 100%;
        min-height: 0;
    }

    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-2 .primary-chart-pane,
    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-3 .primary-chart-pane {
        display: grid;
        height: 100%;
        min-height: 0;
        grid-template-rows: minmax(0, 1fr) auto auto;
    }

    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-2 #trading-chart,
    .charts-dashboard.chart-controls-collapsed .chart-layout-stage.layout-3 #trading-chart {
        height: 100% !important;
        min-height: 0;
    }

    .charts-dashboard.chart-controls-collapsed .multi-chart-grid.layout-2,
    .charts-dashboard.chart-controls-collapsed .multi-chart-grid.layout-3 {
        height: 100%;
        min-height: 0;
    }

    .charts-dashboard.chart-controls-collapsed .multi-chart-grid.layout-3 {
        grid-template-rows: repeat(2, minmax(0, 1fr));
    }

    .charts-dashboard.chart-controls-collapsed .multi-chart-pane,
    .charts-dashboard.chart-controls-collapsed .multi-chart-grid.layout-2 .multi-chart-pane {
        display: grid;
        height: 100%;
        min-height: 0;
        grid-template-rows: 34px minmax(0, 1fr) auto;
    }

    .charts-dashboard.chart-controls-collapsed .multi-chart-canvas,
    .charts-dashboard.chart-controls-collapsed .multi-chart-grid.layout-2 .multi-chart-canvas {
        align-self: stretch;
        height: 100% !important;
        min-height: 0;
        max-height: none;
    }
}

/* Complete chart-layout picker and pane arrangements. */
.chart-layout-menu {
    left: 0;
    right: auto;
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    padding: 4px 8px;
    overflow-x: auto;
}

.chart-layout-menu-row {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #eaecf0;
}

.chart-layout-menu-row:last-child {
    border-bottom: 0;
}

.chart-layout-menu-row > span {
    width: 18px;
    flex: 0 0 18px;
    color: #667085;
    font-size: 0.78rem;
    text-align: center;
}

.chart-layout-menu-row > button {
    width: 32px;
    min-height: 34px;
    padding: 4px;
    flex: 0 0 32px;
    border: 0;
}

.chart-layout-menu .layout-icon,
.chart-layout-trigger .layout-icon {
    display: grid;
    width: 28px;
    height: 24px;
    gap: 1px;
    overflow: hidden;
    border: 1.5px solid currentColor;
    border-radius: 3px;
}

.chart-layout-trigger .layout-icon {
    width: 20px;
    height: 18px;
}

.layout-icon > i {
    display: block;
    min-width: 0;
    min-height: 0;
    background: currentColor;
    opacity: 0.14;
    outline: 1px solid currentColor;
}

.layout-icon-1 { grid-template: "a" 1fr / 1fr; }
.layout-icon-2-v { grid-template: "a b" 1fr / 1fr 1fr; }
.layout-icon-2-h { grid-template: "a" 1fr "b" 1fr / 1fr; }
.layout-icon-3-v { grid-template: "a b c" 1fr / repeat(3, 1fr); }
.layout-icon-3-h { grid-template: "a" 1fr "b" 1fr "c" 1fr / 1fr; }
.layout-icon-3-left { grid-template: "a b" 1fr "a c" 1fr / 1.25fr 1fr; }
.layout-icon-3-right { grid-template: "b a" 1fr "c a" 1fr / 1fr 1.25fr; }
.layout-icon-3-top { grid-template: "a a" 1.2fr "b c" 1fr / 1fr 1fr; }
.layout-icon-3-bottom { grid-template: "b c" 1fr "a a" 1.2fr / 1fr 1fr; }
.layout-icon-4-grid { grid-template: "a b" 1fr "c d" 1fr / 1fr 1fr; }
.layout-icon-4-h { grid-template: "a" 1fr "b" 1fr "c" 1fr "d" 1fr / 1fr; }
.layout-icon-4-v { grid-template: "a b c d" 1fr / repeat(4, 1fr); }
.layout-icon-4-left { grid-template: "a b" 1fr "a c" 1fr "a d" 1fr / 1.25fr 1fr; }
.layout-icon-4-right { grid-template: "b a" 1fr "c a" 1fr "d a" 1fr / 1fr 1.25fr; }
.layout-icon-4-top { grid-template: "a a a" 1.25fr "b c d" 1fr / repeat(3, 1fr); }
.layout-icon-4-bottom { grid-template: "b c d" 1fr "a a a" 1.25fr / repeat(3, 1fr); }
.layout-icon-4-focus-left { grid-template: "a a b" 1fr "a a c" 1fr "d d c" 1fr / repeat(3, 1fr); }
.layout-icon-4-focus-right { grid-template: "b a a" 1fr "c a a" 1fr "c d d" 1fr / repeat(3, 1fr); }
.layout-icon-4-zigzag { grid-template: "a b" 1fr "c b" 1fr "c d" 1fr / 1fr 1fr; }

.layout-icon > i:nth-child(1) { grid-area: a; }
.layout-icon > i:nth-child(2) { grid-area: b; }
.layout-icon > i:nth-child(3) { grid-area: c; }
.layout-icon > i:nth-child(4) { grid-area: d; }

.chart-layout-stage:not(.layout-1) {
    display: grid;
    height: 620px;
    gap: 10px;
    overflow: hidden;
}

.chart-layout-stage:not(.layout-1) > .primary-chart-pane { grid-area: a; }
.chart-layout-stage:not(.layout-1) > .multi-chart-grid:not(.hidden) { display: contents; }
.chart-layout-stage:not(.layout-1) .multi-chart-pane:nth-child(1) { grid-area: b; }
.chart-layout-stage:not(.layout-1) .multi-chart-pane:nth-child(2) { grid-area: c; }
.chart-layout-stage:not(.layout-1) .multi-chart-pane:nth-child(3) { grid-area: d; }

.chart-layout-stage.layout-2-v { grid-template: "a b" 1fr / minmax(0, 1fr) minmax(0, 1fr); }
.chart-layout-stage.layout-2-h { grid-template: "a" 1fr "b" 1fr / minmax(0, 1fr); }
.chart-layout-stage.layout-3-v { grid-template: "a b c" 1fr / repeat(3, minmax(0, 1fr)); }
.chart-layout-stage.layout-3-h { grid-template: "a" 1fr "b" 1fr "c" 1fr / minmax(0, 1fr); }
.chart-layout-stage.layout-3-left { grid-template: "a b" 1fr "a c" 1fr / minmax(0, 1.25fr) minmax(0, 1fr); }
.chart-layout-stage.layout-3-right { grid-template: "b a" 1fr "c a" 1fr / minmax(0, 1fr) minmax(0, 1.25fr); }
.chart-layout-stage.layout-3-top { grid-template: "a a" 1.2fr "b c" 1fr / repeat(2, minmax(0, 1fr)); }
.chart-layout-stage.layout-3-bottom { grid-template: "b c" 1fr "a a" 1.2fr / repeat(2, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-grid { grid-template: "a b" 1fr "c d" 1fr / repeat(2, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-h { grid-template: "a" 1fr "b" 1fr "c" 1fr "d" 1fr / minmax(0, 1fr); }
.chart-layout-stage.layout-4-v { grid-template: "a b c d" 1fr / repeat(4, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-left { grid-template: "a b" 1fr "a c" 1fr "a d" 1fr / minmax(0, 1.25fr) minmax(0, 1fr); }
.chart-layout-stage.layout-4-right { grid-template: "b a" 1fr "c a" 1fr "d a" 1fr / minmax(0, 1fr) minmax(0, 1.25fr); }
.chart-layout-stage.layout-4-top { grid-template: "a a a" 1.25fr "b c d" 1fr / repeat(3, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-bottom { grid-template: "b c d" 1fr "a a a" 1.25fr / repeat(3, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-focus-left { grid-template: "a a b" 1fr "a a c" 1fr "d d c" 1fr / repeat(3, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-focus-right { grid-template: "b a a" 1fr "c a a" 1fr "c d d" 1fr / repeat(3, minmax(0, 1fr)); }
.chart-layout-stage.layout-4-zigzag { grid-template: "a b" 1fr "c b" 1fr "c d" 1fr / repeat(2, minmax(0, 1fr)); }

.chart-layout-stage:not(.layout-1) .primary-chart-pane,
.chart-layout-stage:not(.layout-1) .multi-chart-pane {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.chart-layout-stage:not(.layout-1) .primary-chart-pane {
    grid-template-rows: minmax(0, 1fr) auto auto;
}

.chart-layout-stage:not(.layout-1) .multi-chart-pane {
    grid-template-rows: 34px minmax(0, 1fr) auto;
}

.chart-layout-stage:not(.layout-1) #trading-chart,
.chart-layout-stage:not(.layout-1) .multi-chart-canvas {
    align-self: stretch;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    max-height: none;
}

.charts-dashboard.chart-controls-collapsed .chart-layout-stage:not(.layout-1) {
    height: 100%;
    min-height: 0;
}

@media (max-width: 1100px) {
    .chart-layout-stage:not(.layout-1) {
        height: auto;
        grid-template-columns: minmax(0, 1fr);
        overflow: visible;
    }

    .chart-layout-stage[class*="layout-2-"] {
        grid-template-areas: "a" "b";
        grid-template-rows: minmax(420px, auto) minmax(300px, auto);
    }

    .chart-layout-stage[class*="layout-3-"] {
        grid-template-areas: "a" "b" "c";
        grid-template-rows: minmax(420px, auto) repeat(2, minmax(300px, auto));
    }

    .chart-layout-stage[class*="layout-4-"] {
        grid-template-areas: "a" "b" "c" "d";
        grid-template-rows: minmax(420px, auto) repeat(3, minmax(300px, auto));
    }

    .chart-layout-stage:not(.layout-1) .multi-chart-pane {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .option-comparison-controls {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        padding: 0 12px 10px;
    }

}
