:root {
    --notefarma-blue: #2461c1;
    --notefarma-teal: #2bb2a7;
    --notefarma-cream: #f8e9c6;
    --notefarma-ink: #0a1424;
    --notefarma-muted: #66758a;
    --notefarma-line: #d7e4ee;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (display-mode: standalone) and (pointer: fine) {
    html,
    body {
        min-width: 1024px;
    }
}

.notefarma-pwa-update {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 3000;
    width: min(calc(100vw - 36px), 380px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(36, 97, 193, 0.16);
    border-radius: 8px;
    color: var(--notefarma-ink);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 42px rgba(7, 19, 41, 0.16);
}

.notefarma-pwa-update[hidden] {
    display: none;
}

.notefarma-pwa-update span {
    min-width: 0;
    flex: 1;
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1.35;
}

.notefarma-pwa-update button {
    min-height: 38px;
    flex: 0 0 auto;
    padding: 0 14px;
    border: 1px solid var(--notefarma-blue);
    border-radius: 8px;
    color: #ffffff;
    background: var(--notefarma-blue);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 850;
    cursor: pointer;
}

@media (max-width: 460px) {
    .notefarma-pwa-update {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        display: grid;
    }

    .notefarma-pwa-update button {
        width: 100%;
    }
}

.login-page {
    min-height: 100vh;
    color: var(--notefarma-ink);
    background:
        linear-gradient(118deg, rgba(248, 233, 198, 0.92) 0%, rgba(248, 233, 198, 0.92) 36%, rgba(244, 250, 252, 0.96) 36%, rgba(238, 248, 249, 0.98) 100%);
}

.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.14)),
        linear-gradient(90deg, rgba(36, 97, 193, 0.1), transparent 48%, rgba(43, 178, 167, 0.12));
    pointer-events: none;
}

.login-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px 58px;
}

.login-stage {
    position: relative;
    width: min(100%, 1040px);
    min-height: 650px;
    display: grid;
    align-items: center;
    justify-items: center;
}

.login-stage::before {
    content: "";
    position: absolute;
    inset: auto 10px 28px 10px;
    height: 42%;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(36, 97, 193, 0.12), rgba(43, 178, 167, 0.1));
    transform: skewY(-3deg);
}

.login-visual {
    position: absolute;
    inset: auto 0 18px 0;
    min-height: 330px;
    pointer-events: none;
}

.login-visual__plate {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: min(78vw, 360px);
    height: 92px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(36, 97, 193, 0.14), rgba(43, 178, 167, 0.16));
    filter: blur(1px);
}

.login-persona {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(72vw, 310px);
    height: auto;
    transform: translateX(-50%);
    opacity: 0.24;
}

.login-card {
    position: relative;
    z-index: 2;
    overflow: visible;
    width: min(100%, 374px);
    padding: 28px 24px;
    border: 1px solid rgba(36, 97, 193, 0.16);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 26px 70px rgba(28, 69, 112, 0.16),
        0 0 72px rgba(43, 178, 167, 0.18),
        0 0 120px rgba(36, 97, 193, 0.13),
        0 1px 0 rgba(255, 255, 255, 0.9) inset;
    backdrop-filter: blur(16px);
}

.login-card::before {
    content: "";
    position: absolute;
    inset: -28px;
    z-index: -1;
    border-radius: 34px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.88), rgba(43, 178, 167, 0.2) 42%, rgba(36, 97, 193, 0) 72%);
    filter: blur(18px);
    opacity: 0.82;
    pointer-events: none;
}

.login-card__header {
    text-align: center;
    margin-bottom: 26px;
}

.login-logo {
    display: block;
    width: min(100%, 286px);
    height: auto;
    margin: 2px auto 18px;
}

.login-card p {
    max-width: 275px;
    margin: 0 auto;
    color: var(--notefarma-muted);
    font-size: 0.98rem;
    line-height: 1.45;
}

.auth-title {
    margin: 0 0 10px;
    color: var(--notefarma-ink);
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
}

.login-form {
    display: grid;
    gap: 15px;
}

.login-form .mb-3 {
    margin-bottom: 0 !important;
}

.login-field {
    display: grid;
    gap: 8px;
}

