:root {
  color-scheme: dark;
  --bg: #111014;
  --fg: #f8f4ee;
  --muted: #bbb2c8;
  --soft: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(33, 30, 38, 0.76);
  --panel-strong: rgba(45, 40, 53, 0.92);
  --accent: #a891ff;
  --good: #66d69e;
  --bad: #ff8f78;
  --warn: #ffc36d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 8%, rgba(168, 145, 255, 0.23), transparent 26rem),
    radial-gradient(circle at 86% 12%, rgba(255, 143, 120, 0.15), transparent 24rem),
    var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--fg);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button,
a.auth-button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.auth-state {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 850;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
}

.admin-pill,
.status-strip,
.code {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.admin-pill {
  padding: 9px 13px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ghost-button,
.auth-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 850;
}

.ghost-button {
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 260px);
  padding: 0 18px;
  background: var(--fg);
  color: #15101f;
  text-decoration: none;
}

.hero-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(1.2);
}

[hidden] {
  display: none !important;
}

.auth-state .hero-panel {
  display: block;
  max-width: 720px;
}

.auth-panel {
  align-items: center;
  margin-bottom: 16px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.auth-panel .auth-actions {
  min-width: min(100%, 520px);
}

.help-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.help-card strong {
  display: block;
}

.help-card a {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 820;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 860;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 5rem);
}

h2 {
  font-size: 1.05rem;
}

p {
  max-width: 68ch;
  margin: 12px 0 0;
  color: var(--muted);
}

.range-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 340px);
}

.range-control label {
  color: var(--muted);
  font-weight: 760;
}

.range-control select,
.range-control button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.range-control select {
  flex: 1;
  padding: 0 12px;
  background: var(--soft);
  color: var(--fg);
}

.range-control button {
  padding: 0 15px;
  background: var(--accent);
  color: #15101f;
  font-weight: 850;
}

.status-strip {
  margin: 16px 0;
  padding: 12px 15px;
  border-radius: 18px;
}

.status-strip.error {
  border-color: rgba(255, 143, 120, 0.46);
  color: var(--bad);
}

.metric-grid,
.panel-grid {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(22px) saturate(1.16);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
  border-radius: 22px;
}

.metric-card .label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 2rem;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 650;
}

.panel {
  min-width: 0;
  padding: 18px;
  border-radius: 24px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.panel header {
  margin-bottom: 14px;
}

.panel header p {
  margin-top: 5px;
  font-size: 0.93rem;
}

.control-list {
  display: grid;
  gap: 8px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
}

.state {
  min-width: 56px;
  padding: 5px 9px;
  border-radius: 999px;
  text-align: center;
}

.state.on {
  background: rgba(102, 214, 158, 0.16);
  color: var(--good);
}

.state.off {
  background: rgba(255, 143, 120, 0.14);
  color: var(--bad);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: var(--fg);
  font-weight: 650;
}

.code {
  display: inline-block;
  padding: 8px 11px;
  border-radius: 12px;
}

@media (max-width: 860px) {
  .hero-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .range-control {
    align-items: stretch;
    flex-direction: column;
  }
}
