* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* HEADER */
header {
    background: white;
    padding: 15px 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    color: #1f4e79;
    margin: 0;
}
/* 🔥 HEADER LOGO */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0px;
}

/* LOGO IMAGE */
.logo-container img {
    width: 60px;
    height: 60px;
    object-fit: contain;

    margin-right: -15px;
}

nav a {
    margin: 0 15px;
    text-decoration: none;
    color: #333;
}

.login-btn {
    padding: 8px 18px;
    background: #1f4e79;
    color: white;
    border: none;
    border-radius: 5px;
}

/* MAIN BACKGROUND */
.main {
    position: relative;
    min-height: 85vh;
    background: url('https://bostonmedsupply.com/wp-content/uploads/2024/06/1-Types-of-Lab-Analysis-Basic-Methods-and-Applications.webp') no-repeat center center/cover;
}

/* DARK OVERLAY */
.overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
}

/* CONTENT LAYOUT */
.content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center; 
    align-items: center;    
    min-height: 100vh;       
    padding: 60px 120px;
    flex-wrap: wrap;
}

/* CENTER MODE */
.content.centered {
    justify-content: center;
    text-align: center;
}

/* LEFT TEXT */
.left-text {
    color: white;
    max-width: 520px;
    margin: auto;
}

.left-text h1 {
    font-size: 50px;
    margin-bottom: 20px;
}

.left-text p {
    font-size: 18px;
    line-height: 1.6;
}

/* LOGIN FORM */
.right {
    display: none; /* HIDDEN INITIALLY */
}

.right form {
    background: white;
    padding: 55px;
    width: 440px;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0,0,0,0.25);
}

form h2 {
    text-align: center;
    margin-bottom: 25px;
}

form input {
    width: 100%;
    padding: 14px;
    margin: 12px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.register-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
}

.register-fields[hidden] {
    display: none !important;
}

.register-fields input:last-child {
    grid-column: 1 / -1;
}

.otp-fields {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.otp-fields[hidden] {
    display: none !important;
}

form button.otp-send-btn {
    margin: 12px 0;
    padding: 13px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
}

form button.otp-send-btn:disabled { cursor:not-allowed; opacity:.65; }

#registrationOtp,
#loginOtp {
    font-size:1.5rem;
    font-weight:800;
    letter-spacing:.18em;
    text-align:center;
    font-variant-numeric:tabular-nums;
}

#registrationOtp::placeholder,
#loginOtp::placeholder { font-size:.85rem; font-weight:500; letter-spacing:normal; }

.login-otp-panel {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid rgba(45, 125, 205, 0.28);
    border-radius: 16px;
    background: rgba(232, 245, 255, 0.72);
}

.login-otp-panel[hidden] {
    display: none !important;
}

.login-otp-panel p {
    margin: 0 0 2px;
    color: #164b7e;
    font-size: 0.88rem;
    line-height: 1.5;
}

