.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--color-bg, #f9f9f7);
  color: var(--color-text, #242424);
}
.account-profile-form { display: grid; gap: 12px; margin: 0; }
.account-profile-photo { display: flex; align-items: center; gap: 12px; }
.account-profile-photo .settings-account-details { flex: 1; }
.account-profile-photo .account-avatar-upload { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; }
.account-profile-form .dialog-field { gap: 8px; font-size: 12px; }
.account-profile-form .settings-input { min-height: 38px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
.account-profile-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.account-profile-actions:not(:has(button:not([hidden]))) { display: none; }
.account-profile-actions button[hidden] { display: none; }
.account-session-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.account-profile-photo .settings-account-avatar { flex: 0 0 64px; width: 64px; height: 64px; font-size: 24px; }
.settings-account-avatar, .profile-avatar { position: relative; overflow: hidden; }
.settings-account-avatar img, .profile-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.account-profile-names { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; width: 33.333%; min-width: min(100%, 180px); }
.account-profile-names input { width: 100%; min-width: 0; }
.account-avatar-upload { position: relative; overflow: hidden; }
.account-avatar-edit { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 48%); color: #fff; opacity: 0; pointer-events: none; transition: opacity 120ms ease; }
.account-avatar-upload:hover .account-avatar-edit, .account-avatar-upload:focus-within .account-avatar-edit { opacity: 1; }
.account-avatar-upload:has(input:disabled) .account-avatar-edit { display: none; }
.account-avatar-upload input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.account-avatar-upload:focus-within { outline: 2px solid var(--color-text-secondary); outline-offset: 3px; }
.account-profile-form [data-profile-status]:empty { display: none; }
.account-profile-form [data-profile-reload][hidden] { display: none; }
.account-profile-form > button { justify-self: start; }
@media (max-width: 900px) { .account-profile-photo { flex-wrap: wrap; }  }
@media (max-width: 600px) { .account-profile-names { grid-template-columns: 1fr; } }

.auth-screen--loading {
  align-content: center;
  gap: 14px;
  color: var(--color-text-secondary, #6f6f6b);
}

.auth-card {
  width: min(100%, 420px);
  padding: 34px;
  border: 1px solid var(--color-border, #e5e4df);
  border-radius: 20px;
  background: var(--color-surface, #fff);
  box-shadow: 0 18px 56px rgb(34 34 30 / 8%);
}

.auth-wordmark {
  display: block;
  width: 112px;
  height: 23px;
  background: currentColor;
  color: var(--color-text, #242424);
  -webkit-mask: var(--kalamos-wordmark-mask) center / contain no-repeat;
  mask: var(--kalamos-wordmark-mask) center / contain no-repeat;
}
.auth-wordmark--login { width: 120px; height: 24px; margin-bottom: 24px; }
.auth-heading span,
.settings-account-kicker {
  color: var(--color-text-secondary, #77736c);
  font-size: 12px;
  letter-spacing: .04em;
}
.auth-heading h1 { margin: 8px 0; font-size: 28px; font-weight: 560; }
.auth-heading p { margin: 0 0 10px; color: var(--color-text-secondary, #77736c); line-height: 1.6; }
.auth-heading .auth-marketing-link { margin: 0 0 22px; font-size: 13px; }
.auth-heading .auth-marketing-link a { color: inherit; }
.auth-field { display: grid; gap: 8px; margin-top: 16px; font-size: 13px; }
.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--color-border, #d9d8d2);
  border-radius: 10px;
  background: var(--color-bg, #fff);
  color: inherit;
  font: inherit;
}
.auth-field input:focus { outline: 2px solid color-mix(in srgb, #d97757 35%, transparent); border-color: #d97757; }
.auth-error { margin: 14px 0 0; color: #b34332; font-size: 13px; line-height: 1.5; }
.auth-sent { margin: 14px 0 0; color: var(--color-text-secondary, #6f6f6b); font-size: 13px; line-height: 1.5; }
.auth-submit { width: 100%; margin-top: 22px; justify-content: center; }
.auth-screen--workbench-failed .auth-card h1 { margin: 0 0 8px; font-size: 28px; font-weight: 560; }
.auth-screen--workbench-failed .auth-card p { margin: 0; color: var(--color-text-secondary, #77736c); line-height: 1.6; }
.auth-resend { width: 100%; margin-top: 8px; justify-content: center; }
.settings-account-card { display: grid; gap: 8px; width: min(100%, 560px); margin-top: 20px; padding: 0; text-align: left; }
.settings-account-card strong { font-size: 15px; }
.settings-account-card .button { margin-top: 8px; justify-self: start; }
.settings-account-card .auth-error { margin: 0; }
#toast-root .auth-error[data-auth-logout-error] {
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--color-surface, #fff);
  box-shadow: 0 8px 24px rgb(34 34 30 / 10%);
}

@media (max-width: 600px) {
  .auth-screen { padding: 18px; }
  .auth-card { padding: 26px 22px; border-radius: 16px; }
}

/* A quiet, centered entry surface shares the workbench palette and type scale. */
.auth-screen { background: var(--page, #f9f9f7); color: var(--text-primary, #242424); }
.auth-screen--desktop { height: 100dvh; min-height: 0; overflow-y: auto; padding: 24px; }
.auth-screen--welcome, .auth-screen--signin { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 20px; }
.auth-welcome-content, .auth-card--desktop { width: min(100%, 384px); flex-shrink: 0; margin-block: auto; }
.auth-welcome-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 32px; }
.auth-welcome-wordmark { display: block; width: 144px; height: 30px; background: currentColor; -webkit-mask: var(--kalamos-wordmark-mask) center / contain no-repeat; mask: var(--kalamos-wordmark-mask) center / contain no-repeat; }
.auth-welcome-platform { padding-left: 12px; border-left: 1px solid var(--border, #dfded8); color: var(--text-muted, #77736c); font-size: 13px; }
.auth-welcome-heading { margin-bottom: 28px; text-align: center; }
.auth-welcome-heading h1 { margin: 0; font-family: "方正黄庭坚行书 简", "Songti SC", STSong, serif; font-size: clamp(30px, 3.2vw, 38px); font-weight: 400; line-height: 1.5; letter-spacing: .02em; }
.auth-welcome-heading h1:lang(en) { font-family: var(--font-ui); font-size: 28px; line-height: 1.3; letter-spacing: -.02em; }
.auth-welcome-heading p { margin: 0 auto; max-width: 30em; color: var(--text-muted, #77736c); font-size: 14px; line-height: 1.7; text-wrap: balance; }
.auth-oauth-stack { display: grid; grid-template-columns: 1fr 20px max-content 1fr; gap: 8px 12px; }
.auth-oauth { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; width: 100%; min-width: 44px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--border, #d8d7d0); border-radius: 10px; background: var(--surface-1, #fff); color: var(--text-primary, #242424); font: inherit; font-size: 13px; cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease; }
.auth-oauth > :first-child { grid-column: 2; }
.auth-oauth > span:last-child { grid-column: 3; text-align: center; }
.auth-oauth-label { display: grid; grid-template-columns: auto 1fr auto; white-space: pre; }
.auth-oauth-label > :first-child { text-align: left; }
.auth-oauth-label > :nth-child(2) { text-align: center; }
.auth-oauth-label > :last-child { text-align: right; }
.auth-oauth:hover { background: var(--surface-hover, #f0efea); }
.auth-google-mark, .auth-apple-mark { display: block; width: 20px; height: 20px; }
.auth-oauth > .auth-provider-logo,
.auth-oauth > .provider-logo { width: 20px; height: 20px; min-width: 20px; min-height: 20px; flex-basis: 20px; }
.auth-oauth > .auth-provider-logo .provider-logo__img,
.auth-oauth > .provider-logo .provider-logo__img { width: 20px; height: 20px; }
.auth-provider-note, .auth-local-note { margin: 12px 0 0; color: var(--text-muted, #77736c); text-align: center; font-size: 12px; line-height: 1.6; }
.auth-provider-note { text-wrap: balance; }
.auth-provider-note:empty { display: none; }
.auth-email-choice, .auth-back-link, .auth-preview-continue { display: block; width: fit-content; margin: 18px auto 0; border: 0; padding: 6px 10px; background: transparent; color: var(--text-secondary, #55534d); font: inherit; font-size: 13px; cursor: pointer; border-radius: 6px; }
.auth-email-choice:hover, .auth-back-link:hover, .auth-preview-continue:hover { background: var(--surface-hover, #eeede8); color: var(--text-primary); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--text-muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border, #dfded8); }
.auth-cta { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; margin: 14px 0 0; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--text-primary, #242424); color: var(--page, #f9f9f7); font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; transition: opacity 140ms ease; }
.auth-cta:hover { opacity: .88; }
.auth-cta.auth-email-entry { margin-top: 0; }
.auth-cta:disabled { opacity: .4; cursor: not-allowed; }
.auth-card--desktop { position: relative; padding: 0; border: 0; background: transparent; box-shadow: none; }
.auth-card--desktop .auth-back-link { margin: 0 0 28px -10px; }
.auth-card--desktop .auth-welcome-brand { margin-bottom: 24px; }
.auth-card--desktop .auth-submit { min-height: 40px; }
.auth-screen[data-auth-step="signin"] .auth-field { margin-top: 12px; gap: 6px; }
.auth-screen[data-auth-step="signin"] .auth-field:first-child { margin-top: 0; }
.auth-screen[data-auth-step="signin"] .auth-submit { margin-top: 16px; }
.auth-signin-title { margin: 0 0 18px; text-align: center; font-family: var(--font-ui); font-size: 28px; font-weight: 520; letter-spacing: -.02em; }
.auth-oauth-hint { margin: 0 0 20px; color: var(--text-muted); font-size: 13px; line-height: 1.6; text-align: center; }
.auth-field input { background: var(--surface-1, #fff); border-color: var(--border, #d8d7d0); }
.auth-field--bare input { height: 46px; font-size: 14px; }
.auth-error { color: var(--danger, #b34332); }
.auth-wordmark { color: var(--text-primary); }
.auth-heading p, .auth-heading > span, .settings-account-kicker, .auth-sent { color: var(--text-muted); }
.auth-card { background: var(--surface-1, #fff); border-color: var(--border, #e5e4df); box-shadow: 0 8px 28px rgb(34 34 30 / 4%); }
.auth-card--desktop { background: transparent; box-shadow: none; }
.auth-resend--desktop { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; padding: 10px; cursor: pointer; }
.auth-resend--desktop:disabled { opacity: .5; cursor: default; }
.auth-mark--loading { display: block; width: 52px; height: 52px; background: url("../launcher/kalamos-app-icon-plush.png") center / contain no-repeat; }
.auth-account-portal { position: fixed; inset: 0; z-index: 2000; overflow-y: auto; background: var(--page); }
.auth-screen button:focus-visible, .auth-screen input:focus-visible, .auth-screen a:focus-visible { outline: 2px solid var(--text-muted, #77736c); outline-offset: 3px; }
.auth-screen .auth-welcome-content, .auth-screen .auth-card--desktop { animation: none; }
@media (max-width: 600px) { .auth-welcome-content { width: min(100%, 360px); } .auth-card--desktop { padding: 0; } }
@media (max-height: 700px) {
  .auth-screen--desktop { justify-content: flex-start; padding-top: 12px; padding-bottom: 12px; }
  .auth-welcome-heading h1 { font-size: 30px; }
  .auth-welcome-heading h1:lang(en) { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { .auth-screen *, .auth-screen *::before, .auth-screen *::after { animation: none !important; transition: none !important; } }

.auth-code-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.auth-oauth:disabled { cursor: not-allowed; opacity: 0.6; }
.auth-oauth:disabled:hover { background: var(--surface-1, #fff); }
.auth-oauth[data-unavailable="true"] { opacity: 0.6; }
.auth-welcome-content > .auth-back-link { margin: 0 0 20px -10px; }
.auth-screen .auth-field input:focus { border-color: var(--text-muted, #77736c); outline: 2px solid color-mix(in srgb, var(--text-muted, #77736c) 28%, transparent); outline-offset: 2px; box-shadow: none; }
.auth-secondary-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.auth-login-footer { text-align: center; margin-top: 12px; }
.auth-text-button { border: 0; padding: 4px 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; text-underline-offset: 3px; }
.auth-text-button:hover { color: var(--text-primary); text-decoration: underline; }
.auth-text-button:disabled { opacity: .5; cursor: default; }
.auth-create-account { text-align: center; margin-top: 8px; }
.auth-form-hint, .auth-notice, .auth-legal-note { font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.auth-form-hint[hidden] { display: none; }
.auth-consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; font-size: 13px; line-height: 1.6; }
.auth-consent input { margin-top: 4px; }
.auth-legal-note { text-align: center; margin: 14px 0 0; }
.auth-legal-note a, .auth-consent a { color: inherit; text-underline-offset: 3px; }
.auth-legal-note:empty { display: none; }
.auth-legal-note .auth-text-button { font-size: inherit; padding: 0; text-decoration: underline; }
.auth-sent { overflow-wrap: anywhere; margin: 0 0 24px; }
.auth-code-actions .auth-resend { margin-top: 12px; font-size: 13px; }
.settings-account-card { width: 100%; max-width: 560px; gap: 24px; padding: 0; background: transparent; }
.settings-account-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.settings-account-avatar { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 50%; background: var(--surface-hover, #f0efea); color: var(--text-secondary); font-size: 18px; }
.settings-account-details { display: grid; gap: 5px; min-width: 0; }
.settings-account-details strong { overflow-wrap: anywhere; font-weight: 500; line-height: 1.5; }
.settings-account-card .button { margin: 0; }

.auth-link-content { width: min(100%, 384px); }
.auth-link-provider { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 32px 0 18px; font-size: 13px; color: var(--text-secondary); }
.auth-link-heading { text-align: center; }
.auth-link-heading h1 { margin: 0; font: 520 26px/1.35 var(--font-ui); letter-spacing: -.02em; text-wrap: balance; }
.auth-link-heading p { margin: 14px 0 28px; color: var(--text-muted); font-size: 14px; line-height: 1.7; text-wrap: pretty; }
.auth-link-sent { margin: 0 0 18px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.auth-link-content input[name="code"] { text-align: center; font-size: 22px; letter-spacing: .35em; font-variant-numeric: tabular-nums; }
.auth-link-consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; cursor: pointer; }
.auth-link-consent input { flex: 0 0 16px; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--text-primary); }
.auth-link-footnote { margin: 18px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.6; text-align: center; text-wrap: balance; }
.auth-link-content .auth-link-cancel { margin: 18px auto 0; }

@media (prefers-reduced-motion: reduce) { .account-avatar-edit { transition: none; } }
