:root {
    /* Light Trading Palette */
    --ft-bg: #f3f4f6;
    --ft-bg-secondary: #ffffff;
    --ft-bg-tertiary: #f9fafb;
    --ft-border: #e5e7eb;
    --ft-text-primary: #1e293b;
    --ft-text-secondary: #64748b;
    --ft-green: #22c55e;
    --ft-red: #ef4444;
    --ft-accent: #6366f1;
    --ft-accent-light: #818cf8;
    --ft-accent-glow: rgba(99, 102, 241, 0.12);
    --text-on-primary: #ffffff;
    --ft-hover: rgba(0, 0, 0, 0.03);

    /* Layout Constants */
    --header-height: var(--site-header-height, 64px);
    --ticker-height: 48px;
}

/* Dark Trading Palette — Backpack-inspired */
.dark-mode {
    --ft-bg: #0e0f19;
    --ft-bg-secondary: #141520;
    --ft-bg-tertiary: #1a1b2e;
    --ft-border: #1e2235;
    --ft-text-primary: #e4e5e7;
    --ft-text-secondary: #9da3ae;
    --ft-green: #22c55e;
    --ft-red: #ef4444;
    --ft-accent: #6366f1;
    --ft-accent-light: #818cf8;
    --ft-accent-glow: rgba(99, 102, 241, 0.12);
    --ft-hover: rgba(255, 255, 255, 0.04);
}

body.futures-theme {
    background-color: var(--ft-bg);
    color: var(--ft-text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    overflow: hidden;
}

.futures-layout {
    display: grid;
    grid-template-areas:
        "header header header"
        "ticker ticker ticker"
        "book chart form"
        "book tabs form";
    grid-template-columns: 300px 1fr 310px;
    grid-template-rows: var(--header-height) var(--ticker-height) 1fr 280px;
    height: 100vh;
}

/* ─── Header ─── */
/* The shared header renders as .site-header, not the .dashboard-header these grid areas
   were written against, so it was auto-placed into the first cell — a 300px column. That
   collapsed the primary nav to zero width, moved the auth controls to the left edge, and
   left nothing visible at phone widths where the bar switches to the drawer. */
.futures-layout > .site-header {
    grid-area: header;
    min-width: 0;
}

.dashboard-header {
    grid-area: header;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ft-bg-secondary);
    border-bottom: 1px solid var(--ft-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.25rem;
    color: var(--ft-accent);
}

.header-left h1 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ft-text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

.header-left h1 span {
    color: var(--ft-accent);
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

.header-nav .nav-link {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ft-text-secondary);
    text-decoration: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    letter-spacing: 0.02em;
}

.header-nav .nav-link:hover {
    color: var(--ft-text-primary);
}

.header-nav .nav-link.active {
    color: var(--ft-accent);
    border-bottom-color: var(--ft-accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── Ticker Bar (Premium — matches Spot) ─── */
.futures-ticker-bar {
    grid-area: ticker;
    background: var(--ft-bg-secondary);
    border-bottom: 1px solid var(--ft-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.futures-ticker-bar::-webkit-scrollbar {
    display: none;
}

.ticker-item.main-ticker {
    display: flex;
    align-items: center;
    gap: 14px;
    border-right: 1px solid var(--ft-border);
    padding-right: 20px;
    flex-shrink: 0;
}

.ticker-pair {
    font-size: 15px;
    font-weight: 700;
    color: var(--ft-text-primary);
    letter-spacing: -0.02em;
    cursor: pointer;
}

.pair-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ft-text-secondary);
    background: rgba(148, 163, 184, 0.12);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: -8px;
    line-height: 1.6;
}

.ticker-pair-arrow {
    font-size: 10px;
    color: var(--ft-text-secondary);
    margin-left: 4px;
    transition: transform 0.2s;
    cursor: pointer;
}

.ticker-pair-arrow.open {
    transform: rotate(180deg);
}

/* Market Picker Dropdown */
.ticker-item.main-ticker {
    position: relative;
}

.market-picker-dropdown {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    max-height: 460px;
    background: var(--ft-bg);
    border: 1px solid var(--ft-border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.market-picker-dropdown.open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: _pickerSlideIn 0.2s ease forwards;
}

@keyframes _pickerSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ft-border);
}

.picker-search i {
    font-size: 13px;
    color: var(--ft-text-secondary);
    flex-shrink: 0;
}

.picker-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    color: var(--ft-text-primary);
    font-size: 13px;
}

.picker-search input::placeholder {
    color: var(--ft-text-secondary);
    opacity: 0.6;
}

.picker-tabs {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--ft-border);
    background: var(--ft-bg-secondary);
}

