:root {
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333;
    --primary: #007bff;
    --primary-hover: #0056b3;
    --border: #ddd;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --card-bg: #1e1e1e;
        --text-color: #f1f1f1;
        --border: #333;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

.screen {
    max-width: 1000px;
    margin: 0 auto;
}

.hidden { display: none !important; }

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

#login-screen .card {
    max-width: 400px;
    margin: 100px auto;
    text-align: center;
}

input, select {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
}

button {
    background-color: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

button:hover { background-color: var(--primary-hover); }
button.btn-secondary { background-color: #6c757d; }
button.btn-alert { background-color: #dc3545; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 400px;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.error { color: #dc3545; }

/* Quick status bar above the graph */
.quick-stats {
    display: flex;
    justify-content: space-around;
    background: #1e1e1e;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9em;
    border: 1px solid #333;
}
.stat-box span {
    color: #4bc0c0;
    font-weight: bold;
    font-size: 1.1em;
}

/* Mobile responsive table wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
}
/* Force the JSON string to wrap cleanly */
.table-responsive code {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.8em;
}

/* Graph Selection Tabs */
.graph-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
.tab-btn {
    background-color: #2a2a2a;
    color: #888;
    border: 1px solid #444;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    flex-grow: 1;
    font-weight: bold;
    transition: 0.2s;
}
.tab-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}
