:root {
  --bg: #f4efe6;
  --ink: #1c1915;
  --muted: #5c564c;
  --card: #fffaf3;
  --line: #d9d0c3;
  --accent: #0f5c4c;
  --accent-ink: #f4efe6;
  --danger: #8a2f2f;
  --ok: #0f5c4c;
  --shadow: 0 10px 30px rgba(28, 25, 21, 0.08);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; }
a { color: var(--accent); }
.skip-link {
  position: absolute; left: -999px; top: 0;
}
.skip-link:focus { left: 12px; background: #fff; padding: 8px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1c1915;
  color: #f4efe6;
}
.brand { color: #f4efe6; text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
.nav { display: flex; flex-wrap: wrap; gap: 12px; }
.nav a { color: #d9d0c3; text-decoration: none; }
.nav a.is-active, .nav a:hover { color: #fff; }

.page { width: min(880px, calc(100% - 32px)); margin: 24px auto 64px; display: grid; gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
h1, h2 { margin: 0 0 8px; font-size: 1.35rem; }
.lede, .meta { color: var(--muted); }
.meta { display: block; font-size: 0.92rem; margin-top: 4px; }

.flash {
  background: #e7f3ee;
  color: var(--ok);
  padding: 12px 14px;
  border-radius: 12px;
}
.flash-err { background: #f8e8e8; color: var(--danger); }

.stack { display: grid; gap: 10px; }
label { font-weight: 600; }
input, select, textarea, button {
  font: inherit;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
button, .button-link {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 650;
}
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 22px;
  padding: 28px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
}

.toggle-list, .request-list, .device-list, .domain-list, .plain-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.toggle-list li, .request-list li, .device-list li, .domain-list li, .plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.plain-list a { color: inherit; text-decoration: none; display: block; }
.row-actions, .inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.iface-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; }

.switch { position: relative; width: 52px; height: 32px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: #cfc6b8;
  border-radius: 999px;
  transition: 0.15s ease;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 24px; height: 24px;
  left: 4px; top: 4px;
  background: #fff;
  border-radius: 50%;
  transition: 0.15s ease;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch.is-locked { opacity: 0.55; }

@media (max-width: 640px) {
  .request-list li, .domain-list li { flex-direction: column; align-items: stretch; }
  .iface-row { grid-template-columns: 1fr; }
}