.picker-tab {
    flex: 1;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--ft-text-secondary);
    transition: all 0.15s ease;
}

.picker-tab:hover {
    color: var(--ft-text-primary);
    background: rgba(255,255,255,0.04);
}

.picker-tab.active {
    color: var(--ft-text-primary);
    background: var(--ft-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.picker-list {
    overflow-y: auto;
    flex: 1;
    max-height: 350px;
    overscroll-behavior: contain;
}

.picker-list::-webkit-scrollbar {
    width: 4px;
}

.picker-list::-webkit-scrollbar-track {
    background: transparent;
}

.picker-list::-webkit-scrollbar-thumb {
    background: var(--ft-border);
    border-radius: 4px;
}

.picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.12s ease;
    font-size: 13px;
    border-left: 2px solid transparent;
}

.picker-item:hover {
    background: var(--ft-bg-secondary);
}

.picker-item.active {
    background: var(--ft-bg-secondary);
    border-left-color: var(--ft-accent, #F0B90B);
}

.picker-item-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    background: var(--ft-bg-secondary);
    color: var(--ft-text-secondary);
    flex-shrink: 0;
    overflow: hidden;
}

.picker-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.picker-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.picker-item-name {
    font-weight: 600;
    color: var(--ft-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.picker-item-vol {
    font-size: 10px;
    color: var(--ft-text-secondary);
    font-family: 'Roboto Mono', monospace;
}

.picker-item-change {
    font-size: 11px;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.picker-item-change.positive {
    color: var(--ft-green);
    background: rgba(14, 203, 129, 0.1);
}

.picker-item-change.negative {
    color: var(--ft-red);
    background: rgba(246, 70, 93, 0.1);
}

.picker-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 32px 20px;
    color: var(--ft-text-secondary);
    font-size: 12px;
}

.picker-empty i {
    font-size: 20px;
    opacity: 0.4;
}

.ticker-price {
    font-size: 17px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    color: var(--ft-green);
    transition: color 0.2s ease;
    letter-spacing: -0.02em;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.06);
}

.ticker-price.up {
    color: var(--ft-green);
    background: rgba(34, 197, 94, 0.08);
}

.ticker-price.down {
    color: var(--ft-red);
    background: rgba(239, 68, 68, 0.08);
}

.ticker-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex-shrink: 0;
}

.stat-label {
    color: var(--ft-text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.stat-value {
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--ft-text-primary);
}

.stat-value.muted {
    color: var(--ft-text-secondary);
}

.funding-countdown {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ─── Order Book (Left) ─── */
.futures-book {
    grid-area: book;
    background: var(--ft-bg-secondary);
    border-right: 1px solid var(--ft-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.book-tabs {
    display: flex;
    height: 36px;
    border-bottom: 1px solid var(--ft-border);
}

.book-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--ft-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.book-tab.active {
    color: var(--ft-text-primary);
    font-weight: 600;
    border-bottom-color: var(--ft-accent);
}

.book-tab:hover:not(.active) {
    color: var(--ft-text-primary);
    background: var(--ft-hover);
}

.book-tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.book-tab-content.active {
    display: flex;
}

.order-book-header,
.trades-header-row {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--ft-text-secondary);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 1px solid var(--ft-border);
}

.text-right {
    text-align: right;
}

.order-book-spread {
    padding: 6px 12px;
    background: var(--ft-bg);
    border-top: 1px solid var(--ft-border);
    border-bottom: 1px solid var(--ft-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.spread-price {
    font-size: 15px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    transition: color 0.2s ease;
}

.spread-price.text-up {
    color: var(--ft-green);
}

.spread-price.text-down {
    color: var(--ft-red);
}

.spread-pct {
    font-size: 11px;
    color: var(--ft-text-secondary);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    font-family: 'Roboto Mono', monospace;
}

.spread-pct.is-empty {
    background: transparent;
    padding: 2px 0;
}

.trades-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* ─── Chart (Center) ─── */
.futures-chart {
    grid-area: chart;
    background: var(--ft-bg-secondary);
    border-bottom: 1px solid var(--ft-border);
    display: flex;
    flex-direction: column;
    position: relative;
}

.futures-chart.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--ft-bg);
    border: none;
}

.futures-chart.fullscreen #price-chart {
    flex: 1;
    min-height: 0;
}

.chart-toolbar {
    padding: 0 12px;
    display: flex;
    gap: 8px;
    height: 40px;
    align-items: center;
    background: var(--ft-bg);
    border-bottom: 1px solid var(--ft-border);
}

.chart-spacer {
    flex: 1;
}

.chart-canvas {
    height: calc(100% - 40px);
}

/* ── Empty chart overlay (no candles) ───────────────────────────── */
.chart-empty-state {
    position: absolute;
    inset: 40px 0 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--ft-bg-secondary);
    color: var(--ft-text-secondary);
    font-size: 12px;
    letter-spacing: 0.02em;
    text-align: center;
    pointer-events: none;
}

.chart-empty-state[hidden] {
    display: none;
}

.chart-empty-state i {
    font-size: 22px;
    opacity: 0.3;
}

/* ─── Tabs (Positions/Orders) ─── */
.futures-tabs {
    grid-area: tabs;
    background: var(--ft-bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.futures-tabs .order-tabs {
    height: 40px;
    display: flex;
    border-bottom: 1px solid var(--ft-border);
    align-items: stretch;
}

.futures-tabs .order-tab {
    padding: 0 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ft-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.futures-tabs .order-tab.active {
    color: var(--ft-accent);
    border-bottom-color: var(--ft-accent);
    font-weight: 600;
}

.futures-tabs .order-tab:hover:not(.active) {
    color: var(--ft-text-primary);
    background: var(--ft-hover);
}

.tab-spacer {
    flex: 1;
}

.tab-actions {
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.btn-cancel-all {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(246, 70, 93, 0.1);
    color: var(--ft-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-cancel-all:hover {
    background: rgba(246, 70, 93, 0.2);
    border-color: var(--ft-red);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.15);
}

.tab-content-container {
    height: calc(100% - 40px);
    overflow-y: auto;
}

/* ─── Orders Login Prompt (when user is not logged in) ─── */
.futures-tabs .orders-login-prompt,
.orders-login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px 28px;
    color: var(--ft-text-secondary, #8b929e);
    text-align: center;
    width: 100%;
    min-height: 180px;
}

.orders-login-prompt .olp-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ft-accent, #6366f1) 14%, transparent);
    margin-bottom: 4px;
}

.orders-login-prompt .olp-icon i {
    font-size: 22px;
    color: var(--ft-accent, #6366f1);
    opacity: 0.95;
}

.orders-login-prompt .olp-title {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ft-text-primary, #eaecef);
    letter-spacing: -0.01em;
}

.orders-login-prompt .olp-sub {
    margin: 0;
    font-size: 11.5px;
    color: var(--ft-text-secondary, #8b929e);
    max-width: 300px;
    line-height: 1.45;
}

.orders-login-prompt .olp-btns {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.orders-login-prompt .olp-login {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    height: 32px;
    padding: 0 20px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    background: var(--ft-accent, #6366f1) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none !important;
    line-height: 32px !important;
}

.orders-login-prompt .olp-login:hover {
    filter: brightness(1.12);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.orders-login-prompt .olp-register {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    height: 32px;
    padding: 0 16px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: var(--ft-accent, #6366f1) !important;
    border: 1.5px solid var(--ft-accent, #6366f1) !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none !important;
    line-height: 30px !important;
}

.orders-login-prompt .olp-register:hover {
    background: color-mix(in srgb, var(--ft-accent, #6366f1) 10%, transparent) !important;
}

.positions-table,
.orders-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.positions-table thead,
.orders-table thead {
    position: sticky;
    top: 0;
    background: var(--ft-bg-secondary);
    text-align: left;
    color: var(--ft-text-secondary);
}

.positions-table th,
.orders-table th {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.positions-table td,
.orders-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--ft-border);
    font-size: 11px;
    line-height: 18px;
    font-family: 'Roboto Mono', monospace;
}

.positions-table tbody tr:hover,
.orders-table tbody tr:hover {
    background: var(--ft-hover);
}

.no-positions td,
.no-orders td {
    padding: 40px !important;
    text-align: center;
    color: var(--ft-text-secondary);
    font-size: 13px;
}

.no-positions td::before,
.no-orders td::before {
    content: '\f15c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 400;
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.25;
}

/* ─── Market Selector (Right Column Top) ─── */
.market-selector {
    display: flex;
    flex-direction: column;
    height: 298px;
    border-bottom: 1px solid var(--ft-border);
    background-color: var(--ft-bg-secondary);
    position: relative;
}

/* Subtle accent line on top */
.market-selector::before {
    display: none;
}

.market-selector-header {
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--ft-border);
    background: transparent;
    position: relative;
}

.market-list-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
    background: var(--ft-bg-tertiary);
    border: 1px solid var(--ft-border);
    border-radius: 6px;
    padding: 2px;
}

.market-list-tabs .list-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--ft-text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.market-list-tabs .list-tab:hover {
    color: var(--ft-text-primary);
}

.market-list-tabs .list-tab.active {
    color: var(--ft-text-primary);
    background: var(--ft-bg-secondary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0, 0.1);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--ft-bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--ft-border);
    transition: all 0.2s ease;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ft-text-secondary);
    font-size: 12px;
    pointer-events: none;
    transition: color 0.2s ease;
}

.search-box input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: none;
    border: none;
    color: var(--ft-text-primary);
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--ft-accent);
}

.search-box:focus-within i {
    color: var(--ft-accent);
}

.market-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--ft-border) transparent;
}

.market-list::-webkit-scrollbar {
    width: 4px;
}

.market-list::-webkit-scrollbar-track {
    background: transparent;
}

.market-list::-webkit-scrollbar-thumb {
    background-color: var(--ft-border);
    border-radius: 4px;
}

/* Market Items */
.market-item {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 4px 10px;
    margin: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s ease;
    user-select: none;
    gap: 8px;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

.market-item:hover {
    background-color: var(--ft-bg-tertiary);
}

.market-item.active {
    background: var(--ft-bg-tertiary);
}

.market-item:focus-visible {
    outline: 2px solid var(--ft-accent);
    outline-offset: -2px;
}

.market-item.active::before {
    display: none;
}

.market-item .favorite-btn {
    background: none;
    border: none;
    color: var(--ft-text-secondary);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    width: 12px;
    flex: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.market-item:hover .favorite-btn {
    opacity: 1;
}

.market-item .market-icon {
    margin-right: 0;
}

.market-item .favorite-btn i.fas {
    color: var(--ft-accent);
}

.market-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 50%;
    background-color: var(--ft-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.market-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.market-icon-fallback {
    font-size: 10px;
    font-weight: 700;
    color: var(--ft-text-secondary);
}

.market-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--ft-text-primary);
}

.market-changeB {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-align: right;
    min-width: 54px;
}

.market-changeB.positive {
    background: rgba(14, 203, 129, 0.1);
    color: var(--ft-green);
}

.market-changeB.negative {
    background: rgba(246, 70, 93, 0.1);
    color: var(--ft-red);
}

.market-changeB.neutral {
    background: rgba(148, 163, 184, 0.14);
    color: var(--ft-text-secondary);
}

.market-info-col .market-name {
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.market-vol {
    font-size: 10px;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.market-price-col {
    gap: 1px;
}

.market-price-col .market-last-price {
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.market-item .market-changeB {
    min-width: 58px;
    padding: 1px 6px;
    line-height: 1.4;
    text-align: right;
}

/* ─── Order Form (Right — Premium, matches Spot) ─── */
.futures-form {
    grid-area: form;
    background: var(--ft-bg-secondary);
    border-left: 1px solid var(--ft-border);
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.futures-form .trading-forms-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: var(--ft-bg-secondary);
}

/* Form Tabs */
.futures-form .form-tabs {
    display: flex;
    padding: 0;
    border-bottom: 1px solid var(--ft-border);
}

.futures-form .form-tab {
    flex: 1;
    padding: 11px 0;
    border: none;
    background: transparent;
    color: var(--ft-text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.futures-form .form-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: transparent;
    border-radius: 2px 2px 0 0;
    transition: all 0.2s ease;
}

.futures-form .form-tab[data-form-tab="buy"]:hover {
    color: var(--ft-green);
    background: rgba(14, 203, 129, 0.04);
}

.futures-form .form-tab[data-form-tab="sell"]:hover {
    color: var(--ft-red);
    background: rgba(246, 70, 93, 0.04);
}

.futures-form .form-tab[data-form-tab="buy"].active {
    color: var(--ft-green);
    background: transparent;
}

.futures-form .form-tab[data-form-tab="buy"].active::after {
    background: var(--ft-green);
}

.futures-form .form-tab[data-form-tab="sell"].active {
    color: var(--ft-red);
    background: transparent;
}

.futures-form .form-tab[data-form-tab="sell"].active::after {
    background: var(--ft-red);
}

/* Form Container */
.futures-form .trading-form-container {
    display: none;
    flex-direction: column;
    background-color: var(--ft-bg-secondary);
    padding: 12px 14px 14px;
    overflow-y: auto;
}

.futures-form .trading-form-container.active {
    display: flex;
}

.futures-form .form-body {
    display: flex;
    flex-direction: column;
    overflow: visible;
    gap: 8px;
}

.futures-form .balance-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--ft-text-secondary);
    margin-bottom: 0;
    padding: 6px 0;
}

.futures-form .balance-display .value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: var(--ft-text-primary);
}

.futures-form .balance-display .currency {
    font-weight: 600;
    color: var(--ft-text-secondary);
    margin-left: 4px;
}

.futures-form .input-field {
    background-color: var(--ft-bg-tertiary);
    border-radius: 6px;
    padding: 0 10px;
    height: 36px;
    display: flex;
    align-items: center;
    margin-bottom: 0;
    border: 1px solid var(--ft-border);
    transition: all 0.15s ease;
}

.futures-form .input-field:hover {
    border-color: var(--ft-text-secondary);
}

.futures-form .input-field:focus-within {
    border-color: var(--ft-accent);
    box-shadow: 0 0 0 2px var(--ft-accent-glow);
}

.futures-form .field-label {
    font-size: 11px;
    color: var(--ft-text-secondary);
    width: 48px;
    flex-shrink: 0;
    font-weight: 500;
}

.futures-form .input-field input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--ft-text-primary);
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    outline: none;
    width: 0;
    min-width: 0;
}

.futures-form .input-field input::placeholder {
    color: var(--ft-text-secondary);
}

/* Hide number input spinners */
.futures-form .input-field input[type="number"]::-webkit-outer-spin-button,
.futures-form .input-field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.futures-form .input-field input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.futures-form .field-suffix {
    font-size: 11px;
    color: var(--ft-text-secondary);
    margin-left: 6px;
    width: 40px;
    text-align: right;
    font-weight: 600;
    flex-shrink: 0;
}

.futures-form .leverage-selector {
    margin-bottom: 8px;
    padding-top: 4px;
}

.futures-form .leverage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.futures-form .leverage-label {
    font-size: 12px;
    color: var(--ft-text-secondary);
    font-weight: 500;
}

.futures-form .leverage-value-box {
    display: flex;
    align-items: center;
    background: var(--ft-bg-tertiary);
    border: 1px solid var(--ft-border);
    border-radius: 6px;
    padding: 2px 8px;
    transition: all 0.2s;
}

.futures-form .leverage-value-box:focus-within {
    border-color: var(--ft-accent);
    box-shadow: 0 0 0 2px var(--ft-accent-glow);
}

.futures-form .leverage-input {
    width: 30px;
    background: transparent;
    border: none;
    color: var(--ft-text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    text-align: right;
    outline: none;
    padding: 0;
}

.futures-form .leverage-input::-webkit-outer-spin-button,
.futures-form .leverage-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.futures-form .leverage-suffix {
    color: var(--ft-text-primary);
    font-size: 13px;
    font-weight: 600;
    margin-left: 2px;
}

.futures-form .range-slider-container {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    margin: 0 4px;
}

.futures-form .slider-track-bg {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--ft-bg-tertiary);
    border-radius: 2px;
    z-index: 1;
}

.futures-form .slider-track-fill {
    position: absolute;
    left: 0;
    height: 4px;
    background: var(--ft-accent);
    border-radius: 2px;
    z-index: 2;
    pointer-events: none;
}

.futures-form .styled-slider {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    position: relative;
    z-index: 3;
    outline: none;
    margin: 0;
}

.futures-form .styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 3px solid var(--ft-accent);
    border-radius: 50%;
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.futures-form .styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.futures-form .styled-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.futures-form .leverage-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    padding: 0 4px;
}

.futures-form .leverage-markers span {
    font-size: 10px;
    color: var(--ft-text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.futures-form .leverage-markers span:hover {
    color: var(--ft-text-primary);
}

.futures-form .leverage-markers span::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: var(--ft-border);
    border-radius: 50%;
    z-index: 0;
    transition: background 0.2s ease;
}

.futures-form .leverage-markers span:hover::before {
    background: var(--ft-accent);
}

.futures-form .total-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 0;
    padding: 6px 0;
    font-weight: 500;
}

.futures-form .total-display .value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: var(--ft-text-primary);
}

.futures-form .btn-execute {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.03em;
    margin-top: 8px;
    text-transform: uppercase;
}

.futures-form .btn-execute.buy {
    background: var(--ft-green);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.futures-form .btn-execute.sell {
    background: var(--ft-red);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.futures-form .btn-execute::after {
    display: none;
}

.futures-form .btn-execute:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.futures-form .btn-execute.buy:hover {
    background: #16a34a;
    filter: none;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.futures-form .btn-execute.sell:hover {
    background: #dc2626;
    filter: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.futures-form .btn-execute:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.05s;
    box-shadow: none;
}

/* ─── Utilities ─── */
.text-up {
    color: var(--ft-green);
}

.text-down {
    color: var(--ft-red);
}

.bg-up {
    background-color: var(--ft-green);
}

.bg-down {
    background-color: var(--ft-red);
}

.desktop-only {
    /* Visible by default, hidden on mobile via media query below */
    display: flex;
}

/* ─── Interval Buttons (Chart) ─── */
.futures-chart .interval-btn {
    padding: 5px 10px;
    font-size: 12px;
    background: transparent;
    border: none;
    color: var(--ft-text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.futures-chart .interval-btn:hover {
    background: var(--ft-bg-tertiary);
    color: var(--ft-text-primary);
}

.futures-chart .interval-btn.active {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--ft-accent);
    font-weight: 600;
}

.futures-chart .chart-action-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--ft-border);
    color: var(--ft-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
}

.futures-chart .chart-action-btn:hover {
    background: var(--ft-bg-tertiary);
    color: var(--ft-text-primary);
    border-color: var(--ft-text-secondary);
}

/* ─── TP/SL Section ─── */
.tpsl-section {
    margin: 2px 0 4px;
}

.tpsl-header {
    display: flex;
    align-items: center;
}

.tpsl-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.tpsl-checkbox {
    width: 14px;
    height: 14px;
    accent-color: var(--ft-accent);
    cursor: pointer;
}

.tpsl-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ft-text-secondary);
    letter-spacing: 0.03em;
}

.tpsl-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.tpsl-input {
    padding: 7px 10px !important;
}

/* ─── Order Confirmation Modal ─── */
.modalO {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modalO.show {
    opacity: 1;
}

.modalO-content {
    background: var(--ft-bg-tertiary);
    border: 1px solid var(--ft-border);
    border-radius: 12px;
    width: 380px;
    max-width: 92%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modalO.show .modalO-content {
    transform: translateY(0) scale(1);
}

.modalO-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ft-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modalO-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--ft-text-primary);
    margin: 0;
}

.modalO-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--ft-text-secondary);
    padding: 4px;
    transition: color 0.15s;
    line-height: 1;
}

.modalO-close:hover {
    color: var(--ft-red);
}

.modalO-body {
    padding: 16px 20px 20px;
}

.order-confirm-details {
    margin-bottom: 20px;
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--ft-border);
}

.confirm-row:last-child {
    border-bottom: none;
}

.confirm-label {
    color: var(--ft-text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.confirm-value {
    font-weight: 600;
    font-size: 13px;
    color: var(--ft-text-primary);
    font-family: 'Roboto Mono', monospace;
}

.confirm-currency {
    font-size: 11px;
    color: var(--ft-text-secondary);
    font-weight: 500;
    margin-left: 4px;
}

.modalO-actions {
    display: flex;
    gap: 10px;
}

.modalO-actions .btn {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.modalO-actions .btn-outline {
    background: transparent;
    border: 1px solid var(--ft-border);
    color: var(--ft-text-primary);
}

.modalO-actions .btn-outline:hover {
    background: var(--ft-hover);
    border-color: var(--ft-text-secondary);
}

.modalO-actions .btn-primary {
    background: var(--ft-accent);
    border: none;
    color: #000;
    font-weight: 700;
}

.modalO-actions .btn-primary:hover {
    filter: brightness(1.1);
}

.modalO-actions .btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.modalO-actions .btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: #000;
    border-radius: 50%;
    animation: modal-spinner 0.8s linear infinite;
}

@keyframes modal-spinner {
    to { transform: rotate(360deg); }
}

.error-message {
    background: rgba(246, 70, 93, 0.1);
    border: 1px solid rgba(246, 70, 93, 0.3);
    color: var(--ft-red);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}

/* ─── Mobile Nav ─── */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-nav {
        display: none;
    }
}

/* ─── UI Polish & Micro-interactions ─── */

/* Smooth scrollbars throughout */
.futures-form .trading-form-container::-webkit-scrollbar,
.tab-content-container::-webkit-scrollbar {
    width: 3px;
}

.futures-form .trading-form-container::-webkit-scrollbar-track,
.tab-content-container::-webkit-scrollbar-track {
    background: transparent;
}

.futures-form .trading-form-container::-webkit-scrollbar-thumb,
.tab-content-container::-webkit-scrollbar-thumb {
    background: var(--ft-border);
    border-radius: 3px;
}

.futures-form .trading-form-container::-webkit-scrollbar-thumb:hover,
.tab-content-container::-webkit-scrollbar-thumb:hover {
    background: var(--ft-text-secondary);
}

/* Better tab active indicator */
.futures-tabs .order-tab.active {
    background: rgba(99, 102, 241, 0.06);
}

/* Active market item accent in right column */
.market-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), transparent);
}

