:root { color-scheme: light; font-family: system-ui, sans-serif; color: #173b30; background: #f2f6f3; }
* { box-sizing: border-box; }
body { margin: 0; padding: 24px 16px; }
main { max-width: 520px; margin: 0 auto; padding: 28px; border: 1px solid #d5e1d9; border-radius: 18px; background: white; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } p { line-height: 1.55; overflow-wrap: anywhere; }
.badge { font-size: .75rem; letter-spacing: .04em; font-weight: bold; color: #685019; }
label { display: block; margin: 18px 0 6px; font-weight: 600; }
input, button { width: 100%; font: inherit; min-height: 48px; border-radius: 8px; }
input { border: 1px solid #9cb3a5; padding: 12px; }
button, .action-link { border: 1px solid #164832; background: #205b43; color: white; cursor: pointer; font-weight: 700; box-shadow: 0 3px 0 #163e2e; transition: background-color .15s, box-shadow .15s; }
button { margin: 18px 0 8px; padding: 14px 16px; }
button:not(:disabled):hover, .action-link:hover { background: #174832; box-shadow: 0 4px 8px #173b3026; }
button:not(:disabled):active, .action-link:active { box-shadow: none; }
button:disabled { opacity: .6; cursor: wait; }
button.secondary, .action-link.secondary { background: #edf4ef; color: #173b30; border-color: #9cb3a5; box-shadow: 0 2px 0 #d5e1d9; }
button.secondary:not(:disabled):hover, .action-link.secondary:hover { background: #dcebe1; }
.action-link { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 50px; padding: 14px 18px; border-radius: 10px; text-align: center; text-decoration: none; line-height: 1.4; overflow-wrap: anywhere; }
.access-navigation { margin: 22px 0; }
.complete-actions { display: grid; gap: 14px; margin: 26px 0 12px; }
.app-entry { justify-content: space-between; min-height: 64px; border-color: #164832; border-left: 5px solid #c79a2e; font-size: 1.1rem; }
.app-entry > :last-child { font-size: 1.5rem; }
a { color: #205b43; } summary { cursor: pointer; padding: 18px 0; }
#status { padding: 14px; background: #eef5ef; border-radius: 8px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #c79a2e; outline-offset: 3px; }
@media (max-width: 420px) { main { padding: 20px; } h1 { font-size: 1.45rem; } }

#rescue-choice{margin:18px 0;padding:16px;border:1px solid #b8cebe;border-radius:10px}#use-rescue{width:auto;display:inline;margin-right:8px}#rescue-code{font-family:ui-monospace,monospace}

.diagnostic { font-size: .8rem; color: #53645d; overflow-wrap: anywhere; }

#support-details { margin: 14px 0; border-top: 1px solid #d5e1d9; color: #53645d; font-size: .85rem; }
#support-details summary { padding: 12px 0; }

.password-field { position: relative; }
.password-field input { padding-right: 58px; }
button.password-visibility { position: absolute; top: 0; right: 0; width: 48px; height: 100%; margin: 0; padding: 10px; border: 0; box-shadow: none; background: transparent; color: #205b43; display: grid; place-items: center; }
button.password-visibility:not(:disabled):hover { background: #edf4ef; box-shadow: none; }
button.password-visibility[aria-pressed="true"] { background: #e6eee8; }

.access-progress { display: flex; align-items: center; gap: 12px; padding: 18px 14px; margin: 16px 0; background: #eef5ef; border-radius: 8px; }
.access-spinner { width: 24px; height: 24px; flex: 0 0 24px; border: 3px solid #c8dcd0; border-top-color: #205b43; border-radius: 50%; animation: access-spin .8s linear infinite; }
@keyframes access-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .access-spinner { animation: none; } }
@media (prefers-reduced-motion: reduce) { button, .action-link { transition: none; } }
#status[data-tone="error"] { background: #fff1ee; color: #853d31; }
#status[data-tone="success"] { background: #e6f3e9; color: #174d30; }

.field-error { margin: 6px 0 12px; color: #853d31; font-size: .9rem; }
input[aria-invalid="true"] { border-color: #ad4434; }

.remember-choice{display:flex;align-items:center;gap:10px;font-size:.8rem;font-weight:400;line-height:1.5;margin:14px 0}.remember-choice input{width:20px;min-height:20px;height:20px;flex:0 0 20px;padding:0}.login-method-help{font-size:.78rem;color:#617266}

/* Mobile-first access surface; existing controls and stages remain unchanged. */
body.page-access{min-height:100vh;min-height:100dvh;padding:16px;background:radial-gradient(circle at top,#e8f2ea,#f6f8f5 60%)}
.page-access main{width:100%;max-width:520px;padding:24px;border:1px solid #dce8df;border-radius:22px;background:#fff;box-shadow:0 18px 60px #173b3012}
.page-access h1{margin:4px 0 6px;font-size:clamp(1.6rem,5vw,2rem);letter-spacing:-.04em}
.page-access h1+p{margin:0 0 24px;color:#64786c;font-size:.9rem}
.page-access h2{margin:0 0 12px;letter-spacing:-.02em}
.page-access input:not([type=checkbox]){transition:border-color .18s,box-shadow .18s;background:#fbfdfb}
.page-access input:not([type=checkbox]):focus{outline:none;border-color:#408566;box-shadow:0 0 0 4px #66a68030}
.page-access button:not(:disabled):active{transform:translateY(1px)}
.page-access .first-access{margin-top:20px;padding-top:18px;border-top:1px solid #e4ece5}
.page-access .first-access p{font-size:.85rem;color:#5e7066;margin:0}
.page-access .first-access button{margin:10px 0 0}
.page-access #status:empty{display:none}
.page-access :is(#initial,#email-form,#password-form,#passkey,#retry,#complete):not([hidden]){animation:access-enter .2s ease-out}
@keyframes access-enter{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
@media(min-width:768px){body.page-access{display:grid;place-items:center;padding:40px 24px}.page-access main{padding:40px}}
@media(prefers-reduced-motion:reduce){.page-access :is(#initial,#email-form,#password-form,#passkey,#retry,#complete):not([hidden]){animation:none}.page-access input:not([type=checkbox]){transition:none}.page-access button:not(:disabled):active{transform:none}}

/* Login-specific hierarchy, including overrides for the shared app theme. */
.app-shell.page-access main{border:1px solid #dce8df;border-radius:24px;box-shadow:0 20px 64px #173b3017,0 1px 0 #fff inset}
.page-access .access-heading{text-align:center;margin-bottom:30px}
.app-shell.page-access .church-brand{position:relative;isolation:isolate;display:inline-flex;align-items:center;justify-content:center;margin:0 auto 20px;padding:8px 14px;border-radius:18px}
.app-shell.page-access .church-brand::before{content:"";position:absolute;z-index:-1;inset:-10px -24px;background:radial-gradient(ellipse at center,#8bc7a82b 0%,#dcefe724 48%,transparent 75%);pointer-events:none}
.app-shell.page-access .church-brand-logo{filter:drop-shadow(0 5px 12px #205b431c)}
.app-shell.page-access .access-heading h1{font-size:clamp(1.6rem,5vw,2rem);margin:0 0 6px}
.page-access .access-heading p{margin:0;color:#64786c;font-size:.9rem}
.page-access .login-password-row{display:flex;align-items:stretch;gap:10px}
.page-access .login-password-row .password-field{flex:1;min-width:0}
.app-shell.page-access #biometric-login{width:auto;min-width:96px;min-height:48px;margin:0;padding:8px 10px;display:flex;align-items:center;justify-content:center;gap:6px;background:#f5f8f5;color:#205b43;border:1px solid #d5e2d8;box-shadow:none;font-size:.78rem}
.page-access #biometric-login svg{width:20px;height:20px;flex:none}
.app-shell.page-access button.password-visibility{min-height:0;border:0;background:transparent;color:#62776a;box-shadow:none}
.app-shell.page-access button.password-visibility:hover{background:#edf4ef}
.page-access .first-access{margin-top:16px;padding-top:16px}
.app-shell.page-access #first-access{background:transparent;border:1px solid #afc9b8;color:#205b43;box-shadow:none}
.app-shell.page-access #first-access:hover{background:#f0f6f1}
.app-shell.page-access .recovery-choice{text-align:center;margin:0}
.app-shell.page-access #login-form .forgot-password-link{display:block!important;visibility:visible!important;opacity:1!important;width:fit-content;min-height:44px;line-height:44px;margin:4px auto 8px auto!important;padding:0 4px;border:none!important;border-radius:0;background:transparent!important;box-shadow:none!important;color:#1b4d3e!important;font-size:.83rem;font-weight:500;text-align:center!important;text-decoration:underline!important;text-decoration-color:#1b4d3e!important;text-underline-offset:4px!important;cursor:pointer!important}
.app-shell.page-access #login-form>label:not(.remember-choice){margin:18px 0 7px;font-size:.88rem;color:#294d3d}
.app-shell.page-access #login-form>label:first-child{margin-top:0}
.app-shell.page-access #login-form input:not([type=checkbox]){min-height:50px;border:1px solid #d5e2d9;border-radius:12px;background:#fff;box-shadow:none}
.app-shell.page-access #login-form input:not([type=checkbox]):focus{border-color:#408566;box-shadow:0 0 0 3px #66a68030}
.app-shell.page-access .login-password-row{align-items:stretch;gap:8px}
.app-shell.page-access .login-password-row .password-field{min-height:50px}
.app-shell.page-access .login-password-row .password-visibility{top:1px;right:1px;width:48px;height:calc(100% - 2px);min-height:0;margin:0;padding:0;display:grid;place-items:center;border:0;border-radius:11px;background:transparent;box-shadow:none;color:#526f5e}
.app-shell.page-access #biometric-login{min-height:50px;border-color:#dce8df;border-radius:12px;background:#f8fbf9;box-shadow:none}
.app-shell.page-access #login-form>button[type=submit],.app-shell.page-access #login-form>button:not([type]){margin:0 0 4px;min-height:50px;border-radius:12px;box-shadow:0 5px 14px #173b301a}
.app-shell.page-access #login-form .remember-choice{margin:16px 0 0;color:#52685b}
.app-shell.page-access #login-form .first-access{margin-top:12px;padding-top:12px;border-top-color:#edf2ee}
.app-shell.page-access #first-access{margin:0;min-height:50px;border-color:#d5e2d9;border-radius:12px;font-weight:600}
.page-access .access-help{margin-top:24px;text-align:center;border-top:1px solid #e4ece5}
.page-access .access-help summary{display:inline-block;padding:20px 0 4px;color:#526f5e;font-size:.83rem;text-decoration:underline;text-underline-offset:3px}
.page-access .access-help p{text-align:left;color:#52685b;font-size:.85rem}
@media(max-width:360px){.app-shell.page-access #biometric-login{min-width:82px;gap:4px;padding:8px 6px;font-size:.72rem}}
