:root {
  --bg: #0f1419;
  --bg-elev: #171e26;
  --card: #1c2530;
  --line: #2c3948;
  --text: #e8eef4;
  --muted: #8b9aab;
  --blue: #2196f3;
  --blue-dim: rgba(33, 150, 243, 0.16);
  --green: #34c759;
  --green-dim: rgba(52, 199, 89, 0.16);
  --amber: #ffb020;
  --amber-dim: rgba(255, 176, 32, 0.16);
  --red: #ff5a5f;
  --red-dim: rgba(255, 90, 95, 0.16);
  --slate: #9aa8b6;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.brand-panel {
  padding: 64px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(33, 150, 243, 0.28), transparent 55%),
    linear-gradient(160deg, #101820, #0f1419 60%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mark {
  display: flex;
  gap: 12px;
  align-items: center;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.mark-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
}
.brand-panel h1 { font-size: 52px; line-height: 1.05; max-width: 640px; }
.brand-panel p { color: var(--muted); max-width: 460px; font-size: 18px; margin-top: 18px; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.online, .stripe.active, .pill.active { background: var(--green); }
.dot.offline { background: #5c6b7a; }
.presence { display: flex; align-items: center; gap: 8px; }
.presence strong { font-size: 16px; }
.presence.online { color: var(--green); }
.presence.online .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-dim); }
.presence.offline { color: var(--muted); }
.presence.offline .dot { background: #5c6b7a; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode {
  text-align: left;
  background: #121920;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  min-height: 118px;
}
.mode strong { font-size: 20px; }
.mode.on { border-color: var(--blue); background: var(--blue-dim); box-shadow: inset 0 0 0 1px var(--blue); }
.mode span { display: block; color: var(--muted); margin-top: 6px; font-size: 14px; line-height: 1.35; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #121920;
  border: 1px solid var(--line);
}
.option strong { display: block; font-size: 16px; }
.option span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.option input { width: 22px; height: 22px; accent-color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #121920;
  border-radius: 999px;
  padding: 10px 16px;
}
.chip.on { background: var(--blue); border-color: var(--blue); color: white; }
.more { margin-top: 18px; }
.more summary { cursor: pointer; color: var(--muted); padding: 8px 0; }
.login-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.login-card form, .modal {
  width: min(440px, 100%);
  padding: 28px;
  box-shadow: var(--shadow);
}
label { display: block; color: var(--muted); font-size: 13px; margin: 14px 0 6px; }
input, select {
  width: 100%;
  background: #121920;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.primary, .ghost, .danger {
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
}
.primary { background: var(--blue); color: white; }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { background: var(--red-dim); color: #ffd7d8; }
button:disabled, input:disabled, select:disabled { opacity: 0.45; cursor: not-allowed; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.page > .row { flex-wrap: wrap; align-items: flex-start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.space { justify-content: space-between; }
.error { color: #ffb4b6; font-size: 14px; min-height: 1.2em; }
.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.demo-accounts button { text-align: left; padding: 10px; }

.topbar, .page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 22px 0; gap: 12px; flex-wrap: wrap; }
.who { color: var(--muted); font-size: 14px; }
.page h2 { font-size: 28px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.stat { padding: 16px 18px; }
.stat b { display: block; font-size: 28px; margin-top: 4px; }
.stat span { color: var(--muted); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: white; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.device-card {
  padding: 0;
  overflow: hidden;
  text-align: left;
  display: block;
  width: 100%;
  position: relative;
}
.device-card .body { padding: 16px 16px 16px 18px; }
.stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--slate); }
.stripe.expiring_soon { background: var(--amber); }
.stripe.off { background: var(--red); }
.stripe.enrolled_no_subscription { background: var(--blue); }
.stripe.not_enrolled { background: var(--slate); }
.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #2a3542;
  color: var(--text);
}
.pill.active { color: #06210e; }
.pill.expiring_soon { background: var(--amber); color: #2a1c00; }
.pill.off { background: var(--red); color: white; }
.pill.enrolled_no_subscription { background: var(--blue-dim); color: #b9dcff; }
.pill.not_enrolled { background: #2a3542; color: var(--muted); }
.device-card h3 { margin: 10px 0 4px; font-size: 20px; }
.meta { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--slate); }

.detail { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; margin-top: 18px; }
.panel { padding: 18px; }
.panel + .panel { margin-top: 0; }
.section-title { margin-bottom: 12px; }
.setting-block { margin-top: 22px; }
.setting-block h3 { margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.switch {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.switch small { display: block; color: var(--amber); margin-top: 4px; }
.switch input { width: auto; }
.banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--red-dim);
  color: #ffd7d8;
  margin-bottom: 12px;
}
.banner.warn { background: var(--amber-dim); color: #ffe3ad; }
.banner.ok { background: var(--green-dim); color: #b6f3c4; }
.panel-preview {
  border-radius: 28px;
  border: 8px solid #0a0e12;
  min-height: 320px;
  background: #070b10;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.panel-preview h3 { font-size: 28px; margin-bottom: 8px; }
.panel-preview p { color: var(--muted); }
.remote-screen {
  width: 100%;
  display: block;
  border-radius: 16px;
  background: #070b10;
  border: 8px solid #0a0e12;
  cursor: crosshair;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.back { background: none; border: 0; color: var(--blue); padding: 0; }
textarea {
  width: 100%;
  min-height: 140px;
  background: #121920;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}
.empty { color: var(--muted); padding: 24px; }

@media (max-width: 900px) {
  .login-shell, .detail, .stats, .modes, .option-grid { grid-template-columns: 1fr; }
  .brand-panel { padding: 32px 20px; }
  .brand-panel h1 { font-size: 36px; }
}