/* Subtle hover lift on chart action buttons */
.futures-chart .chart-action-btn:active {
    transform: scale(0.92);
}

/* Better cancel-all button */
.btn-cancel-all:active {
    transform: scale(0.95);
}

/* Leverage input focus glow — defined above in .futures-form section */

/* Better input field focus for futures */
.futures-form .buy-side .input-field:focus-within {
    border-color: var(--ft-green);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.futures-form .sell-side .input-field:focus-within {
    border-color: var(--ft-red);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

/* Order book header polish */
.order-book-header,
.trades-header-row {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

/* Market selector active accent override */
.market-selector .market-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    background: var(--ft-accent);
    border-radius: 0 2px 2px 0;
}

/* Ticker stat separators */
.ticker-stats .ticker-stat + .ticker-stat {
    position: relative;
    padding-left: 20px;
}

.ticker-stats .ticker-stat + .ticker-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 1px;
    background: var(--ft-border);
}
/* ─── Compact Desktop (769–1200px) ─── */
@media (max-width: 1200px) and (min-width: 769px) {
    .futures-layout {
        grid-template-columns: 240px minmax(0, 1fr) 280px;
    }

    /* Table panels are narrower here; hide secondary columns rather than clip. */
    .positions-table th:nth-child(5),
    .positions-table td:nth-child(5),
    .positions-table th:nth-child(6),
    .positions-table td:nth-child(6),
    .orders-table th:nth-child(1),
    .orders-table td:nth-child(1),
    .orders-table th:nth-child(7),
    .orders-table td:nth-child(7) {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   Trading desk refinement — futures
   Matches the spot desk. Presentational only; every id that futures.js
   reads is untouched.
   ═══════════════════════════════════════════════════════════════════ */

/* 1. The book should hug the mid price instead of floating away from it.
   It did that with justify-content: flex-end, but a scroll container laid out
   that way clips its own start edge, and the clipped rows above it cannot be
   scrolled to — the sell book simply stopped responding to scroll-up once the
   ladder was taller than the pane. An auto margin does the same job safely: it
   absorbs the free space while the levels fit, and collapses to zero once they
   overflow, so the whole ladder becomes reachable. Spot keeps the bottom-hug by
   rendering the asks in a reversed column instead; this keeps futures' existing
   DOM order. */
.futures-book .order-book-asks {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
    overflow-y: auto;
}

.futures-book .order-book-asks > :first-child {
    margin-top: auto;
}

.futures-book .order-book-bids {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
    overflow-y: auto;
}

/* 2. Depth bars that actually read as depth. */
.futures-book .depth-bar {
    opacity: 1;
    top: 1px;
    bottom: 1px;
    border-radius: 1px;
    transition: width 180ms ease, filter 180ms ease;
}

.futures-book .ask .depth-bar {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.02) 0%, rgba(239, 68, 68, 0.13) 100%);
}

.futures-book .bid .depth-bar {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.02) 0%, rgba(34, 197, 94, 0.13) 100%);
}

