:root {
  color-scheme: light;
  --bg: #edf2f7;
  --card: #ffffff;
  --line: #d7e0ea;
  --text: #122033;
  --muted: #5a6b81;
  --primary: #1f6feb;
  --primary-dark: #164fa8;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --off-bg: #eef2f7;
  --off-text: #334155;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #eff5ff 0%, var(--bg) 100%);
  color: var(--text);
  font: 15px/1.5 Inter, Arial, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 22px; }
.muted { color: var(--muted); margin: 0; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: 2px solid rgba(31, 111, 235, 0.18);
  border-color: var(--primary);
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.btn:hover { background: var(--primary-dark); }

.btn-light {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-light:hover {
  background: #f8fafc;
}

.panel-head,
.toolbar,
.dialog-head,
.dialog-actions,
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head { margin-bottom: 16px; }
.toolbar { margin-bottom: 14px; }
.panel-actions { flex-wrap: wrap; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th, td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fbff;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 102px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.on {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge.off {
  background: var(--off-bg);
  color: var(--off-text);
}

.badge.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
}

.row-btn:hover {
  background: #f8fafc;
}

.row-btn.danger {
  border-color: #fecaca;
  color: var(--danger-text);
  background: #fff5f5;
}

small {
  color: var(--muted);
  font-weight: 600;
}

dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  max-width: 720px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 24px;
  line-height: 1;
}

.switches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.switch {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.switch input {
  width: 18px;
  height: 18px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel-head,
  .toolbar,
  .dialog-head,
  .dialog-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
  }
}
