:root {
  color-scheme: dark;
  --bg: #101110;
  --panel: #191b19;
  --line: #2c302b;
  --line-2: #41463e;
  --text: #f1f3ed;
  --muted: #a4aca0;
  --dim: #858e80;
  --acid: #dafa9c;
  --ember: #ffab98;
  --cyan: #a6dcd3;
  --font-ui: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
a { color: var(--acid); }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }

.shell {
  width: min(1120px, calc(100% - 64px));
  min-height: 100svh;
  margin: auto;
  display: flex;
  flex-direction: column;
}
.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand { color: inherit; text-decoration: none; }
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.06em;
}
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); }
.user-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.landing { padding: clamp(48px, 8vw, 96px) 0; flex: 1; display: flex; align-items: center; }
.landing-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 72px;
  align-items: center;
}
.hero {
  margin: 0;
  font-size: clamp(46px, 5.2vw, 64px);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -.055em;
}
.hero em { color: var(--acid); font-style: normal; }
.hero-caption { margin: 20px 0 0; font-size: 16px; color: var(--muted); }

.auth-card {
  padding: 28px 28px 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: 8px;
  background: #121410;
  border: 1px solid var(--line);
}
.tabs button {
  appearance: none;
  min-height: 40px;
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.tabs button[aria-selected="true"] {
  background: var(--acid);
  color: #1a2410;
  font-weight: 650;
}

.notice, .error-box {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.notice {
  border: 1px solid #3f4c31;
  background: #1c2418;
  color: var(--acid);
}
.error-box {
  border: 1px solid #774b3f;
  background: #38251f;
  color: var(--ember);
}
.notice[hidden], .error-box[hidden], [hidden] { display: none !important; }

.field { min-width: 0; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field label { font-size: 13px; color: #c5ccc0; }
.field input {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--text);
  background: #121410;
  font-size: 16px;
}
.field input::placeholder { color: #808879; }
.field input:focus { outline: none; border-color: var(--acid); box-shadow: 0 0 0 3px #dafa9c22; }
.field input[aria-invalid="true"] { border-color: #b67665; }
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px #121410 inset;
}

.strength { display: flex; flex-direction: column; gap: 6px; }
.strength-bar { height: 4px; border-radius: 8px; background: #2c302b; overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; background: var(--dim); transition: width .15s, background .15s; }
.strength[data-level="weak"] span { width: 28%; background: var(--ember); }
.strength[data-level="ok"] span { width: 66%; background: var(--cyan); }
.strength[data-level="strong"] span { width: 100%; background: var(--acid); }
.hint { margin: 0; color: var(--dim); font-size: 12px; }

.btn {
  appearance: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #22251f;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #30362a; border-color: #68765b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.btn.primary { background: var(--acid); border-color: var(--acid); color: #1a2410; font-weight: 650; }
.btn.primary:hover:not(:disabled) { background: #e6ffb9; border-color: #e6ffb9; }
.btn.wide { width: 100%; }
.auth-card .btn { min-height: 48px; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
}
.site-footer span:first-child { letter-spacing: .08em; font-size: 11px; }

.dash { flex: 1; padding: 48px 0 72px; }
.dash-head { margin-bottom: 28px; }
.dash-head h1 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -.045em; }
.dash-head p { margin: 6px 0 0; color: var(--muted); }
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.metric .k { color: var(--muted); font-size: 12px; }
.metric .v { margin-top: 6px; font: 22px/1.4 var(--font-mono); overflow-wrap: anywhere; }
.metric .v.text { font-family: var(--font-ui); font-size: 16px; font-weight: 600; }
.metric .meta { margin-top: 4px; color: var(--ember); font-size: 12px; }
.placeholder-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.placeholder-card h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.03em; }
.placeholder-card p { margin: 0 0 20px; color: var(--muted); }

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::before { animation: none; }
  .strength-bar span { transition: none; }
}

@media (max-width: 800px) {
  .shell { width: calc(100% - 40px); }
  .topbar { min-height: 72px; }
  .wordmark { font-size: 18px; }
  .landing { padding: 36px 0 48px; align-items: stretch; }
  .landing-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .hero { font-size: clamp(36px, 10vw, 48px); }
  .hero-caption { margin-top: 12px; font-size: 14px; }
  .auth-card, .placeholder-card { padding: 22px 18px; }
  .dash { padding: 32px 0 48px; }
  .dash-head h1 { font-size: 28px; }
  .metrics { grid-template-columns: 1fr; gap: 16px; }
  .placeholder-card .btn { width: 100%; }
}
@media (max-width: 420px) {
  .shell { width: calc(100% - 28px); }
  .tabs button { font-size: 13px; padding: 8px 2px; }
  .auth-card { padding: 18px 14px; }
}

body[data-page="auth"] main { visibility: hidden; }

#privacy-request{max-width:680px;margin:24px auto;padding:24px;line-height:1.8;border:1px solid var(--line);border-radius:12px;color:var(--muted)}
#privacy-request h2{font-size:20px;color:var(--text)}

.recovery-main { flex: 1; display: grid; place-items: center; padding: 48px 0; }
.recovery-card { width: min(100%, 440px); }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .08em; margin: 0 0 28px; }
.recovery-card h1 { font-size: 28px; line-height: 1.3; margin: 20px 0 12px; }
.recovery-copy { color: var(--muted); margin: 0 0 28px; overflow-wrap: anywhere; }
.status-icon { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; font-size: 28px; color: var(--acid); }
[data-state="error"] .status-icon { color: var(--ember); border-color: #774b3f; }
[data-state="loading"] .status-icon { border-right-color: var(--acid); animation: spin .8s linear infinite; }
.text-link { border: 0; background: none; color: var(--acid); padding: 12px 0; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.resend-open { display: block; margin: 12px auto 0; }
dialog { width: min(440px, calc(100% - 28px)); color: var(--text); }
dialog::backdrop { background: #000b; }
dialog h2 { font-size: 22px; }
.password-row { display: flex; gap: 8px; }
.password-row input { flex: 1; width: 0; }
#password-strength { margin: -6px 0 20px; }
#resend-message { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { [data-state="loading"] .status-icon { animation: none; } }

/* Auth owns one grid: introduction, then forms and supporting information. */
body[data-page="auth"] .shell { width: min(1120px, calc(100% - 32px)); }
body[data-page="auth"] .landing { padding: 32px 0; }
body[data-page="auth"] .landing-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}
body[data-page="auth"] .landing-grid > *, .auth-column { min-width: 0; }
.auth-column { display: grid; gap: 24px; }
body[data-page="auth"] .hero { font-size: clamp(32px, 5vw, 64px); }
body[data-page="auth"] .hero-caption { margin-top: 16px; }
body[data-page="auth"] .auth-card { min-width: 0; padding: 24px; }
body[data-page="auth"] .tabs { margin-bottom: 24px; gap: 8px; }
body[data-page="auth"] .tabs button { min-height: 48px; white-space: nowrap; }
body[data-page="auth"] .resend-open { margin: 0 0 16px; padding: 8px 0; min-height: 44px; text-align: left; }
body[data-page="auth"] #privacy-request {
  max-width: none;
  margin: 0;
  padding: 24px;
  overflow-wrap: anywhere;
}
body[data-page="auth"] #privacy-request h2 { margin: 0 0 8px; font-size: 18px; }
body[data-page="auth"] #privacy-request p { margin: 0 0 16px; }
body[data-page="auth"] .site-footer { padding: 24px 0; gap: 16px; }
@media (min-width: 1024px) {
  body[data-page="auth"] .landing-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
    gap: 64px;
  }
}
@media (max-width: 900px) {
  body[data-page="auth"] .landing { align-items: center; }
  body[data-page="auth"] .auth-card { padding: 16px; }
  body[data-page="auth"] #privacy-request { padding: 16px; }
}