.login-step-label {
    margin-bottom: 5px !important;
    color: #0b5e9d !important;
    font-size: .72rem !important;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.login-otp-panel input:disabled {
    cursor: not-allowed;
    background: #edf2f7;
    color: #8092a5;
}

.auth-status {
    margin: 12px 0 0;
    padding: 11px 13px;
    border: 1px solid #b9d8f0;
    border-radius: 12px;
    background: #eef8ff;
    color: #164b7e;
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.45;
}

.auth-status.is-error {
    border-color: #efb9bd;
    background: #fff2f3;
    color: #922f37;
}

.auth-status[hidden] { display: none !important; }

#resendLoginOtp[hidden] + #loginOtp { grid-column: 1 / -1; }

/* PASSWORD BOX */
.password-box {
    position: relative;
}

.password-box input {
    width: 100%;
    padding: 14px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #555;
}

.password-guideline {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 4;
    width: min(310px, 100%);
    padding: 10px 12px;
    border: 1px solid rgba(176, 205, 235, 0.95);
    border-radius: 12px;
    background: #f8fbff;
    color: #365f88;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.45;
    box-shadow: 0 14px 26px rgba(15, 75, 143, 0.14);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.password-box:hover .password-guideline,
.password-box:focus-within .password-guideline {
    opacity: 1;
    transform: translateY(0);
}

.terms {
    display: flex;
    align-items: flex-start;
    font-size: 13px;
    margin-top: 12px;
    gap: 8px;
}

.terms input[type="checkbox"] {
    width: auto;
    margin: 3px 0 0;
    flex: 0 0 auto;
}

.terms label {
    line-height: 1.5;
}

.terms a {
    color: var(--brand-blue);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.captcha-widget {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 14px 0 0;
    min-height: 50px;
    padding: 8px 12px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    background: #f9f9f9;
    color: #1f1f1f;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.captcha-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 0.86rem;
    font-weight: 600;
}

.captcha-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--brand-blue);
}

.captcha-brand {
    display: grid;
    gap: 1px;
    margin-left: auto;
    color: #676767;
    text-align: center;
    font-size: 0.48rem;
    line-height: 1.1;
}

.captcha-brand strong {
    color: #555;
    font-size: 0.62rem;
    font-weight: 500;
}

.captcha-logo {
    position: relative;
    display: grid;
    place-items: center;
    width: 34px;
    height: 24px;
    margin: 0 auto 1px;
    border-radius: 4px;
    background: #f8fbff;
}

.captcha-logo-ring {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background:
        conic-gradient(from 35deg, #4285f4 0 38%, transparent 38% 47%, #4285f4 47% 69%, transparent 69% 100%);
}

.captcha-logo-ring::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: #f8fbff;
}

.captcha-logo-ring::after {
    content: "";
    position: absolute;
    right: 0;
    top: 4px;
    border-left: 6px solid #4285f4;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transform: rotate(16deg);
}

.captcha-logo-check {
    position: absolute;
    left: 8px;
    bottom: 4px;
    width: 8px;
    height: 5px;
    border-left: 2px solid #34a853;
    border-bottom: 2px solid #34a853;
    transform: rotate(-45deg);
}

/* BUTTON */
form button {
    width: 100%;
    padding: 14px;
    background: #1f4e79;
    color: white;
    border: none;
    border-radius: 5px;
    margin-top: 20px;
    font-size: 16px;
}

/* FORGOT PASSWORD */
.forgot {
    display: block;
    width: auto;
    margin: 12px auto 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    text-align: center;
    font-size: 13px;
    color: #1f4e79;
    box-shadow: none;
    cursor: pointer;
}

/* REGISTER */
.register {
    text-align: center;
    margin-top: 20px;
}

#authFormNote {
    margin: -8px 0 18px;
    text-align: center;
    color: #5a7598;
    line-height: 1.7;
    font-size: 0.96rem;
}

/* FOOTER */
footer {
    background: white;
    text-align: center;
    padding: 15px;
    border-top: 1px solid #ddd;
}

.policy-main {
    width: min(920px, calc(100% - 32px));
    margin: 44px auto;
}

.policy-document {
    padding: 42px;
    border: 1px solid rgba(176, 205, 235, 0.75);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 24px 48px rgba(15, 75, 143, 0.12);
}

.policy-kicker {
    margin: 0 0 10px;
    color: #2a7fc3;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.policy-document h1 {
    margin: 0 0 20px;
    color: #082f59;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.08;
}

.policy-document h2 {
    margin: 24px 0 8px;
    color: #0f4b8f;
    font-size: 1.2rem;
}

.policy-document p {
    margin: 0;
    color: #4f7197;
    line-height: 1.8;
}

.policy-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(8, 28, 52, 0.58);
}

.policy-modal[hidden] {
    display: none !important;
}

.policy-modal-dialog {
    width: min(860px, 100%);
    height: min(760px, calc(100vh - 48px));
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border-radius: 22px;
    background: white;
    box-shadow: 0 30px 70px rgba(8, 47, 89, 0.32);
}

.policy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid #dceefe;
}

.policy-modal-header h2 {
    margin: 0;
    color: #082f59;
    font-size: 1.2rem;
}

.policy-modal-header button {
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border-radius: 12px;
}

.policy-modal iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #f8fbff;
}

/* Refined login theme */
:root {
    --brand-blue: #0f4b8f;
    --brand-blue-dark: #082f59;
    --brand-blue-soft: #dceefe;
    --text-dark: #173350;
}

* {
    font-family: "Manrope", "Segoe UI", sans-serif;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(188, 219, 249, 0.42), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
    color: var(--text-dark);
}

