:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f6f5f2;
  color: #302d29;
  --page: #f6f5f2;
  --surface: #fcfbf9;
  --surface-active: #f1eee9;
  --text: #302d29;
  --muted: #746d64;
  --border: #d8d3cb;
  --border-strong: #b8afa5;
  --accent: #5a4d43;
  --accent-hover: #493f37;
  --focus: rgba(90, 77, 67, .18);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

a { color: inherit; }

button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

button:hover:not(:disabled) { border-color: var(--border-strong); }
button:disabled { cursor: wait; opacity: .58; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.shell {
  width: min(620px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 72px;
}

.hero {
  display: grid;
  justify-items: center;
  margin-bottom: 24px;
}

.brand-link {
  color: #665f57;
  font-size: clamp(24px, 4.2vw, 28px);
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.25;
  text-decoration: none;
}

.brand-link:hover { color: var(--accent); }

.back-link {
  width: 100%;
  margin-top: 28px;
  color: var(--muted);
  font-size: 14px;
  text-underline-offset: 3px;
}

.back-link:hover { color: var(--accent); }

.candidate-notice {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

#candidate-description { margin: 5px 0 0; }

.eyebrow {
  margin: 0;
  color: #817160;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .11em;
}

.panel, .mailbox, .status {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(48, 45, 41, .04);
}

.status {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status.is-error {
  border-color: rgba(157, 44, 37, .3);
  background: #fdf6f5;
  color: #922f29;
}

.status.is-success {
  border-color: rgba(47, 109, 73, .28);
  background: #f4f9f6;
  color: #326746;
}

.panel { padding: 26px; }

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.tab {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.tab:last-child { border-right: 0; }
.tab:hover:not(:disabled) { background: #f7f5f1; border-color: var(--border); color: var(--text); }
.tab.is-active { background: var(--surface-active); color: var(--text); }

.legacy-account-note {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.flow { display: grid; gap: 15px; }

.flow h2, .flow h3 {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.35;
}

.flow h3 { font-size: 20px; }

.flow label {
  display: grid;
  gap: 7px;
  color: #413c36;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.flow input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.flow input:hover { border-color: var(--border-strong); }
.flow input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus);
}

.password-field {
  position: relative;
  display: block;
}

.field-group { display: grid; gap: 7px; }

.password-field input { padding-right: 62px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 34px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  transform: translateY(-50%);
}

.password-toggle:hover:not(:disabled) { background: var(--surface-active); }
.password-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }

.actions {
  display: flex;
  min-width: 0;
  align-items: end;
  gap: 8px;
}

.verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.verification-row .actions button { min-width: 132px; white-space: nowrap; }
.verification-row .hint:empty { display: none; }
.hint, .muted { color: var(--muted); font-size: 14px; line-height: 1.6; }
.compact { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border); }
.account-heading, .human-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.account-heading h2, .human-heading h2 { margin: 5px 0; }

.human-panel { margin-top: 16px; }
.local-slider {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f3f1ed;
}
.local-slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.local-slider strong { color: var(--accent); }

.mailbox { margin-top: 16px; padding: 16px 18px; box-shadow: none; }
.mailbox p:last-child { margin-bottom: 0; }
.mailbox code { color: #7d4038; font-size: 18px; letter-spacing: .16em; }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 620px); padding: 28px 0 48px; }
  .hero { margin-bottom: 18px; }
  .brand-link { font-size: 23px; }
  .back-link { margin-top: 20px; }
  .panel { padding: 18px; border-radius: 12px; }
  .tabs { margin-bottom: 22px; }
  .tab { min-height: 44px; padding: 0 8px; font-size: 14px; }
  .flow { gap: 14px; }
  .flow h2 { font-size: 22px; }
  .account-heading, .human-heading { align-items: stretch; flex-direction: column; }
}