.login-field label,
.login-form label,
.login-form .form-label {
    color: #172235;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.login-form .form-control,
.login-form .form-select {
    min-height: 50px;
    border: 1px solid var(--notefarma-line);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.94);
    color: var(--notefarma-ink);
    box-shadow: 0 8px 18px rgba(36, 97, 193, 0.05);
}

.login-form .form-control::placeholder {
    color: #8a96a6;
}

.login-form .form-control:focus,
.login-form .form-select:focus {
    border-color: rgba(43, 178, 167, 0.92);
    background-color: #ffffff;
    color: var(--notefarma-ink);
    box-shadow:
        0 0 0 0.2rem rgba(43, 178, 167, 0.14),
        0 12px 26px rgba(36, 97, 193, 0.1);
}

.login-form .invalid-feedback {
    font-size: 0.82rem;
    font-weight: 600;
}

.login-form .form-text {
    margin-top: 7px;
    color: var(--notefarma-muted);
    font-size: 0.78rem;
}

.login-error {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid rgba(220, 53, 69, 0.24);
    border-radius: 12px;
    color: #9f2634;
    background: rgba(255, 238, 240, 0.9);
    font-size: 0.88rem;
    font-weight: 600;
}

.login-error--success {
    border-color: rgba(43, 178, 167, 0.28);
    color: #0b6f66;
    background: rgba(231, 248, 246, 0.95);
}

.login-error--error {
    border-color: rgba(220, 53, 69, 0.24);
    color: #9f2634;
    background: rgba(255, 238, 240, 0.9);
}

.login-recaptcha {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 2px 0;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: -2px;
    font-size: 0.82rem;
}

.login-options--end {
    justify-content: flex-end;
}

.login-options .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    margin: 0;
    padding-left: 0;
}

.login-options .form-check-input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    border-color: rgba(36, 97, 193, 0.35);
    cursor: pointer;
}

.login-options .form-check-input:checked {
    background-color: var(--notefarma-blue);
    border-color: var(--notefarma-blue);
}

.login-options .form-check-label {
    color: var(--notefarma-muted);
    cursor: pointer;
    line-height: 1.2;
}

.login-link {
    color: var(--notefarma-blue);
    font-weight: 700;
    text-decoration: none;
}

.login-link:hover {
    color: #1d55ad;
    text-decoration: underline;
}

.btn-login {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #2461c1;
    --bs-btn-border-color: #2461c1;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #1d55ad;
    --bs-btn-hover-border-color: #1d55ad;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #194b9b;
    --bs-btn-active-border-color: #194b9b;
    min-height: 52px;
    margin-top: 4px;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 16px 32px rgba(36, 97, 193, 0.24);
}

.btn-login:hover {
    transform: translateY(-1px);
}

.btn-login.is-loading,
.btn-register-secondary.is-loading,
.verification-resend__button.is-loading {
    pointer-events: none;
    opacity: 0.74;
}

.login-signup {
    margin: -2px 0 0;
    color: var(--notefarma-muted);
    font-size: 0.88rem;
    text-align: center;
}

.login-footer {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 18px;
    color: rgba(10, 20, 36, 0.58);
    font-size: 0.78rem;
    text-align: center;
}

.register-stage {
    min-height: 660px;
}

.register-card {
    width: min(100%, 430px);
    padding-top: 26px;
    padding-bottom: 24px;
}

.register-card .login-logo {
    width: min(100%, 250px);
    margin-bottom: 14px;
}

.register-form {
    gap: 12px;
}

.register-form .row {
    --bs-gutter-x: 12px;
    --bs-gutter-y: 13px;
}

.register-step {
    display: none;
}

.register-step.is-active {
    display: block;
}

.register-step .mb-3 + .mb-3 {
    margin-top: 12px !important;
}

.register-step .row {
    margin-top: 12px;
}

.register-step .form-text ul {
    margin: 6px 0 0;
    padding-left: 16px;
}

