:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --primary-color: #bb86fc;
    --secondary-color: #03dac6;
    --error-color: #cf6679;
    --success-color: #4caf50;
    --warning-color: #ffeb3b;
    --danger-color: #f44336;
    --low-color: #f44336;
    --mid-color: #ffeb3b;
    --high-color: #4caf50;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.hidden { display: none !important; }

/* Login View */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #333;
    background: #2a2a2a;
    color: white;
    box-sizing: border-box;
}

button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    background: var(--primary-color);
    color: black;
    font-weight: bold;
    cursor: pointer;
}

button:hover { opacity: 0.9; }

/* Dashboard Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.connected { background: var(--success-color); color: white; }
.disconnected { background: var(--danger-color); color: white; }

#logout-btn {
    width: auto;
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

/* Dashboard Layout */
main {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.top-row, .bottom-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .top-row, .bottom-row { grid-template-columns: 1fr; }
}

.card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--primary-color);
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

/* History Panel */
.rounds-list {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.round-badge {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.round-low { background: #d32f2f; color: white; }
.round-mid { background: #fbc02d; color: black; }
.round-high { background: #388e3c; color: white; }

/* Alerts Panel */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alert-card {
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--warning-color);
    background: #252525;
    animation: flash 1s ease-out;
}

@keyframes flash {
    0% { background: #444; }
    100% { background: #252525; }
}

.alert-type { font-weight: bold; color: var(--warning-color); margin-bottom: 0.25rem; }
.alert-msg { font-size: 0.9rem; margin-bottom: 0.5rem; }
.alert-inst { font-size: 0.95rem; font-style: italic; color: var(--secondary-color); }

/* Stats & Accuracy */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-item label { display: block; font-size: 0.8rem; color: #888; }
.stat-item span { font-size: 1.25rem; font-weight: bold; }

.accuracy-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #333;
}

.accuracy-item:last-child { border-bottom: none; }
.acc-label { font-size: 0.85rem; }
.acc-val { font-weight: bold; color: var(--secondary-color); }

/* Admin nav link */
.admin-nav-link {
    padding: 0.4rem 1rem;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s;
}
.admin-nav-link:hover { background: rgba(187,134,252,0.1); }
