/* trading.css — Spot Trading */

:root {
    /* Core colors — Professional Exchange */
    --primary: #6366f1;
    --primary-light: rgba(var(--primary-rgb), 0.1);
    --primary-dark: #4f46e5;
    --primary-rgb: 99, 102, 241;
    --gradient-end: #8b5cf6;
    --text-on-primary: #ffffff;
    --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--gradient-end) 100%);
    --accent-gradient: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.1);
    --success-dark: #16a34a;
    --success-rgb: 34, 197, 94;
    --success-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);

    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --danger-dark: #dc2626;
    --danger-rgb: 239, 68, 68;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --info: #3b82f6;
    --info-rgb: 59, 130, 246;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    --border-dark: #94a3b8;

    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;

    --hover-bg: rgba(0, 0, 0, 0.03);
    --active-bg: rgba(var(--primary-rgb), 0.08);

    --orderbook-ask: rgba(239, 68, 68, 0.04);
    --orderbook-bid: rgba(34, 197, 94, 0.04);

    --chart-bg: #ffffff;
    --chart-grid: rgba(0, 0, 0, 0.03);
    --chart-tooltip-bg: #ffffff;
    --chart-tooltip-border: #e5e7eb;
    --chart-line: #6366f1;
    --chart-fill: rgba(var(--primary-rgb), 0.06);

    --skeleton-base: #e5e7eb;
    --skeleton-shine: #f3f4f6;

    --transition: all 0.15s ease;
    --transition-slow: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 8px 24px -4px rgba(0, 0, 0, 0.1);
    --shadow-color: 0 2px 8px rgba(var(--primary-rgb), 0.12);
    --shadow-glow: 0 0 20px rgba(var(--primary-rgb), 0.08);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-full: 9999px;

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    --primary-glow: 0 0 20px rgba(var(--primary-rgb), 0.3);

    --font-mono: 'Roboto Mono', 'SF Mono', 'Fira Code', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.connection-status {
    display: none;
    /* Hide by default */
}

/* Only show when we explicitly set a state */
.connection-status.connected,
.connection-status.polling,
.connection-status.disconnected {
    display: flex;
}

.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 300px;
}

.connection-status.connected {
    background-color: rgba(var(--success-rgb), 0.15);
    color: var(--success);
    border: 1px solid rgba(var(--success-rgb), 0.25);
}

.connection-status.disconnected {
    background-color: rgba(var(--danger-rgb), 0.15);
    color: var(--danger);
    border: 1px solid rgba(var(--danger-rgb), 0.25);
}

.reconnect-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.reconnect-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .connection-status {
        top: 5px;
        right: 5px;
        left: 5px;
        max-width: none;
        justify-content: center;
    }
}

/* Hide mobile order forms on desktop */
.order-forms-container-mobile {
    display: none;
}

.dark-mode {
    --primary: #818cf8;
    --primary-light: rgba(var(--primary-rgb), 0.12);
    --primary-dark: #6366f1;
    --primary-rgb: 99, 102, 241;
    --gradient-end: #8b5cf6;
    --text-on-primary: #ffffff;
    --primary-gradient: linear-gradient(135deg, var(--primary-dark) 0%, var(--gradient-end) 100%);
    --accent-gradient: linear-gradient(135deg, var(--primary-dark) 0%, #06b6d4 100%);

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.1);
    --success-dark: #16a34a;
    --success-rgb: 34, 197, 94;
    --success-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);

    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --danger-dark: #dc2626;
    --danger-rgb: 239, 68, 68;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --info: #3b82f6;
    --info-rgb: 59, 130, 246;

    --text-primary: #e4e5e7;
    --text-secondary: #9da3ae;
    --text-muted: #5d6474;

    --border-light: #1e2235;
    --border-medium: #282d3e;
    --border-dark: #363c4e;

    --bg-primary: #0e0f19;
    --bg-secondary: #141520;
    --bg-tertiary: #1a1b2e;

    --hover-bg: rgba(255, 255, 255, 0.04);
    --active-bg: rgba(var(--primary-rgb), 0.08);

    --orderbook-ask: rgba(239, 68, 68, 0.06);
    --orderbook-bid: rgba(34, 197, 94, 0.06);

    --chart-bg: #0e0f19;
    --chart-grid: rgba(255, 255, 255, 0.03);
    --chart-tooltip-bg: #141520;
    --chart-tooltip-border: #1c1f2e;
    --chart-line: #818cf8;
    --chart-fill: rgba(var(--primary-rgb), 0.08);

    --skeleton-base: #1c1f2e;
    --skeleton-shine: #252836;

    --glass-bg: rgba(14, 15, 25, 0.95);
    --glass-border: rgba(255, 255, 255, 0.04);
    --primary-glow: 0 0 16px rgba(var(--primary-rgb), 0.12);
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    line-height: 1.4;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Order update animations */
tr.highlight {
    animation: orderHighlight 1.5s ease-out;
}

@keyframes orderHighlight {
    0% {
        background-color: rgba(var(--primary-rgb), 0.2);
    }

    100% {
        background-color: transparent;
    }
}

tr.highlight td {
    font-weight: bold;
    transition: font-weight 1.5s ease-out;
}

/* Progress bar animation */
.progress-bar {
    transition: width 0.5s ease;
}

/* Show market icon only on desktop */
.market-icon.desktop-only {
    display: flex;
}

/* Hide market icon on mobile */
@media only screen and (max-width: 768px) {
    .market-icon.desktop-only {
        display: none !important;
    }

    /* Adjust the market pair container to account for missing icon */
    .market-pair-container {
        gap: 0.5rem;
    }
}

.market-link-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    text-decoration: none !important;
    /* This removes the underline */
}

.market-link-logo img {
    height: 100%;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.market-link-logo:hover img,
.market-link-logo:hover i {
    opacity: 1;
}

.market-link-logo i {
    font-size: 16px;
    color: var(--text-secondary);
    transition: color 0.2s;
    text-decoration: none !important;
    /* Ensures no underline on the icon */
}

.market-link-logo:hover i {
    color: var(--primary);
    text-decoration: none !important;
}

.market-links.desktop-only {
    display: flex;
}

/* Hide market links on mobile */
@media only screen and (max-width: 768px) {
    .market-links.desktop-only {
        display: none !important;
    }

    /* Adjust the market pair container to account for missing links */
    .market-pair-container {
        gap: 0.5rem;
    }
}

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

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

.market-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: bold;
    font-size: 0.75rem;
}