header {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 56px;
    border-bottom: 1px solid rgba(15, 75, 143, 0.1);
    box-shadow: 0 14px 32px rgba(15, 75, 143, 0.08);
}

.logo {
    color: var(--brand-blue-dark);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.logo-container {
    gap: 8px;
}

.logo-container img {
    width: 64px;
    height: 64px;
    margin-right: 0;
}

nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

nav a {
    margin: 0;
    color: var(--brand-blue);
    font-weight: 700;
    font-size: 1rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

nav a:hover {
    color: #2a7fc3;
    transform: translateY(-1px);
}

.login-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #1f67ad, var(--brand-blue));
    border-radius: 18px;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 16px 28px rgba(15, 75, 143, 0.22);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 34px rgba(15, 75, 143, 0.28);
}

.main {
    min-height: calc(100vh - 156px);
    background:
        linear-gradient(135deg, rgba(8, 47, 89, 0.78), rgba(15, 75, 143, 0.6)),
        url('https://bostonmedsupply.com/wp-content/uploads/2024/06/1-Types-of-Lab-Analysis-Basic-Methods-and-Applications.webp') no-repeat center center/cover;
}

.overlay {
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.14), transparent 18%),
        linear-gradient(180deg, rgba(6, 34, 65, 0.18), rgba(6, 34, 65, 0.34));
}

.content {
    min-height: calc(100vh - 156px);
    padding: 72px 120px;
    gap: 48px;
}

.left-text {
    max-width: 560px;
}

.left-text h1 {
    font-size: clamp(2.7rem, 5vw, 4.2rem);
    line-height: 1.05;
}

.left-text p {
    font-size: 1.12rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.92);
}

.right form {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.94));
    padding: 42px;
    width: 460px;
    border-radius: 28px;
    border: 1px solid rgba(197, 220, 245, 0.72);
    box-shadow: 0 26px 44px rgba(8, 47, 89, 0.2);
}

form h2 {
    color: var(--brand-blue-dark);
    font-size: 1.8rem;
}

form input {
    padding: 15px 16px;
    border-radius: 16px;
    border: 1px solid rgba(176, 205, 235, 0.9);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    font-size: 0.98rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 4px rgba(15, 75, 143, 0.12);
}

.password-box input {
    padding-right: 52px;
}

.toggle-password {
    right: 16px;
    color: #5b7ca3;
    font-size: 1rem;
}

.terms {
    font-size: 0.85rem;
    margin-top: 10px;
    gap: 10px;
    color: #54779f;
}

