:root {
  --bg: #0a0a0a;
  --bg-elevated: #121212;
  --bg-soft: #101113;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: #1f1f1f;
  --border-strong: rgba(255, 255, 255, 0.08);
  --text: #f5f7fa;
  --muted: #a1a1aa;
  --muted-strong: #c9c9d1;
  --accent: #fafafa;
  --success: #3ddc97;
  --danger: #ff6b6b;
  --warning: #f0b429;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  --radius: 12px;
  --radius-sm: 10px;
  --content-width: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(82, 189, 255, 0.08), transparent 22%),
    linear-gradient(180deg, #090909 0%, #0b0b0c 100%);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

code,
pre {
  font-family: 'JetBrains Mono', monospace;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 28px 20px;
  background: rgba(10, 10, 10, 0.82);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ffffff, #5dd1ff);
  box-shadow: 0 0 28px rgba(93, 209, 255, 0.4);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted-strong);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, color 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item svg,
.ghost-button svg,
.upload-zone svg,
.empty-state svg {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.sidebar-footer p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-footer code {
  color: var(--muted-strong);
  font-size: 12px;
}

.main-column {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 40px 8px;
}

.topbar h1,
.setup-card h1,
.install-shell h1,
.hero-card h2 {
  margin: 6px 0 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.03;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.topbar-actions,
.hero-actions,
.form-actions,
.endpoint-actions,
.list-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.content-area {
  width: min(calc(100vw - 320px), var(--content-width));
  padding: 24px 40px 48px;
}

.hero-card,
.card,
.setup-card,
.install-panel,
.install-card,
.device-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 34px;
  margin-bottom: 24px;
}

.hero-card::after,
.preview-surface::after,
.install-panel::after {
  content: '';
  position: absolute;
  inset: auto -10% -55% auto;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(120, 180, 255, 0.18), transparent 62%);
  pointer-events: none;
}

.hero-copy,
.card p,
.field span,
.doc-list p,
.generated-meta p {
  color: var(--muted);
  line-height: 1.7;
}

.button,
.button-secondary,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.button {
  background: linear-gradient(180deg, #ffffff, #d9dce3);
  color: #0a0a0a;
  font-weight: 700;
}

.button:hover,
.button-secondary:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.button-secondary,
.ghost-button {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-strong);
  color: var(--text);
}

.compact {
  min-height: 38px;
  padding-inline: 14px;
}

.text-link {
  color: var(--muted-strong);
}

.stat-grid,
.panel-grid,
.apps-grid,
.install-grid,
.install-detail-grid {
  display: grid;
  gap: 18px;
}

.stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 24px;
}

.panel-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.create-grid {
  align-items: start;
}

.docs-grid .span-three,
.panel-grid .span-three {
  grid-column: span 3;
}

.span-two {
  grid-column: span 2;
}

.card {
  padding: 24px;
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.card:hover,
.install-card:hover,
.device-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.12);
}