.dark-mode .market-icon {
    background-color: var(--bg-secondary);
}

.dark-mode .market-icon-fallback {
    background-color: var(--primary-dark);
    color: white;
}

/* Mobile adjustments */
@media only screen and (max-width: 768px) {
    .market-icon {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }

    .market-icon-fallback {
        font-size: 0.65rem;
    }
}

@media only screen and (max-width: 480px) {
    .market-icon {
        width: 18px;
        height: 18px;
        margin-right: 4px;
    }
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 0;
    padding-bottom: 2rem;
    /* Space for footer */
}

/* Header Styles */
.dashboard-header {
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-light);
    height: 48px;
}

.dashboard-header.scrolled {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border-bottom-color: var(--border-light);
}

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 6px;
    font-size: 1rem;
    color: white;
    transition: transform 0.15s ease;
}

.logo-container:hover .logo-icon {
    transform: scale(1.05);
}

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

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

.breadcrumb {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb i {
    margin: 0 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.header-nav .nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0;
    transition: color 0.15s ease;
    letter-spacing: 0;
    white-space: nowrap;
    position: relative;
    border-bottom: 2px solid transparent;
}

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

.header-nav .nav-link.active {
    color: var(--primary);
    background-color: transparent;
    font-weight: 600;
    border-bottom-color: var(--primary);
}

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

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

/* Favorite Button Styles */
.favorite-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.favorite-btn:hover {
    background-color: rgba(var(--warning-rgb), 0.1);
}

.favorite-btn .fa-star {
    color: var(--warning);
}

.favorite-btn .far.fa-star {
    color: var(--text-secondary);
}

.favorite-btn:hover .far.fa-star {
    color: var(--warning);
}

.favorite-btn::before {
    content: attr(aria-label);
    position: absolute;
    top: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-bg);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 100;
}

.favorite-btn:hover::before {
    opacity: 1;
}

/* market-item row styles live in the Market List section below */

.market-change {
    width: 5rem;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    margin-left: 2.0rem !important;
}

.dark-mode .favorite-btn {
    color: var(--text-muted);
}

.dark-mode .favorite-btn:hover {
    background-color: rgba(var(--warning-rgb), 0.2);
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    line-height: 1;
    white-space: nowrap;
}

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

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: button-loading-spinner 1s ease infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }

    to {
        transform: rotate(1turn);
    }
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    display: none;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: none;
}

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

.btn-outline:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-dark);
}

.btn-icon {
    padding: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 6px;
    background-color: rgba(var(--primary-rgb), 0.06);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background-color: rgba(var(--primary-rgb), 0.12);
}

/* ─── Pro-style Ticker Bar ─── */
.spot-ticker-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    height: 48px;
    transition: background-color 0.15s ease;
}

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

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

.pair-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

.market-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 13px;
    border-radius: 50%;
}

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

.ticker-pair-arrow {
    font-size: 10px;
    color: var(--text-muted);
    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(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

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

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

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

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

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

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

.picker-tabs {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-light);
    background: var(--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(--text-muted);
    transition: all 0.15s ease;
}

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

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

.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(--border-light);
    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(--bg-secondary);
}

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

.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(--bg-secondary);
    color: var(--text-muted);
    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;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.picker-item-vol {
    font-size: 10px;
    color: var(--text-muted);
    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: #0ECB81;
    background: rgba(14, 203, 129, 0.1);
}

.picker-item-change.negative {
    color: #F6465D;
    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(--text-muted);
    font-size: 12px;
}

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

.ticker-price {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    transition: color 0.3s ease, background-color 0.3s ease;
    letter-spacing: -0.03em;
    position: relative;
    padding: 4px 10px;
    border-radius: 6px;
    background: transparent;
}

.ticker-price.up {
    color: var(--success);
    background: rgba(var(--success-rgb), 0.08);
}

.ticker-price.down {
    color: var(--danger);
    background: rgba(var(--danger-rgb), 0.08);
}

.ticker-price.is-muted {
    color: var(--text-muted);
    font-weight: 500;
}

.ticker-price.flash-up {
    animation: priceFlashUp 0.5s ease-out;
}

.ticker-price.flash-down {
    animation: priceFlashDown 0.5s ease-out;
}

@keyframes priceFlashUp {
    0%   { color: var(--success); }
    100% { color: var(--text-primary); }
}

@keyframes priceFlashDown {
    0%   { color: var(--danger); }
    100% { color: var(--text-primary); }
}

.ticker-stats {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.ticker-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    position: relative;
    padding: 0 16px;
    border-left: 1px solid var(--border-light);
}

.ticker-stat:first-child {
    border-left: none;
}

.ticker-stat::before {
    display: none;
}

.stat-label {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
    line-height: 1.2;
}

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

.stat-value.text-up,
.stat-value.positive {
    color: var(--success);
}

.stat-value.text-down,
.stat-value.negative {
    color: var(--danger);
}

/* ─── Trading Content Layout ─── */
.trading-content {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 0;
    height: calc(100vh - var(--site-header-height, 64px) - 48px);
    background-color: var(--border-light);
}

.left-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    grid-column: 1;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    overflow: hidden;
}

.chart-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
    grid-column: 2;
    background-color: var(--bg-primary);
    overflow: hidden;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    grid-column: 3;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-light);
    overflow: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.right-column::-webkit-scrollbar {
    display: none;
}

/* Left Column Tabbed UI */
.left-tabs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Order Book Column Headers */
.order-book-columns {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background-color: var(--bg-primary);
}

.order-book-columns span:last-child {
    text-align: right;
}

.tabs-header {
    display: flex;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 0 12px;
    gap: 0;
}

.tab-btn {
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, background-color 0.15s ease;
    letter-spacing: 0.01em;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--primary);
}

.dark-mode .tab-btn {
    color: var(--text-muted);
}

.dark-mode .tab-btn:hover {
    color: var(--text-primary);
}

.dark-mode .tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--primary);
}

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

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ─── Tabbed Order Forms ─── */
.trading-forms-wrapper {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    order: 1;
    padding-bottom: 12px;
}

/* Tab Buttons */
.form-tabs {
    display: flex;
    padding: 0;
    gap: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.form-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.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.15s ease;
}

.form-tab[data-form-tab="buy"]:hover {
    color: var(--success);
    background: rgba(var(--success-rgb), 0.04);
}

.form-tab[data-form-tab="sell"]:hover {
    color: var(--danger);
    background: rgba(var(--danger-rgb), 0.04);
}

