:root {
  --bg: #050b14;
  --panel: rgba(8, 18, 32, .94);
  --panel-2: rgba(12, 27, 47, .94);
  --line: rgba(52, 135, 255, .22);
  --blue: #087cff;
  --blue-2: #0062ff;
  --cyan: #19a7ff;
  --text: #f4f8ff;
  --muted: #8190a6;
  --green: #2ed384;
  --red: #ff5468;
  --yellow: #ffb84d;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 110, 255, .18), transparent 28%),
    radial-gradient(circle at 85% 80%, rgba(0, 85, 255, .15), transparent 25%),
    linear-gradient(135deg, #050a12 0%, #071321 46%, #040811 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(rgba(70,130,255,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70,130,255,.12) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.bg-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
  opacity: .18;
}

.glow-a {
  width: 420px;
  height: 420px;
  background: #0077ff;
  top: -140px;
  left: -120px;
}

.glow-b {
  width: 460px;
  height: 460px;
  background: #0051ff;
  right: -180px;
  bottom: -170px;
}

button,
input {
  font: inherit;
}

.wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top))
    16px
    max(20px, env(safe-area-inset-bottom));
}

.panel {
  width: 100%;
  max-width: 620px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(10, 24, 42, .97), rgba(6, 14, 26, .97));
  box-shadow:
    0 28px 70px rgba(0,0,0,.45),
    0 0 40px rgba(0,102,255,.08);
  backdrop-filter: blur(16px);
}

.hidden {
  display: none !important;
}

h1, h2 {
  margin: 0;
}

h1 {
  margin-top: 26px;
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

.muted,
.help,
.brand-sub {
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-weight: 900;
  font-size: 23px;
  background:
    linear-gradient(145deg, #0a8cff, #004eff);
  box-shadow:
    0 0 22px rgba(0, 115, 255, .36),
    inset 0 1px 0 rgba(255,255,255,.25);
}

.brand-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1.2px;
}

.brand-sub {
  margin-top: 1px;
  font-size: 13px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.form {
  margin-top: 18px;
}

input {
  width: 100%;
  margin: 6px 0;
  padding: 14px 15px;
  color: white;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(113,149,197,.20);
  border-radius: 12px;
  outline: none;
}

input::placeholder {
  color: #68788f;
}

input:focus {
  border-color: rgba(0,126,255,.72);
  box-shadow: 0 0 0 3px rgba(0,126,255,.11);
}

.btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
}

.btn:active {
  transform: scale(.98);
}

.btn-primary {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  color: white;
  font-weight: 800;
  background: linear-gradient(90deg, #0077ff, #0057ff);
  box-shadow: 0 8px 26px rgba(0,91,255,.25);
}

.btn-secondary {
  padding: 11px 15px;
  color: #eaf4ff;
  background: rgba(0,107,255,.14);
  border: 1px solid rgba(0,120,255,.30);
}

.btn-ghost {
  padding: 10px 14px;
  color: #a9b8cc;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

.device-card {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-radius: 15px;
  border: 1px solid rgba(0,123,255,.16);
  background:
    linear-gradient(90deg, rgba(0,100,255,.09), rgba(255,255,255,.02));
}

.device-left {
  display: flex;
  gap: 11px;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.online {
  background: var(--green);
  color: var(--green);
}

.offline {
  background: var(--red);
  color: var(--red);
}

.device-title {
  font-size: 12px;
  color: #6f819a;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.device-state {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
}

.signal-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: #6eb8ff;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(0,130,255,.25);
  background: rgba(0,110,255,.08);
}

.garage-button {
  width: 100%;
  height: 180px;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  color: white;
  border: 1px solid rgba(79,164,255,.35);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(44,159,255,.42), transparent 48%),
    linear-gradient(145deg, #087cff 0%, #0055ed 45%, #003aa9 100%);
  box-shadow:
    0 16px 42px rgba(0,92,255,.28),
    inset 0 1px 0 rgba(255,255,255,.24);
  cursor: pointer;
  transition: transform .10s ease, filter .18s ease, opacity .18s ease;
}

.garage-button:active:not(:disabled) {
  transform: scale(.985);
  filter: brightness(1.08);
}

.garage-button:disabled {
  opacity: .28;
  cursor: not-allowed;
  filter: grayscale(.25);
}

.garage-button-main {
  font-size: 30px;
  font-weight: 950;
  letter-spacing: .4px;
}

.garage-button-small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,.72);
}

.command-status {
  min-height: 25px;
  margin-top: 14px;
  text-align: center;
  font-weight: 750;
}

.success { color: var(--green); }
.warning { color: var(--yellow); }
.fail, .error { color: var(--red); }

.message {
  min-height: 22px;
}

.stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(75,125,190,.13);
  background: rgba(255,255,255,.035);
}

.stat-label {
  display: block;
  color: #6f8198;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.stat-value {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.stat-small {
  font-size: 13px;
  line-height: 1.4;
}

.admin {
  margin-top: 30px;
}

.section-header {
  margin-bottom: 12px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.075);
}

.section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.3px;
}

.admin-card {
  margin-top: 10px;
  padding: 15px;
  border-radius: 15px;
  border: 1px solid rgba(62,120,190,.13);
  background: rgba(255,255,255,.025);
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #aebdd1;
  font-size: 13px;
  font-weight: 800;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row input {
  flex: 1;
}

.userRow,
.logRow {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.045);
}

.userRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.userName {
  font-weight: 800;
}

.userMeta,
.logMeta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.userActions {
  display: flex;
  gap: 6px;
}

.danger {
  color: #ff8090;
  background: rgba(255,74,96,.09);
  border-color: rgba(255,74,96,.18);
}

.logTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.logStatus {
  color: #70b8ff;
  font-weight: 800;
}

@media (max-width: 560px) {
  .wrap {
    align-items: flex-start;
    padding-left: 10px;
    padding-right: 10px;
  }

  .panel {
    margin-top: 10px;
    padding: 18px;
    border-radius: 18px;
  }

  .garage-button {
    height: 175px;
  }

  .garage-button-main {
    font-size: 27px;
  }

  .stackMobile {
    flex-direction: column;
  }

  .stackMobile .btn {
    width: 100%;
  }

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

  .userActions {
    width: 100%;
  }

  .userActions .btn {
    flex: 1;
  }
}