.register-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-register-secondary {
    --bs-btn-color: #2461c1;
    --bs-btn-bg: rgba(255, 255, 255, 0.92);
    --bs-btn-border-color: rgba(36, 97, 193, 0.18);
    --bs-btn-hover-color: #1d55ad;
    --bs-btn-hover-bg: #ffffff;
    --bs-btn-hover-border-color: rgba(36, 97, 193, 0.32);
    min-width: 116px;
    min-height: 46px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 800;
}

.register-actions .btn-login {
    min-width: 140px;
    padding-right: 22px;
    padding-left: 22px;
}

.register-form [data-register-prev],
.register-form [data-register-submit] {
    display: none;
}

.register-form.is-security-step [data-register-prev],
.register-form.is-security-step [data-register-submit] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.register-form.is-security-step [data-register-next] {
    display: none;
}

.verification-card {
    text-align: left;
}

.verification-header {
    margin-bottom: 18px;
}

.verification-header p,
.verification-header strong {
    display: block;
}

.verification-header p {
    margin-bottom: 2px;
}

.verification-header strong {
    color: var(--notefarma-muted);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}

.verification-phone-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: stretch;
    width: max-content;
    margin: -2px 0 4px auto;
    padding: 0;
    border: 0;
    color: #8a3340;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.2;
    cursor: pointer;
}

.verification-phone-toggle:hover {
    color: #731f2c;
    text-decoration: underline;
}

.verification-countdown {
    display: block;
    gap: 5px;
    min-height: auto;
    margin: -4px 0 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--notefarma-muted);
    background: transparent;
    font-size: 0.8rem;
    text-align: left;
}

.verification-countdown strong {
    color: var(--notefarma-blue);
    font-variant-numeric: tabular-nums;
}

.verification-countdown.is-expired {
    color: #9f2634;
    border-color: transparent;
    background: transparent;
}

.verification-countdown.is-expired strong {
    color: #9f2634;
}

.verification-form input[name="code"] {
    min-height: 58px;
    font-size: 1.42rem;
    font-weight: 760;
    letter-spacing: 0;
    text-align: center;
}

.verification-form .btn-login {
    font-weight: 800;
}

.verification-form .btn-login:disabled {
    color: #6c7787;
    border-color: #5f6c7b;
    background: transparent;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

.verification-resend {
    margin-top: 16px;
    text-align: center;
}

.verification-resend__button {
    border: 0;
    color: var(--notefarma-muted);
    background: transparent;
    cursor: pointer;
}

.verification-resend__button:hover {
    color: #4f5e72;
}

.verification-resend__button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.verification-phone {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(36, 97, 193, 0.12);
}

.verification-phone summary {
    display: none;
    color: var(--notefarma-blue);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    list-style-position: inside;
}

.verification-phone__form {
    margin-top: 12px;
}

.verification-phone__form .btn-register-secondary {
    margin-top: 2px;
}

@media (min-width: 768px) {
    .login-shell {
        padding: 42px 28px 64px;
    }

    .login-stage {
        grid-template-columns: minmax(0, 1fr) 392px;
        gap: 40px;
        justify-items: stretch;
    }

    .login-stage::before {
        inset: 58px auto 58px 0;
        width: 64%;
        height: auto;
        transform: skewX(-7deg);
    }

    .login-visual {
        position: relative;
        inset: auto;
        align-self: end;
        min-height: 620px;
    }

    .login-visual__plate {
        left: 44%;
        width: 440px;
        height: 124px;
    }

    .login-persona {
        left: 44%;
        width: min(48vw, 490px);
        opacity: 1;
    }

    .login-card {
        width: 392px;
        padding: 32px;
    }

    .register-stage {
        grid-template-columns: minmax(0, 1fr) 448px;
    }

    .register-card {
        width: 448px;
        padding: 28px 30px;
    }

    .register-actions {
        justify-content: center;
    }

    .register-form.is-security-step [data-register-submit] {
        min-width: 176px;
    }
}

@media (min-width: 1100px) {
    .login-stage {
        grid-template-columns: minmax(0, 1fr) 400px;
        gap: 62px;
    }

    .login-persona {
        left: 50%;
        width: 548px;
    }

    .login-visual__plate {
        left: 50%;
        width: 500px;
    }

    .register-stage {
        grid-template-columns: minmax(0, 1fr) 456px;
    }

    .register-card {
        width: 456px;
    }
}