.form-tab[data-form-tab="buy"].active {
    color: var(--success);
}

.form-tab[data-form-tab="buy"].active::after {
    background: var(--success);
    left: 10%;
    right: 10%;
}

.form-tab[data-form-tab="sell"].active {
    color: var(--danger);
}

.form-tab[data-form-tab="sell"].active::after {
    background: var(--danger);
    left: 10%;
    right: 10%;
}

/* Form Panels */
.trading-form-container {
    display: none;
    flex-direction: column;
    background-color: var(--bg-primary);
    padding: 10px 14px 14px;
}

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

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

/* ─── Balance Display ─── */
.balance-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 0;
    padding: 6px 0;
}

.balance-display .label {
    font-weight: 500;
    margin-right: auto;
}

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

.balance-display .currency {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
}

/* ─── Input Fields ─── */
.input-field {
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    margin-bottom: 0;
    border: 1px solid var(--border-light);
    transition: border-color 0.15s ease;
    height: 36px;
}

.input-field:hover {
    border-color: var(--border-medium);
}

.input-field:focus-within {
    border-color: var(--primary);
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.08);
}

.buy-side .input-field:focus-within {
    border-color: var(--success);
    box-shadow: 0 0 0 2px rgba(var(--success-rgb), 0.08);
}

.sell-side .input-field:focus-within {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(var(--danger-rgb), 0.08);
}

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

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

.input-field input::placeholder {
    color: var(--text-muted);
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
    opacity: 0.6;
}

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

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

.field-suffix {
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: 8px;
    min-width: 36px;
    text-align: right;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ─── Percent Selector ─── */
.percent-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin: 2px 0;
    position: relative;
}

.percent-btn {
    padding: 5px 0;
    font-size: 11px;
    font-weight: 600;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.percent-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.buy-side .percent-btn:hover {
    border-color: var(--success);
    color: var(--success);
}

.sell-side .percent-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.percent-btn:active {
    transform: scale(0.96);
}

.percent-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(var(--primary-rgb), 0.25);
}

/* ─── Total Display ─── */
.total-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 0;
    padding: 8px 0 4px;
    font-weight: 500;
    border-top: 1px solid var(--border-light);
}

.total-display .label {
    font-weight: 500;
    color: var(--text-muted);
    margin-right: auto;
}

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

.total-display .currency {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
}

/* ─── Execute Buttons ─── */
.btn-execute {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.btn-execute.buy {
    background: var(--success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--success-rgb), 0.25);
}

.btn-execute.sell {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--danger-rgb), 0.25);
}

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

.btn-execute:active {
    filter: brightness(0.95);
    transform: translateY(0) scale(0.99);
    box-shadow: none;
}

.btn-execute.buy:hover {
    background: var(--success-dark);
    box-shadow: 0 4px 12px rgba(var(--success-rgb), 0.3);
}

.btn-execute.sell:hover {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px rgba(var(--danger-rgb), 0.3);
}

/* Mobile Bottom Nav — Premium */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    flex: 1;
    padding: 6px 0;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item i {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.nav-item.active {
    color: var(--primary-dark);
}

.nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.nav-item.active i {
    transform: translateY(-1px);
}

.nav-item:active {
    background: var(--hover-bg);
}

@media (max-width: 768px) {
    .trading-content {
        grid-template-columns: 1fr;
    }

    /* mobile.css handles the layout — no tab-based view switching needed */
    .mobile-nav {
        display: none;
    }
}

/* ─── Orders Login Prompt ─── */
.orders-login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px 16px 24px;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
}

.orders-login-prompt .olp-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    margin-bottom: 4px;
}

.orders-login-prompt .olp-icon i {
    font-size: 20px;
    color: var(--primary);
    opacity: 0.85;
}

.orders-login-prompt .olp-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, var(--text-color));
}

.orders-login-prompt .olp-sub {
    margin: 0;
    font-size: 11.5px;
    color: var(--text-secondary);
    max-width: 260px;
    line-height: 1.4;
}

.orders-login-prompt .olp-btns {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.orders-login-prompt .olp-login {
    padding: 6px 22px;
    font-size: 12px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
}

.orders-login-prompt .olp-login:hover {
    background: var(--primary-dark);
    filter: brightness(1.08);
}

.orders-login-prompt .olp-register {
    padding: 6px 18px;
    font-size: 12px;
    border-radius: 6px;
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
}

.orders-login-prompt .olp-register:hover {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* Card Styles */
.market-selector,
.order-book,
.recent-trades,
.open-orders,
.open-orders-mobile,
.chart-container {
    background-color: var(--bg-primary);
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.market-selector:hover,
.order-book:hover,
.recent-trades:hover,
.chart-container:hover {
    box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.04);
}

/* ─── Market Selector ─── */
.market-selector {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 160px;
    order: 2;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
    border-bottom: none;
    border-top: 1px solid var(--border-light);
}

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

.market-selector-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.market-selector-header h3 {
    display: none;
}

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

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

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

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

.search-box {
    position: relative;
    width: 100%;
}

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

.search-box input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 5px 10px 5px 30px;
    font-size: 12px;
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box:focus-within i {
    color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}



/* Add this to your CSS */
.order-book-row.latest-update {
    animation: highlightUpdate 1s ease-out;
}

@keyframes highlightUpdate {
    0% {
        background-color: rgba(var(--primary-rgb), 0.3);
    }

    100% {
        background-color: transparent;
    }
}

.order-book-asks .order-book-row.latest-update {
    animation-name: highlightAskUpdate;
}

.order-book-bids .order-book-row.latest-update {
    animation-name: highlightBidUpdate;
}

@keyframes highlightAskUpdate {
    0% {
        background-color: rgba(239, 68, 68, 0.3);
    }

    100% {
        background-color: var(--orderbook-ask);
    }
}

@keyframes highlightBidUpdate {
    0% {
        background-color: rgba(16, 185, 129, 0.3);
    }

    100% {
        background-color: var(--orderbook-bid);
    }
}

.order-book .loading {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin: 1rem;
}

/* Order book new order highlights.
 * These used to carry a background-color with !important, which wins over an
 * animation in the cascade — so the fade never ran and a flagged level sat as a
 * solid block for as long as the class was held. */
.order-book-row.bid.new-order {
    animation: bidHighlight 1.5s ease-out;
}

.order-book-row.ask.new-order {
    animation: askHighlight 1.5s ease-out;
}

@keyframes bidHighlight {
    0% {
        background-color: rgba(5, 150, 105, 0.6);
    }

    100% {
        background-color: transparent;
    }
}

@keyframes askHighlight {
    0% {
        background-color: rgba(220, 38, 38, 0.6);
    }

    100% {
        background-color: transparent;
    }
}

/* Level grouping, so a thick book can be read at a glance. The bar is a flex child of
 * .order-book, so it takes its height from the ladders rather than pushing them out. */
.book-grouping {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
}

.grouping-btn {
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    padding: 3px 7px;
}

.grouping-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
}

/* A print that just landed. The tape is keyed by trade id, so only the new row
 * animates — the rows already on screen keep their nodes and stay quiet. */
tr.new-print {
    animation: printIn 1.4s ease-out;
}

@keyframes printIn {
    0% {
        background-color: rgba(99, 102, 241, 0.35);
    }

    100% {
        background-color: transparent;
    }
}

/* Make loading message more visible */
.order-book .loading {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin: 1rem;
}

.no-orders-message {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.order-book-row.latest-update {
    animation: debugHighlight 2s ease-out;
}

/* ─── Market List ─── */
.market-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

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

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

.market-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 10px;
}

.market-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.1s ease;
    gap: 8px;
    margin-bottom: 0;
    border: none;
    border-left: 2px solid transparent;
    font-variant-numeric: tabular-nums;
}

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

