/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0d0d0f;
    --bg-surface: #141418;
    --bg-card: #191920;
    --bg-hover: #1f1f28;
    --bg-input: #1c1c24;
    --border: #2a2a35;
    --border-light: #35354a;
    --text: #f5f5f7;
    --text-2: #a1a1aa;
    --text-3: #6b6b78;
    --green: #3dd68c;
    --green-bg: rgba(61, 214, 140, 0.1);
    --green-border: rgba(61, 214, 140, 0.2);
    --red: #ef6b6b;
    --red-bg: rgba(239, 107, 107, 0.1);
    --red-border: rgba(239, 107, 107, 0.2);
    --blue: #4da3ff;
    --blue-bg: rgba(77, 163, 255, 0.08);
    --blue-border: rgba(77, 163, 255, 0.2);
    --yellow: #f0c040;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg: #f5f5f7;
    --bg-surface: #ffffff;
    --bg-card: #f0f0f3;
    --bg-hover: #eaeaef;
    --bg-input: #f0f0f3;
    --border: #e0e0e6;
    --border-light: #ccccd5;
    --text: #1a1a22;
    --text-2: #5a5a68;
    --text-3: #8a8a98;
    --green: #16a368;
    --green-bg: rgba(22, 163, 104, 0.08);
    --green-border: rgba(22, 163, 104, 0.18);
    --red: #dc3545;
    --red-bg: rgba(220, 53, 69, 0.07);
    --red-border: rgba(220, 53, 69, 0.15);
    --blue: #2563eb;
    --blue-bg: rgba(37, 99, 235, 0.06);
    --blue-border: rgba(37, 99, 235, 0.15);
    --yellow: #d97706;
}

[data-theme="light"] ::selection {
    background: rgba(37, 99, 235, 0.15);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background 0.25s, color 0.25s;
}

::selection {
    background: rgba(77, 163, 255, 0.25);
}

/* ===== HEADER ===== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 13, 15, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transition: background 0.25s;
}

[data-theme="light"] header {
    background: rgba(245, 245, 247, 0.92);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.logo-mark {
    width: 24px;
    height: 24px;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-mark svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-item {
    padding: 6px 14px;
    background: none;
    border: none;
    color: var(--text-3);
    font-family: var(--font);
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.nav-item:hover {
    color: var(--text-2);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--text);
    background: var(--bg-card);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-light);
}

/* ===== WORLD CLOCKS ===== */
.world-clocks {
    display: flex;
    gap: 12px;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-left: 8px;
}

.clock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 42px;
    padding: 0 4px;
    border-right: 1px solid var(--border);
}

.clock-item:last-child {
    border-right: none;
}

.clock-label {
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-bottom: 2px;
}

.clock-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

[data-theme="light"] .world-clocks {
    background: var(--bg-surface);
    border-color: var(--border);
}

/* ===== MAIN ===== */
main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

.tab {
    display: none;
}

.tab.active {
    display: block;
    animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

/* ===== STATS BAR ===== */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 14px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 24px;
}

.stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-val {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-lbl {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.toolbar-controls {
    display: flex;
    gap: 6px;
}

.select-sm {
    padding: 6px 28px 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%236b6b78'%3E%3Cpath d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
}

.select-sm:focus {
    outline: none;
    border-color: var(--blue);
}

[data-theme="light"] .select-sm {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%238a8a98'%3E%3Cpath d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

/* Header Specific Select & X Link */


.x-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    margin-right: 8px;
}

.x-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

/* ===== MARKET CARDS ===== */
.markets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.market-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.market-card:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.mc-header {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.mc-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-card);
    flex-shrink: 0;
}

.mc-title {
    font-size: 0.87rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mc-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.72rem;
    color: var(--text-3);
}

/* Price bars — Polymarket style */
.mc-prices {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.mc-price {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
}

.mc-price-bar {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.88rem;
    gap: 5px;
}

.mc-price-label {
    font-weight: 500;
    font-size: 0.72rem;
    opacity: 0.7;
}

.mc-price.yes .mc-price-bar {
    background: var(--green-bg);
    color: var(--green);
}

.mc-price.no .mc-price-bar {
    background: var(--red-bg);
    color: var(--red);
}

.mc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.mc-roi {
    font-size: 0.73rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.roi-high {
    background: var(--green-bg);
    color: var(--green);
}

.roi-mid {
    background: var(--blue-bg);
    color: var(--blue);
}

.roi-low {
    color: var(--text-3);
    background: var(--bg-card);
}

.mc-change {
    font-size: 0.73rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

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

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

.flat {
    color: var(--text-3);
}

.mc-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.mc-link:hover {
    background: var(--blue-bg);
}

/* ===== SKELETON ===== */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.skeleton-card {
    height: 190px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 30%, rgba(255, 255, 255, 0.02) 50%, transparent 70%);
    animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ===== LOAD MORE ===== */
.btn-load-more {
    display: block;
    margin: 20px auto 0;
    padding: 8px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-load-more:hover {
    border-color: var(--blue);
    color: var(--text);
}

/* ===== SCANNER ===== */
.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-3);
    font-size: 0.88rem;
    margin-bottom: 20px;
}

.scanner-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ctrl-group {
    flex: 1;
    min-width: 160px;
}

.ctrl-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-3);
    font-weight: 500;
    margin-bottom: 6px;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctrl-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--blue);
    min-width: 40px;
}

.range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--blue);
    cursor: pointer;
}

.btn-primary {
    padding: 8px 20px;
    background: var(--blue);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-full {
    width: 100%;
    padding: 10px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-3);
    font-size: 0.88rem;
}

/* Scanner result cards */
.sr-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.15s;
}

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

.sr-rank {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--blue);
    min-width: 28px;
    text-align: center;
}

.sr-info {
    flex: 1;
}

.sr-title {
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.sr-meta {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-3);
}

.sr-stats {
    display: flex;
    gap: 8px;
}

.sr-stat {
    text-align: center;
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: 6px;
}

.sr-stat-val {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
}

.sr-stat-lbl {
    display: block;
    font-size: 0.6rem;
    color: var(--text-3);
    text-transform: uppercase;
}

.sr-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 6px;
}

.sr-link:hover {
    background: var(--blue-bg);
}

/* ===== KELLY ===== */
.kelly-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-3);
    font-weight: 500;
    margin-bottom: 6px;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
}

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

.input-sm {
    width: 64px;
    text-align: center;
    flex-shrink: 0;
}

/* Kelly Fraction Segmented Control */
.k-tabs {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.k-tab {
    flex: 1;
    padding: 8px 0;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-3);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.k-tab:hover {
    color: var(--text-2);
}

.k-tab.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.kelly-hero {
    text-align: center;
    padding: 24px;
    background: var(--blue-bg);
    border-color: var(--blue-border);
    margin-bottom: 12px;
}

.kelly-hero-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kelly-hero-val {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--blue);
}

.kelly-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.kelly-stat {
    text-align: center;
    padding: 12px 8px;
}

.kelly-stat-lbl {
    display: block;
    font-size: 0.65rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.kelly-stat-val {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.green {
    color: var(--green);
}

.red {
    color: var(--red);
}

.kelly-warning {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-radius: 8px;
    color: var(--red);
    font-size: 0.82rem;
}

/* ===== NO RESULTS ===== */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-3);
    text-align: center;
    gap: 6px;
}

/* ===== MODAL ===== */
.modal {
    border: none;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 800px;
    background: var(--bg-card);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    color: var(--text);
}
.modal::backdrop {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}
.modal-content {
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}
.btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-3);
    cursor: pointer;
}
.btn-close:hover {
    color: var(--red);
}
.modal-body {
    padding: 20px;
}
.chart-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: flex-end;
}
.chart-time-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 12px;
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
}
.chart-time-btn:hover {
    background: var(--bg-hover);
}
.chart-time-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }

    main {
        padding: 16px;
    }

    .stats-bar {
        flex-wrap: wrap;
    }

    .stat-divider {
        display: none;
    }

    .stat {
        min-width: 50%;
        padding: 6px 0;
    }

    .markets-grid,
    .skeleton-grid {
        grid-template-columns: 1fr;
    }

    .kelly-grid {
        grid-template-columns: 1fr;
    }

    .kelly-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .scanner-controls {
        flex-direction: column;
    }

    .header-left {
        gap: 16px;
    }

    .nav-item {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ===== SEARCH ===== */
.toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}

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

