:root {
  --bg: #f4f5f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-muted: #f6f7f9;
  --text: #101214;
  --muted: #6e7681;
  --line: rgba(16, 18, 20, 0.08);
  --line-strong: rgba(16, 18, 20, 0.12);
  --brand: #0a84ff;
  --brand-soft: rgba(10, 132, 255, 0.1);
  --brand-strong: #0066cc;
  --success: #0f8a5f;
  --success-soft: rgba(15, 138, 95, 0.12);
  --warning: #c57b00;
  --warning-soft: rgba(197, 123, 0, 0.12);
  --danger: #d12f2f;
  --danger-soft: rgba(209, 47, 47, 0.12);
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.07);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, "SF Pro Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at top center, rgba(10, 132, 255, 0.12), transparent 22%),
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.92), transparent 28%),
    linear-gradient(180deg, #fbfbfd 0%, #f4f5f7 42%, #eef1f5 100%);
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero,
.grid,
.stats-grid,
.overview-grid,
.table-controls,
.feature-band,
.landing-grid,
.platform-grid {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin-bottom: 24px;
}

.hero.single { grid-template-columns: 1fr; }

.hero-copy { max-width: 860px; }

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 28px;
  align-items: center;
  min-height: 72vh;
  margin-bottom: 28px;
}

.landing-copy h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 6vw, 5.4rem);
}

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

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

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

.table-controls {
  grid-template-columns: minmax(0, 2fr) minmax(220px, 0.8fr);
  margin-bottom: 18px;
}

.card,
.stat-card,
.device-card,
.glass-section,
.feature-tile,
.platform-card,
.step-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(160%);
}

.card,
.stat-card {
  border-radius: var(--radius-xl);
  border-color: var(--line);
}

.card { padding: 24px; }

.stat-card { padding: 20px; }

.device-card,
.glass-section {
  border-radius: 36px;
}

.device-card { padding: 18px; }

.feature-tile,
.platform-card,
.step-card {
  padding: 24px;
  border-radius: 28px;
}

.glass-section {
  padding: 28px;
  margin-bottom: 24px;
}

.compact-section {
  padding-top: 24px;
  padding-bottom: 24px;
}

.auth-shell {
  min-height: calc(100vh - 96px);
  display: grid;
  place-items: center;
}

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

.device-screen {
  display: grid;
  gap: 18px;
  min-height: 520px;
  padding: 22px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 244, 248, 0.82)),
    radial-gradient(circle at top right, rgba(10, 132, 255, 0.12), transparent 24%);
  border: 1px solid rgba(16, 18, 20, 0.06);
}

.device-status,
.device-panel {
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 18, 20, 0.06);
}

.device-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

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

.mini-steps {
  display: grid;
  gap: 10px;
}

.mini-steps span,
.inline-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(16, 18, 20, 0.05);
  color: var(--text);
  font-size: 0.9rem;
}

.device-qr {
  display: grid;
  place-items: center;
  min-height: 260px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 251, 0.94));
  border: 1px solid rgba(16, 18, 20, 0.06);
}

.qr-placeholder {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(16, 18, 20, 0.08) 12px, transparent 12px) 0 0 / 24px 24px,
    linear-gradient(rgba(16, 18, 20, 0.08) 12px, transparent 12px) 0 0 / 24px 24px,
    linear-gradient(135deg, rgba(10, 132, 255, 0.14), rgba(16, 18, 20, 0.03));
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.85);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--success));
}

h1, h2, h3 { margin: 0; }

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.lead { max-width: 740px; }

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

.stack { display: grid; gap: 16px; }

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

.section-head-column {
  align-items: flex-start;
  justify-content: flex-start;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(10, 132, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.1);
  background: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, #1490ff, #007aff);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(10, 132, 255, 0.22);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: none;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
}

.text-link {
  color: var(--brand-strong);
  text-decoration: none;
  font-weight: 600;
}

.alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.alert.error {
  color: var(--danger);
  background: rgba(209, 47, 47, 0.06);
  border-color: rgba(209, 47, 47, 0.14);
}

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

.pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.pill.success,
.status-active {
  color: var(--success);
  background: var(--success-soft);
}

.status-stale {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-never {
  color: var(--danger);
  background: var(--danger-soft);
}

.metric-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.metric-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.result-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.invite-note { margin-top: 18px; }

.qr-image {
  width: min(100%, 300px);
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  font-family: "Cascadia Code", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.steps {
  display: grid;
  gap: 12px;
}

.step {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.92));
  border: 1px solid var(--line);
}

.feature-tile p,
.platform-card p,
.step-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.step-index {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--brand-strong);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.stat-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  display: block;
  margin-bottom: 8px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.profiles {
  display: grid;
  gap: 10px;
}

.profile-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.92));
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.profile-row:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 132, 255, 0.18);
}

.profile-main,
.profile-meta {
  min-width: 0;
}

.profile-main { font-weight: 700; }

.profile-meta {
  max-width: 58%;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

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

.peer-table th,
.peer-table td {
  padding: 14px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.peer-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.peer-name { font-weight: 700; }

.peer-key,
.mono {
  font-family: "Cascadia Code", "Courier New", monospace;
  font-size: 0.86rem;
}

.compact-table th,
.compact-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.sort-button::after {
  content: "↕";
  color: var(--muted);
  font-size: 0.9em;
}

.sort-button[data-active="true"][data-direction="asc"]::after {
  content: "↑";
  color: var(--brand-strong);
}

.sort-button[data-active="true"][data-direction="desc"]::after {
  content: "↓";
  color: var(--brand-strong);
}

@media (max-width: 980px) {
  .grid,
  .stats-grid,
  .overview-grid,
  .table-controls,
  .feature-band,
  .landing-grid,
  .platform-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .hero,
  .landing-hero {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .page { padding: 18px 14px 42px; }

  .card,
  .stat-card,
  .feature-tile,
  .platform-card,
  .step-card,
  .glass-section {
    padding: 18px;
    border-radius: 22px;
  }

  .device-card {
    padding: 14px;
    border-radius: 24px;
  }

  .device-screen {
    min-height: 420px;
    padding: 16px;
    border-radius: 22px;
  }

  .profile-row,
  .metric-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-meta {
    max-width: 100%;
    text-align: left;
  }

  .actions { width: 100%; }

  .actions .button,
  .actions form {
    width: 100%;
  }

  .actions form .button { width: 100%; }
}
