:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  background: #f3f6fa;
  color: #182230;
}

* { box-sizing: border-box; }
body { margin: 0; }

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 260px;
  background: linear-gradient(135deg, #12355b 0%, #0f6cbd 52%, #1f9d8a 100%);
  z-index: -1;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.hero {
  min-height: 124px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
  padding: 8px 2px 28px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.1; font-weight: 800; }
h2 { font-size: 18px; line-height: 1.2; }
p { color: #5f6f82; margin-top: 6px; }
.hero p { color: rgba(255,255,255,.78); }

button {
  border: 0;
  background: #0f6cbd;
  color: #fff;
  padding: 10px 14px;
  border-radius: 7px;
  font-weight: 750;
  cursor: pointer;
  min-height: 38px;
}

button:hover { background: #0b5ea8; }
.ghostButton { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.34); }
.ghostButton:hover { background: rgba(255,255,255,.24); }

.panel {
  background: rgba(255,255,255,.98);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 16px 38px rgba(15, 39, 65, .13);
}

.hidden { display: none; }
.loginPanel { max-width: 460px; margin-top: -36px; }

.adminGrid {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
  gap: 16px;
  margin-top: -36px;
}

.controlCard { min-height: 270px; }
.cardHeader, .deviceHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #60738a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.statusPill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e7f7f2;
  color: #08715f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

label {
  display: block;
  margin-top: 12px;
  color: #405064;
  font-size: 13px;
  font-weight: 700;
}

input, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px 11px;
  border: 1px solid #cbd6e3;
  border-radius: 7px;
  color: #17202a;
  background: #fbfdff;
  font: inherit;
  font-size: 14px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: #0f6cbd;
  box-shadow: 0 0 0 3px rgba(15,108,189,.14);
}

textarea { resize: vertical; line-height: 1.45; }
.helper { font-size: 13px; color: #6b7c8f; margin-top: 10px; }

.settingsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px 12px;
}

.wide { grid-column: 1 / -1; }
.toggleRow { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 8px; }
.switchLine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #dbe3ed;
  border-radius: 7px;
  background: #f8fafc;
}
.switchLine input { width: auto; margin: 0; }

.devicePanel { margin-top: 16px; padding: 0; overflow: hidden; }
.deviceHeader { padding: 18px 18px 0; }
.summary { display: flex; gap: 10px; flex-wrap: wrap; color: #405064; }
.summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid #dbe3ed;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 13px;
}
.summary strong { color: #182230; }

.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1060px; }
th, td { text-align: left; border-top: 1px solid #e6edf5; padding: 14px 12px; vertical-align: top; }
th { color: #68798b; font-size: 11px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; background: #f8fafc; }
tbody tr:hover { background: #fbfdff; }

.badge {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}
.on { background: #dff7e8; color: #126b35; }
.off { background: #f4e2e2; color: #9b2424; }
.muted { color: #69798a; font-size: 13px; line-height: 1.45; }

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}
.inline input { width: auto; margin: 0; }
td label { margin-top: 7px; }
td input { width: 180px; padding: 8px; }
td button { margin-top: 9px; padding: 8px 10px; }

@media (max-width: 900px) {
  .adminGrid { grid-template-columns: 1fr; }
  .hero, .cardHeader, .deviceHeader { flex-direction: column; }
  .loginPanel, .adminGrid { margin-top: -28px; }
  .settingsGrid { grid-template-columns: 1fr; }
}

.dashboardShell { margin-top: -36px; }
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 8px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
}
.tabButton {
  background: transparent;
  color: #fff;
  border: 1px solid transparent;
  min-height: 36px;
}
.tabButton:hover { background: rgba(255,255,255,.18); }
.tabButton.active {
  background: #fff;
  color: #12355b;
  border-color: #fff;
}
.tabPanel { display: none; }
.tabPanel.active { display: block; }
.singleCard { max-width: 860px; }
.footerActions { margin-top: 14px; display: flex; justify-content: flex-end; }
.deviceToolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 16px;
  flex-wrap: wrap;
}
.deviceToolbar label { margin-top: 0; min-width: 260px; }
select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px 11px;
  border: 1px solid #cbd6e3;
  border-radius: 7px;
  color: #17202a;
  background: #fbfdff;
  font: inherit;
  font-size: 14px;
}
.dangerButton { background: #b42318; }
.dangerButton:hover { background: #8f1d14; }
th:first-child, td:first-child { width: 42px; text-align: center; }
th input, td input[type="checkbox"] { width: auto; margin: 0 auto; }
.emptyState { padding: 26px 18px; text-align: center; }
.roomy { margin-top: 10px; }
@media (max-width: 900px) {
  .dashboardShell { margin-top: -28px; }
  .tabs { background: rgba(255,255,255,.22); }
  .tabButton { flex: 1 1 100%; }
  .deviceToolbar { align-items: stretch; }
  .deviceToolbar label { min-width: 100%; }
}
td select {
  width: 180px;
  padding: 8px;
}