.futures-book .order-book-row {
    font-variant-numeric: tabular-nums;
    line-height: 20px;
    transition: background-color 0.1s ease, box-shadow 0.1s ease;
}

.futures-book .order-book-row:hover {
    background-color: var(--ft-hover);
    box-shadow: inset 2px 0 0 var(--ft-accent);
}

.futures-book .order-book-row:hover .depth-bar {
    filter: brightness(1.45);
}

/* 3. The mid price row is the anchor of the column — make it look like one. */
.futures-book .order-book-spread {
    padding: 9px 12px;
    background: var(--ft-bg-tertiary);
    border-top: 1px solid var(--ft-border);
    border-bottom: 1px solid var(--ft-border);
}

.futures-book .spread-price {
    font-size: 16px;
}

/* 4. Bottom tabs sit together instead of stretching across the desk. */
.futures-tabs .order-tab {
    flex: 0 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
}

.futures-tabs .order-tabs {
    padding-left: 4px;
}

/* 5. Hero price: neutral until the tick direction says otherwise. */
.ticker-price {
    font-size: 20px;
    color: var(--ft-text-primary);
    background: transparent;
    border-radius: 6px;
    padding: 4px 10px;
    font-variant-numeric: tabular-nums;
}

#market-change {
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 11px;
    line-height: 1.5;
    background: var(--ft-bg-tertiary);
}

