@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Base dark colors */
    --bg-base: #06090e;
    --bg-gradient: radial-gradient(circle at top right, #101c2a 0%, #06090e 100%);

    /* Text */
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Neon Accents */
    --neon-green: #10b981;
    --neon-blue: #3b82f6;
    --neon-red: #ef4444;
    --neon-yellow: #f59e0b;

    /* Premium Glassmorphism */
    --glass-bg: rgba(16, 24, 38, 0.4);
    --glass-bg-hover: rgba(26, 38, 58, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);

    /* Sizes */
    --font-size-small: 12px;
    --font-size-medium: 13px;
    --font-size-large: 15px;

    color-scheme: dark;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body {
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Theme: Darker */
body.theme-darker {
    --bg-base: #030508;
    --bg-gradient: radial-gradient(circle at top right, #0a1018 0%, #030508 100%);
    --glass-bg: rgba(8, 12, 20, 0.6);
    --glass-bg-hover: rgba(14, 22, 36, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* Theme: AMOLED */
body.theme-amoled {
    --bg-base: #000000;
    --bg-gradient: none;
    --glass-bg: rgba(5, 5, 5, 0.9);
    --glass-bg-hover: rgba(15, 15, 15, 0.9);
    --glass-border: rgba(255, 255, 255, 0.04);
    -moz-osx-font-smoothing: grayscale;
}

/* Loading shimmer for empty chart bodies */
.mc-chart-body:empty::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 30%,
        rgba(255, 255, 255, 0.02) 50%,
        transparent 70%
    );
    background-size: 200% 100%;
    animation: mc-shimmer 1.8s ease-in-out infinite;
}

@keyframes mc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Custom Premium Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Header */
.top {
    padding: 0 20px;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(6, 9, 14, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tabs {
    display: flex;
    gap: 2px;
    margin-left: 8px;
}

.tab {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.2px;
    font-family: inherit;
}

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

.tab.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--neon-blue);
}

.status {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-text {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 10px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Layout */
.layout {
    display: flex;
    min-height: calc(100vh - 54px);
}

/* Old left sidebar removed — settings now via right slide-out panel */

/* Volume Indicator */
.vol-indicator {
    display: flex;
    width: 90px;
    height: 14px;
    gap: 2px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.vol-block {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}

.vol-block.high {
    background: var(--neon-red);
    box-shadow: 0 0 5px var(--neon-red);
}

.vol-block.med {
    background: var(--neon-yellow);
    box-shadow: 0 0 5px var(--neon-yellow);
}

.vol-block.low {
    background: var(--neon-green);
    box-shadow: 0 0 5px var(--neon-green);
}

.modal-body label input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: var(--font-size-medium);
    transition: all 0.2s ease;
    outline: none;
}

.modal-body label input:hover,
.modal-body label input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.btn-primary,
.modal-footer .btn-primary {
    width: 100%;
    height: 40px;
    margin-top: 10px;
    border: none;
    background: var(--neon-blue);
    color: #fff;
    font-size: var(--font-size-medium);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover,
.modal-footer .btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}

.btn-secondary,
.modal-footer .btn-secondary {
    width: 100%;
    height: 40px;
    margin-top: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: var(--font-size-medium);
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover,
.modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main {
    flex: 1;
    padding: 24px;
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-medium);
}

.table th,
.table td {
    padding: 12px 10px;
    text-align: left;
    white-space: nowrap;
}

.table th {
    color: var(--text-secondary);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}

.table th:hover {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
}

/* Sticky First Column for desktop table */
.table th:first-child,
.table td:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    background: #0d141e;
}

.table th:first-child {
    z-index: 30;
    /* Header stays strictly on top */
    background: rgba(0, 0, 0, 0.8);
}

.table tr {
    transition: background 0.2s;
}

.table tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.table tr.isMM {
    background: rgba(16, 185, 129, 0.05);
}

.table tr.isMM:hover {
    background: rgba(16, 185, 129, 0.08);
}

.table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sym {
    font-weight: 600;
    color: var(--text-primary);
}

/* Severity badges */
.sev-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}
.sev-s { background: rgba(239,68,68,0.2); color: #ef4444; }
.sev-m { background: rgba(234,179,8,0.2); color: #eab308; }
.sev-l { background: rgba(100,116,139,0.15); color: #94a3b8; }

.score {
    color: var(--neon-yellow);
    font-weight: 600;
}

/* Watchlist button */
.btn-star {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-star:hover {
    color: var(--neon-yellow);
    transform: scale(1.1);
}

.btn-star.active {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

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

/* Error and status */
.error {
    padding: 16px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin: 16px 0;
    color: var(--neon-red);
    backdrop-filter: var(--glass-blur);
}

.error.hidden {
    display: none;
}

.status-text.loading {
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

.btn-filters {
    display: none;
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: var(--font-size-medium);
    cursor: pointer;
    backdrop-filter: var(--glass-blur);
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: #0d141e;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background-image: linear-gradient(rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0));
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
}

/* Mobile Cards Component */
.cards-container {
    display: none;
}

/* ===== MOBILE HEADER ===== */
@media screen and (max-width: 600px) {
    .top {
        padding: 0 10px;
        height: 44px;
        gap: 6px;
    }
    .brand {
        display: none;
    }
    .tabs {
        margin-left: 0;
        gap: 1px;
        flex: 1;
    }
    .tab {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        text-align: center;
        min-height: 36px;
    }
    .status {
        gap: 4px;
    }
}

@media screen and (max-width: 900px) {
    .btn-filters {
        display: none !important;
        /* Hide old bottom filter button */
    }

    .layout {
        flex-direction: column;
    }

    .table-container {
        display: none !important;
    }

    .cards-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        padding: 0 !important;
    }

    .main {
        padding: 16px;
    }

    .card {
        background: var(--glass-bg);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        border-radius: 12px;
        border: 1px solid var(--glass-border);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        overflow: hidden;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .card:active {
        transform: scale(0.98);
    }

    .card.isMM {
        border-color: rgba(16, 185, 129, 0.3);
        box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
    }

    .card-header {
        padding: 12px 16px;
        background: rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid var(--glass-border);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .card-header a {
        color: var(--text-primary);
        font-weight: 600;
        font-size: 15px;
        text-decoration: none;
    }

    .mm-badge {
        font-size: 10px;
        padding: 2px 6px;
        border-radius: 4px;
        background: rgba(16, 185, 129, 0.15);
        color: var(--neon-green);
        border: 1px solid rgba(16, 185, 129, 0.3);
        font-weight: 700;
        display: none;
    }

    .mm-badge.active {
        display: inline-block;
    }

    .card-body {
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 13px;
    }

    .card-row.bid {
        background: rgba(239, 68, 68, 0.05);
        padding: 8px 10px;
        border-radius: 8px;
        border-left: 3px solid var(--neon-red);
    }

    .card-row.ask {
        background: rgba(16, 185, 129, 0.05);
        padding: 8px 10px;
        border-radius: 8px;
        border-left: 3px solid var(--neon-green);
    }

    .card-row.isMM {
        border-left-width: 4px;
        box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02);
    }

    .card-row .label {
        color: var(--text-secondary);
        font-size: 12px;
    }

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

    .card-row .value .dist {
        color: var(--text-muted);
        font-size: 11px;
        margin-left: 6px;
    }

    .card-row .notional {
        font-family: monospace;
        font-weight: 600;
    }
}

@media screen and (min-width: 901px) {
    /* Main left padding is no longer needed since sidebar is overlay */
}

/* ============================================
   Mini-Charts Tab — Professional Screener UI
   ============================================ */

/* Global Toolbar */
.mc-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: rgba(8, 12, 21, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    z-index: 40;
    position: relative;
    overflow: visible;
}

.mc-toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mc-density-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s;
    user-select: none;
}

.mc-density-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.mc-density-toggle input[type="checkbox"] {
    accent-color: var(--accent, #6c5ce7);
    width: 13px;
    height: 13px;
    cursor: pointer;
}

.mc-toolbar-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.mc-tf-buttons {
    display: flex;
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.mc-tf-btn {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    letter-spacing: 0.3px;
}

.mc-tf-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.mc-tf-btn.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.85);
    box-shadow: 0 1px 6px rgba(59, 130, 246, 0.35);
}

.mc-toolbar-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0 2px;
}

.mc-select {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.mc-select:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.mc-select:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.mc-refresh-btn {
    padding: 4px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.mc-refresh-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.mc-status {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ========== Layout Picker ========== */
.mc-layout-picker {
    display: flex;
    align-items: center;
    gap: 4px;
}
.mc-layout-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.mc-layout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
}
.mc-layout-btn.active {
    background: rgba(59,130,246,0.15);
    border-color: rgba(59,130,246,0.4);
    color: #60a5fa;
}

/* ========== Multi-Chart Container ========== */
.mch-container {
    height: calc(100vh - 140px);
    overflow: hidden;
    background: var(--bg-base);
    display: flex;
}
.mch-grid {
    flex: 1;
    display: grid;
    gap: 2px;
    min-width: 0;
    min-height: 0;
}
.mch-grid[data-layout="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}
.mch-grid[data-layout="2"], .mch-grid[data-layout="2h"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}
.mch-grid[data-layout="2v"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}
.mch-grid[data-layout="4"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.mch-grid[data-layout="1+3"] {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.mch-grid[data-layout="1+3"] .mch-slot:first-child {
    grid-row: 1 / 3;
}

/* Individual chart slot */
.mch-slot {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    overflow: hidden;
    min-height: 0;
}
.mch-slot.active {
    border-color: rgba(59,130,246,0.4);
}
.mch-slot-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--glass-border);
    font-size: 12px;
    flex-shrink: 0;
}
.mch-slot-sym {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}
.mch-slot-price {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.mch-slot-change {
    font-size: 11px;
    font-weight: 500;
}
.mch-slot-tf {
    margin-left: auto;
    display: flex;
    gap: 2px;
}
.mch-slot-tf .mc-tf-btn {
    font-size: 10px;
    padding: 2px 5px;
}
.mch-slot-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    opacity: 0.5;
    flex: 1;
}
.mch-slot-chart {
    flex: 1;
    min-height: 0;
    position: relative;
}

/* Charts + Sidebar Layout */
.mc-layout {
    display: flex;
    height: calc(100vh - 140px);
    overflow: hidden;
    background: var(--bg-base);
}

.mc-charts-area {
    flex: 1;
    min-width: 0;
    padding: 4px;
    overflow-y: auto;
}

.mc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 270px;
    gap: 3px;
}

/* Individual chart card */
.mc-chart-card {
    background: rgba(12, 17, 28, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mc-chart-card:hover {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.06), 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.mc-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mc-chart-header:hover {
    background: rgba(59, 130, 246, 0.06);
}

.mc-chart-header:hover .mc-chart-symbol {
    color: var(--neon-blue);
}

.mc-chart-symbol {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    transition: color 0.15s ease;
}

.mc-chart-metrics {
    display: flex;
    gap: 8px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.mc-metric-green {
    color: #22c55e;
    font-weight: 600;
}

.mc-metric-red {
    color: #ef4444;
    font-weight: 600;
}

.mc-metric-muted {
    color: var(--text-muted);
    font-weight: 500;
}

.mc-chart-body {
    flex: 1;
    min-height: 120px;
    position: relative;
}

/* Sidebar */
.mc-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: rgba(8, 12, 21, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mc-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.15);
}

.mc-sidebar-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.mc-sidebar-count {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Search input */
.mc-search-wrap {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    position: relative;
}

.mc-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 11px;
    padding: 6px 8px 6px 26px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.mc-search-wrap::before {
    content: '⌕';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
    opacity: 0.6;
}

.mc-search-input:focus {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

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

/* Color flags — bar style like TradingView */
.mc-flag-btn {
    width: 4px;
    height: 100%;
    min-height: 24px;
    border-radius: 2px 0 0 2px;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 8px;
    padding: 0;
    transition: all 0.12s ease;
    position: relative;
}

.mc-flag-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    width: 4px;
}

.mc-flag-btn.flagged {
    width: 4px;
    border-radius: 2px;
}

/* Flag color picker popup */
.mc-flag-popup {
    position: absolute;
    left: 0;
    top: 18px;
    z-index: 500;
    background: rgba(15, 20, 30, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: mc-flag-pop 0.12s ease-out;
}

@keyframes mc-flag-pop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.mc-flag-color {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.1s ease;
}

.mc-flag-color:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.mc-flag-clear {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 0;
}

.mc-flag-clear:hover {
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.mc-coin-list {
    flex: 1;
    overflow-y: auto;
}

.mc-coin-item {
    display: grid;
    grid-template-columns: 20px 1fr 18px 16px 50px 34px 40px;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 11px;
    gap: 0;
}

.mc-coin-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.mc-coin-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--neon-blue);
}

.mc-coin-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
    letter-spacing: 0.2px;
    min-width: 40px;
}

.mc-copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 1px 2px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.mc-coin-item:hover .mc-copy-btn,
.mc-chart-header:hover .mc-copy-btn {
    opacity: 0.7;
}

.mc-copy-btn:hover {
    opacity: 1 !important;
    color: var(--neon-blue);
}

.mc-copy-ok {
    opacity: 1 !important;
    color: var(--neon-green) !important;
}

.mch-copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 3px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.mch-copy-btn:hover {
    opacity: 1;
    color: var(--neon-blue);
}
}

.mc-coin-price {
    color: var(--text-secondary);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    flex: 1;
    text-align: right;
}

.mc-coin-change {
    font-weight: 600;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.mc-coin-natr {
    color: #a78bfa;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.mc-sort-sr-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}
.mc-sort-sr-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}
.mc-sort-sr-btn.active {
    background: rgba(99, 102, 241, 0.5);
    color: #fff;
    border-color: #818cf8;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.mc-coin-vol {
    color: var(--text-muted);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.mc-coin-sig {
    font-size: 10px;
    font-weight: 600;
    color: #ef4444;
    text-align: right;
    min-width: 18px;
}

/* Column headers — same grid as .mc-coin-item but Coin spans first 4 cols */
.mc-col-headers {
    display: grid;
    grid-template-columns: 20px 1fr 18px 16px 50px 34px 40px;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    user-select: none;
}
.mc-col-hdr:first-child {
    grid-column: 1 / 5;
}
.mc-col-hdr {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: color 0.15s;
    text-align: right;
    padding: 2px 2px;
    border-left: 1px solid rgba(255,255,255,0.06);
}
.mc-col-hdr:first-child {
    text-align: left;
    border-left: none;
}
.mc-col-hdr:hover { color: var(--text-secondary); }
.mc-col-hdr.active { color: #818cf8; }
.mc-col-hdr.active.desc::after { content: ' ▼'; font-size: 7px; }
.mc-col-hdr.active.asc::after { content: ' ▲'; font-size: 7px; }

/* Coin Detail Modal */
.mc-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: mc-modal-in 0.2s ease-out;
}

@keyframes mc-modal-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mc-modal.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.mc-modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.mc-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    max-height: 900px;
    background: #080c15;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04);
    animation: mc-modal-slide 0.25s ease-out;
}

@keyframes mc-modal-slide {
    from { transform: translateY(12px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.mc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
}

.mc-modal-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.cm-metrics {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 4px;
}

.cm-metric {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}


.mc-modal-sym {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.mc-modal-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.mc-chart-countdown {
    font-size: 12px;
    color: #f59e0b;
    font-variant-numeric: tabular-nums;
    font-family: monospace;
    padding: 2px 8px;
    margin-left: 8px;
}

.mc-modal-change {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mc-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.mc-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.mc-modal-toolbar {
    display: flex;
    align-items: center;
    padding: 6px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    gap: 6px;
}

.mc-modal-tf {
    display: flex;
    gap: 2px;
    align-items: center;
}

.dt-tools {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(15, 20, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
    backdrop-filter: blur(8px);
}

.dt-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dt-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.dt-btn.dt-active {
    background: rgba(59, 130, 246, 0.2);
    color: #5b9cf6;
}

.dt-btn[data-tool="trash"] {
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 4px;
    height: 36px;
}

.dt-btn[data-tool="trash"]:hover {
    color: #ef4444;
}

/* Compact drawing toolbar inside multi-chart slots */
.mch-slot-chart .dt-tools {
    left: 4px;
    top: 8px;
    transform: none;
    padding: 2px;
    gap: 1px;
    border-radius: 6px;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.mch-slot-chart:hover .dt-tools,
.mch-slot-chart .dt-tools:hover {
    opacity: 1;
}
.mch-slot-chart .dt-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
}
.mch-slot-chart .dt-btn svg {
    width: 14px;
    height: 14px;
}
.mch-slot-chart .dt-divider {
    margin: 2px 0;
}
.mch-slot-chart .dt-btn[data-tool="trash"] {
    height: 26px;
    margin-top: 2px;
    padding-top: 2px;
}

/* Mini-chart drawing toolbar — ultra-compact, hidden until hover */
.mc-chart-body .dt-tools {
    left: 2px;
    top: 4px;
    transform: none;
    padding: 2px;
    gap: 0px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.mc-chart-body:hover .dt-tools {
    opacity: 0.7;
    pointer-events: auto;
}
.mc-chart-body .dt-tools:hover {
    opacity: 1;
}
.mc-chart-body .dt-btn {
    width: 20px;
    height: 20px;
    font-size: 10px;
    border-radius: 3px;
}
.mc-chart-body .dt-btn svg {
    width: 12px;
    height: 12px;
}
.mc-chart-body .dt-divider {
    margin: 1px 0;
}
.mc-chart-body .dt-btn[data-tool="trash"] {
    height: 22px;
    margin-top: 1px;
    padding-top: 1px;
}

.dt-separator {
    display: none;
}
.dt-divider {
    width: 24px;
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 3px 0;
}
.dt-magnet.dt-active {
    color: #3b82f6;
    background: rgba(59,130,246,0.15);
}

/* Drawing edit panel */
.draw-panel {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    animation: mc-flag-pop 0.12s ease-out;
}

.draw-panel-colors {
    display: flex;
    gap: 4px;
}

.draw-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.1s ease;
}

.draw-color-dot:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.draw-color-dot.draw-color-active {
    border-color: #fff;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

.draw-panel-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    line-height: 1;
}

.draw-panel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.draw-panel-delete:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Fib levels popup */
.fib-levels-popup {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 250;
    background: rgba(15, 20, 30, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    min-width: 180px;
    animation: mc-flag-pop 0.12s ease-out;
}

.fib-popup-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fib-popup-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fib-level-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fib-level-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, transform 0.1s;
}

.fib-level-color:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.15);
}

.fib-color-picker {
    position: absolute;
    z-index: 260;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    background: rgba(10, 14, 22, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
    width: 112px;
    animation: mc-flag-pop 0.1s ease-out;
}

.fib-color-opt {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.1s, transform 0.1s;
}

.fib-color-opt:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

.fib-color-opt.active {
    border-color: #fff;
}

.fib-level-input {
    width: 70px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 4px 6px;
    text-align: right;
    font-family: var(--font-mono);
}

.fib-level-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
}

.fib-level-pct {
    font-size: 11px;
    color: var(--text-muted);
}

.fib-level-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}

.fib-level-remove:hover {
    color: #ef4444;
}

.fib-popup-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.fib-popup-btn {
    flex: 1;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.fib-popup-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.fib-apply-btn {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #5b9cf6;
}

.fib-apply-btn:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* Alert button active state */
.draw-alert-active {
    color: #eab308 !important;
    background: rgba(234, 179, 8, 0.15) !important;
    border-color: rgba(234, 179, 8, 0.3) !important;
}

/* Alert Toast — bottom right */
.alert-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 260px;
    max-width: 340px;
    background: rgba(15, 20, 30, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid #5b9cf6;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    animation: toast-slide-in 0.3s ease-out;
    backdrop-filter: blur(12px);
    transition: opacity 0.3s, transform 0.3s;
}

.alert-toast:hover {
    background: rgba(25, 30, 45, 0.98);
    transform: translateX(-4px);
}

.alert-toast + .alert-toast {
    margin-bottom: 8px;
    bottom: calc(20px + var(--toast-offset, 0px));
}

.alert-toast:nth-last-child(2) { bottom: 90px; }
.alert-toast:nth-last-child(3) { bottom: 160px; }
.alert-toast:nth-last-child(4) { bottom: 230px; }
.alert-toast:nth-last-child(5) { bottom: 300px; }

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(80px); }
    to { opacity: 1; transform: translateX(0); }
}

.alert-toast-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.alert-toast-icon {
    font-size: 14px;
}

.alert-toast-sym {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
}

.alert-toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.alert-toast-close:hover {
    color: var(--text-primary);
}

.alert-toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-toast-dir {
    font-size: 12px;
    font-weight: 600;
}

.alert-toast-price,
.alert-toast-current {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.alert-toast-price b,
.alert-toast-current b {
    color: var(--text-primary);
}

.mc-modal-chart {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #060a12;
}

/* Chart loader / error overlay */
.cm-chart-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    color: #64748b;
    font-size: 13px;
    background: #060a12;
}
.cm-chart-loader.hidden { display: none; }
.cm-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(100,116,139,0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cm-spin 0.8s linear infinite;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }
.cm-chart-error {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
}
.cm-chart-error button {
    margin-top: 8px;
    padding: 4px 16px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.cm-chart-error button:hover {
    background: #334155;
    color: #e2e8f0;
}

/* OHLCV Legend (crosshair data) */
.mc-ohlcv-legend {
    position: absolute;
    top: 6px;
    left: 8px;
    z-index: 30;
    display: none;
    gap: 10px;
    font-size: 11px;
    font-family: 'Inter', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    pointer-events: none;
    background: rgba(6, 10, 18, 0.75);
    padding: 3px 8px;
    border-radius: 4px;
}

.mc-ohlcv-legend b {
    font-weight: 600;
}

/* old .mc-modal-stats and .mc-modal-links removed — now inline in header */

@media screen and (max-width: 768px) {
    .mc-modal {
        padding: 0;
    }
    .mc-modal-content {
        width: 100%;
        height: 100vh;
        max-height: none;
        max-width: none;
        border-radius: 0;
        border: none;
    }
    .mc-modal-header {
        padding: 10px 14px;
    }
    .mc-modal-sym {
        font-size: 15px;
    }
    .mc-modal-price {
        font-size: 13px;
    }
    .mc-modal-toolbar {
        padding: 5px 10px;
        gap: 4px;
        flex-wrap: wrap;
    }
    .dt-tools {
        left: 4px;
        padding: 3px;
        gap: 1px;
    }
    .dt-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    .mc-tf-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    .mc-modal-header {
        flex-wrap: wrap;
        padding: 10px 14px;
    }
    .mc-modal-title {
        gap: 8px;
    }
    .cm-metrics {
        gap: 6px;
        flex-basis: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
    .draw-panel {
        top: 4px;
        right: 4px;
        padding: 5px 8px;
    }
    .draw-color-dot {
        width: 20px;
        height: 20px;
    }
}

/* Grid columns controlled by settings (JS inline style).
   No media overrides — user picks cards per row in Settings. */

/* Hamburger button — hidden on desktop */
.mc-sidebar-toggle {
    display: none;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    width: 32px; height: 32px;
    border-radius: 6px;
    cursor: pointer;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.mc-sidebar-toggle:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

/* Sidebar overlay — hidden by default */
.mc-sidebar-overlay {
    display: none;
}

@media screen and (max-width: 768px) {
    .mc-sidebar-toggle {
        display: flex;
    }
    .mc-layout {
        flex-direction: column;
        height: auto;
        max-height: calc(100vh - 140px);
    }
    .mc-sidebar {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 280px;
        height: 100vh;
        z-index: 200;
        background: rgba(8, 12, 21, 0.98);
        border-right: 1px solid rgba(255,255,255,0.08);
        box-shadow: 4px 0 24px rgba(0,0,0,0.6);
        transition: transform 0.25s ease;
    }
    .mc-sidebar.mobile-open {
        display: flex;
    }
    .mc-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 199;
    }
    .mc-sidebar-overlay.active {
        display: block;
    }
    .mc-hide-mobile {
        display: none !important;
    }
    .mc-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 220px;
    }
    .mc-charts-area {
        flex: 1;
        overflow-y: auto;
    }
    .mc-toolbar {
        gap: 6px;
        padding: 6px 10px;
    }
    .mc-chart-header {
        padding: 6px 10px;
    }
    .mc-chart-metrics {
        gap: 6px;
    }
}

/* ===== AUTH STYLES ===== */

.auth-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s;
    position: relative;
    margin-left: 8px;
    padding: 0;
}
.auth-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.auth-btn.logged-in {
    width: auto;
    padding: 0 8px;
    gap: 4px;
}

.auth-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-tier-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 1px 4px;
    border-radius: 3px;
}
.auth-tier-badge.pro { background: #f59e0b; color: #000; }
.auth-tier-badge.admin { background: #ef4444; color: #fff; }

/* Auth Modal */
.auth-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.auth-modal.hidden { display: none; }
.auth-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.auth-modal-box {
    position: relative;
    background: #1a1e26;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.15s;
}
.auth-modal-close:hover { color: #fff; }

.auth-modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.auth-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.auth-tab:hover { color: var(--text-secondary); }
.auth-tab.active { color: #6366f1; border-bottom-color: #6366f1; }

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.auth-error.hidden { display: none; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }
.auth-field label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}
.auth-field input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.auth-field input:focus { border-color: #6366f1; }
.auth-field input::placeholder { color: rgba(255,255,255,0.2); }

.auth-submit {
    width: 100%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 11px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 4px;
    transition: opacity 0.15s;
}
.auth-submit:hover { opacity: 0.9; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.08);
}
.auth-divider.hidden { display: none; }

.auth-google-btn {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
}
.auth-google-btn:hover { background: rgba(255,255,255,0.1); }
.auth-google-btn.hidden { display: none; }

/* Profile view (when logged in) */
.auth-profile { margin-bottom: 16px; }
.auth-profile-info {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.auth-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.auth-profile-name { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.auth-profile-email { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.auth-profile-tier { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-profile-tier .pro { color: #f59e0b; font-weight: 700; }
.auth-profile-tier .admin { color: #ef4444; font-weight: 700; }
.auth-profile-tier .free { color: var(--text-secondary); }

.auth-logout-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-size: 14px;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.auth-logout-btn:hover { background: rgba(239, 68, 68, 0.2); }

/* PRO upgrade toast */
.pro-upgrade-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #c7d2fe;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    z-index: 99999;
    animation: toastIn 0.3s ease;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ===== SETTINGS PANEL ===== */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9000;
}
.settings-overlay.hidden { display: none; }

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 95vw;
    height: 100vh;
    background: #12161c;
    border-left: 1px solid rgba(255,255,255,0.06);
    z-index: 9001;
    display: flex;
    flex-direction: column;
    animation: spSlideIn 0.2s ease;
    overflow: hidden;
}
.settings-panel.hidden { display: none; }
@keyframes spSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.sp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sp-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary); flex: 1; }
.sp-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 22px; cursor: pointer; transition: color 0.15s;
}
.sp-close:hover { color: #fff; }
.sp-back {
    background: none; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; padding: 0 4px;
}
.sp-back.hidden { display: none; }

.sp-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Navigation */
.sp-nav {
    width: 130px;
    min-width: 130px;
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 12px 0;
    overflow-y: auto;
    flex-shrink: 0;
}
.sp-nav.hidden { display: none; }
.sp-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.sp-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-secondary); }
.sp-nav-item.active { background: rgba(99, 102, 241, 0.1); color: #818cf8; border-right: 2px solid #6366f1; }
.sp-nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* Content */
.sp-content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

.sp-section {
    margin-bottom: 20px;
}
.sp-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.sp-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    margin-top: 6px;
}

.sp-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 16px 0 8px;
}

/* Layout picker */
.sp-layout-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.sp-layout-btn {
    width: 52px;
    height: 44px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.15s;
}
.sp-layout-btn:hover { background: rgba(255,255,255,0.08); }
.sp-layout-btn.active { background: rgba(99,102,241,0.15); border-color: #6366f1; color: #818cf8; }
.sp-layout-icon { font-size: 16px; }
.sp-layout-label { font-size: 9px; }

/* Radio group */
.sp-radio-group { display: flex; flex-direction: column; gap: 6px; }
.sp-radio {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary); font-size: 13px; cursor: pointer;
}
.sp-radio input { accent-color: #6366f1; }

/* Toggle (checkbox with label) */
.sp-toggle {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary); font-size: 13px; cursor: pointer;
}
.sp-toggle input { accent-color: #6366f1; width: 16px; height: 16px; }

/* Accordion groups */
.sp-group {
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}
.sp-group-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.15s;
}
.sp-group-header:hover { background: rgba(255,255,255,0.06); }
.sp-group-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
    margin-left: auto;
}
.sp-group.open .sp-group-arrow { transform: rotate(90deg); }
.sp-group-body {
    display: none;
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.sp-group.open .sp-group-body { display: block; }
.sp-group-body .sp-section { margin-bottom: 14px; }
.sp-group-body .sp-section:last-child { margin-bottom: 0; }

/* Slider */
.sp-slider-row { display: flex; align-items: center; gap: 12px; }
.sp-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
}
.sp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
}
.sp-slider-val {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
}

/* Number input */
.sp-num-input {
    width: 60px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 13px;
    text-align: center;
    outline: none;
}
.sp-num-input:focus { border-color: #6366f1; }
.sp-text-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 4px;
}
.sp-text-input:focus { border-color: #6366f1; outline: none; }

/* Severity rows */
.sp-severity-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.sp-severity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.sp-severity-dot.large { background: #22c55e; }
.sp-severity-dot.medium { background: #f59e0b; }
.sp-severity-dot.small { background: #6b7280; }
.sp-severity-label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.sp-severity-x { font-size: 12px; color: var(--text-muted); }

/* Danger buttons */
.sp-danger-btn {
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.sp-danger-btn:hover { background: rgba(239, 68, 68, 0.2); }
.sp-danger-btn.orange {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
.sp-danger-btn.orange:hover { background: rgba(245, 158, 11, 0.2); }

.sp-action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.sp-action-btn:hover { background: rgba(59, 130, 246, 0.2); }
.sp-action-btn.small { padding: 5px 12px; font-size: 12px; margin-top: 6px; }

.sp-share-box {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.sp-share-box.hidden { display: none; }
.sp-share-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.sp-share-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 11px;
    font-family: monospace;
    padding: 8px;
    resize: none;
    outline: none;
}
.sp-share-textarea:focus { border-color: rgba(59, 130, 246, 0.4); }

/* Watchlist ★ button in sidebar */
.mc-wl-btn {
    background: none; border: none; cursor: pointer;
    font-size: 12px; color: rgba(255,255,255,0.15); padding: 0;
    line-height: 1; transition: color 0.15s;
}
.mc-wl-btn:hover { color: rgba(250, 204, 21, 0.6); }
.mc-wl-btn.active { color: #facc15; }
.mc-coin-item.mc-wl { background: rgba(250, 204, 21, 0.03); }

/* Theme: color presets */
.sp-color-presets { display: flex; flex-direction: column; gap: 6px; }
.sp-color-preset {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 8px; cursor: pointer;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.15s; color: var(--text-secondary); font-size: 12px;
}
.sp-color-preset:hover { background: rgba(255,255,255,0.06); }
.sp-color-preset.active { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.08); }
.sp-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.sp-color-name { font-weight: 500; }

.sp-color-row { display: flex; gap: 16px; }
.sp-color-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.sp-color-input { width: 32px; height: 28px; border: none; background: none; cursor: pointer; padding: 0; }

.sp-candle-preview {
    display: flex; align-items: flex-end; gap: 6px; height: 50px;
    margin-top: 12px; padding: 8px 12px;
    background: rgba(0,0,0,0.3); border-radius: 6px;
}
.sp-candle {
    width: 10px; border-radius: 2px; position: relative;
    background: var(--c);
}
.sp-candle::before {
    content: ''; position: absolute; left: 50%; transform: translateX(-50%);
    width: 2px; background: var(--c);
}
.sp-candle.up { height: 34px; }
.sp-candle.up::before { top: -6px; height: 6px; }
.sp-candle.down { height: 28px; }
.sp-candle.down::before { bottom: -5px; height: 5px; }
.sp-candle.small { height: 16px; }
.sp-candle.small::before { top: -4px; height: 4px; }

.sp-wl-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-wl-item {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px; font-size: 12px; font-weight: 600; color: #60a5fa;
}
.sp-wl-remove {
    background: none; border: none; color: rgba(255,255,255,0.3); cursor: pointer;
    font-size: 11px; padding: 0 2px; line-height: 1;
}
.sp-wl-remove:hover { color: #ef4444; }

/* Mobile: full-width panel, hide nav */
@media (max-width: 600px) {
    .settings-panel { width: 100vw; }
    .sp-nav { width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
    .sp-body { flex-direction: column; }
}

/* ======================== Signals Tab ======================== */
.sig-toolbar {
    position: relative;
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 12px; flex-wrap: wrap;
}
.sig-filters { display: flex; gap: 8px; align-items: center; }

/* Channel type dropdown */
.ch-type-multi { position: relative; display: inline-block; }
.ch-type-btn { white-space: nowrap; }
.ch-type-btn.has-active { box-shadow: 0 0 6px rgba(251,146,60,0.5); border-color: rgba(251,146,60,0.4); }
.ch-type-dropdown {
    display: none; position: absolute; top: 100%; left: 0; z-index: 99999;
    margin-top: 4px; padding: 6px 0; min-width: 190px;
    background: var(--bg-card, #1e1e2e); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ch-type-dropdown.open { display: block; }

/* Multi-select signal type dropdown */
.sig-type-multi { position: relative; }
.sig-type-btn { white-space: nowrap; min-width: 100px; text-align: left; }
.sig-type-dropdown {
    display: none; position: absolute; top: 100%; left: 0; z-index: 999;
    margin-top: 4px; padding: 6px 0; min-width: 190px;
    background: var(--bg-card, #1e1e2e); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.sig-type-dropdown.open { display: block; }
.sig-type-opt {
    display: flex; align-items: center; gap: 6px; padding: 5px 12px;
    font-size: 12px; color: var(--text-secondary); cursor: pointer; white-space: nowrap;
    transition: background 0.1s;
}
.sig-type-opt:hover { background: rgba(255,255,255,0.06); }
.sig-type-opt input[type="checkbox"] {
    accent-color: #3b82f6; width: 14px; height: 14px; cursor: pointer; margin: 0;
}
.sig-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sig-summary { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
.sig-summary-item { display: flex; align-items: center; gap: 4px; }
.sig-summary-dot { width: 8px; height: 8px; border-radius: 50%; }
.sig-summary-count { font-weight: 600; color: var(--text-primary); }

.sig-layout {
    display: flex; height: calc(100vh - 120px); overflow: hidden;
}
.sig-table-wrap {
    flex: 1; overflow-y: auto; min-width: 0;
}
.sig-table {
    width: 100%; border-collapse: collapse; font-size: 12px;
}
.sig-table thead { position: sticky; top: 0; z-index: 2; }
.sig-table th {
    padding: 6px 10px; text-align: left; font-weight: 600; font-size: 11px;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    background: var(--bg-primary, #0b0f14); border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}
.sig-table td {
    padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap; color: var(--text-secondary);
}
.sig-table tr { cursor: pointer; transition: background 0.1s; }
.sig-table tr:hover { background: rgba(255,255,255,0.03); }
.sig-table tr.sig-active { background: rgba(59,130,246,0.08); }
.sig-desc-col { min-width: 200px; white-space: normal !important; }

.sig-type-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500;
    white-space: nowrap;
}
.sig-type-badge.volume_spike { background: rgba(59,130,246,0.12); color: #60a5fa; }
.sig-type-badge.big_mover { background: rgba(245,158,11,0.12); color: #fbbf24; }
.sig-type-badge.natr_spike { background: rgba(239,68,68,0.12); color: #f87171; }
.sig-type-badge.oi_cvd { background: rgba(139,92,246,0.12); color: #a78bfa; }
.sig-type-badge.density_break { background: rgba(139,92,246,0.12); color: #a78bfa; }
.sig-type-badge.channel { background: rgba(6,182,212,0.12); color: #22d3ee; }

.sig-dir { font-weight: 600; font-size: 11px; }
.sig-dir.LONG { color: #22c55e; }
.sig-dir.SHORT { color: #ef4444; }

.sig-conf-bar {
    display: inline-block; height: 4px; border-radius: 2px; min-width: 20px; max-width: 50px;
}
.sig-conf-text { font-size: 11px; font-variant-numeric: tabular-nums; }

.sig-time { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sig-symbol { font-weight: 600; color: var(--text-primary); }

/* Detail Panel */
.sig-detail {
    width: 340px; min-width: 340px; border-left: 1px solid rgba(255,255,255,0.06);
    overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.sig-detail-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--text-muted); font-size: 13px;
}
.sig-detail-header {
    display: flex; align-items: center; gap: 10px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sig-detail-symbol { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.sig-detail-price { font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.sig-detail-section { margin-top: 4px; }
.sig-detail-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); margin-bottom: 4px; font-weight: 600;
}
.sig-detail-value { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.sig-detail-meta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.sig-detail-meta-item {
    background: rgba(255,255,255,0.03); border-radius: 6px; padding: 8px 10px;
}
.sig-detail-meta-key { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.sig-detail-meta-val { font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sig-detail-btn {
    margin-top: 8px; padding: 8px 16px; border-radius: 6px; border: none;
    background: rgba(59,130,246,0.15); color: #60a5fa; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background 0.15s; width: 100%;
}
.sig-detail-btn:hover { background: rgba(59,130,246,0.25); }
.sig-detail-back {
    display: none;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted); font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: 6px; cursor: pointer;
    margin-bottom: 12px; width: fit-content;
}
.sig-detail-back:hover { background: rgba(255,255,255,0.08); }
@media (max-width: 900px) {
    .sig-detail-back { display: block; }
}

/* Signal Settings Panel */
/* Outcome Stats Bar */
.sig-outcome-bar {
    display: flex; gap: 10px; padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
}
.sig-outcome-card {
    background: rgba(255,255,255,0.03); border-radius: 8px; padding: 8px 14px;
    min-width: 130px; font-size: 12px;
}
.sig-outcome-type { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; font-size: 11px; }
.sig-outcome-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 2px 0; color: var(--text-secondary); font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .sig-detail {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; min-width: 100%;
        z-index: 200;
        background: rgba(8, 12, 21, 0.98);
        border: none;
        padding: 16px;
        overflow-y: auto;
    }
    .sig-detail.mobile-open {
        display: flex;
    }
    .sig-table-wrap { flex: 1; }
    .sig-desc-col { display: none; }
}

/* ============================================================
   DENSITY V2 — Statistical Walls + Imbalance
   ============================================================ */

/* Toolbar */
.dv2-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-bottom: 12px;
    backdrop-filter: var(--glass-blur);
    gap: 12px;
    flex-wrap: wrap;
}

.dv2-toolbar-left,
.dv2-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dv2-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dv2-select {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
    outline: none;
}
.dv2-select:hover { border-color: rgba(255,255,255,0.15); }
.dv2-select:focus { border-color: var(--neon-blue); }

.dv2-btn {
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 6px;
    color: var(--neon-blue);
    font-size: 16px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.dv2-btn:hover { background: rgba(59,130,246,0.25); }

.dv2-status {
    font-size: 11px;
    color: var(--text-muted);
}

.dv2-auto-label {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.dv2-auto-label input { cursor: pointer; }

/* Table overrides for v2 */
.dv2-table th {
    font-size: 10px;
    padding: 10px 8px;
}

.dv2-table th.sortable::after {
    content: '';
    display: inline-block;
    margin-left: 4px;
}
.dv2-table th.sort-asc::after { content: '▲'; font-size: 8px; }
.dv2-table th.sort-desc::after { content: '▼'; font-size: 8px; }

/* Row */
.dv2-row {
    cursor: pointer;
    transition: background 0.15s;
}
.dv2-row:hover {
    background: rgba(255,255,255,0.04);
}

/* Coin cell */
.dv2-coin {
    font-weight: 600;
    min-width: 80px;
}
.dv2-coin a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
}
.dv2-coin a:hover { color: var(--neon-blue); }

/* Imbalance cell */
.dv2-imbalance {
    min-width: 100px;
    padding: 8px !important;
}
.dv2-imb-wrap {
    position: relative;
    height: 22px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.dv2-imb-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.dv2-imb-text {
    position: relative;
    z-index: 1;
    font-weight: 600;
    font-size: 13px;
    padding: 0 6px;
    font-family: 'Inter', monospace;
}
.dv2-imb-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    opacity: 0.8;
}

/* Wall price cell */
.dv2-wall-price {
    font-family: 'Inter', monospace;
    font-size: 13px;
    white-space: nowrap;
}

/* Distance cell */
.dv2-wall-dist {
    font-size: 12px;
    font-family: monospace;
}

/* Size cell with bar */
.dv2-wall-size {
    min-width: 110px;
    padding: 6px 8px !important;
}
.dv2-size-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 20px;
}
.dv2-size-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.dv2-size-text {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: var(--text-primary);
    font-family: monospace;
}
.dv2-size-mult {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
}

/* Age cell */
.dv2-wall-age {
    font-size: 12px;
    white-space: nowrap;
}
.dv2-age-text {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 11px;
}
.dv2-erosion-text {
    font-family: monospace;
    font-size: 11px;
}
.dv2-wall-erosion {
    white-space: nowrap;
}
.dv2-range {
    width: 60px;
    height: 4px;
    cursor: pointer;
    accent-color: #60a5fa;
    vertical-align: middle;
}
.dv2-range-val {
    font-family: monospace;
    font-size: 10px;
    color: #60a5fa;
    min-width: 24px;
    display: inline-block;
}

/* Vol 24h cell */
.dv2-vol {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Empty wall cell */
.dv2-wall-empty {
    text-align: center;
}

/* === Mobile Cards === */
.dv2-card {
    cursor: pointer;
}
.dv2-card-sym {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.dv2-card-imb {
    font-size: 12px;
    font-weight: 600;
}
.dv2-card-wall {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.dv2-card-side {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 28px;
    color: var(--text-muted);
}
.dv2-card-bid .dv2-card-side { color: #22c55e; }
.dv2-card-ask .dv2-card-side { color: #ef4444; }
.dv2-card-price {
    font-weight: 600;
    font-size: 13px;
    font-family: monospace;
}
.dv2-card-dist {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}
.dv2-card-notional {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
}
.dv2-card-mult {
    font-size: 11px;
    font-weight: 700;
}

/* Quick-blacklist X button on row */
.dv2-bl-quick {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 0 0 0 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    vertical-align: middle;
}
.dv2-row:hover .dv2-bl-quick { opacity: 0.6; }
.dv2-bl-quick:hover { opacity: 1 !important; color: var(--neon-red); }

/* Blacklist button badge */
.dv2-bl-btn { position: relative; font-size: 13px; }
.dv2-bl-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--neon-red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    line-height: 15px;
    text-align: center;
    border-radius: 8px;
    padding: 0 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Blacklist Modal */
.dv2-bl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.dv2-bl-modal {
    background: #0d141e;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 340px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.dv2-bl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.dv2-bl-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}
.dv2-bl-close:hover { color: var(--neon-red); background: rgba(239,68,68,0.1); }

.dv2-bl-add {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
}
.dv2-bl-input {
    flex: 1;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 10px;
    outline: none;
    text-transform: uppercase;
}
.dv2-bl-input:focus { border-color: var(--neon-blue); }
.dv2-bl-input::placeholder { color: var(--text-muted); text-transform: none; }

.dv2-bl-add-btn {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 6px;
    color: var(--neon-red);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.dv2-bl-add-btn:hover { background: rgba(239,68,68,0.25); }

.dv2-bl-list {
    padding: 8px 16px;
    overflow-y: auto;
    flex: 1;
    max-height: 300px;
}
.dv2-bl-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 13px;
}
.dv2-bl-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.dv2-bl-item:hover { background: rgba(255,255,255,0.04); }
.dv2-bl-coin {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}
.dv2-bl-rm {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}
.dv2-bl-rm:hover { color: var(--neon-red); background: rgba(239,68,68,0.1); }

.dv2-bl-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}
.dv2-bl-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* Mobile toolbar */
@media (max-width: 768px) {
    .dv2-toolbar {
        padding: 8px 10px;
        gap: 8px;
    }
    .dv2-toolbar-left { flex-wrap: wrap; gap: 6px; }
    .dv2-label { font-size: 10px; }
    .dv2-select { font-size: 11px; padding: 3px 6px; }
    .dv2-table th { font-size: 9px; padding: 8px 4px; }
    .dv2-table td { padding: 8px 4px; font-size: 11px; }
    .dv2-bl-modal { width: 90vw; }
}