:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #687483;
  --border: #dfe6ee;
  --primary: #155eef;
  --primary-dark: #0f46bb;
  --good: #16845b;
  --warning: #b56a00;
  --danger: #c53929;
  --shadow:
    0 16px 40px rgba(27, 39, 51, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
}

.center-screen {
  display: grid;
  place-items: center;
  padding: 24px;

  background:
    radial-gradient(
      circle at top left,
      #e8f0ff,
      transparent 40%
    ),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 38px;

  background: var(--panel);

  border:
    1px solid var(--border);

  border-radius: 22px;

  box-shadow: var(--shadow);
}

.brand-lock,
.mini-logo {
  display: grid;
  place-items: center;

  font-weight: 800;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      #155eef,
      #0f46bb
    );
}

.brand-lock {
  width: 60px;
  height: 60px;

  margin-bottom: 24px;

  border-radius: 18px;

  font-size: 20px;
}

.mini-logo {
  width: 40px;
  height: 40px;

  border-radius: 12px;

  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login-card h1 {
  margin-bottom: 6px;

  font-size: 30px;
}

.subtitle {
  margin-bottom: 30px;

  color: var(--muted);
}

label {
  display: block;

  margin-bottom: 18px;

  font-size: 13px;
  font-weight: 650;
}

input {
  width: 100%;

  margin-top: 8px;
  padding: 13px 14px;

  border:
    1px solid var(--border);

  border-radius: 10px;

  background: #fff;

  outline: none;
}

input:focus {
  border-color: var(--primary);

  box-shadow:
    0 0 0 3px
    rgba(21, 94, 239, .10);
}

button {
  border: 0;
  border-radius: 10px;

  padding: 11px 16px;

  font-weight: 700;
}

.primary {
  color: #fff;
  background: var(--primary);
}

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

.secondary {
  color: var(--primary);

  background: #edf3ff;
}

.ghost {
  color: var(--text);

  background: transparent;

  border:
    1px solid var(--border);
}

.full {
  width: 100%;
}

.message {
  min-height: 18px;

  margin-top: 16px;

  font-size: 13px;

  color: var(--danger);
}

.topbar {
  height: 72px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding:
    0
    max(24px, calc((100vw - 1260px) / 2));

  background: #fff;

  border-bottom:
    1px solid var(--border);
}

.brand-row,
.top-actions,
.hero-status {
  display: flex;
  align-items: center;

  gap: 12px;
}

.brand-row small {
  display: block;

  margin-top: 2px;

  color: var(--muted);
}

.user-name {
  font-size: 14px;
}

.dashboard {
  width: min(1260px, calc(100% - 40px));

  margin: 0 auto;

  padding: 36px 0 60px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 30px;

  margin-bottom: 28px;

  padding: 30px;

  color: #fff;

  border-radius: 20px;

  background:
    linear-gradient(
      135deg,
      #14274a,
      #155eef
    );
}

.hero h2 {
  margin-bottom: 8px;

  font-size: 28px;
}

.hero p {
  margin-bottom: 0;

  opacity: .86;
}

.hero-status {
  min-width: 190px;

  padding: 14px 16px;

  background:
    rgba(255, 255, 255, .12);

  border:
    1px solid
    rgba(255, 255, 255, .16);

  border-radius: 14px;
}

.hero-status small {
  display: block;

  margin-top: 3px;

  opacity: .8;
}

.status-dot {
  width: 12px;
  height: 12px;

  border-radius: 50%;

  background: #48d597;

  box-shadow:
    0 0 0 5px
    rgba(72, 213, 151, .14);
}

.eyebrow {
  margin-bottom: 8px;

  font-size: 11px;
  font-weight: 800;

  letter-spacing: .12em;
}

.stats-grid {
  display: grid;

  grid-template-columns:
    repeat(4, 1fr);

  gap: 16px;

  margin-bottom: 34px;
}

.stat-card,
.side-card,
.device-card,
.empty-state {
  background: var(--panel);

  border:
    1px solid var(--border);

  border-radius: 16px;
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  display: block;

  margin-bottom: 8px;

  color: var(--muted);

  font-size: 13px;
}

.stat-card strong {
  font-size: 28px;
}

.content-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    320px;

  gap: 24px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  margin-bottom: 16px;
}

.section-heading h3 {
  margin: 0;

  font-size: 21px;
}

.device-list {
  display: grid;

  gap: 14px;
}

.device-card {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 20px;

  padding: 22px;
}

.device-card h3 {
  margin-bottom: 6px;
}

.device-meta {
  display: flex;
  flex-wrap: wrap;

  gap: 8px 16px;

  color: var(--muted);

  font-size: 13px;
}

.device-state {
  text-align: right;
}

.badge {
  display: inline-block;

  padding: 5px 9px;

  border-radius: 999px;

  font-size: 11px;
  font-weight: 800;
}

.badge.online {
  color: var(--good);
  background: #eaf8f2;
}

.badge.offline {
  color: #697586;
  background: #eef1f5;
}

.device-state small {
  display: block;

  margin-top: 8px;

  color: var(--muted);
}

.empty-state {
  padding: 42px 24px;

  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;

  display: grid;
  place-items: center;

  margin: 0 auto 16px;

  border-radius: 15px;

  background: #edf3ff;

  color: var(--primary);

  font-size: 24px;
}

.empty-state p {
  max-width: 420px;

  margin:
    0 auto
    20px;

  color: var(--muted);
}

.side-card {
  margin-bottom: 16px;
  padding: 22px;
}

.side-card > p:not(.eyebrow) {
  color: var(--muted);

  line-height: 1.55;
}

.protection-row {
  display: flex;
  justify-content: space-between;

  gap: 16px;

  padding: 12px 0;

  border-bottom:
    1px solid var(--border);

  font-size: 13px;
}

.protection-row:last-child {
  border-bottom: 0;
}

.good {
  color: var(--good);
}

.pending {
  color: var(--warning);
}

.modal {
  position: fixed;
  inset: 0;

  display: grid;
  place-items: center;

  padding: 24px;

  background:
    rgba(12, 22, 35, .55);
}

.modal-card {
  position: relative;

  width: min(460px, 100%);

  padding: 30px;

  background: #fff;

  border-radius: 20px;

  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;

  top: 14px;
  right: 14px;

  width: 36px;
  height: 36px;

  padding: 0;

  border-radius: 50%;

  background: #f0f3f7;

  font-size: 23px;
}

.pair-code {
  margin: 24px 0;

  padding: 20px;

  text-align: center;

  border:
    1px dashed #9bb7ed;

  border-radius: 14px;

  background: #f5f8ff;
}

.pair-code small,
.pair-code span {
  display: block;

  color: var(--muted);
}

.pair-code strong {
  display: block;

  margin: 8px 0;

  font-size: 27px;

  letter-spacing: .08em;
}

.security-note {
  margin:
    16px
    0
    0;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 900px) {

  .stats-grid {
    grid-template-columns:
      repeat(2, 1fr);
  }

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

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

}

@media (max-width: 600px) {

  .dashboard {
    width:
      min(100% - 24px, 1260px);

    padding-top: 20px;
  }

  .topbar {
    padding: 0 14px;
  }

  .user-name {
    display: none;
  }

  .stats-grid {
    grid-template-columns:
      1fr 1fr;

    gap: 10px;
  }

  .stat-card {
    padding: 16px;
  }

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

  .device-card {
    grid-template-columns: 1fr;
  }

  .device-state {
    text-align: left;
  }

}
