:root {
    --blue: #2563eb;
    --green: #16a34a;
    --red: #dc2626;
    --gray-bg: #f4f6f8;
    --gray-border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
}

* { box-sizing: border-box; }

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

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 320px;
    text-align: center;
}

.login-card h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.subtitle { color: var(--text-light); margin: 0 0 1.5rem; font-size: 0.85rem; }

.login-card form { text-align: left; }
.login-card label { display: block; font-size: 0.85rem; margin: 0.75rem 0 0.25rem; }
.login-card input {
    width: 100%; padding: 0.6rem; border: 1px solid var(--gray-border);
    border-radius: 6px; font-size: 1rem;
}
.login-card button {
    width: 100%; margin-top: 1.25rem; padding: 0.7rem; border: none;
    border-radius: 6px; background: var(--blue); color: white;
    font-size: 1rem; cursor: pointer;
}
.login-card button:hover { background: #1d4ed8; }

.alert { padding: 0.6rem; border-radius: 6px; margin-bottom: 0.5rem; font-size: 0.85rem; }
.alert-error { background: #fee2e2; color: var(--red); }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: white; padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-border);
}
.topbar h1 { margin: 0; font-size: 1.25rem; }
.user-info { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; color: var(--text-light); }
.btn-link { color: var(--blue); text-decoration: none; }

.container { max-width: 700px; margin: 1.5rem auto; padding: 0 1rem; }

.status-card, .panel {
    background: white; border-radius: 12px; padding: 1.5rem;
    margin-bottom: 1.25rem; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.status-indicator { display: flex; align-items: center; gap: 0.6rem; font-size: 1.4rem; font-weight: 600; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #94a3b8; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--red); }
.dot.stale { background: #f59e0b; }

.status-meta { color: var(--text-light); font-size: 0.85rem; margin: 0.4rem 0 1.2rem; }

.controls { display: flex; gap: 1rem; }
.btn {
    flex: 1; padding: 0.9rem; border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 600; cursor: pointer; color: white;
}
.btn-start { background: var(--green); }
.btn-start:hover { background: #15803d; }
.btn-stop { background: var(--red); }
.btn-stop:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.control-msg { margin-top: 0.75rem; font-size: 0.85rem; color: var(--text-light); min-height: 1.2em; }

.panel h2 { margin: 0 0 1rem; font-size: 1.05rem; }

.history-list { font-size: 0.9rem; }
.history-row {
    display: flex; justify-content: space-between; padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-border);
}
.history-row:last-child { border-bottom: none; }
.badge { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-on { background: #dcfce7; color: var(--green); }
.badge-off { background: #fee2e2; color: var(--red); }

.schedule-form {
    display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1.2rem;
}
.schedule-form input[type="text"], .schedule-form select, .schedule-form input[type="time"] {
    padding: 0.5rem; border: 1px solid var(--gray-border); border-radius: 6px;
}
.days-picker { display: flex; gap: 0.5rem; font-size: 0.8rem; flex-wrap: wrap; }
.btn-add { background: var(--blue); color: white; padding: 0.5rem 0.9rem; border: none; border-radius: 6px; cursor: pointer; }

.schedule-list { font-size: 0.9rem; }
.schedule-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0; border-bottom: 1px solid var(--gray-border);
}
.schedule-row:last-child { border-bottom: none; }
.btn-delete { background: none; border: none; color: var(--red); cursor: pointer; font-size: 0.85rem; }