#market-change.text-up,
#market-change.positive {
    color: var(--ft-green);
    background: rgba(34, 197, 94, 0.12);
}

#market-change.text-down,
#market-change.negative {
    color: var(--ft-red);
    background: rgba(239, 68, 68, 0.12);
}

/* 6. The order form is the action surface: it goes first, the list fills below. */
.futures-form .trading-forms-wrapper {
    order: 1;
    flex: 0 0 auto;
}

.futures-form .market-selector {
    order: 2;
    height: auto;
    flex: 1 1 auto;
    min-height: 160px;
    border-bottom: none;
    border-top: 1px solid var(--ft-border);
}

.market-item+.market-item {
    box-shadow: inset 0 1px 0 var(--ft-border);
}

.market-item:hover {
    border-left-color: var(--ft-accent);
}

/* 7. OHLCV legend — futures.js writes into #chart-legend, which now exists. */
.futures-chart .chart-legend {
    top: 48px;
    left: 12px;
    gap: 12px;
    padding: 5px 10px;
    border: 1px solid var(--ft-border);
    border-radius: 6px;
    background: var(--ft-bg-secondary);
    font-family: 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
    max-width: calc(100% - 80px);
}

/* 8. Form rhythm — one spacing scale from balance to execute. */
.futures-form .form-body {
    padding: 12px;
    gap: 10px;
}

