:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --border: #30363d;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --green: #238636;
    --green-bright: #3fb950;
    --red: #da3633;
    --red-bright: #f85149;
    --blue: #58a6ff;
    --yellow: #d29922;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.5;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

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

h1 {
    font-size: 24px;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: rgba(35, 134, 54, 0.2);
    color: var(--green-bright);
}

.status-badge.offline {
    background: rgba(218, 54, 51, 0.2);
    color: var(--red-bright);
}

.status-badge.stale {
    background: rgba(210, 153, 34, 0.2);
    color: var(--yellow);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

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

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.big-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
}

.big-number.positive { color: var(--green-bright); }
.big-number.negative { color: var(--red-bright); }

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

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

.stat-value {
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.price-main {
    font-size: 28px;
    font-weight: 700;
    font-family: 'SF Mono', Consolas, monospace;
}

.price-label {
    font-size: 12px;
    color: var(--text-muted);
}

.gap-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
}

.gap-indicator.positive {
    background: rgba(35, 134, 54, 0.2);
    color: var(--green-bright);
}

.gap-indicator.negative {
    background: rgba(218, 54, 51, 0.2);
    color: var(--red-bright);
}

/* Trade Table */
.table-card {
    grid-column: 1 / -1;
}

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

th {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    font-family: 'SF Mono', Consolas, monospace;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.direction {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.direction.YES {
    background: rgba(35, 134, 54, 0.2);
    color: var(--green-bright);
}

.direction.NO {
    background: rgba(218, 54, 51, 0.2);
    color: var(--red-bright);
}

.result {
    font-weight: 600;
}

.result.win { color: var(--green-bright); }
.result.loss { color: var(--red-bright); }
.result.pending { color: var(--text-muted); }

.pnl.positive { color: var(--green-bright); }
.pnl.negative { color: var(--red-bright); }

.dry-run-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(88, 166, 255, 0.2);
    color: var(--blue);
    border-radius: 4px;
    margin-left: 8px;
}

.last-update {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Win Rate Donut */
.win-rate-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.donut {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: relative;
}

.donut-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.win-loss-stats {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

.pagination button {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s, border-color 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--border);
    border-color: var(--text-muted);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#page-info {
    font-size: 14px;
    color: var(--text-muted);
}

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

    .price-main {
        font-size: 24px;
    }

    .big-number {
        font-size: 28px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 4px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagination button {
        padding: 6px 12px;
        font-size: 12px;
    }
}
