:root {
    --bg-color: #0d0e12;
    --card-bg: #1a1c23;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-cyan: #00f2ff;
    --accent-magenta: #ff00e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass-bg: rgba(26, 28, 35, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 242, 255, 0.3);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

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

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

/* Main Content Grid */
.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    min-width: 0;
}

/* Prevent grid children from overflowing their track */
.main-grid > * {
    min-width: 0;
    overflow: hidden;
}

.main-grid > * > .panel {
    min-width: 0;
}

.panel {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

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

.panel-title {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

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

.tag {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag.long {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cyan);
}

.tag.short {
    background: rgba(255, 0, 229, 0.1);
    color: var(--accent-magenta);
}

.tag.win {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tag.loss {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.tag.buy {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tag.sell {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Charts */
.chart-container {
    padding: 1.5rem;
    height: 300px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #2a2d37;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3e4b;
}

}

/* ── Mobile nav ─────────────────────────────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: background 0.2s;
}

.hamburger:hover {
    background: rgba(255,255,255,0.1);
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    transform-origin: center;
}

.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
    width: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Responsive breakpoints ─────────────────────────────────────── */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
        position: relative;
    }

    header .logo h1 {
        font-size: 1.4rem;
    }

    /* Hamburger: visible on mobile */
    .hamburger {
        display: flex;
        margin-left: auto;
    }

    /* Nav: animates via max-height so CSS transition works */
    header nav {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        background: var(--card-bg);
        border-radius: 0.75rem;
        border: 1px solid transparent;
        order: 10;
        transition: max-height 0.35s ease, border-color 0.2s ease;
    }

    header nav.open {
        max-height: 400px;
        border-color: var(--border-color);
    }

    header nav a {
        padding: 0.875rem 1rem !important;
        margin: 0 !important;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.9rem !important;
    }

    header nav a:last-child {
        border-bottom: none;
    }

    .header-right {
        width: 100%;
        order: 9;
    }

    .status-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    /* Chart — prevent overflow on narrow screens */
    #chart-container {
        min-height: 280px !important;
        width: 100% !important;
        overflow: hidden;
    }

    /* Tables: horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 540px;
    }

    th,
    td {
        padding: 0.75rem 0.875rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Panels */
    .panel-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .panel-title {
        font-size: 1rem;
    }

    .chart-container {
        height: 220px;
        padding: 1rem;
    }

    /* Filter rows in signals/logs */
    .filters {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    header .logo p {
        display: none;
    }

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

    .stat-card {
        padding: 0.75rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

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

    #chart-container {
        min-height: 240px !important;
        width: 100% !important;
    }
}