.desktop-only { display: none; }

/* Shared visual language; the mobile layout is defined below. */
@media all {
    body {
        background: #c0deed url('/images/lopana-login-clinic.png') center center / cover fixed no-repeat;
        color: #073574;
    }
    .login-shell {
        position: relative;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
        min-height: 100vh;
        padding: 38px clamp(32px, 4.5vw, 76px) 38px;
        gap: clamp(40px, 6vw, 108px);
        background: linear-gradient(90deg, rgba(227, 246, 255, .12), rgba(205, 229, 246, .08) 48%, rgba(10, 72, 114, .22));
    }
    .desktop-only { display: block; }
    .care-hero {
        background: none;
        color: #073574;
        padding: 30px 0 140px;
        gap: 0;
        justify-content: flex-start;
        text-align: center;
        position: relative;
    }
    .care-hero::before {
        content: '';
        position: absolute;
        inset: 1% -5% 15%;
        background: radial-gradient(ellipse, rgba(255,255,255,.92), rgba(244,251,255,.74) 42%, transparent 72%);
        z-index: -1;
        pointer-events: none;
    }
    .care-hero-image { width: clamp(170px, 15vw, 220px); height: auto; filter: none; margin-bottom: -45px; }
    .brand-name { font-size: clamp(44px, 3.6vw, 54px); font-weight: 700; line-height: 1.2; letter-spacing: -2px; }
    .care-hero .brand-description { color: #073574; margin: 10px 0 0; font-size: clamp(19px, 1.8vw, 26px); font-weight: 700; line-height: 1.4; }
    .care-hero .brand-english { color: #306ab8; margin: 0; font: clamp(14px, 1.3vw, 20px)/1.6 Arial, sans-serif; }
    .care-hero h1 { color: #073574; margin: 26px 0 12px; font-size: clamp(30px, 3vw, 42px); line-height: 1.25; font-weight: 700; white-space: pre-line; }
    .care-hero .brand-message { color: #5484c5; margin: 0; font-size: clamp(18px, 1.65vw, 23px); line-height: 1.5; white-space: pre-line; }
    .care-benefits { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 525px; margin-top: 28px; }
    .care-benefits > div { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #063575; font-size: clamp(12px, 1.05vw, 16px); font-weight: 700; line-height: 1.55; }
    .care-benefits > div + div::before { content: ''; position: absolute; right: 0; top: 8px; bottom: 0; width: 1px; background: #a9d2f6; }
    .care-benefits > div > span:last-child { white-space: pre-line; }
    .benefit-icon { width: 70px; height: 62px; display: grid; place-items: center; border: 1px solid #e0f2ff; border-radius: 14px; background: rgba(255,255,255,.72); box-shadow: 0 4px 18px #63b6da18; }
    .benefit-icon svg { width: 38px; height: 38px; fill: none; stroke: #00afbf; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .form-area { min-height: calc(100vh - 76px); padding: 0; flex-direction: column; gap: 25px; justify-content: center; }
    .form-area::before, .form-area::after { display: none; }
    .language-switch { display: flex; direction: ltr; align-self: flex-start; border-radius: 30px; background: #d6eaff; padding: 0; overflow: hidden; }
    .language-switch button { min-width: 90px; padding: 8px 20px; background: transparent; color: #073574; font: 400 16px/1.4 'VazirFD', Tahoma, sans-serif; border: 0; border-radius: 30px; cursor: pointer; }
    .language-switch button[aria-pressed='true'] { background: linear-gradient(100deg, #008caa, #004479); color: white; }
    .login-card { width: 100%; max-width: 565px; padding: 32px; border-radius: 24px; background: rgba(255,255,255,.96); border: 1px solid white; box-shadow: 0 18px 65px #1b578326; backdrop-filter: blur(20px); }
    .login-card > .logo-mark, .login-card > .subtitle { display: none; }
    .welcome-copy { text-align: center; margin-bottom: 40px; }
    .welcome-copy h2 { font-size: clamp(30px, 2.8vw, 43px); color: #073574; line-height: 1.55; }
    .welcome-copy p { color: #5788cd; margin: 10px 0 0; font-size: clamp(14px, 1.3vw, 19px); line-height: 1.8; }
    .credential-field > label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
    .field { margin-bottom: 18px; }
    .field label { color: #38679f; font-size: 13px; font-weight: 400; }
    .form-control { height: 62px; border: 1px solid #b4d8ff; border-radius: 14px; background: rgba(239,248,255,.42); box-shadow: none; font-size: clamp(14px, 1.25vw, 18px); font-weight: 400; padding: 14px 18px 14px 52px; color: #073574; }
    .form-control::placeholder { color: #608cd0; opacity: 1; }
    .field-icon { right: auto; left: 18px; color: #073574 !important; opacity: 1; pointer-events: none; }
    .password-field .form-control { padding-right: 56px; }
    .password-toggle { display: grid; place-items: center; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #073574; cursor: pointer; }
    .password-toggle svg { stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .password-toggle[aria-pressed='true'] .eye-slash { display: none; }
    .captcha-grid { gap: 12px; }
    .captcha-grid .form-control, .captcha-box { height: 44px; font-size: 17px; border: 1px solid #b4d8ff; border-radius: 10px; background: rgba(239,248,255,.42); box-shadow: none; }
    .captcha-box { color: #145b9c; }
    .options { font-size: clamp(13px, 1.15vw, 17px); color: #073574; gap: 10px; margin: 2px 0 22px; font-weight: 400; }
    .options label { direction: ltr; gap: 9px; white-space: nowrap; }
    .options input { width: 22px; height: 22px; margin: 0; accent-color: #007eaa; }
    .submit-btn { height: 62px; border-radius: 14px; background: linear-gradient(105deg, #00b1b8, #007c99 45%, #06417f); box-shadow: 0 8px 20px #00a4b316; font-size: 23px; }
    .mobile-submit-label { display: none; }
    .desktop-submit-label { display: flex; align-items: center; justify-content: center; gap: 22px; }
    .support-help { margin-top: 18px; text-align: center; font-size: 14px; color: #5686c7; }
    .support-help summary { display: flex; align-items: center; justify-content: center; gap: 20px; list-style: none; cursor: pointer; }
    .support-help summary::-webkit-details-marker { display: none; }
    .support-help strong { display: block; margin-top: 4px; font-size: 17px; color: #0656ee; }
    .support-help svg { stroke: #073574; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .support-help p { line-height: 1.9; margin: 12px 0 0; }
    .login-motto { display: flex; align-items: center; justify-content: center; gap: 20px; color: white; font-size: 16px; margin: 14px 0 0; text-shadow: 0 1px 6px #15456b; }
    .login-motto::before, .login-motto::after { content: ''; width: 48px; height: 1px; background: #22cfdd; }
    .platform-signature { position: absolute; left: 3%; bottom: 26px; color: white; font: 14px/1.4 Arial, sans-serif; text-shadow: 0 1px 5px #164967; }
    .platform-signature strong, .platform-signature span { display: block; }
    .platform-signature strong { font-size: 18px; font-weight: 400; }
    .platform-signature::after { content: ''; display: block; margin-top: 7px; width: 54px; height: 2px; background: #18d1d1; }
    button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #00aebc; outline-offset: 4px; }
    .login-shell[data-language='en'] .care-hero, .login-shell[data-language='en'] .form-area { direction: ltr; }
    .login-shell[data-language='en'] .password-field .form-control { padding-right: 50px; }
    .login-shell[data-language='en'] .options { flex-direction: row-reverse; }
    @media (max-height: 850px) {
        .login-shell { padding-top: 22px; padding-bottom: 24px; }
        .form-area { gap: 16px; min-height: calc(100vh - 46px); }
        .login-card { padding: 25px 30px; }
        .welcome-copy { margin-bottom: 24px; }
        .welcome-copy h2 { font-size: 34px; }
        .field { margin-bottom: 14px; }
        .form-control { height: 54px; }
        .options { margin-bottom: 16px; }
        .submit-btn { height: 54px; min-height: 54px; }
        .support-help { margin-top: 12px; }
        .login-motto { margin-top: 0; }
        .care-hero { padding-top: 0; padding-bottom: 100px; }
        .care-hero-image { width: 180px; }
        .care-hero h1 { font-size: 34px; margin-top: 18px; }
        .brand-name { font-size: 48px; }
        .care-benefits { margin-top: 20px; }
    }
}

@media (max-width: 1100px) {
    body {
        background: #b9dcec url('/images/lopana-login-mobile.png') center center / cover no-repeat;
        background-attachment: scroll;
        min-height: 100svh;
    }
    .login-shell {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        width: 100%;
        min-height: 100svh;
        padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
        background: linear-gradient(180deg, rgba(199,232,248,.08), rgba(233,247,255,.2) 60%, rgba(216,237,251,.06));
        align-content: start;
    }
    /* Let the brand, form, and feature row share a single reading order. */
    .care-hero, .form-area { display: contents; }
    .care-hero::before, .form-area::before, .form-area::after { display: none; }
    .language-switch {
        order: 0;
        justify-self: start;
        margin: 0 0 8px;
        background: rgba(244,250,255,.92);
    }
    .language-switch button { min-width: 66px; min-height: 36px; padding: 7px 15px; font-size: 14px; }
    .care-hero-image {
        order: 1;
        justify-self: center;
        width: clamp(140px, 38vw, 190px);
        max-height: none;
        margin: 0 0 -34px;
        filter: none;
    }
    .care-hero-copy {
        order: 2;
        justify-self: center;
        width: 100%;
        max-width: 560px;
        margin: 0 0 20px;
        color: #073574;
        text-shadow: 0 2px 16px white;
    }
    .brand-name { font-size: clamp(36px, 10vw, 46px); line-height: 1.2; }
    .care-hero .brand-description { font-size: clamp(16px, 4.4vw, 22px); line-height: 1.5; margin: 8px 0 0; }
    .care-hero .brand-english { color: #073574; font-size: clamp(12px, 3.5vw, 16px); line-height: 1.5; }
    .care-hero h1, .care-hero .brand-message { display: none; }
    .login-card {
        order: 3;
        justify-self: center;
        width: 100%;
        max-width: 560px;
        padding: 20px;
        border-radius: 22px;
        background: linear-gradient(145deg, rgba(255,255,255,.90), rgba(243,249,255,.86));
        border: 1px solid rgba(255,255,255,.8);
        box-shadow: 0 12px 42px rgba(66,131,173,.1);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        direction: rtl;
    }
    .welcome-copy { margin-bottom: 18px; }
    .welcome-copy h2 { font-size: clamp(27px, 7vw, 34px); line-height: 1.4; }
    .welcome-copy p { margin-top: 7px; font-size: 13px; line-height: 1.85; }
    .field { margin-bottom: 12px; }
    .form-control {
        height: 48px;
        padding: 10px 12px 10px 39px;
        border-radius: 11px;
        font-size: 16px;
        background: rgba(245,250,255,.5);
    }
    .form-control::placeholder { font-size: 13px; }
    .field-icon { left: 10px; }
    .field-icon svg { width: 23px; height: 23px; }
    .password-field .form-control { padding-right: 42px; }
    .password-toggle { right: 1px; width: 40px; height: 44px; }
    .password-toggle svg { width: 22px; height: 22px; }
    .field label { font-size: 11px; margin-bottom: 5px; }
    .captcha-grid { gap: 8px; }
    .captcha-grid .form-control, .captcha-box { height: 40px; font-size: 16px; }
    .options { align-items: center; gap: 8px; margin: 16px 0; font-size: 12px; }
    .options a { font-weight: 700; }
    .options label { gap: 6px; }
    .options input { width: 19px; height: 19px; flex: 0 0 auto; }
    .submit-btn { min-height: 48px; height: 48px; font-size: 18px; border-radius: 11px; }
    .desktop-submit-label { gap: 18px; }
    .desktop-submit-label svg { width: 23px; height: 23px; }
    .support-help { margin-top: 16px; font-size: 12px; }
    .support-help strong { font-size: 14px; margin-top: 2px; }
    .support-help summary { gap: 14px; }
    .support-help svg { width: 30px; height: 30px; }
    .care-benefits {
        order: 4;
        justify-self: center;
        direction: rtl;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        max-width: 560px;
        gap: 10px;
        margin: 14px 0 0;
    }
    .care-benefits > div {
        padding: 7px 2px 9px;
        border: 1px solid rgba(255,255,255,.2);
        border-radius: 12px;
        background: rgba(242,249,255,.66);
        backdrop-filter: blur(8px);
        gap: 6px;
        font-size: clamp(10px, 2.7vw, 13px);
        line-height: 1.5;
        text-align: center;
        overflow-wrap: anywhere;
    }
    .care-benefits > div + div::before { display: none; }
    .benefit-icon { width: 100%; height: 38px; border: 0; border-radius: 9px; box-shadow: none; background: rgba(255,255,255,.25); }
    .benefit-icon svg { width: 30px; height: 30px; }
    .login-motto {
        order: 5;
        justify-self: end;
        max-width: 230px;
        display: block;
        margin: 36px 0 0;
        padding: 0 4px 10px;
        border-bottom: 1px solid #00b5c6;
        color: #073574;
        text-shadow: 0 1px 10px white;
        text-align: right;
        font-size: 19px;
        font-style: italic;
        line-height: 1.9;
    }
    .login-motto::before, .login-motto::after, .platform-signature { display: none; }
    .login-shell[data-language='en'] .login-card { direction: ltr; }
    .login-shell[data-language='en'] .care-benefits { direction: ltr; }
    .login-shell[data-language='en'] .login-motto { text-align: left; }
}

@media (max-width: 360px) {
    .login-shell { padding-right: max(12px, env(safe-area-inset-right)); padding-left: max(12px, env(safe-area-inset-left)); }
    .login-card { padding: 17px 14px; }
    .care-benefits { gap: 6px; }
    .options { font-size: 11px; }
    .form-control::placeholder { font-size: 12px; }
}

/* Fit the composition to the available screen height, without clipping the form. */
.login-shell { min-height: 100dvh; }
.form-area { min-height: 0; }
.support-help { position: relative; }
.validation-summary-errors { margin: 0 0 8px; padding: 7px 10px; font-size: 12px; line-height: 1.5; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 18px; }
.support-help[open] p {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 12px;
    border: 1px solid #b4d8ff;
    border-radius: 12px;
    background: #f4faff;
    box-shadow: 0 8px 30px #07357424;
}
@media (min-width: 1101px) and (max-height: 800px) {
    .login-shell { padding-top: 16px; padding-bottom: 16px; }
    .care-hero { padding-bottom: 0; justify-content: center; }
    .form-area { gap: 12px; }
    .care-hero-image { width: 150px; margin-bottom: -30px; }
    .brand-name { font-size: 40px; }
    .care-hero h1 { font-size: 30px; margin-top: 14px; }
    .care-hero .brand-message { font-size: 18px; }
    .care-benefits { margin-top: 16px; }
    .platform-signature { bottom: 12px; font-size: 11px; }
    .login-card { padding: 20px 28px; }
    .welcome-copy { margin-bottom: 18px; }
}
@media (min-width: 1101px) and (max-height: 650px) {
    .login-shell { padding-top: 10px; padding-bottom: 10px; }
    .welcome-copy p, .login-motto, .platform-signature { display: none; }
    .form-area { gap: 8px; }
    .login-card { padding: 16px 24px; }
    .welcome-copy { margin-bottom: 12px; }
    .welcome-copy h2 { font-size: 28px; }
    .field { margin-bottom: 10px; }
    .form-control, .submit-btn { min-height: 44px; height: 44px; }
    .options { margin-bottom: 12px; }
    .support-help { margin-top: 10px; }
    .care-hero .brand-message { display: none; }
}
@media (max-width: 1100px) {
    body { min-height: 100dvh; }
    .login-shell {
        min-height: 100dvh;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        align-content: center;
    }
    .language-switch { margin-bottom: 0; }
    .language-switch button { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
    .care-hero-image { width: 100px; margin-top: -12px; margin-bottom: -22px; }
    .care-hero-copy { margin-bottom: 12px; }
    .brand-name { font-size: 30px; }
    .care-hero .brand-description { font-size: 15px; margin-top: 3px; }
    .care-hero .brand-english { font-size: 12px; }
    .login-card { padding: 16px; }
    .welcome-copy { margin-bottom: 12px; }
    .welcome-copy h2 { font-size: 27px; }
    .welcome-copy p { margin-top: 4px; font-size: 12px; line-height: 1.6; }
    .field { margin-bottom: 8px; }
    .form-control { height: 44px; }
    .captcha-grid .form-control, .captcha-box { height: 36px; }
    .options { margin: 10px 0; }
    .submit-btn { min-height: 44px; height: 44px; }
    .support-help { margin-top: 10px; }
    .support-help summary > span { display: flex; align-items: center; gap: 8px; }
    .support-help strong { margin-top: 0; font-size: 12px; }
    .support-help svg { width: 24px; height: 24px; }
    .care-benefits { margin-top: 10px; }
    .care-benefits > div { font-size: 10px; padding: 5px 2px; gap: 3px; }
    .benefit-icon { height: 28px; }
    .benefit-icon svg { width: 25px; height: 25px; }
    .login-motto { max-width: none; justify-self: center; margin-top: 10px; padding-bottom: 4px; font-size: 13px; line-height: 1.5; }
}
@media (max-width: 1100px) and (max-height: 760px) {
    .care-hero-image { width: 76px; margin-bottom: -16px; }
    .brand-name { font-size: 25px; }
    .care-hero .brand-english, .login-motto { display: none; }
    .care-hero-copy { margin-bottom: 8px; }
    .welcome-copy p { display: none; }
    .care-benefits > div { font-size: 9px; }
}
@media (max-width: 1100px) and (max-height: 650px) {
    .care-benefits, .care-hero .brand-description { display: none; }
    .login-card { padding: 12px 16px; }
    .welcome-copy { margin-bottom: 8px; }
    .welcome-copy h2 { font-size: 23px; }
}
@media (max-width: 1100px) and (max-height: 500px) {
    .care-hero-image, .care-hero-copy, .welcome-copy, .support-help { display: none; }
    .language-switch { margin-bottom: 6px; }
    .login-shell { padding-top: 6px; padding-bottom: 6px; }
    .login-card { max-width: 560px; padding: 10px 14px; }
    .field { margin-bottom: 6px; }
    .options { margin: 6px 0; }
}
@media (max-width: 1100px) {
    .login-shell:has(.validation-summary-errors) .care-benefits,
    .login-shell:has(.validation-summary-errors) .login-motto { display: none; }
}
@media (max-width: 1100px) and (max-height: 760px) {
    .login-shell:has(.validation-summary-errors) .care-hero-image,
    .login-shell:has(.validation-summary-errors) .care-hero-copy { display: none; }
    .login-shell:has(.validation-summary-errors) .language-switch { margin-bottom: 8px; }
}
@media (min-width: 600px) and (max-width: 1100px) and (max-height: 500px) {
    .login-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
    .login-card > :not(.credential-field) { grid-column: 1 / -1; }
    .field { margin-bottom: 0; }
    .form-control::placeholder { font-size: 12px; }
}

/* Slightly quieter typography in desktop windows and full-screen views.
   Keep the mobile font sizes and the existing control dimensions. */
@media (min-width: 1101px) {
    .brand-name { font-size: clamp(40px, 3.2vw, 48px); }
    .care-hero .brand-description { font-size: clamp(17px, 1.6vw, 23px); }
    .care-hero .brand-english { font-size: clamp(13px, 1.15vw, 18px); }
    .care-hero h1 { font-size: clamp(27px, 2.65vw, 37px); }
    .care-hero .brand-message { font-size: clamp(16px, 1.45vw, 20px); }
    .care-benefits > div { font-size: clamp(12px, .95vw, 14px); }
    .welcome-copy h2 { font-size: clamp(27px, 2.4vw, 37px); }
    .welcome-copy p { font-size: clamp(13px, 1.15vw, 17px); }
    .form-control { font-size: clamp(14px, 1.1vw, 16px); }
    .captcha-grid .form-control, .captcha-box { font-size: 16px; }
    .options { font-size: clamp(13px, 1vw, 15px); }
    .submit-btn { font-size: 20px; }
    .support-help { font-size: 13px; }
    .support-help strong { font-size: 15px; }
    .login-motto { font-size: 14px; }
    .platform-signature { font-size: 13px; }
    .platform-signature strong { font-size: 16px; }
}
@media (min-width: 1101px) and (max-height: 850px) {
    .brand-name { font-size: 43px; }
    .care-hero h1, .welcome-copy h2 { font-size: 30px; }
}
@media (min-width: 1101px) and (max-height: 650px) {
    .welcome-copy h2 { font-size: 25px; }
}