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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
}

header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: #1a1a2e;
    border-bottom: 1px solid #2a2a40;
}

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

.subtitle {
    color: #888;
    font-size: 0.9rem;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.auto-refresh {
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.last-updated {
    color: #666;
    font-size: 0.8rem;
}

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

h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: #ccc;
}

h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #aaa;
}

/* Users table */
table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: #22223a;
}

th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
}

td {
    padding: 10px 14px;
    font-size: 0.9rem;
    border-top: 1px solid #2a2a40;
}

#usersTable tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

#usersTable tbody tr:hover {
    background: #22223a;
}

#usersTable tbody tr.active {
    background: #1e293b;
    border-left: 3px solid #60a5fa;
}

.loading {
    text-align: center;
    color: #666;
    padding: 40px;
}

/* Status indicator */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-dot.online {
    background: #4ade80;
    box-shadow: 0 0 6px #4ade8066;
}

.status-dot.offline {
    background: #666;
}

/* Detail section */
.hidden {
    display: none;
}

#detailSection {
    margin-top: 24px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #1a1a2e;
    border-radius: 8px;
    margin-bottom: 20px;
}

.user-info .username {
    color: #888;
    font-size: 0.9rem;
}

.tz-display {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.tz-big {
    font-size: 2rem;
    font-weight: 700;
    color: #60a5fa;
}

.status-badge {
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: #4ade8022;
    color: #4ade80;
}

.status-badge.offline {
    background: #66666622;
    color: #888;
}

/* Charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 16px;
}

.chart-container {
    position: relative;
    height: 250px;
}

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

/* Sleep / TZ tables */
.sleep-table-section,
.tz-table-section {
    margin-top: 20px;
}

.sleep-table-section table td,
.tz-table-section table td {
    font-size: 0.85rem;
}

.tz-offset {
    font-weight: 600;
    color: #60a5fa;
}

/* Responsive */
@media (min-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
    .charts-grid .chart-card:first-child {
        grid-column: 1 / -1;
    }
}
