:root {
  --bg: #0b1220;
  --bg-card: #151f32;
  --bg-muted: #111827;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #10b981;
  --accent-hover: #059669;
  --border: rgba(148, 163, 184, 0.15);
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container { width: min(720px, calc(100% - 2rem)); margin: 0 auto; }

.topbar {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  padding: .85rem 0;
}
.topbar-inner {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; }
.logout-form { margin: 0; }

.main { padding: 2rem 0 3rem; }
.page-head { margin-bottom: 1.75rem; }
.page-head h1 { margin: 0 0 .5rem; font-size: 1.65rem; }
.page-head p { margin: 0; color: var(--text-muted); }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.panel h2 { margin: 0 0 1rem; font-size: 1.05rem; }
.panel h3 { margin: 0 0 .85rem; font-size: .95rem; color: var(--text-muted); }
.panel-muted { background: var(--bg-muted); }

.service-grid { display: grid; gap: .85rem; }
.service-card {
  display: block;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  transition: border-color .2s;
}
.service-card:has(input:checked) { border-color: rgba(16,185,129,.45); }
.service-card input { position: absolute; opacity: 0; pointer-events: none; }
.service-card-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
}
.service-icon { font-size: 1.5rem; }
.service-card-body small { display: block; color: var(--text-muted); font-size: .82rem; margin-top: .15rem; }
.service-card-body > div { flex: 1; }

.status-pill {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .3rem .65rem;
  border-radius: 999px;
}
.status-pill.on { background: rgba(16,185,129,.15); color: #34d399; }
.status-pill.off { background: rgba(245,158,11,.15); color: #fbbf24; }

.field { margin-bottom: .5rem; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .4rem; color: var(--text-muted); }
.field input,
.field textarea {
  width: 100%;
  padding: .75rem .85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: .92rem;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); }

.hint { font-size: .82rem; color: var(--text-muted); margin: .75rem 0 0; }
.hint code { background: var(--bg); padding: .15rem .4rem; border-radius: 4px; font-size: .85em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .6rem 1.15rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-lg { padding: .85rem 1.5rem; }
.btn-block { width: 100%; }
.form-actions { margin-top: .5rem; }

.alert {
  padding: .85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); }
.alert-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); }

.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li {
  display: flex;
  justify-content: space-between;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.status-list li:last-child { border-bottom: none; }
.status-list span { color: var(--text-muted); }
.text-ok { color: #34d399; }
.text-warn { color: #fbbf24; }

.footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .82rem;
}
.footer p { margin: 0; }

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem;
}
.auth-card {
  width: min(400px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 1.5rem;
}
.auth-brand strong { display: block; font-size: 1.1rem; }
.auth-brand span { font-size: .85rem; color: var(--text-muted); }