.market-item.active {
    background: var(--active-bg);
    border-left-color: var(--primary);
}

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

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

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

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

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

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

.market-item .market-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 10px;
    border-radius: 50%;
}

.market-item .market-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.market-item .market-price {
    flex: 0 0 auto;
    width: auto;
    min-width: 62px;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    white-space: nowrap;
}

.market-item .market-changeB {
    flex: 0 0 auto;
    min-width: 56px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-align: right;
    border-radius: 4px;
}

.market-changeB.positive {
    color: var(--success);
    background: rgba(var(--success-rgb), 0.1);
}

.market-changeB.negative {
    color: var(--danger);
    background: rgba(var(--danger-rgb), 0.1);
}

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

.loading-markets {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
    gap: 0.5rem;
}

.loading-markets i {
    font-size: 1.25rem;
    animation: spin 1s linear infinite;
}

.order-book-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 400px;
    max-height: 550px;
    overflow: hidden;
    position: relative;
}

.order-book {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.order-book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.order-book-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.order-book-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-book-depth {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
    transition: var(--transition);
}

.order-book-depth:focus {
    border-color: var(--primary);
}

.order-book-content {
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.order-book-content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.order-book-asks {
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column-reverse;
}

.order-book-asks,
.order-book-bids {
    overflow-y: scroll;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
    padding-right: 10px;
    /* Add some padding to prevent content clipping */
    margin-right: -10px;
    /* Counteract the padding */
}

.order-book-asks::-webkit-scrollbar,
.order-book-bids::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and*/
}

/* ─── Order Book Rows with Depth Bars ─── */
.order-book-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 2px 12px;
    font-size: 11px;
    position: relative;
    cursor: pointer;
    line-height: 19px;
    font-family: 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.1s ease, box-shadow 0.1s ease;
}

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

.depth-bar {
    position: absolute;
    right: 0;
    top: 1px;
    bottom: 1px;
    z-index: 0;
    opacity: 1;
    border-radius: 1px;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ask .depth-bar {
    background: linear-gradient(90deg, rgba(var(--danger-rgb), 0.02) 0%, rgba(var(--danger-rgb), 0.13) 100%);
}

.bid .depth-bar {
    background: linear-gradient(90deg, rgba(var(--success-rgb), 0.02) 0%, rgba(var(--success-rgb), 0.13) 100%);
}

.order-book-price,
.order-book-amount,
.order-book-total {
    position: relative;
    z-index: 1;
}

.ask .order-book-price {
    color: var(--danger);
}

.bid .order-book-price {
    color: var(--success);
}

.order-book-total {
    text-align: right;
    color: var(--text-secondary);
}

.order-book-bids .order-book-row:hover {
    background-color: var(--hover-bg);
}

.order-book-price {
    font-weight: 500;
    text-align: left;
}

.order-book-asks .order-book-price {
    color: var(--danger);
}

.order-book-bids .order-book-price {
    color: var(--success);
}

.order-book-amount {
    color: var(--text-muted);
    text-align: center;
}

.order-book-total {
    text-align: right;
}

.order-book-spread {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin: 0;
    flex-shrink: 0;
    background: var(--bg-primary);
    position: relative;
}

.spread-price-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spread-price {
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    transition: color 0.2s ease;
}

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

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

.spread-price-container .price-up,
.spread-price-container .price-down {
    font-size: 11px;
    animation: spreadArrowPulse 0.6s ease-out;
}

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

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

@keyframes spreadArrowPulse {
    0% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.spread-details {
    display: flex;
    align-items: center;
}

.spread-label {
    font-weight: 500;
}

.spread-value {
    font-weight: 600;
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.spread-value.is-empty {
    background: transparent;
    padding: 1px 0;
}

/* Chart Container */
.chart-container {
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    border-bottom: none;
}

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

.chart-toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.chart-divider {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 4px;
}

/* Chart type buttons */
.chart-type-btns {
    display: flex;
    gap: 2px;
}

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

.chart-type-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.chart-type-btn.active {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.2);
    color: var(--primary);
}

/* Indicator buttons */
.chart-indicators {
    display: flex;
    gap: 2px;
}

.indicator-btn {
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
}

.indicator-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.indicator-btn.active {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary);
    color: var(--primary);
}

.market-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
    flex-wrap: wrap;
}

.market-pair-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
}

.market-pair {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    white-space: nowrap;
}

.market-change-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.market-changeB-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.market-change {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
    display: inline-block;
}

.market-change.positive {
    background-color: var(--success-light);
    color: var(--success);
}

.market-change.negative {
    background-color: var(--danger-light);
    color: var(--danger);
}

@keyframes flashGreen {
    0% {
        background-color: var(--success-light);
    }

    100% {
        background-color: transparent;
    }
}

@keyframes flashRed {
    0% {
        background-color: var(--danger-light);
    }

    100% {
        background-color: transparent;
    }
}

.market-change.up {
    animation: flashGreen 1s ease-in-out;
}

.market-change.down {
    animation: flashRed 1s ease-in-out;
}

.market-stats {
    width: 100%;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 500;
    color: var(--text-primary);
}

