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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    line-height: 1.6;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #1e293b;
}

h1 {
    font-size: 2rem;
    color: #60a5fa;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
}

.last-update {
    font-size: 12px;
    color: #94a3b8;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: #1e293b;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #334155;
}

.card h3 {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat.positive {
    color: #10b981;
}

.stat.negative {
    color: #ef4444;
}

.sub-stat {
    font-size: 13px;
    color: #64748b;
    display: flex;
    justify-content: space-between;
}

.positions-section {
    margin-bottom: 30px;
}

.positions-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #60a5fa;
}

.position-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.position-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #334155;
}

.position-symbol {
    font-size: 24px;
    font-weight: 700;
    color: #60a5fa;
}

.position-pnl {
    text-align: right;
}

.pnl-amount {
    font-size: 24px;
    font-weight: 700;
}

.pnl-percent {
    font-size: 14px;
    color: #94a3b8;
}

.position-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.metric {
    padding: 10px;
    background: #0f172a;
    border-radius: 6px;
}

.metric-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 5px;
}

.metric-value {
    font-size: 16px;
    font-weight: 600;
}

.liquidation-warning {
    background: #7f1d1d;
    color: #fecaca;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 20px;
}

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

.chart-header h2 {
    font-size: 1.25rem;
    color: #60a5fa;
    margin: 0;
}

.chart-container h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: #60a5fa;
}

.time-period-selector {
    display: flex;
    gap: 5px;
}

.period-btn {
    background: #334155;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.period-btn:hover {
    background: #475569;
    color: #e2e8f0;
}

.period-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.chart-container canvas {
    max-height: 300px;
}

.data-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 13px;
    color: #64748b;
    padding: 20px;
    background: #1e293b;
    border-radius: 8px;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1e293b;
    padding: 30px 50px;
    border-radius: 8px;
    font-size: 18px;
    display: none;
    z-index: 1000;
}

.loading.active {
    display: block;
}

.error {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #7f1d1d;
    color: #fecaca;
    padding: 15px 20px;
    border-radius: 8px;
    display: none;
    z-index: 1000;
    max-width: 400px;
}

.error.active {
    display: block;
}

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

    .position-metrics {
        grid-template-columns: 1fr;
    }
}