.search-icon {
    color: var(--text-3);
    flex-shrink: 0;
}

.search-input {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.84rem;
    width: 160px;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: var(--text-3);
}

/* ===== AUTO-REFRESH INDICATOR ===== */
.refresh-indicator {
    position: relative;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    cursor: default;
}

.refresh-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--blue);
    animation: refreshSpin 60s linear infinite;
}

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

.refresh-text {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-3);
    z-index: 1;
}

/* ===== BADGES ===== */
.mc-badges {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-hot {
    background: rgba(239, 107, 107, 0.12);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.badge-ending {
    background: rgba(240, 192, 64, 0.1);
    color: var(--yellow);
    border: 1px solid rgba(240, 192, 64, 0.2);
}

.badge-high-vol {
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid var(--blue-border);
}

/* ===== WATCHLIST STAR ===== */
.mc-star {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    z-index: 2;
}

.market-card {
    position: relative;
}

.market-card:hover .mc-star {
    opacity: 1;
}

.mc-star.active {
    opacity: 1;
    background: rgba(240, 192, 64, 0.12);
    border-color: rgba(240, 192, 64, 0.3);
}

.mc-star:hover {
    background: var(--bg-hover);
}

/* ===== SPARKLINE ===== */
.mc-sparkline {
    height: 24px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.mc-sparkline svg {
    width: 100%;
    height: 100%;
}

/* ===== PROFIT SIMULATOR ===== */
.mc-profit {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.72rem;
    color: var(--text-3);
}

.mc-profit-label {
    flex-shrink: 0;
}

.mc-profit-input {
    width: 50px;
    padding: 2px 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

.mc-profit-input:focus {
    outline: none;
    border-color: var(--blue);
}

.mc-profit-result {
    font-weight: 700;
    color: var(--green);
    margin-left: auto;
}

/* ===== WATCHLIST EXTRAS ===== */
.btn-secondary {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s;
}

.btn-secondary:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ===== RESPONSIVE / MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    /* Header & Nav */
    .header-inner {
        padding: 0 12px;
        height: auto;
        min-height: 56px;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }

    .nav {
        overflow-x: auto;
        padding-bottom: 4px;
        /* Space for scrollbar */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    /* Hide scrollbar Chrome/Safari */

    .nav-item {
        padding: 6px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .header-right {
        width: 100%;
        justify-content: center;
        padding-top: 4px;
        border-top: 1px solid var(--border);
    }

    /* Main Container */
    main {
        padding: 12px 12px 60px;
    }

    /* Stats Bar */
    .stats-bar {
        flex-wrap: wrap;
        padding: 10px;
        gap: 10px 0;
    }

    .stat-divider {
        display: none;
    }

    .stat {
        min-width: 50%;
        padding: 4px 0;
    }

    .stat-val {
        font-size: 1.1rem;
    }

    /* Toolbar & Search */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .toolbar-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .search-box {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

    .toolbar-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .select-sm {
        width: 100%;
    }

    /* Grids */
    .markets-grid,
    .skeleton-grid {
        grid-template-columns: 1fr;
    }

    /* Scanner */
    .scanner-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .ctrl-group {
        min-width: 100%;
    }

    .sr-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        position: relative;
    }

    .sr-rank {
        position: absolute;
        top: 12px;
        right: 12px;
        font-size: 0.9rem;
    }

    .sr-link {
        text-align: center;
        background: var(--blue-bg);
        padding: 8px;
    }

    /* Kelly Calc */
    .kelly-grid {
        grid-template-columns: 1fr;
    }

    .kelly-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .kelly-stat {
        padding: 8px 4px;
    }
}