.stat-currency {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.chart-intervals {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.interval-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
}

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

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

.chart-actions {
    display: flex;
    gap: 4px;
}

.chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

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

.chart-action-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

#price-chart {
    width: 100% !important;
    height: 100% !important;
}

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

/* ── Empty chart overlay (no candles) ───────────────────────────── */
.chart-empty-state {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg-primary);
    color: var(--text-muted);
    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;
}

/* ── Chart legend (OHLCV on hover) ──────────────────────────────── */
.chart-legend {
    position: absolute;
    top: 8px;
    left: 12px;
    z-index: 10;
    display: flex;
    gap: 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    pointer-events: none;
    flex-wrap: wrap;
}

.chart-legend span {
    white-space: nowrap;
}

.chart-legend .legend-label {
    color: var(--text-muted);
    margin-right: 2px;
}

.chart-legend .legend-up {
    color: #10b981;
}

.chart-legend .legend-down {
    color: #ef4444;
}

/* ── Chart fullscreen ─────────────────────────────────────────────── */
.chart-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--bg-primary);
    min-height: unset;
}

.chart-wrapper.fullscreen #price-chart {
    min-height: unset;
    flex: 1;
}

.chart-wrapper.fullscreen .chart-legend {
    top: 12px;
    left: 16px;
    font-size: 12px;
}

/* ── Dark mode chart overrides ── */
.dark-mode .chart-toolbar {
    background: var(--bg-primary);
    border-bottom-color: var(--border-medium, #2a2e39);
}

.dark-mode .chart-action-btn {
    color: var(--text-secondary);
    border-color: var(--border-medium, #2a2e39);
}

.dark-mode .chart-action-btn:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.dark-mode .chart-divider {
    background: var(--border-medium, #2a2e39);
}

/* ── Chart loading spinner ── */
#price-chart:empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

#price-chart:empty::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: chart-spin 0.8s linear infinite;
}

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

/* Order Forms Container */
.order-forms-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.buy-order-form,
.sell-order-form {
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition-slow);
}

.buy-order-form {
    border-top: 2px solid var(--success);
}

.buy-order-form:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--success-rgb), 0.2);
    border-top-color: var(--success);
}

.sell-order-form {
    border-top: 2px solid var(--danger);
}

.sell-order-form:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--danger-rgb), 0.2);
    border-top-color: var(--danger);
}

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

.form-header h3 {
    margin: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-header.buy h3 {
    color: var(--success);
}

.form-header.sell h3 {
    color: var(--danger);
}

.form-header h3 i {
    font-size: 0.9rem;
}

.balance-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}

.balance-label {
    color: var(--text-muted);
}

.balance-value {
    font-weight: 500;
}

