:root {
  --bg: #0f172a;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #e2e8f0;
  --success: #059669;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Segoe UI, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, #1e3a8a 0%, transparent 45%),
    linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

.page { max-width: 720px; margin: 0 auto; padding: 32px 20px 48px; }

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  color: #fff;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.header h1 { margin: 0; font-size: 28px; }

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.status {
  text-align: center;
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--border);
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border: 4px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.spinner.hidden { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.status h2 { margin: 0 0 8px; font-size: 22px; }
.status p { margin: 0; color: var(--muted); line-height: 1.5; }
.status.success h2 { color: var(--success); }

.steps { margin-top: 24px; }
.steps h3 { margin: 0 0 12px; font-size: 18px; }
.steps ol { margin: 0; padding-left: 20px; line-height: 1.7; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary { color: #fff; background: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }

.btn.secondary {
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.btn.secondary:hover { background: #dbeafe; }

.btn.small {
  padding: 10px 14px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.btn.small:hover { background: #dbeafe; }

.hidden { display: none !important; }

.step-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.step-nav-2 { grid-template-columns: repeat(2, 1fr); }
.step-nav-3 { grid-template-columns: repeat(3, 1fr); }

.visual-guide-1 { grid-template-columns: 1fr; }

.agent-secret {
  margin: 16px 0;
  padding: 16px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.agent-secret code {
  display: block;
  margin: 8px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: #b91c1c;
}

.step-item {
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.step-item span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  border-radius: 50%;
  background: #e2e8f0;
  font-size: 12px;
}

.step-item.active {
  color: var(--primary);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.step-item.active span { background: var(--primary); color: #fff; }

.step-item.done { color: var(--success); }
.step-item.done span { background: #d1fae5; color: var(--success); }

.panel { display: none; }
.panel.active { display: block; }

.panel h2 { margin: 0 0 10px; font-size: 22px; }

.lead {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.checklist {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.checklist li {
  position: relative;
  padding: 10px 12px 10px 36px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
}

.checklist li::before {
  content: "○";
  position: absolute;
  left: 12px;
  color: #94a3b8;
}

.checklist li.done {
  color: var(--success);
  background: #ecfdf5;
}

.checklist li.done::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
}

.agent-badge {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
}

.agent-badge-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.agent-badge strong {
  font-size: 20px;
  color: var(--primary);
}

.agent-badge-note {
  font-size: 13px;
  color: var(--muted);
}

.credentials-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
}

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.input-row input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
}

.input-row input:focus {
  outline: 2px solid #bfdbfe;
  border-color: var(--primary);
}

.share-hint {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.connect-steps {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
  color: var(--muted);
}

.launch-tip {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 14px;
  line-height: 1.6;
}

.one-click-box {
  margin: 20px 0 0;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #ecfdf5 100%);
  border: 2px solid #2563eb;
  text-align: center;
}

.one-click-box.hidden { display: none; }

.one-click-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: #1d4ed8;
}

.one-click-steps {
  text-align: left;
  margin: 0 0 14px;
  padding-left: 22px;
  line-height: 1.9;
  color: #0f172a;
}

.one-click-note {
  margin: 0;
  font-size: 14px;
  color: #64748b;
}

.run-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px dashed #2563eb;
}

.run-file {
  padding: 10px 16px;
  background: #0f172a;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
}

.run-arrow { font-size: 20px; color: #64748b; }

.run-action { font-size: 16px; color: #0f172a; }

.visual-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.visual-guide-box {
  padding: 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed var(--border);
  text-align: center;
}

.visual-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.visual-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.visual-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.page-wide { max-width: 900px; }

body.agent-page .card { padding: 32px; }

.agent-section {
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.agent-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.agent-badge-large {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.agent-badge-large strong { font-size: 22px; }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.theme-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.theme-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.theme-preview {
  margin: 0 0 12px;
  padding: 20px 12px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.theme-preview-loading { background: #000; }
.theme-preview-windows-update { background: #0078d4; }
.theme-preview-working { background: #1a1a2e; }
.theme-preview-maintenance { background: #0d1117; color: #56d364; }
.theme-preview-buffering { background: #111; color: #f87171; }
.theme-preview-security { background: #0f172a; color: #34d399; }

.run-cmd {
  display: block;
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 11px;
  word-break: break-all;
  line-height: 1.5;
}

.theme-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-actions .btn { padding: 10px 14px; font-size: 13px; }

kbd {
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  font-size: 12px;
  font-family: inherit;
}

@media (max-width: 600px) {
  .visual-guide { grid-template-columns: 1fr; }
}

.actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.actions-main {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.btn-run-primary {
  width: 100%;
  padding: 20px 24px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  text-align: center;
  text-decoration: none;
  display: block;
}

.btn-run-primary:hover {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
}

.btn-run-secondary {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.instructions-box {
  margin: 20px 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.instructions-box h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text);
}

.instructions-box .one-click-steps {
  margin: 0;
}

.ios-note {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 14px;
  color: #92400e;
  line-height: 1.6;
}

.note {
  margin: 24px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.footer {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.platform-badge {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.platform-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}

.platform-switch select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.one-click-steps code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  font-size: 12px;
}

.ios-post-install {
  margin: 20px 0 0;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #eff6ff 100%);
  border: 2px solid #f59e0b;
  text-align: left;
}

.ios-post-install.hidden { display: none; }

.mac-gatekeeper {
  margin: 20px 0 0;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fff7ed 100%);
  border: 2px solid #f59e0b;
  text-align: left;
}

.mac-gatekeeper.hidden { display: none; }

.mac-note {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  color: #78350f;
}

.mac-alert-steps {
  margin: 0;
  padding-left: 20px;
  color: #78350f;
  font-size: 14px;
  line-height: 1.6;
}

.mac-alert-steps li { margin-bottom: 6px; }

.ios-apple-note {
  margin: 0;
  font-size: 13px;
  color: #92400e;
  line-height: 1.6;
}

.diagnostics-consent {
  margin: 0 0 24px;
  padding: 20px;
  border-radius: 14px;
  background: #f0fdf4;
  border: 1px solid #86efac;
}

.diagnostics-consent h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #166534;
}

.diagnostics-intro {
  margin: 0 0 14px;
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
}

.diagnostics-list {
  margin: 0 0 14px;
  padding: 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #bbf7d0;
  font-size: 14px;
}

.diagnostics-list-title { margin: 0 0 8px; font-weight: 600; }
.diagnostics-list ul { margin: 0 0 10px; padding-left: 20px; line-height: 1.7; }
.diagnostics-never { margin: 0; font-size: 13px; color: #64748b; }

.diagnostics-issue-label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.diagnostics-issue {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.diagnostics-checkbox-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

.diagnostics-checkbox-label input { margin-top: 3px; }

.diagnostics-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.diagnostics-status { font-size: 14px; font-weight: 600; }
.diagnostics-status.success { color: var(--success); }
.diagnostics-status.error { color: #b91c1c; }

.diagnostics-lookup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.diagnostics-lookup input {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
}

.diagnostics-result {
  padding: 18px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.diagnostics-result.hidden { display: none; }

.diagnostics-result h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.diag-consent-badge {
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
}

.diag-dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
}

.diag-dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.diag-dl dd { margin: 0; color: var(--text); }

.diag-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.diag-alerts {
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 14px;
}

.diag-alerts ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }

.risk-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
}

.risk-high { background: #fecaca; color: #991b1b; }
.risk-medium { background: #fde68a; color: #92400e; }
.risk-low { background: #d1fae5; color: #065f46; }

.diag-sub {
  margin: 18px 0 8px;
  font-size: 15px;
  color: var(--text);
}

.diag-block {
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.6;
  max-height: 160px;
  overflow-y: auto;
}

.theme-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 600px) {
  .card { padding: 22px 18px; }
  .header h1 { font-size: 24px; }
}

/* ── Privacy mode overlay ── */

body.privacy-active { overflow: hidden; }

.privacy-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.privacy-overlay.active {
  display: flex;
  opacity: 1;
}

.privacy-screen {
  text-align: center;
  color: #e5e5e5;
  padding: 32px 24px;
  max-width: 420px;
  width: 100%;
  user-select: none;
}

.privacy-buffer-ring {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  animation: privacy-spin 1.1s linear infinite;
}

@keyframes privacy-spin { to { transform: rotate(360deg); } }

.privacy-buffer-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}

.privacy-buffer-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  animation: privacy-dot 1.4s ease-in-out infinite;
}

.privacy-buffer-dots span:nth-child(2) { animation-delay: 0.2s; }
.privacy-buffer-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes privacy-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.privacy-label {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
}

.privacy-message {
  margin: 0 0 28px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  min-height: 20px;
  transition: opacity 0.3s ease;
}

.privacy-progress-wrap { margin-bottom: 20px; }

.privacy-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.privacy-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #555, #aaa);
  border-radius: 4px;
  transition: width 0.15s linear;
}

.privacy-progress-text {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.06em;
}

.privacy-hint {
  margin: 0 0 24px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.28);
}

.privacy-exit {
  display: none;
  margin: 0 auto;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.privacy-exit:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
}

.privacy-overlay.active .privacy-exit { display: block; }
