:root {
  --bg: #f7f7f8;
  --bg-glow: rgba(246, 130, 31, 0.10);
  --card: #ffffff;
  --text: #18181b;
  --muted: #63636b;
  --faint: #9c9ca5;
  --line: #e6e6ea;
  --soft: #f2f2f4;
  --primary: #18181b;
  --primary-ink: #ffffff;
  --primary-hover: #2c2c31;
  --accent: #f6821f;
  --accent-ink: #b45309;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --warn-soft: #fef3c7;
  --warn-ink: #92400e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -10px rgba(0, 0, 0, 0.12);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --bg-glow: rgba(246, 130, 31, 0.09);
    --card: #161619;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #6f6f78;
    --line: #26262b;
    --soft: #202024;
    --primary: #f4f4f5;
    --primary-ink: #18181b;
    --primary-hover: #dcdce0;
    --accent-ink: #fdba74;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.12);
    --err: #f87171;
    --err-soft: rgba(248, 113, 113, 0.12);
    --warn-soft: rgba(251, 191, 36, 0.12);
    --warn-ink: #fcd34d;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 12px 32px -10px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(900px 420px at 50% -120px, var(--bg-glow), transparent 70%), var(--bg);
}
a { color: inherit; }
main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px 64px; }
h1, h2, h3 { letter-spacing: -0.015em; margin: 0; }

/* Top bar and footer */
.topbar {
  width: 100%; max-width: 1040px; margin: 0 auto; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; text-decoration: none; }
.topbar nav { display: flex; gap: 20px; font-size: 14px; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }
.footer {
  width: 100%; max-width: 1040px; margin: 0 auto; padding: 20px 20px 28px;
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--faint);
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--muted); }

/* Landing */
.title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.find { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.find input { padding: 12px 14px; }
.under { margin: 16px 0 0; text-align: center; font-size: 12.5px; color: var(--faint); }
.under a { color: var(--muted); }

/* Install flow card */
.flow { max-width: 440px; margin: 8vh auto 0; }
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; }
.steps { display: flex; list-style: none; margin: 0 0 24px; padding: 0; gap: 8px; }
.steps li { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 500; color: var(--faint); }
.steps li::before { content: ""; height: 3px; border-radius: 3px; background: var(--line); transition: background 0.3s; }
.steps li.done, .steps li.current { color: var(--text); }
.steps li.done::before { background: var(--text); }
.steps li.current::before { background: var(--accent); }

