/* Settings, sign-in dialogs and the guest entry card. Loaded last. */

/* ---------- Settings ---------- */
.st-settings.profile-editor-card { display: grid; gap: 14px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.st-head h2 { margin: 6px 0 4px; font: 400 32px/1.1 var(--studio-serif, Georgia, serif); letter-spacing: -.02em; color: var(--ink); }
.st-head .eyebrow { margin: 0; }
.st-head p { margin: 0; font-size: 13.5px; color: var(--muted); }
.st-card { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-card); box-shadow: 0 1px 2px var(--shadow); }
.st-card h3 { margin: 0; font: 650 14px/1.3 Inter, system-ui, sans-serif; color: var(--ink); }
.st-card p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.st-card .secondary { justify-self: start; margin-top: 6px; }
.st-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.st-identity { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; background: radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--accent-color) 10%, var(--bg-card)), var(--bg-card) 65%); }
.st-avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-color); color: var(--on-accent); font: 400 24px/1 var(--studio-serif, Georgia, serif); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-color) 18%, transparent); }
.st-identity-copy { display: grid; gap: 2px; min-width: 0; }
.st-identity-copy strong { font: 400 22px/1.2 var(--studio-serif, Georgia, serif); color: var(--ink); overflow-wrap: anywhere; }
.st-identity-copy > span { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.st-identity-copy > span:empty { display: none; }
.st-identity-copy p { margin-top: 4px; font-size: 12px; }
.st-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; background: color-mix(in srgb, var(--positive) 13%, var(--bg-card)); color: var(--positive); font-size: 12px; font-weight: 650; white-space: nowrap; }
.st-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-session { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 20px; }
.st-session-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.st-session-actions .secondary { margin: 0; }
.st-danger { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 18px; border: 1px solid color-mix(in srgb, var(--red) 40%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--red) 7%, var(--bg-card)); color: var(--red); font-size: 13px; font-weight: 650; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
.st-danger:hover { background: color-mix(in srgb, var(--red) 14%, var(--bg-card)); border-color: var(--red); }
[data-sign-out][aria-disabled=true] { opacity: .55; pointer-events: none; }
.st-session-status { grid-column: 1 / -1; min-height: 0; }
.st-session-status:empty { display: none; }

/* Guest entry inside Settings */
#account-guest-entry { display: grid; justify-items: start; gap: 8px; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: radial-gradient(110% 140% at 0% 0%, color-mix(in srgb, var(--accent-color) 12%, var(--bg-card)), var(--bg-card) 62%); }
#account-guest-entry h3 { margin: 0; font: 400 32px/1.1 var(--studio-serif, Georgia, serif); letter-spacing: -.02em; color: var(--ink); }
#account-guest-entry p { max-width: 52ch; margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: var(--muted); }