.balance-currency {
    color: var(--text-muted);
    font-weight: 500;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group {
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    background-color: var(--bg-primary);
}

.input-currency {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-actions {
    margin-top: 20px;
}

.btn-buy,
.btn-sell {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.btn-buy {
    background: var(--success-gradient);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}

.btn-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-buy:active {
    transform: translateY(0);
}

.btn-sell {
    background: var(--danger-gradient);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}

.btn-sell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-sell:active {
    transform: translateY(0);
}

.form-percentages {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 5px;
}

/* percent-btn legacy override removed — see refined version in Percent Selector section */

/* Recent Trades */
.recent-trades {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

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

.trades-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.trades-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trades-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.trades-table-container::-webkit-scrollbar {
    display: none;
}


.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.trades-table th {
    text-align: left;
    padding: 6px 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 10px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-light);
}

.trades-table td {
    padding: 2px 12px;
    font-size: 11px;
    white-space: nowrap;
    font-family: 'Roboto Mono', monospace;
    line-height: 18px;
}

.trades-table tr:last-child td {
    border-bottom: none;
}

.no-trades {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 20px;
}

.no-trades td {
    font-size: 13px;
}

.buy-trade td:first-child {
    color: var(--success);
}

.sell-trade td:first-child {
    color: var(--danger);
}

/* Open Orders */
.open-orders,
.open-orders-mobile {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.orders-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.orders-header h3::before {
    display: none;
}

.orders-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.open-orders {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 200px;
    max-height: 250px;
    overflow: hidden;
}

.orders-table-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.orders-table-container::-webkit-scrollbar {
    display: none;
}

.order-book-content,
.trades-table-container,
.orders-table-container {
    padding: 0 10px;
    margin: 0 -10px;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: fixed;
}

.orders-table th {
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    z-index: 10;
    text-align: left;
    padding: 8px 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 10px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.orders-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    font-family: 'Roboto Mono', monospace;
}

.orders-table tbody tr:hover {
    background: var(--hover-bg);
    cursor: default;
}

.orders-table tr:last-child td {
    border-bottom: none;
}

.no-orders {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 20px;
    font-size: 13px;
}

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

.order-action {
    color: var(--danger);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.15s ease;
    padding: 3px 8px;
    border-radius: 4px;
}

.order-action:hover {
    background: rgba(var(--danger-rgb), 0.1);
    text-decoration: none;
}

@keyframes priceUp {
    0% {
        color: inherit;
        background-color: transparent;
    }

    50% {
        color: #10b981;
        background-color: rgba(16, 185, 129, 0.1);
    }

    100% {
        color: inherit;
        background-color: transparent;
    }
}

@keyframes priceDown {
    0% {
        color: inherit;
        background-color: transparent;
    }

    50% {
        color: #ef4444;
        background-color: rgba(239, 68, 68, 0.1);
    }

    100% {
        color: inherit;
        background-color: transparent;
    }
}

#market-price.up {
    animation: priceUp 1s ease-in-out;
}

#market-price.down {
    animation: priceDown 1s ease-in-out;
}

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

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

/* Refresh Button */
.refresh-btn {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

/* Modal */
.modalO {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modalO.show {
    display: flex;
    opacity: 1;
}

.modalO-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-2xl);
    width: 400px;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modalO-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modalO-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

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

.modalO-body {
    padding: 15px;
}

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

.confirm-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

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

.confirm-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.confirm-value {
    font-weight: 500;
    font-size: 0.95rem;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 15px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border-light);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-icon.fa-check-circle {
    color: var(--success);
}

.toast-icon.fa-exclamation-circle {
    color: var(--danger);
}

.toast-message {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

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

.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

/* Loading states */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius-lg);
}

.loading-spinner {
    animation: spin 1s linear infinite;
    font-size: 2rem;
    color: var(--primary);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Skeleton loading animations */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-text {
    display: inline-block;
    width: 60px;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    vertical-align: middle;
}

.skeleton-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    gap: 8px;
}

.skeleton-row span {
    display: inline-block;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    flex: 1;
}

.skeleton-row span:first-child {
    max-width: 70px;
}

.skeleton-row span:nth-child(2) {
    max-width: 60px;
}

.skeleton-row span:last-child {
    max-width: 80px;
}

.skeleton-trade td {
    padding: 6px 8px;
}

.skeleton-trade td span {
    display: inline-block;
    width: 50px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Responsive adjustments */
@media (min-width: 992px) {
    .main-content {
        padding-bottom: 0;
    }

    .ticker-price {
        font-size: 22px;
        padding: 4px 12px;
    }

    .market-selector {
        flex: 1 1 auto;
        height: auto;
        max-height: none;
        min-height: 160px;
    }
}

@media (max-width: 1200px) {
    .trading-content {
        grid-template-columns: 240px 1fr 260px;
    }

    /* Narrow right rail: drop the 24h pill so pair names stay readable. */
    .market-item {
        padding: 6px 8px;
        gap: 6px;
    }

    .market-item .market-changeB {
        display: none;
    }

    .market-item .market-price {
        min-width: 54px;
    }

    /* Keep the chart toolbar on a single row instead of wrapping out of view. */
    .chart-toolbar-left {
        flex-wrap: nowrap;
    }

    .chart-toolbar .chart-indicators {
        display: none;
    }

    .chart-toolbar-left > .chart-divider:nth-child(4) {
        display: none;
    }

    .chart-toolbar .chart-intervals {
        flex-wrap: nowrap;
    }

    .chart-toolbar .interval-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
}

@media (min-width: 1200px) {
    .trading-content {
        grid-template-columns: 260px 1fr 320px;
    }
}

@media (max-width: 992px) {
    .trading-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }

    .left-column {
        grid-row: 1;
        grid-column: 1;
        border-right: none;
    }

    .chart-area {
        grid-row: 2;
        grid-column: 1;
    }

    .right-column {
        grid-row: 3;
        grid-column: 1;
        border-left: none;
    }

    .open-orders-mobile {
        display: block;
    }

    .right-column .open-orders {
        display: none;
    }

    .chart-wrapper {
        min-height: 300px;
    }

    .market-selector {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        padding: 10px;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }

    .chart-intervals {
        flex-wrap: wrap;
        justify-content: center;
    }

    .interval-btn {
        padding: 5px 8px;
        font-size: 12px;
    }

    .orders-table th,
    .orders-table td,
    .trades-table th,
    .trades-table td {
        padding: 6px;
        font-size: 12px;
    }

    .orders-table th:nth-child(1),
    .orders-table td:nth-child(1),
    .orders-table th:nth-child(6),
    .orders-table td:nth-child(6) {
        display: none;
    }

    .order-book-row:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .dark-mode .order-book-row:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .form-group input {
        padding: 8px;
    }

    .percent-btn {
        padding: 4px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {

    .orders-table th:nth-child(4),
    .orders-table td:nth-child(4) {
        display: none;
    }

    .btn-buy,
    .btn-sell {
        padding: 8px;
        font-size: 14px;
    }

    .market-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .market-stats {
        flex-direction: column;
        gap: 5px;
    }
}

/* Dark mode toggle animation */
.dark-mode-toggle {
    transition: var(--transition-bounce);
}

.dark-mode-toggle:hover {
    transform: rotate(30deg) scale(1.1);
}

/* Monospace font for numbers */
.order-book-price,
.order-book-amount,
.order-book-total {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trades-table td,
.orders-table td,
.market-price,
.market-change,
.stat-value,
.input-group input,
.confirm-value {
    font-family: 'Roboto Mono', monospace, 'Inter', sans-serif;
}

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

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

.market-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: bold;
    font-size: 0.75rem;
}

.dark-mode .market-icon {
    background-color: var(--bg-secondary);
}

.dark-mode .market-icon-fallback {
    background-color: var(--primary-dark);
    color: white;
}

/* Mobile adjustments */
@media only screen and (max-width: 768px) {
    .market-icon {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }

    .market-icon-fallback {
        font-size: 0.65rem;
    }
}

@media only screen and (max-width: 480px) {
    .market-icon {
        width: 18px;
        height: 18px;
        margin-right: 4px;
    }
}

/* Footer Styles */
.footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: 2rem 1rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    text-decoration: none;
}

.footer-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.15s ease;
}

.footer-logo:hover .footer-logo-icon {
    transform: scale(1.05);
}

.footer-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-logo-text span {
    color: var(--primary);
}

.footer-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-slow);
}

.social-link:hover {
    color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.1);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-link a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link a:hover {
    color: var(--primary);
}