.app { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.app-icon {
  flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  color: #fff; font-size: 22px; font-weight: 650;
  background: linear-gradient(135deg, hsl(var(--hue, 27) 85% 58%), hsl(calc(var(--hue, 27) + 35) 80% 46%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.app-text { min-width: 0; }
.app-title { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px; }
.app h1 { font-size: 20px; line-height: 1.25; font-weight: 650; overflow-wrap: anywhere; }
.app-meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.app-meta a { text-decoration: none; }
.app-meta a:hover { text-decoration: underline; }
.pill { font: 500 12px/1 var(--mono); padding: 4px 7px; border-radius: 6px; background: var(--soft); }

.page > * + * { margin-top: 14px; }
.lead-sm { margin: 0; color: var(--muted); }
.muted { color: var(--muted); margin: 0; }
.fine { margin: 14px 0 0; font-size: 12.5px; color: var(--faint); text-align: center; }
label .fine { margin: 0; display: inline; text-align: left; }

.creates { padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 13.5px; }
.creates strong { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.creates ul { margin: 0; padding-left: 18px; }

input, select {
  width: 100%; font: inherit; color: inherit; background: transparent;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--bg-glow); }
button { font: inherit; cursor: pointer; color: inherit; }
.primary, .button.primary {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 12px 16px; border: 0; border-radius: 12px; text-decoration: none;
  background: var(--primary); color: var(--primary-ink); font-size: 15px; font-weight: 600;
  transition: background 0.15s, transform 0.05s;
}
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary svg { width: 20px; height: 20px; color: var(--accent); }
.primary.busy { opacity: 0.6; pointer-events: none; }
button:disabled { opacity: 0.4; cursor: default; }
button.link { background: none; border: 0; padding: 0; font-size: 13px; color: var(--muted); }
button.link:hover { color: var(--text); text-decoration: underline; }
.secondary {
  display: inline-block; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; font-size: 14px; font-weight: 500; text-decoration: none;
}
.secondary:hover { background: var(--soft); }

.account { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--soft); font-size: 14px; }
.avatar { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--card); color: var(--muted); }
.account-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.account select { flex: 1; min-width: 0; padding: 4px 8px; border: 0; background: transparent; font-weight: 500; }

.plan { margin: 16px 0; display: grid; grid-template-columns: auto 1fr; font-size: 14px; }
.plan dt, .plan dd { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.plan dt:last-of-type, .plan dd:last-of-type { border-bottom: 0; }
.plan dt { color: var(--muted); padding-right: 16px; }
.plan dd { text-align: right; font-weight: 500; }
.plan .addr { font: 13px/1.5 var(--mono); }
.plan .arrow { color: var(--faint); margin: 0 4px; }
.plan .tag { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.plan .checking { grid-column: 1 / -1; color: var(--muted); padding: 10px 0; }
.note { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: var(--warn-soft); color: var(--warn-ink); }

.secrets { margin: 0 0 16px; }
.secrets-title { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.secrets label { display: block; margin-top: 10px; font-size: 13.5px; }
.secret-name { font: 500 13px var(--mono); }
.secrets input { margin-top: 6px; }
.secrets input[type="text"] { font-family: var(--mono); font-size: 14px; }
.auto-note { margin: 10px 0 0; font-size: 12.5px; color: var(--faint); }

details { margin-top: 16px; font-size: 14px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; width: max-content; }
summary:hover { color: var(--text); }
details label { display: block; margin-top: 12px; color: var(--muted); font-size: 13px; }
details input { margin-top: 6px; color: var(--text); }

.progress { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.progress li { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: var(--muted); }
.progress li::before {
  content: "✓"; flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--ok-soft); color: var(--ok);
}
.progress li:last-child { color: var(--text); }
.progress.running li:last-child::before {
  content: ""; background: none; border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.progress.failed li:last-child::before { content: "✕"; background: var(--err-soft); color: var(--err); }
.progress.done { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .progress li::before { animation: none !important; } }

.done-mark { width: 48px; height: 48px; margin: 4px auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.done-mark svg { width: 24px; height: 24px; }
.result-ok { text-align: center; }
.result-ok h2, .result-fail h2 { margin: 0 0 4px; font-size: 18px; font-weight: 650; }
.result-ok p, .result-fail p { margin: 0; color: var(--muted); font-size: 14px; }
.url-box { display: flex; align-items: center; gap: 8px; margin: 18px 0 14px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.url-box span { flex: 1; min-width: 0; font: 13px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-box a { flex: none; padding: 7px 12px; border-radius: 8px; text-decoration: none; background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 600; }
.result-ok .created { margin-top: 4px; font-size: 13px; color: var(--muted); }
.result-fail { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--err-soft); }
.result-fail h2 { color: var(--err); font-size: 15px; }
.result-fail p { color: var(--text); margin-top: 4px; }
.result-fail .secondary { margin-top: 12px; }

.status { margin: 14px 0 0; font-size: 13.5px; text-align: center; color: var(--muted); }
.status:empty { display: none; }
.status.err { color: var(--err); }

/* Privacy page */
.prose { max-width: 680px; margin: 28px auto 0; }
.prose h1 { font-size: 26px; margin-bottom: 8px; }
.prose h2 { font-size: 16px; margin: 24px 0 6px; }
.prose p, .prose li { color: var(--muted); font-size: 14.5px; }
.prose b { color: var(--text); font-weight: 600; }
.prose ul { padding-left: 18px; margin: 0; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--text); }

@media (max-width: 480px) {
  .card { padding: 22px; }
  .flow { margin-top: 8px; }
}

/* ---- Connect page ---- */
.center { text-align: center; }
.checks { margin: 16px 0 18px; padding: 0; list-style: none; font-size: 13.5px; color: var(--muted); }
.checks li { position: relative; padding-left: 22px; margin-top: 8px; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.connected { margin-top: 14px; font-size: 13px; color: var(--muted); }
.choices { display: grid; gap: 8px; margin: 16px 0; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice input { width: auto; }

/* ---- Dashboard ---- */
.dash .topbar nav a { padding: 6px 10px; border-radius: 8px; }
.dash .topbar nav a.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.dash-main { max-width: 920px; padding-top: 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.panel h2 { font-size: 15px; font-weight: 650; margin-bottom: 10px; }
.panel h3 { font-size: 13px; font-weight: 650; color: var(--muted); margin: 18px 0 6px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.list { display: flex; flex-direction: column; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel .list { box-shadow: none; border: 1px solid var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); text-decoration: none; }
.row:first-child { border-top: 0; }
.row.link:hover { background: var(--soft); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-main strong { font-weight: 600; overflow-wrap: anywhere; }
.row-main .muted { font-size: 13px; }
.row-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.accent { background: var(--bg-glow); color: var(--accent-ink); }
.error-line { font-size: 12.5px; color: var(--err); text-decoration: none; overflow-wrap: anywhere; }
.error-line:hover { text-decoration: underline; }
button.small, .button.small { width: auto; padding: 7px 12px; font-size: 13px; font-weight: 600; border-radius: 9px; }
button.small:not(.primary), .button.small:not(.primary) { background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; display: inline-block; }
.ghost:hover { background: var(--soft) !important; }
.small-link { background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.small-link:hover { color: var(--text); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.toggle input { width: auto; }
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.inline-form input { flex: 1; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-size: 13px; }
.mono { font-family: var(--mono); }
.empty { text-align: center; padding: 40px 20px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.empty p { margin: 4px 0; }
.footnote { font-size: 12.5px; margin-top: 14px; }
.subpanel { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: var(--bg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin: 0; }
.grid2 label.check { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; }
.grid2 label.check input { width: auto; }
.settings { display: grid; gap: 12px; }
.setting-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.setting .gen { display: flex; gap: 10px; }
.setting .req { color: var(--err); }
.small-text { font-size: 12.5px; margin: 0 0 6px; }
.preview { margin: 14px 0 0; font-size: 13px; text-align: left; }
.deploy-form .actions { justify-content: flex-end; margin-top: 14px; }
.progress.finished li:last-child::before { content: "✓"; }
.result-line { margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }
.result-line.ok { background: var(--ok-soft); color: var(--ok); }
.result-line.ok a { color: inherit; }
.result-line.err { background: var(--err-soft); color: var(--err); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--primary); color: var(--primary-ink); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 10; max-width: calc(100% - 32px); }
.toast.err { background: var(--err); color: #fff; }
@media (max-width: 640px) {
  .row { flex-direction: column; align-items: flex-start; }
  .row-side { justify-content: flex-start; }
  .grid2 { grid-template-columns: 1fr; }
  .copy-row { flex-wrap: wrap; }
}