/* ---------- Sign-in dialogs ---------- */
#account-dialog.edit-dialog, #welcome-dialog.edit-dialog { width: min(460px, calc(100vw - 28px)); max-height: min(94dvh, 860px); padding: 30px 30px 24px; overflow: auto; border: 1px solid var(--line); border-radius: 26px; background: radial-gradient(90% 40% at 50% 0%, color-mix(in srgb, var(--accent-color) 10%, var(--bg-card)), var(--bg-card) 70%); box-shadow: 0 30px 90px rgb(10 20 16 / .4); }
#account-dialog .dialog-top, #welcome-dialog .dialog-top { margin-bottom: 4px; }
#account-dialog .eyebrow, #welcome-dialog .eyebrow { margin: 0; font-size: 10.5px; letter-spacing: .14em; }
#account-dialog h2, #welcome-dialog h2 { margin: 8px 0 0; font: 400 32px/1.1 var(--studio-serif, Georgia, serif); letter-spacing: -.02em; color: var(--ink); }
#account-dialog .account-status { margin: 14px 0 0; padding: 9px 13px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); font-size: 12.5px; color: var(--text); }
#account-dialog .account-help, #welcome-dialog > p { margin: 12px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.account-auth { display: grid; gap: 16px; margin: 20px 0 6px; }
.google-sign-in { display: flex; align-items: center; gap: 14px; width: 100%; box-sizing: border-box; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); color: var(--ink); text-decoration: none; box-shadow: 0 1px 2px var(--shadow); transition: border-color .15s, box-shadow .15s, transform .15s; }
.google-sign-in:hover { border-color: color-mix(in srgb, var(--accent-color) 45%, var(--line)); box-shadow: 0 6px 18px var(--shadow); transform: translateY(-1px); }
.google-provider-icon { flex-shrink: 0; width: 24px; height: 24px; }
.google-sign-in strong { display: block; font-size: 14px; font-weight: 650; }
.google-sign-in small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.sign-in-divider { display: flex; align-items: center; gap: 14px; margin: 0; font-size: 12px; color: var(--muted); }
.sign-in-divider::before, .sign-in-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.account-auth-form { display: grid; gap: 14px; margin: 0; }
.account-auth-form label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.account-auth-form input { display: block; width: 100%; min-height: 46px; box-sizing: border-box; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--control-line) 22%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--ink) 2.5%, var(--bg-card)); color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 400; box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink) 5%, transparent); outline: none; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.account-auth-form input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.account-auth-form input:focus { border-color: var(--accent-color); background: var(--bg-card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-color) 16%, transparent); }
.auth-password { position: relative; display: block; }
.auth-password input { padding-inline-end: 64px; }
.auth-reveal { position: absolute; inset-inline-end: 6px; top: 50%; translate: 0 -50%; min-height: 32px; padding: 4px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--accent-color); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.auth-reveal:hover { background: var(--soft); }
.account-auth-status { min-height: 0; margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--amber); }
.account-auth-status:empty { display: none; }
.account-auth-actions { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.account-auth-actions .primary, .account-auth-actions .secondary { width: 100%; min-height: 46px; border-radius: 12px; }
.account-auth-form .auth-fields { display: grid; gap: 14px; }
.account-auth-form .auth-fields[hidden], .auth-sent[hidden], .auth-hint[hidden] { display: none; }
.auth-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.auth-mode-option { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s; }
.auth-mode-option:hover:not([aria-pressed="true"]) { color: var(--ink); }
.auth-mode-option[aria-pressed="true"] { background: var(--bg-card); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.auth-mode-option:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.account-auth-form input[aria-invalid="true"] { border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent); }
.auth-hint { font-size: 12px; font-weight: 400; line-height: 1.4; color: var(--muted); }
.auth-hint[data-level="low"] { color: var(--amber); }
.auth-hint[data-level="ok"], .auth-hint[data-level="strong"] { color: var(--positive); }
.account-auth-status[data-tone="info"] { color: var(--ink); }
.account-auth-status[data-tone="ok"] { color: var(--positive); }
.auth-submit { width: 100%; min-height: 48px; border-radius: 12px; }
.auth-submit:disabled { cursor: progress; opacity: .78; }
.auth-sent { display: grid; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.auth-sent strong { font-size: 15px; color: var(--ink); }
.auth-sent p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.auth-sent b { color: var(--ink); overflow-wrap: anywhere; }
.auth-sent .text-button { justify-self: start; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 650; text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  .account-auth-status:not(:empty) { animation: auth-rise .18s ease-out; }
  @keyframes auth-rise { from { opacity: 0; transform: translateY(-3px); } }
}
.account-auth-note { margin: 0; font-size: 12.5px; text-align: center; color: var(--muted); }
.account-auth-note a { color: var(--accent-color); font-weight: 600; text-decoration: none; }
.account-auth-note a:hover { text-decoration: underline; text-underline-offset: 3px; }
#account-dialog .account-local-note { margin-top: 14px; padding: 14px 16px; border: 0; border-radius: 14px; background: var(--soft); }
#account-dialog .account-local-note strong { font-size: 13px; color: var(--ink); }
#account-dialog .account-local-note p { margin: 4px 0 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
#account-dialog .dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 0; border: 0; }
#account-dialog .dialog-actions .text-button { font-size: 13px; font-weight: 600; }
.welcome-guest-option { margin: 0 0 14px; }
.welcome-guest-option button { width: 100%; min-height: 44px; border-radius: 12px; }
#welcome-dialog .fineprint { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); max-width: none; }

@media (max-width: 760px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); }
  .st-session { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .st-identity { grid-template-columns: auto minmax(0, 1fr); }
  .st-badge { grid-column: 1 / -1; justify-self: start; }
  .st-head h2 { font-size: 27px; }
  #account-guest-entry { padding: 24px; }
  #account-dialog.edit-dialog, #welcome-dialog.edit-dialog { padding: 24px 20px 20px; }
  .account-auth-form input { font-size: 16px; }
  .account-auth-actions { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Forgot password, check-inbox panel and resend ---- */
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-forgot, .auth-reset-back { padding: 0; border: 0; background: none; color: var(--accent-color); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; text-decoration: none; }
.auth-forgot:hover, .auth-reset-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-forgot[hidden], .auth-reset-back[hidden], .auth-mode[hidden], [data-auth-password-field][hidden] { display: none; }
.auth-reset-back { justify-self: center; font-size: 13px; }
.auth-sent-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 6px; }
.auth-sent-actions .secondary { min-height: 42px; padding: 0 18px; border-radius: 12px; }
.auth-sent-actions .secondary:disabled { opacity: .65; cursor: default; }
.auth-sent-status { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.auth-sent-status:empty { display: none; }
.auth-sent-status[data-tone="ok"] { color: var(--positive); }
.auth-sent-status[data-tone="error"] { color: var(--amber); }

/* ---- Emailed-link dialogs ---- */
.security-dialog { max-width: 460px; width: calc(100vw - 32px); padding: 30px 28px 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--bg-card); color: var(--ink); box-shadow: 0 30px 80px color-mix(in srgb, var(--ink) 22%, transparent); }
.security-dialog::backdrop { background: color-mix(in srgb, var(--ink) 38%, transparent); backdrop-filter: blur(3px); }
.security-dialog h2 { margin: 8px 0 0; font: 400 28px/1.15 var(--studio-serif, Georgia, serif); letter-spacing: -.015em; }
.security-dialog h2[data-tone="ok"] { color: var(--positive); }
.security-dialog h2[data-tone="care"] { color: var(--amber); }
.security-copy { margin: 12px 0 18px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.security-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.security-actions .primary, .security-actions .secondary { min-height: 46px; padding: 0 20px; border-radius: 12px; }
.security-form { margin-top: 4px; }
.security-danger { background: var(--amber); border-color: var(--amber); color: var(--bg-card); }
.security-danger:disabled { opacity: .45; cursor: not-allowed; }
.security-danger-outline { border-color: var(--amber); color: var(--amber); }

/* ---- Email & security section in Account settings ---- */
.sec-card { display: grid; gap: 22px; }
.sec-head h3 { margin: 0; }
.sec-head p, .sec-help, .sec-note { margin: 6px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.sec-note { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.sec-facts { display: grid; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sec-facts > div { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.sec-facts > div:first-child { border-top: 0; }
.sec-facts dt { font-size: 12.5px; color: var(--muted); }
.sec-facts dd { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.sec-badge { display: inline-block; margin-inline-start: 8px; padding: 2px 9px; border-radius: 999px; background: var(--positive-bg); color: var(--positive); font-size: 11.5px; font-weight: 650; vertical-align: middle; }
.sec-badge-warn { background: var(--danger-bg); color: var(--amber); }
.sec-block { display: grid; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.sec-block h4 { margin: 0; font-size: 14px; font-weight: 650; }
.sec-list, .sec-activity { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.sec-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.sec-list li:first-child { border-top: 0; padding-top: 0; }
.sec-list strong { display: block; font-size: 14px; }
.sec-list small, .sec-toggle small, .sec-help { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.sec-activity { padding: 4px 14px; border-radius: 12px; background: var(--soft); }
.sec-activity li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13px; border-top: 1px solid var(--line); }
.sec-activity li:first-child { border-top: 0; }
.sec-activity time { color: var(--muted); white-space: nowrap; }
.sec-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sec-toggle { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; cursor: pointer; }
.sec-toggle input { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent-color); }
.sec-toggle strong { display: block; font-size: 14px; }
.sec-toggle input:disabled + span { opacity: .85; }
.sec-form { max-width: 420px; }
.sec-form .secondary { justify-self: start; min-height: 44px; padding: 0 20px; border-radius: 12px; }
.sec-status { margin: 0; min-height: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.sec-status:empty { display: none; }
.sec-status[data-tone="ok"] { color: var(--positive); }
.sec-status[data-tone="error"] { color: var(--amber); }
.sec-danger { border-top-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }
@media (max-width: 520px) {
  .sec-facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .security-dialog { padding: 24px 20px 20px; }
}

/* ---- Local development inbox link ---- */
.auth-dev-link { font-size: 13px; font-weight: 650; color: var(--accent-color); text-underline-offset: 3px; }
.auth-dev-link[hidden] { display: none; }
.sec-note a { color: var(--accent-color); font-weight: 650; }
