:root {
    --bg: #f4f6f8; --surface: #fff; --text: #1c2430; --muted: #6b7686; --line: #e1e5ea;
    --accent: #2563eb; --ok: #16a34a; --off: #9ca3af; --danger: #dc2626;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #11151b; --surface: #1a2029; --text: #e6e9ee; --muted: #8b95a5; --line: #2b3441; --accent: #5b8def; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
h1 { margin: 0 0 16px; font-size: 1.5rem; }
h2 { margin: 0 0 12px; font-size: 1rem; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar a { color: var(--text); text-decoration: none; }
.topbar a:hover { color: var(--accent); }
.logout { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; }
.tile .value { font-size: 2rem; font-weight: 600; }
.tile .value small { font-size: 1rem; color: var(--muted); font-weight: 400; }
.tile .label { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.grid .wide { grid-column: 1 / -1; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar .fill { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar .count { font-size: .75rem; color: var(--muted); order: -1; }
.bar .tick { font-size: .7rem; color: var(--muted); margin-top: 4px; }
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: grid; grid-template-columns: 1fr 90px 36px; gap: 8px; align-items: center; padding: 4px 0; }
.ranking .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .meter { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.ranking .meter span { display: block; height: 100%; background: var(--accent); }
.ranking .num { text-align: right; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; }
.muted { color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--off); }
input { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
button { padding: 6px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; }
button.danger { color: var(--danger); }
.actions { display: flex; gap: 12px; align-items: center; }
.actions form { display: flex; gap: 6px; align-items: center; }
.actions input { width: 130px; padding: 3px 8px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline h2 { width: 100%; }
.check { display: flex; gap: 6px; align-items: center; }
.notice { background: var(--surface); border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 4px; }
.login { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; }
select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
a { color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; }
.checklist li { padding: 4px 0; }
.modal { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); padding: 20px 24px; max-width: 420px; width: calc(100% - 32px); }
.modal::backdrop { background: rgba(0, 0, 0, .5); }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
button.secondary { background: var(--line); color: var(--text); }
button.danger-solid { background: var(--danger); }
.error { color: var(--danger); margin: 0; }
