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

:root {
    --bg: #0a0e17;
    --card: #111827;
    --card-hover: #1a2332;
    --border: #1e293b;
    --text: #e2e8f0;
    --text-dim: #64748b;
    --accent: #00ff88;
    --accent2: #3b82f6;
    --red: #ef4444;
    --green: #22c55e;
    --yellow: #eab308;
    --purple: #a855f7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
}

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

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

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(0, 255, 136, 0.1);
    font-size: 13px;
    font-weight: 600;
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}

.status-badge.offline .pulse {
    background: var(--red);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.symbol {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent2);
    padding: 4px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
}

main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Метрики */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.metric-card:hover {
    background: var(--card-hover);
    border-color: var(--accent);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-icon { background: rgba(59, 130, 246, 0.15); color: var(--accent2); }
.trend-icon { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.pnl-icon { background: rgba(0, 255, 136, 0.15); color: var(--accent); }
.win-icon { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.orders-icon { background: rgba(234, 179, 8, 0.15); color: var(--yellow); }
.balance-icon { background: rgba(0, 255, 136, 0.15); color: var(--accent); }

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
}

.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }

/* Графики */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

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

.chart-card h3 {
    font-size: 15px;
    margin-bottom: 16px;
    color: var(--text-dim);
}

canvas {
    width: 100% !important;
    height: 250px !important;
}

.sparkline, .barchart {
    width: 100%;
    height: auto;
}

/* Статистика */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

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

.stat-card h3 {
    font-size: 15px;
    margin-bottom: 16px;
    color: var(--text-dim);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-dim);
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

.config-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    font-size: 13px;
}

.config-item span:first-child {
    color: var(--text-dim);
}

.config-item span:last-child {
    font-weight: 600;
    color: var(--accent);
}

/* Таблицы */
.tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.table-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

.table-wrapper {
    max-height: 350px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    position: sticky;
    top: 0;
    background: var(--card);
}

th {
    text-align: left;
    padding: 8px;
    color: var(--text-dim);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.side-buy {
    color: var(--green);
    font-weight: 600;
}

.side-sell {
    color: var(--red);
    font-weight: 600;
}

footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 6px;
}

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

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

/* Адаптив */
@media (max-width: 900px) {
    .charts-row, .stats-row, .tables-row {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    header {
        flex-direction: column;
        gap: 12px;
    }
}