.futures-form .btn-execute {
    letter-spacing: 0.02em;
}

.futures-form .btn-execute:hover {
    filter: brightness(1.05);
}

/* Cap the depth wash so the largest level cannot blanket its own row. */
.futures-book .depth-bar {
    max-width: 45%;
}

/* ─── Order book view mode ─── */
.book-tabs {
    padding-right: 6px;
}

.book-tabs .book-tab {
    flex: 0 0 auto;
    padding: 0 14px;
}

.ob-view {
    margin-left: auto;
    align-self: center;
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--ft-bg);
    border: 1px solid var(--ft-border);
    border-radius: 6px;
}

.ob-view-btn {
    width: 24px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--ft-text-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ob-view-btn:hover {
    color: var(--ft-text-primary);
}

.ob-view-btn.active {
    color: var(--ft-accent);
    background: var(--ft-bg-secondary);
}

.ob-view-btn:focus-visible {
    outline: 2px solid var(--ft-accent);
    outline-offset: 1px;
}

.futures-book.view-bids .order-book-asks,
.futures-book.view-asks .order-book-bids {
    display: none;
}

@media only screen and (max-width: 768px) {
    .book-tabs {
        display: flex;
        height: 36px;
    }
}

/* ─── Book tabs + view control ─── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.book-tabs {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    background: var(--ft-bg-primary, #12161f);
    border-bottom: 1px solid var(--ft-border, rgba(255, 255, 255, 0.08));
    min-width: 0;
    gap: 2px;
    box-sizing: border-box;
}

.ob-caption {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ft-text-secondary, #787b86);
    margin-right: 8px;
    padding-right: 8px;
    border-right: 1px solid var(--ft-border, rgba(255, 255, 255, 0.1));
    height: 18px;
    user-select: none;
}

.book-tabs .book-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: var(--ft-text-secondary, #848e9c);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.18s ease, background-color 0.18s ease;
    border-bottom: none;
}

.book-tabs .book-tab:hover:not(.active) {
    color: var(--ft-text-primary, #ffffff);
    background: rgba(255, 255, 255, 0.03);
}

.book-tabs .book-tab.active {
    color: var(--ft-text-primary, #ffffff);
    font-weight: 700;
}

.book-tabs .book-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 8px;
    right: 8px;
    height: 2.5px;
    background: var(--ft-accent, #6366f1);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.45);
}

.book-tabs .book-tab:focus-visible {
    outline: 2px solid var(--ft-accent, #6366f1);
    outline-offset: -2px;
    border-radius: 4px 4px 0 0;
}

.book-tabs .ob-view {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 3px;
    background: var(--ft-bg-tertiary, rgba(0, 0, 0, 0.25));
    border: 1px solid var(--ft-border, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    flex: 0 0 auto;
}

.ob-view-btn {
    width: 26px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--ft-text-secondary, #787b86);
    font-size: 11px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s ease;
}

.ob-view-btn i {
    line-height: 1;
    transition: color 0.15s ease;
}

.ob-view-btn:hover:not(.active) {
    color: var(--ft-text-primary, #ffffff);
    background: rgba(255, 255, 255, 0.06);
}

.ob-view-btn[data-ob-view="both"]:hover:not(.active) i {
    color: #38bdf8;
}

.ob-view-btn[data-ob-view="bids"]:hover:not(.active) i {
    color: #10b981;
}

.ob-view-btn[data-ob-view="asks"]:hover:not(.active) i {
    color: #ef4444;
}

.ob-view-btn.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ob-view-btn[data-ob-view="both"].active i {
    color: #38bdf8;
}

.ob-view-btn[data-ob-view="bids"].active i {
    color: #10b981;
}

.ob-view-btn[data-ob-view="asks"].active i {
    color: #ef4444;
}

.ob-view-btn:focus-visible {
    outline: 2px solid var(--ft-accent, #6366f1);
    outline-offset: 1px;
}