form button {
    padding: 17px 20px;
    background: linear-gradient(135deg, #1f67ad, var(--brand-blue));
    border-radius: 18px;
    margin-top: 22px;
    font-size: 1.03rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 18px 28px rgba(15, 75, 143, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 36px rgba(15, 75, 143, 0.26);
}

.forgot {
    color: var(--brand-blue);
    font-weight: 700;
}

form button.forgot,
form button.forgot:hover {
    width: auto;
    padding: 0;
    margin: 12px auto 0;
    background: none;
    border: 0;
    color: var(--brand-blue);
    box-shadow: none;
    transform: none;
    text-decoration: none;
}

.register {
    color: #57789d;
}

.register a {
    color: var(--brand-blue);
    font-weight: 700;
}

footer {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(15, 75, 143, 0.1);
    color: #5c7ea6;
}

body.dark-mode {
    background: #14283d;
    color: #d9e8f7;
}

body.dark-mode header,
body.dark-mode footer {
    background: #213a53;
    border-color: rgba(162, 202, 240, 0.32);
    color: #d9e8f7;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

body.dark-mode .logo,
body.dark-mode nav a,
body.dark-mode form h2 {
    color: #f6fbff;
}

body.dark-mode .main {
    background:
        linear-gradient(135deg, rgba(6, 22, 38, 0.88), rgba(13, 52, 85, 0.76)),
        url('https://bostonmedsupply.com/wp-content/uploads/2024/06/1-Types-of-Lab-Analysis-Basic-Methods-and-Applications.webp') no-repeat center center/cover;
}

body.dark-mode .right form {
    background:
        radial-gradient(circle at top right, rgba(145, 196, 246, 0.14), transparent 26%),
        linear-gradient(180deg, #213a53, #172d43);
    border-color: rgba(162, 202, 240, 0.34);
    box-shadow: 0 26px 44px rgba(0, 0, 0, 0.28);
}

body.dark-mode #authFormNote,
body.dark-mode .terms,
body.dark-mode .register,
body.dark-mode footer {
    color: #d3e4f5;
}

body.dark-mode .captcha-widget {
    background: #10243a;
    border-color: rgba(162, 202, 240, 0.36);
    color: #f2f8ff;
}

body.dark-mode .captcha-brand,
body.dark-mode .captcha-challenge {
    color: #d3e4f5;
}

body.dark-mode .captcha-brand strong {
    color: #eef7ff;
}

body.dark-mode form input {
    background: #10243a;
    border-color: rgba(162, 202, 240, 0.36);
    color: #f2f8ff;
}

body.dark-mode form input::placeholder {
    color: #a9c5df;
}

body.dark-mode .toggle-password,
body.dark-mode .forgot,
body.dark-mode .register a,
body.dark-mode .terms a {
    color: #9fd0ff;
}

body.dark-mode .password-guideline,
body.dark-mode .policy-modal-dialog {
    background: #213a53;
    border-color: rgba(162, 202, 240, 0.34);
    color: #d3e4f5;
}

body.dark-mode .policy-modal-header {
    border-color: rgba(162, 202, 240, 0.32);
}

body.dark-mode .policy-modal-header h2 {
    color: #f6fbff;
}

@media (max-width: 960px) {
    header {
        padding: 14px 20px;
        flex-direction: column;
        gap: 16px;
    }

    .content {
        min-height: auto;
        padding: 56px 20px;
    }

    .left-text {
        text-align: center;
    }
}

@media (max-width: 640px) {
    nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .logo {
        font-size: 1.08rem;
    }

    .logo-container img {
        width: 54px;
        height: 54px;
    }

    .right form {
        padding: 32px 22px;
        border-radius: 22px;
    }

    .left-text h1 {
        font-size: 2.3rem;
    }
}

/* Final compact patient portal layout for phones only. */
@media (max-width: 640px) {
    body {
        width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    header {
        padding: 8px 12px;
        gap: 8px;
    }

    .logo-container {
        gap: 8px;
    }

    .logo-container img {
        width: 34px;
        height: 34px;
    }

    .logo {
        font-size: .88rem;
        line-height: 1.18;
    }

    nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    nav a,
    nav .login-btn {
        min-height: 40px;
        padding: 7px 5px;
        border-radius: 11px;
        font-size: .8rem;
    }

    .content,
    .content.centered {
        padding: 16px 12px 20px;
    }

    .content.centered .right form,
    .right form {
        width: 100%;
        max-width: 390px;
        padding: 20px 16px;
        border-radius: 20px;
    }

    form h2 {
        margin-bottom: 8px;
        font-size: 1.48rem;
        line-height: 1.15;
    }

    #authFormNote {
        margin: 0;
        font-size: .84rem;
        line-height: 1.5;
    }

    .login-role-chooser {
        margin: 16px 0 2px;
    }

    .role-choice-heading {
        margin-bottom: 9px !important;
        font-size: .78rem !important;
    }

    .login-role-chooser > .role-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .role-login-btn,
    .role-login-btn[data-role="user"] {
        min-width: 0;
        min-height: 104px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 9px;
        padding: 13px;
        border-radius: 16px;
    }

    .role-choice-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: .9rem;
    }

    .role-choice-copy strong {
        font-size: .84rem;
        line-height: 1.25;
    }

    form input {
        padding: 12px 13px;
        border-radius: 12px;
    }

    form button {
        margin-top: 14px;
        padding: 12px 14px;
        border-radius: 13px;
        font-size: .92rem;
    }

    footer {
        padding: 11px 12px;
        font-size: .74rem;
        line-height: 1.45;
        text-align: center;
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    header {
        padding: 12px 14px;
        gap: 12px;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
        text-align: center;
        gap: 10px;
    }

    .logo-container img {
        margin-right: 0;
    }

    nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    nav a {
        margin: 0;
        padding: 8px 10px;
        font-size: 0.94rem;
    }

    .login-btn {
        width: 100%;
        max-width: 220px;
        padding: 13px 18px;
        border-radius: 16px;
    }

    .main,
    .content {
        min-height: auto;
    }

    .content {
        padding: 32px 14px 40px;
        gap: 28px;
    }

    .left-text {
        max-width: none;
        text-align: center;
    }

    .left-text h1 {
        font-size: clamp(1.9rem, 10vw, 2.7rem);
    }

    .left-text p {
        font-size: 1rem;
        line-height: 1.65;
    }

    .right,
    .right form {
        width: 100%;
    }

    .right form {
        max-width: 460px;
        padding: 30px 20px;
        border-radius: 22px;
    }
}

@media (max-width: 520px) {
    .logo-container img {
        width: 46px;
        height: 46px;
    }

    .logo {
        font-size: 1rem;
        line-height: 1.25;
    }

    nav {
        gap: 8px;
    }

    nav a,
    .login-btn {
        width: 100%;
        max-width: none;
        text-align: center;
    }

    .content {
        padding: 24px 12px 34px;
    }

    .right form {
        padding: 24px 16px;
        border-radius: 20px;
    }

    .left-text h1 {
        font-size: clamp(1.65rem, 10vw, 2.2rem);
    }

    footer {
        font-size: 0.85rem;
        padding: 14px 12px;
    }
}

@media (max-width: 560px) {
    header {
        padding: 10px 12px;
        gap: 10px;
    }

    .logo-container {
        gap: 8px;
    }

    .logo-container img {
        width: 40px;
        height: 40px;
    }

    .logo {
        font-size: 0.98rem;
    }

    nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    nav a,
    .login-btn {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 10px 8px;
        font-size: 0.88rem;
        text-align: center;
    }

    .login-btn {
        border-radius: 14px;
    }

    .content {
        padding: 20px 12px 28px;
        gap: 20px;
    }

    .left-text h1 {
        font-size: clamp(1.65rem, 10vw, 2.05rem);
    }

    .left-text p {
        font-size: 0.94rem;
        line-height: 1.55;
    }

    .right form {
        padding: 22px 16px;
        border-radius: 18px;
    }

    form h2 {
        font-size: 1.55rem;
    }

    form input {
        padding: 13px 14px;
        border-radius: 14px;
    }

    form button {
        padding: 14px 16px;
        border-radius: 16px;
        margin-top: 18px;
        font-size: 0.98rem;
    }
}

@media (max-width: 390px) {
    nav a,
    .login-btn {
        font-size: 0.84rem;
        padding: 9px 6px;
    }
}

form .forgot,
form button.forgot,
form button.forgot:hover,
form button.forgot:focus {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    margin: 10px auto 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--brand-blue) !important;
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    text-decoration: none !important;
    transform: none !important;
}
/* Explicit user/admin entry choice */
.login-role-chooser {
    margin: 18px 0;
    padding: 14px;
    border: 1px solid #d8e7f4;
    border-radius: 16px;
    background: #f8fbfe;
}

.login-role-chooser[hidden],
.auth-credential-fields[hidden],
.terms[hidden],
.captcha-widget[hidden] { display: none !important; }

.auth-credential-fields {
    animation: reveal-login-fields .22s ease-out;
}

@keyframes reveal-login-fields {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-role-chooser p {
    margin: 0 0 10px;
    color: #536f8d;
    font-size: .86rem;
    font-weight: 700;
}

.login-role-chooser > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.role-login-btn {
    min-height: 46px;
    border: 1px solid #bdd5e8;
    border-radius: 999px;
    background: #fff;
    color: #0d6194;
    font-weight: 800;
    cursor: pointer;
}

.role-login-btn[data-role="user"] {
    border-color: #0d88b4;
    background: #0d88b4;
    color: #fff;
    box-shadow: 0 8px 20px rgba(13, 136, 180, .2);
}

.role-login-btn.is-active {
    border-color: #0d88b4;
    background: #0d88b4;
    color: #fff;
    box-shadow: 0 8px 20px rgba(13, 136, 180, .2);
}

/* Account portal chooser */
.content.centered .left-text {
    display: none;
}

.content.centered .right {
    display: block !important;
}

.content.centered .right form {
    width: min(500px, calc(100vw - 32px));
    padding: 36px;
}

.login-role-chooser {
    margin: 22px 0 4px;
    padding: 0;
    border: 0;
    background: transparent;
}

.role-choice-heading {
    margin: 0 0 12px !important;
    color: #536f8d !important;
    font-size: .86rem !important;
    font-weight: 800 !important;
    text-align: left;
}

.login-role-chooser > .role-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.role-login-btn,
.role-login-btn[data-role="user"] {
    min-height: 76px;
    display: grid;
    grid-template-columns: 38px 1fr;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 13px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid #c6dcef;
    border-radius: 18px;
    background: rgba(255,255,255,.9);
    color: var(--brand-blue-dark);
    text-align: left;
    box-shadow: 0 14px 30px rgba(15,75,143,.08);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.role-login-btn[data-role="user"] {
    border-color: var(--brand-blue);
    background: linear-gradient(135deg, #1f67ad, var(--brand-blue));
    color: #fff;
    box-shadow: 0 14px 28px rgba(15,75,143,.22);
}

.role-login-btn[data-role="user"] .role-choice-icon {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.role-login-btn:hover,
.role-login-btn:focus-visible {
    border-color: #69a9d8;
    background: #fff;
    color: var(--brand-blue-dark);
    transform: translateY(-3px);
    box-shadow: 0 20px 38px rgba(15,75,143,.16);
}

.role-login-btn[data-role="user"]:hover,
.role-login-btn[data-role="user"]:focus-visible {
    border-color: #2f7fc4;
    background: linear-gradient(135deg, #2876bd, #0f4b8f);
    color: #fff;
    box-shadow: 0 18px 34px rgba(15,75,143,.28);
}

.role-choice-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #dff5ff, #c9e5fb);
    color: #087ca8;
    font-size: 1rem;
    font-weight: 900;
}

.role-choice-icon.is-admin {
    background: linear-gradient(135deg, #e9edff, #d9e0ff);
    color: #4356a7;
}

.role-choice-copy {
    display: block;
}

.role-choice-copy strong {
    font-size: .98rem;
}

form button.change-login-role,
form button.change-login-role:hover,
form button.change-login-role:focus {
    width: auto;
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #2a6ea7;
    box-shadow: none;
    font-size: .82rem;
    font-weight: 800;
    transform: none;
}

@media (max-width: 640px) {
    .content.centered .right form {
        padding: 28px 18px;
    }

    .login-role-chooser > .role-choice-grid {
        grid-template-columns: 1fr;
    }

    .role-login-btn,
    .role-login-btn[data-role="user"] {
        min-height: 68px;
        padding: 13px 14px;
    }
}

/* Keep this last: final compact patient portal layout for phones. */
@media (max-width: 640px) {
    body {
        width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    header {
        padding: 8px 12px;
        gap: 8px;
    }

    .logo-container {
        gap: 8px;
    }

    .logo-container img {
        width: 34px;
        height: 34px;
    }

    .logo {
        font-size: .88rem;
        line-height: 1.18;
    }

    nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    nav a,
    nav .login-btn {
        min-height: 40px;
        padding: 7px 5px;
        border-radius: 11px;
        font-size: .8rem;
    }

    .content,
    .content.centered {
        padding: 16px 12px 20px;
    }

    .content.centered .right form,
    .right form {
        width: 100%;
        max-width: 390px;
        padding: 20px 16px;
        border-radius: 20px;
    }

    form h2 {
        margin-bottom: 8px;
        font-size: 1.48rem;
        line-height: 1.15;
    }

    #authFormNote {
        margin: 0;
        font-size: .84rem;
        line-height: 1.5;
    }

    .login-role-chooser {
        margin: 16px 0 2px;
    }

    .role-choice-heading {
        margin-bottom: 9px !important;
        font-size: .78rem !important;
    }

    .login-role-chooser > .role-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .role-login-btn,
    .role-login-btn[data-role="user"] {
        min-width: 0;
        min-height: 104px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 9px;
        padding: 13px;
        border-radius: 16px;
    }

    .role-choice-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: .9rem;
    }

    .role-choice-copy strong {
        font-size: .84rem;
        line-height: 1.25;
    }

    form input {
        padding: 12px 13px;
        border-radius: 12px;
    }

    form button {
        margin-top: 14px;
        padding: 12px 14px;
        border-radius: 13px;
        font-size: .92rem;
    }

    footer {
        padding: 11px 12px;
        font-size: .74rem;
        line-height: 1.45;
        text-align: center;
    }
}
