:root {
  --bg: #fff;
  --surface: #fff;
  --soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --border: #e2e8f0;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --green: #15803d;
  --amber: #92400e;
  --amber-bg: #fffbeb;
  --max: 1180px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --surface: #0b0f14;
    --soft: #111820;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #26303b;
    --blue: #60a5fa;
    --blue-hover: #93c5fd;
    --green: #4ade80;
    --amber: #fbbf24;
    --amber-bg: #211a0a;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
form { margin: 0; }

.page { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }

header {
  height: 72px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.header-inner, .header-nav, .footer-inner, .actions, .section-heading, .card-header {
  display: flex;
  align-items: center;
}
.header-inner, .footer-inner, .section-heading, .card-header { justify-content: space-between; }
.header-inner, .header-nav, .footer-inner { gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.logo { width: 26px; height: 32px; display: block; }

main { flex: 1; display: flex; align-items: center; padding: 54px 0; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 72px;
  align-items: center;
}
.kicker { margin-bottom: 16px; color: var(--blue); font-size: 14px; font-weight: 650; }
.kicker.success { color: var(--green); }
h1 { margin: 0; max-width: 760px; font-size: clamp(42px, 5vw, 68px); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.lead { max-width: 660px; margin: 24px 0 0; color: var(--muted); font-size: 19px; line-height: 1.6; }
.muted { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.actions { flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.button:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.button:disabled { opacity: .65; cursor: wait; }
.secondary-btn { background: var(--soft); border-color: var(--border); color: var(--text); }
.secondary-btn:hover { background: var(--surface); border-color: var(--muted); color: var(--text); }
.button.full { width: 100%; margin-top: 20px; }
.secondary { color: var(--muted); font-size: 14px; font-weight: 550; }
.secondary:hover { color: var(--text); }

.facts { display: flex; flex-wrap: wrap; gap: 12px 26px; margin-top: 30px; color: var(--muted); font-size: 13px; }

.card { padding: 28px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.price { display: flex; align-items: baseline; gap: 8px; }
.price strong { font-size: 42px; letter-spacing: -.04em; }
.price span { color: var(--muted); font-size: 14px; }
.storage { margin-top: 4px; font-size: 17px; font-weight: 650; }
hr { margin: 24px 0; border: 0; border-top: 1px solid var(--border); }
.features { margin: 0; padding-left: 20px; display: grid; gap: 12px; color: var(--muted); font-size: 14px; }
.plan-card .button { width: 100%; margin-top: 24px; }
.smallprint { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.smallprint.left { text-align: left; }

.bottom { border-top: 1px solid var(--border); background: var(--soft); }
.bottom-inner { min-height: 116px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; }
.bottom-inner > div { padding: 0 28px; border-right: 1px solid var(--border); }
.bottom-inner > div:first-child { padding-left: 0; }
.bottom-inner > div:last-child { padding-right: 0; border-right: 0; }
.bottom-inner strong, .bottom-inner span { display: block; }
.bottom-inner strong { margin-bottom: 5px; font-size: 14px; }
.bottom-inner span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.status-banner {
  margin-top: 18px;
  padding: 11px 14px;
  border: 1px solid #f59e0b;
  border-radius: 7px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.45;
}
.status-banner[hidden] { display: none; }

footer { min-height: 54px; display: flex; align-items: center; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.footer-links { display: flex; gap: 18px; }

.auth-page main { justify-content: center; }
.auth-container { max-width: 480px; }
.auth-card { padding: 36px; }
.auth-card h1 { font-size: 28px; letter-spacing: -.03em; }
.auth-lead { margin: 10px 0 20px; font-size: 15px; }
label { display: block; margin-top: 16px; font-size: 13px; font-weight: 600; }
input {
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}
input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.notice { margin: 14px 0; padding: 11px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--soft); font-size: 13px; line-height: 1.45; }
.notice:empty { display: none; }

.dashboard-page main { align-items: stretch; padding: 44px 0; }
.dashboard-container { max-width: 980px; }
.dashboard-container h1, .setup-container h1 { font-size: 36px; letter-spacing: -.035em; }
.dashboard-container .lead, .setup-container .lead { margin-top: 12px; font-size: 16px; }
.user-badge { max-width: 280px; overflow: hidden; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.keys-card { margin-top: 32px; }
.keys-header { align-items: flex-start; gap: 20px; }
.keys-header .button { flex: none; }
.password-list { margin-top: 22px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--soft); }
.app-password { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.app-password:last-child { border-bottom: 0; }
.app-password-info { display: flex; align-items: center; min-width: 0; gap: 12px; }
.app-password strong { font-size: 14px; }
.app-password form { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.app-password .key-error { margin: 8px 0 0; text-align: right; }
.key-hint { color: var(--muted); font-size: 13px; }
.empty-keys { padding: 18px 16px; color: var(--muted); font-size: 14px; }
.security-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-menu { display: flex; gap: 8px; margin-top: 24px; padding-bottom: 4px; overflow-x: auto; }
.account-menu a { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.account-menu a:hover { border-color: var(--muted); color: var(--text); }
.account-section { margin-top: 18px; scroll-margin-top: 20px; }
.account-section:first-of-type { margin-top: 24px; }
.account-section-header { align-items: flex-start; gap: 20px; }
.plan-badge { flex: none; padding: 5px 9px; border-radius: 999px; background: var(--soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.account-details { margin-top: 20px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; }
.account-details > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.account-details > div:last-child { border-bottom: 0; }
.account-details > div > span:first-child { color: var(--muted); font-size: 13px; }
.account-details strong { font-size: 14px; }
.account-email { min-width: 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.account-actions .button { width: auto; }
.danger-card { border-color: color-mix(in srgb, #b91c1c 35%, var(--border)); }
.danger-btn { border-color: #b91c1c; background: #b91c1c; }
.danger-btn:hover { border-color: #991b1b; background: #991b1b; }
.delete-account-form { margin-top: 18px; }
.delete-account-form label { margin-top: 0; }
.delete-account-form .danger-btn { width: auto; margin-top: 14px; }
.link-button { padding: 4px 8px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 13px; font-weight: 550; cursor: pointer; }
@media (hover: hover) {
  .link-button:hover { background: var(--surface); color: var(--text); }
}

.setup-container { width: min(760px, calc(100% - 48px)); margin: 0 auto; }
.setup-flow { margin-top: 32px; padding: 0 28px; }
.setup-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 16px; padding: 26px 0; border-bottom: 1px solid var(--border); }
.setup-step.last-step { border-bottom: 0; }
.step-number { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--soft); color: var(--blue); font-size: 13px; font-weight: 700; }
.step-copy h2 { margin: 2px 0 8px; font-size: 17px; letter-spacing: -.02em; }
.step-copy p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.step-copy p + p { margin-top: 8px; }
.step-copy strong { color: var(--text); }
.credential-box { padding: 6px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--soft); }
.setup-fields { margin: 16px 0 10px; }
.credential-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.credential-row:last-child { border-bottom: 0; }
.cred-label { color: var(--muted); font-size: 13px; font-weight: 550; }
.cred-val { min-width: 0; font-size: 14px; }
.copy-field { display: flex; align-items: center; gap: 8px; }
.copy-value { min-width: 0; cursor: copy; }
code.copy-value { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
.copy-value:hover { border-color: var(--muted); }
.copy-value:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.copy-button {
  min-width: 68px;
  min-height: 32px;
  flex: none;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.copy-button:hover { border-color: var(--muted); color: var(--text); }
.muted-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.one-time-secret { margin-top: 14px; padding: 16px; border: 1px solid var(--blue); border-radius: 8px; background: var(--soft); }
.one-time-secret > strong { display: block; font-size: 14px; }
.one-time-secret p { margin-top: 10px; color: var(--text); font-size: 13px; }
.secret-copy-row { align-items: stretch; margin-top: 10px; }
.secret-input { min-width: 0; margin: 0; background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.secret-copy-row .copy-button { min-height: 44px; }
.key-error { margin-bottom: 0; }
.device-input { max-width: 340px; }
.setup-actions { margin-top: 14px; }
.setup-actions .button, .step-copy form .button { width: auto; margin-top: 14px; }
code { padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; word-break: break-all; }

@media (max-width: 820px) {
  .wrap { width: min(100% - 32px, var(--max)); }
  header { height: 64px; }
  main { align-items: stretch; padding: 40px 0; }
  .hero { grid-template-columns: 1fr; gap: 42px; }
  h1 { font-size: clamp(34px, 9vw, 54px); }
  .lead { font-size: 16px; }
  input { font-size: 16px; }
  .bottom-inner { grid-template-columns: 1fr; padding: 10px 0; }
  .bottom-inner > div { padding: 18px 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .bottom-inner > div:last-child { border-bottom: 0; }
  footer { padding: 16px 0; }
}

@media (max-width: 560px) {
  .header-nav .user-badge { display: none; }
  .card, .auth-card { padding: 20px; }
  .keys-header { flex-direction: column; }
  .keys-header .button { width: 100%; }
  .account-details > div { align-items: flex-start; flex-direction: column; gap: 7px; }
  .account-email { width: 100%; }
  .account-actions { flex-direction: column; }
  .account-actions .button, .delete-account-form .danger-btn { width: 100%; }
  .app-password { align-items: flex-start; }
  .app-password-info { align-items: flex-start; flex-direction: column; gap: 5px; }
  .setup-container { width: min(100% - 32px, 760px); }
  .setup-flow { padding: 0 20px; }
  .setup-step { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .credential-row { grid-template-columns: 1fr; gap: 4px; }
  .setup-actions .button, .step-copy form .button { width: 100%; }
  .footer-inner { padding: 8px 0; white-space: nowrap; }
}