.footer-bottom {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-legal-links {
    display: flex;
    gap: 1.5rem;
}

.footer-legal-link a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-legal-link a:hover {
    color: var(--primary);
}

.app-download p {
    margin: 1.5rem 0 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.app-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.app-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
}

.app-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.footer-newsletter {
    max-width: 300px;
}

.newsletter-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 1rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.newsletter-form input {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.payment-methods {
    margin-top: 1.5rem;
}

.payment-methods p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.payment-icons {
    display: flex;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Dark mode footer adjustments */
.dark-mode .footer {
    background-color: var(--bg-secondary);
    border-top-color: var(--border-medium);
}

.dark-mode .footer-description,
.dark-mode .footer-link a,
.dark-mode .footer-legal-link a,
.dark-mode .app-download p,
.dark-mode .newsletter-text,
.dark-mode .payment-methods p {
    color: var(--text-muted);
}

.dark-mode .social-link {
    background-color: var(--bg-tertiary);
}

/* Responsive footer adjustments */
@media (max-width: 1024px) {
    .footer-container {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-about,
    .footer-newsletter {
        grid-column: span 3;
    }
}

@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-about,
    .footer-newsletter {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    .footer-container {
        grid-template-columns: 1fr;
    }

    .footer-about,
    .footer-newsletter {
        grid-column: span 1;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-legal-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

.order-book-row.order-update {
    animation: orderUpdateHighlight 4s ease-out;
}

@keyframes orderUpdateHighlight {
    0% {
        background-color: rgba(var(--primary-rgb), 0.3);
    }

    100% {
        background-color: transparent;
    }
}

.order-book-row.ask.order-update {
    animation-name: askOrderUpdateHighlight;
    animation-duration: 4s;
}


.order-book-row.bid.order-update {
    animation-name: bidOrderUpdateHighlight;
    animation-duration: 4s;
}

@keyframes askOrderUpdateHighlight {
    0% {
        background-color: rgba(239, 68, 68, 0.3);
    }

    100% {
        background-color: var(--orderbook-ask);
    }
}

@keyframes bidOrderUpdateHighlight {
    0% {
        background-color: rgba(16, 185, 129, 0.3);
    }

    100% {
        background-color: var(--orderbook-bid);
    }
}

.order-book-row.order-update .order-book-price,
.order-book-row.order-update .order-book-amount,
.order-book-row.order-update .order-book-total {
    font-weight: bold;
    transition: font-weight 3s ease-out;
}

.order-book-row.ask.order-update .order-book-price {
    color: var(--danger);
}

.order-book-row.bid.order-update .order-book-price {
    color: var(--success);
}

/* Balance Notifications */
.balance-notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.balance-notification {
    padding: 12px 16px;
    border-radius: 8px;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
    transition: opacity 0.3s;
}

.balance-notification.positive {
    border-left: 4px solid var(--success);
}

.balance-notification.negative {
    border-left: 4px solid var(--danger);
}

.balance-notification .currency {
    font-weight: bold;
    color: var(--text-primary);
}

.balance-notification .amount {
    font-family: monospace;
}

.balance-notification.positive .amount {
    color: var(--success);
}

.balance-notification.negative .amount {
    color: var(--danger);
}

.balance-notification.fade-out {
    opacity: 0;
}

/* Market volume animations */
.market-volume {
    transition: all 0.3s ease;
}

/* Market volume update */
.market-volume.volume-update {
    color: var(--primary);
    font-weight: bold;
    animation: volumePulse 0.8s ease;
}

@keyframes volumePulse {
    0% {
        transform: scale(1);
        color: inherit;
    }

    50% {
        transform: scale(1.1);
        color: var(--primary);
    }

    100% {
        transform: scale(1);
        color: inherit;
    }
}

/* ─── Auth / Login Buttons ─── */
.btn-execute.buy-login,
.btn-execute.sell-login {
    opacity: 0.85;
}

.btn-execute.buy-login:hover,
.btn-execute.sell-login:hover {
    opacity: 1;
}

.header-actions .auth-buttons .btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 13px;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-slow);
    cursor: pointer;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
    position: relative;
    overflow: hidden;
}

.header-actions .auth-buttons .btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    pointer-events: none;
}

.header-actions .auth-buttons .btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
}

.header-actions .auth-buttons .btn-primary i {
    font-size: 12px;
}

/* Ensure market items don't exceed container */
.market-item {
    max-width: 100%;
}

/* ─── Spread Price — Live Market Price Colors ─── */
.spread-price {
    font-family: 'Roboto Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    transition: color 0.3s ease;
}

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

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

.price-up {
    color: var(--success);
    font-size: 11px;
    display: none;
}

.price-down {
    color: var(--danger);
    font-size: 11px;
    display: none;
}

/* ─── Chart Container — Premium Upgrade ─── */
.chart-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* chart-toolbar, chart-toolbar-left, chart-divider defined above — this section adds flex-shrink */

.chart-indicators {
    display: flex;
    gap: 2px;
}

.indicator-btn {
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
}

.indicator-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.indicator-btn.active {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.1);
}

.chart-intervals {
    display: flex;
    align-items: center;
    gap: 2px;
}

.interval-btn {
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
}

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

.interval-btn.active {
    background: var(--primary);
    color: var(--text-on-primary, #fff);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.chart-action-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
}

.chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 320px;
}

.chart-legend {
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 10;
    display: flex;
    gap: 12px;
    padding: 5px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: var(--font-mono, 'Roboto Mono', monospace);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    pointer-events: none;
    flex-wrap: wrap;
    max-width: calc(100% - 80px);
}

.chart-legend span { white-space: nowrap; }
.chart-legend .legend-label { color: var(--text-muted); margin-right: 2px; }
.chart-legend .legend-up { color: var(--success); }
.chart-legend .legend-down { color: var(--danger); }

.chart-wrapper.fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: var(--bg-primary);
    min-height: unset;
}
.chart-wrapper.fullscreen #price-chart { min-height: unset; flex: 1; }
.chart-wrapper.fullscreen .chart-legend { top: 12px; left: 16px; font-size: 12px; }

#price-chart {
    width: 100%;
    height: 100%;
}

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

/* Smooth scrollbars throughout */
.right-column::-webkit-scrollbar,
.orders-table-container::-webkit-scrollbar,
.trades-table-container::-webkit-scrollbar {
    width: 3px;
}

.right-column::-webkit-scrollbar-track,
.orders-table-container::-webkit-scrollbar-track,
.trades-table-container::-webkit-scrollbar-track {
    background: transparent;
}

.right-column::-webkit-scrollbar-thumb,
.orders-table-container::-webkit-scrollbar-thumb,
.trades-table-container::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.right-column::-webkit-scrollbar-thumb:hover,
.orders-table-container::-webkit-scrollbar-thumb:hover,
.trades-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Active tab glow */
.tab-btn.active {
    position: relative;
}

/* Chart action button press feedback */
.chart-action-btn:active,
.chart-type-btn:active {
    transform: scale(0.9);
}

/* Order book column header polish */
.order-book-columns {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    background: var(--bg-secondary);
}

/* Trades table alternating row hint */
.trades-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.01);
}

.dark-mode .trades-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

/* Form tab press feedback */
.form-tab:active {
    transform: scale(0.97);
}

/* Better balance display hover */
.balance-display:hover {
    border-color: var(--border-medium);
}

/* Total display subtle shine */
.total-display:hover {
    border-color: var(--border-medium);
}

/* Confirmation modal button polish */
.modalO-actions .btn-primary {
    transition: all 0.2s ease;
}

.modalO-actions .btn-primary:active {
    transform: scale(0.96);
}

/* Toast entrance enhancement */
.toast.show {
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   DEPTH PANEL — heatmap of resting liquidity + cumulative DOM ladder
   ══════════════════════════════════════════════════════════════════════════ */

.depth-panel {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    height: 186px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}

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

.depth-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
}