.stat-card strong,
.preview-surface h4,
.install-hero-brand strong,
.install-status h2 {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.accent-card {
  background: linear-gradient(180deg, rgba(93, 209, 255, 0.12), rgba(255, 255, 255, 0.03));
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}

.panel-head h3,
.install-card h3,
.device-card h3,
.empty-state h4 {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 320px;
  padding: 24px;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.empty-state.spacious {
  min-height: 420px;
}

.list-stack,
.timeline,
.endpoint-stack,
.doc-list {
  display: grid;
  gap: 14px;
}

.list-row,
.timeline-step {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.list-row:first-child,
.timeline-step:first-child {
  border-top: 0;
  padding-top: 0;
}

.app-chip {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-chip-link {
  padding: 6px;
  margin: -6px;
  border-radius: 12px;
  transition: background 180ms ease, transform 180ms ease;
}

.app-chip-link:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.app-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-chip img,
.install-hero-brand img,
.preview-logo img,
.mini-phone-screen img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.app-chip strong,
.generated-preview strong {
  display: block;
}

.app-chip span,
.generated-preview span,
.preview-meta span,
.generated-meta p,
.install-copy,
.install-note {
  color: var(--muted);
  font-size: 14px;
}

.field {
  display: grid;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field input[type='text'],
.field input[type='password'],
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.color-field {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
}

.color-field input[type='color'] {
  inline-size: 100%;
  block-size: 50px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: transparent;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  cursor: pointer;
}

.upload-zone input {
  display: none;
}

.form-actions {
  justify-content: space-between;
  padding-top: 10px;
}

.preview-card {
  position: sticky;
  top: 24px;
}

.preview-surface {
  position: relative;
  padding: 28px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at top, color-mix(in srgb, var(--preview-accent, #111111) 40%, transparent), transparent 58%);
}

.preview-badge,
.permission-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-strong);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-logo {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 22px 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-logo img {
  width: 100%;
  height: 100%;
}

.preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  font-family: 'JetBrains Mono', monospace;
}

.apps-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-card {
  display: grid;
  gap: 18px;
}

.app-settings-form {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.inline-action-form {
  margin-top: 6px;
}

.edit-upload-zone {
  min-height: 180px;
}

.edit-current-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  border-radius: 18px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.app-card-top,
.generated-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.app-card-highlight {
  border-color: rgba(93, 209, 255, 0.36);
  box-shadow: 0 0 0 1px rgba(93, 209, 255, 0.14), var(--shadow);
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--dot);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 18%, transparent);
}

.endpoint-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.endpoint-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.endpoint-card code,
.docs-block code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted-strong);
}

.mini-phone {
  width: 130px;
  padding: 8px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.mini-phone-screen {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 170px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 34%, #151515), #121212);
}

.docs-block {
  padding: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.docs-block pre {
  margin: 0;
  white-space: pre-wrap;
}

.timeline-step span {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
}

.timeline-step p {
  margin: 0;
}

.toast {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 15px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 12, 12, 0.94);
  opacity: 0;
  transform: translateY(8px);
  transition: transform 220ms ease, opacity 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(61, 220, 151, 0.28);
}

.toast-error {
  border-color: rgba(255, 107, 107, 0.28);
}

.toast-inline {
  position: sticky;
  top: 14px;
  z-index: 10;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 100;
}

.modal-backdrop.is-visible {
  opacity: 1;
}

.modal-card {
  width: min(480px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(22, 22, 24, 0.98), rgba(12, 12, 12, 0.98));
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin: 6px 0 12px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.danger-button {
  border-color: rgba(255, 107, 107, 0.3);
  color: #ffd1d1;
}

.setup-shell,
.install-shell {
  display: grid;
  place-items: center;
  padding: 32px;
}

.setup-card {
  width: min(760px, 100%);
  padding: 36px;
}

.install-shell {
  min-height: 100vh;
}

.install-wrap {
  width: min(1180px, 100%);
}

.install-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.install-panel {
  padding: 32px;
}

.install-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.install-hero-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.install-grid {
  grid-template-columns: 1.1fr 0.9fr;
  margin-top: 20px;
}

.install-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

.install-card,
.device-card {
  padding: 24px;
}

.install-status {
  display: grid;
  gap: 14px;
}

.permission-pill[data-tone='success'] {
  background: rgba(61, 220, 151, 0.14);
  color: #b6f4d5;
}

.permission-pill[data-tone='error'] {
  background: rgba(255, 107, 107, 0.14);
  color: #ffd1d1;
}

.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.install-copy code {
  display: block;
  margin-top: 8px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.device-card ol {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.install-note {
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content-area {
    width: 100%;
    padding-inline: 20px;
  }

  .topbar {
    padding-inline: 20px;
  }

  .stat-grid,
  .panel-grid,
  .apps-grid,
  .install-grid,
  .install-detail-grid {
    grid-template-columns: 1fr;
  }

  .span-two,
  .docs-grid .span-three,
  .panel-grid .span-three {
    grid-column: auto;
  }

  .preview-card {
    position: static;
  }

  .install-hero,
  .hero-card,
  .list-row,
  .app-card-top,
  .generated-preview,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar h1,
  .setup-card h1,
  .install-shell h1,
  .hero-card h2 {
    font-size: 34px;
  }

  .content-area,
  .topbar,
  .sidebar,
  .install-shell {
    padding: 20px;
  }

  .hero-card,
  .card,
  .install-panel,
  .install-card,
  .device-card,
  .setup-card {
    padding: 20px;
  }
}
