:root {
  color-scheme: light dark;
  --paper: light-dark(#f8fafc, #111717);
  --white: light-dark(#ffffff, #1a2028);
  --ink: light-dark(#1e293b, #f0f6ff);
  --muted: light-dark(#64748b, #a4b3c8);
  --line: light-dark(#dce4ef, #384456);
  --line-strong: light-dark(#dce4ef, #384456);
  --green: light-dark(#2563eb, #80aeff);
  --green-light: light-dark(#eaf1ff, #263b5c);
  --accent-hover: light-dark(#1d4ed8, #bdd5ff);
  --on-accent: light-dark(#ffffff, #102348);
  --hover: light-dark(#dce8fc, #30496c);
  --subtle: light-dark(#f1f5fb, #243145);
  --focus: light-dark(#3b82f6, #80aeff);
  --focus-ring: light-dark(#2563eb1a, #80aeff24);
  --shadow-color: light-dark(#1e3a5f14, #00000040);
  --shadow-soft: light-dark(#1e3a5f08, #0000001a);
  --danger-ink: light-dark(#a64437, #f2a99a);
  --danger-fill: light-dark(#a94b3e, #a94b3e);
  --on-danger: light-dark(#ffffff, #ffffff);
  --danger-hover: light-dark(#913d32, #be5b4d);
  --warning-ink: light-dark(#8b4d2d, #edbe98);
  --warning-bg: light-dark(#fcf1e8, #392c22);
  --warning-line: light-dark(#e9cdb9, #69503b);
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --shadow: 0 18px 55px -28px var(--shadow-color), 0 2px 5px var(--shadow-soft);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); line-height: 1.15; letter-spacing: -.045em; }
a { color: var(--green); }
button, input, textarea { font: inherit; }
button:not(:disabled), summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.hidden { display: none !important; }
.icon { flex: 0 0 auto; width: 1.15em; height: 1.15em; vertical-align: middle; }

.frame { display: flow-root; width: min(1096px, calc(100% - 72px)); margin-inline: auto; padding-bottom: 32px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.masthead { min-height: 85px; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
.masthead-actions { display: flex; align-items: center; gap: 10px; }
.theme-picker { display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); }
.theme-picker select { min-height: 38px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); font: inherit; font-size: .82rem; cursor: pointer; }
.frame > .theme-picker { margin-top: 16px; }
.frame > .theme-picker + main { margin-top: clamp(14px, 5vh, 52px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; background: var(--green); color: var(--on-accent); font-size: 22px; }
.brand-name { font: 750 1.2rem var(--mono); letter-spacing: -.06em; }
.status-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.lede { margin-top: 9px; color: var(--muted); line-height: 1.65; }

.login-layout { width: min(100%, 408px); margin: clamp(28px, 9vh, 100px) auto 0; }
.login-card, .single-card, .setting-panel { border-radius: 16px; }
.login-card, .single-card, .setting-panel { min-width: 0; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-card { padding: clamp(22px, 5vw, 32px); }
.login-heading { display: grid; justify-items: center; gap: 11px; }
.login-heading h1 { font-size: 1.55rem; letter-spacing: normal; }
.login-form { margin-top: 22px; }
.account-link { display: block; width: fit-content; margin: 16px auto 0; font-size: .85rem; text-underline-offset: 3px; }
.step-number { font-family: var(--mono); }
.form { display: grid; gap: 14px; }
.form label { display: block; min-width: 0; font-size: .87rem; font-weight: 650; }
.label-note { color: var(--muted); font-size: .78rem; font-weight: 450; margin-left: 5px; }
.form input:not([type='hidden'], [type='button']), textarea {
  display: block; width: 100%; min-width: 0; min-height: 45px; margin-top: 5px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--white); color: var(--ink);
  font-size: 1rem; font-weight: 450;
}
.form input:not([type='hidden'], [type='button']):focus, textarea:focus { border-color: var(--focus); outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.password-field { display: block; position: relative; }
.password-field:has(.password-toggle:not(.hidden)) #login-password { padding-right: 68px; }
.password-toggle { position: absolute; inset-inline-end: 5px; top: 5px; min-width: 50px; min-height: 35px; padding: 4px 8px; border: 0; border-radius: 7px; color: var(--green); background: transparent; font-size: .82rem; font-weight: 670; cursor: pointer; }
.password-toggle:hover { background: var(--green-light); }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 9px 15px;
  border: 1px solid transparent; border-radius: 9px; text-align: center; text-decoration: none;
  font-size: .9rem; font-weight: 690; line-height: 1.35; transition: background-color .16s ease, border-color .16s ease;
}
.button:disabled { opacity: .65; cursor: wait; }
.primary { background: var(--green); color: var(--on-accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.secondary:hover:not(:disabled) { background: var(--hover); border-color: var(--focus); }
.nav-button { font-size: .84rem; white-space: nowrap; }
.divider { display: flex; align-items: center; gap: 12px; margin-block: 21px 13px; font-size: .79rem; font-weight: 600; color: var(--muted); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.provider-row { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 9px; }
.helper { margin-top: 10px; color: var(--muted); font-size: .79rem; line-height: 1.65; }
altcha-widget {
  display: block; min-width: 0; min-height: 42px; font-size: .83rem;
  --altcha-max-width: 100%; --altcha-color-base: var(--subtle); --altcha-color-border: var(--line);
  --altcha-color-text: var(--ink); --altcha-color-error-text: var(--danger-ink); --altcha-color-border-focus: var(--focus); --altcha-border-radius: 9px;
}
.register-box { margin-top: 17px; border-top: 1px solid var(--line); }
.register-box summary { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-height: 44px; color: var(--green); font-size: .9rem; font-weight: 700; list-style: none; }
.register-box summary::-webkit-details-marker { display: none; }
.register-box[open] summary .chevron, [aria-expanded='true'] .chevron { transform: rotate(180deg); }

[data-account='1'] .frame { max-width: 720px; }
.dashboard-heading { margin: 34px 0 24px; }
.dashboard-heading h1 { font-size: 2rem; }
.tile-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--green-light); color: var(--green); }
.tile-icon { font-size: 18px; }
.settings { display: grid; gap: 16px; min-width: 0; }
.setting-panel { padding: clamp(18px, 3.5vw, 30px); scroll-margin-top: 16px; }
.setting-heading { display: flex; gap: 12px; align-items: center; }
.setting-heading h2 { font-size: 1.15rem; line-height: 1.3; }
.setting-heading p, .connection-head p { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.setting-heading p { margin-top: 4px; }
.setting-panel .form { max-width: 420px; margin-top: 16px; }
.profile-id { margin: 14px 0 0; font-size: .87rem; }
.profile-id dt { font-weight: 650; }
.profile-id dd { margin: 3px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.profile-id code { font-family: var(--mono); }
.delete-account summary { display: flex; align-items: center; justify-content: space-between; min-height: 28px; gap: 8px; color: var(--danger-ink); font-weight: 690; list-style: none; }
.delete-account summary::-webkit-details-marker { display: none; }
.delete-account[open] summary .chevron { transform: rotate(180deg); }
.delete-account p { margin-top: 8px; color: var(--muted); font-size: .87rem; }
.danger { background: var(--danger-fill); color: var(--on-danger); }
.danger:hover:not(:disabled) { background: var(--danger-hover); }
.setting-panel .form:empty { display: none; }
.setting-panel .form .button { justify-self: start; }
.connection { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.connection-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.connection-head .tile-icon { width: 36px; height: 36px; border-radius: 9px; font-size: 16px; }
.connection-head h3 { font-size: .94rem; }
.badge { padding: 4px 9px; border-radius: 40px; background: var(--green-light); color: var(--green); font-size: .75rem; font-weight: 650; white-space: nowrap; }

.verification, .confirmation { margin-top: 15px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--subtle); }
.verification h3, .confirmation h2 { font-size: 1rem; }
.verification .form, .confirmation .button { margin-top: 10px; }
.step { display: flex; gap: 10px; align-items: flex-start; margin-top: 15px; }
.step-number { flex: none; display: grid; place-items: center; width: 29px; height: 25px; background: var(--green-light); color: var(--green); border-radius: 6px; font-size: .72rem; font-weight: 750; }
.step h4 { font-size: .9rem; margin-top: 2px; }
.step p, .confirmation p { margin-top: 4px; color: var(--muted); font-size: .85rem; }
#proof { margin-top: 8px; resize: vertical; font: .78rem/1.5 var(--mono); }
#proof-heading { scroll-margin-top: 15px; }
.proof-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 7px; }
.copy-status { color: var(--green); font-size: .8rem; }
.copy-status:not(:empty) { margin-top: 6px; }
.proof-actions a { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; text-underline-offset: 3px; }
.message { padding: 11px 13px; margin-block: 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--green-light); font-size: .87rem; overflow-wrap: anywhere; }
.message.error { border-color: var(--warning-line); color: var(--danger-ink); background: var(--warning-bg); }
.single-card { width: min(100%, 460px); margin: clamp(28px, 7vw, 85px) auto 0; padding: clamp(23px, 4.5vw, 48px); }
.single-card h1 { font-size: 1.55rem; letter-spacing: normal; }
.single-card strong { color: var(--ink); }
.single-card .lede { overflow-wrap: anywhere; }
.single-card > .button { margin-top: 20px; }
.permission-list { list-style: none; display: grid; gap: 1px; margin-block: 19px; padding: 1px; border: 1px solid var(--line); border-radius: 10px; background: var(--line); overflow: hidden; }
.permission-list li { display: flex; align-items: center; gap: 9px; padding: 9px 11px; color: var(--ink); background: var(--subtle); font-size: .9rem; }
.consent-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; }

@media (max-width: 800px) {
  .frame { display: flow-root; width: calc(100% - 36px); }
  .masthead { min-height: 64px; margin-bottom: 14px; }
}
@media (max-width: 570px) {
  .dashboard-heading { margin-top: 24px; }
}
@media (max-width: 350px) {
  .login-card { padding: 18px; }
  .frame { display: flow-root; width: calc(100% - 24px); }
  .button { padding-inline: 10px; }
  .brand { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