.depth-seg {
    display: flex;
    gap: 3px;
    padding: 3px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.depth-seg-btn {
    padding: 3px 10px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.depth-seg-btn:hover:not(.active) {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.depth-seg-btn.active {
    background-color: var(--primary);
    color: var(--text-on-primary);
}

.depth-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.depth-stat.bid {
    color: var(--success);
}

.depth-stat.ask {
    color: var(--danger);
}

.depth-canvas {
    display: block;
    flex: 1;
    width: 100%;
    min-height: 0;
}

.depth-action {
    color: var(--primary);
}

.chart-action-btn.depth-active {
    background-color: var(--active-bg);
    color: var(--primary);
}

.dark-mode .depth-panel {
    background-color: #0b0f1a;
}

.depth-canvas {
    background-color: var(--bg-primary);
}

/* ── Order book readability ───────────────────────────────────────────────
   The rows nearest the spread are the only prices a trader can actually
   trade against, so they carry more weight than the rest of the ladder. */
.order-book-asks > .order-book-row:first-child,
.order-book-bids > .order-book-row:first-child {
    position: relative;
    font-weight: 700;
    background: var(--hover-bg, rgba(99, 102, 241, 0.07));
}

.order-book-asks > .order-book-row:first-child .order-book-price,
.order-book-bids > .order-book-row:first-child .order-book-price {
    color: var(--danger, #ef4444);
}

.order-book-bids > .order-book-row:first-child .order-book-price {
    color: var(--success, #10b981);
}

.order-book-asks > .order-book-row:hover,
.order-book-bids > .order-book-row:hover {
    background: var(--hover-bg, rgba(99, 102, 241, 0.10));
    cursor: pointer;
}

/* The depth bar should never compete with the numbers drawn over it. */
.order-book-asks > .order-book-row .depth-bar,
.order-book-bids > .order-book-row .depth-bar {
    opacity: 1;
    border-radius: 2px;
    transition: width 180ms ease, filter 180ms ease;
}

.order-book-asks > .order-book-row:hover .depth-bar,
.order-book-bids > .order-book-row:hover .depth-bar {
    filter: brightness(1.45);
}

/* ═══════════════════════════════════════════════════════════════════
   Trading desk refinement — spot
   Presentational only: no selector used by trading.js is renamed, and
   every rule below is scoped to the three-column desk.
   ═══════════════════════════════════════════════════════════════════ */

/* The 24h change reads as a status, not a number: give it a pill. */
#market-change {
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 11px;
    line-height: 1.5;
    background: var(--bg-tertiary);
}

#market-change.text-up,
#market-change.positive {
    color: var(--success);
    background: rgba(var(--success-rgb), 0.12);
}

#market-change.text-down,
#market-change.negative {
    color: var(--danger);
    background: rgba(var(--danger-rgb), 0.12);
}

/* A book that fills its column should still say it is scrollable. */
.market-list {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

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

.market-list::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 10px;
}

.market-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

/* Row separators so a long list stays scannable. */
.market-item+.market-item {
    box-shadow: inset 0 1px 0 var(--border-light);
}

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

/* Keep the mid-price row visually attached to the book above and below. */
.order-book-spread {
    padding: 8px 12px;
    background: var(--bg-secondary);
}

.dark-mode .order-book-spread {
    background: var(--bg-tertiary);
}

/* Order form: one rhythm for label → field → total → action. */
.trading-forms-wrapper .form-body {
    padding: 12px;
    gap: 10px;
}

.trading-forms-wrapper .input-field {
    border-radius: var(--radius-md);
}

.trading-forms-wrapper .percent-btn {
    border-radius: var(--radius-sm);
}

/* The execute button is the only filled surface in the column — let it own it. */
.btn-execute {
    letter-spacing: 0.02em;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06) inset;
}

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

/* Bottom panel: keep the chart the dominant surface. */
.open-orders {
    flex: 0 0 auto;
    max-height: 230px;
    border-top: 1px solid var(--border-light);
}

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

/* ─── Order book view mode ─── */
.ob-view {
    margin-left: auto;
    align-self: center;
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    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(--text-muted);
    font-size: 10px;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

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

.ob-view-btn.active {
    color: var(--primary);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

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

/* One side hidden: the survivor takes the column, mid price stays adjacent. */
.order-book.view-bids .order-book-asks,
.order-book.view-asks .order-book-bids {
    display: none;
}

.order-book.view-bids .order-book-content {
    grid-template-rows: auto 1fr;
}

.order-book.view-asks .order-book-content {
    grid-template-rows: 1fr auto;
}

@media only screen and (max-width: 768px) {
    .ob-view {
        margin-right: 2px;
    }
}

/* ─── Tabs header + book view control ─── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.tabs-header {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-primary, #12161f);
    border-bottom: 1px solid var(--border-light, 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(--text-muted, #787b86);
    margin-right: 8px;
    padding-right: 8px;
    border-right: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    height: 18px;
    user-select: none;
}

.tabs-header .tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: var(--text-muted, #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;
}

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

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

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

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

.tabs-header .ob-view {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 3px;
    background: var(--bg-tertiary, rgba(0, 0, 0, 0.25));
    border: 1px solid var(--border-light, 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(--text-muted, #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(--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(--primary, #6366f1);
    outline-offset: 1px;
}

/* ── 2026-11-06 polish: tap targets, focus, numbers ───────────────────────
   Book-grouping and indicator chips were 19–21px tall, below a usable click
   target; inputs had no visible keyboard focus; changing numbers jittered
   because digits were proportional. */
.grouping-btn, .indicator-btn, .interval-btn, .chart-type-btn, .refresh-btn, .percent-btn {
    min-height: 26px;
    min-width: 28px;
}
@media (pointer: coarse) {
    .grouping-btn, .indicator-btn, .interval-btn, .chart-type-btn, .refresh-btn,
    .percent-btn, .percentage-btn, .pct-btn, .leverage-preset, .cancel-btn, .cancel-order-btn {
        min-height: 34px;
    }
}
.order-book-asks, .order-book-bids, .orders-table td, .trades-table td,
#buy-total, #sell-total, .spread-price, .ticker-price {
    font-variant-numeric: tabular-nums;
}
input[type="number"]:focus-visible, .input-field input:focus-visible,
button:focus-visible, [role="button"]:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.85);
    outline-offset: 1px;
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.order-book-asks > *, .order-book-bids > * { cursor: pointer; }
.order-book-asks > *:hover, .order-book-bids > *:hover { background-color: rgba(148, 163, 184, 0.08); }
@media (prefers-reduced-motion: reduce) {
    .order-book-asks *, .order-book-bids *, .trades-table * { transition: none !important; animation: none !important; }
}
