/* ============================================================
   SEMED — tela de login compartilhada (gateway + sistemas)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

.login-page {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--sm-text, #1c2b30);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-page h1,
.login-page h2 {
    font-family: inherit;
}

.login-split {
    display: grid;
    grid-template-columns: minmax(440px, 50%) 1fr;
    min-height: 100vh;
}

.login-brand {
    background:
        radial-gradient(90% 55% at 78% -10%, rgba(64, 200, 219, .18), transparent 58%),
        linear-gradient(180deg, #07242c 0%, #04181d 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 36px 48px 32px;
    position: relative;
    overflow: hidden;
}

.brand-logo {
    position: relative;
    z-index: 1;
    display: block;
    height: 58px;
    width: auto;
    max-width: min(280px, 100%);
    object-fit: contain;
    object-position: left center;
}

.login-mobile-brand {
    display: none;
}

.login-mobile-brand__mark {
    display: inline-flex;
    align-items: center;
    background: #07242c;
    border-radius: 12px;
    padding: 8px 12px;
}

.login-mobile-brand img {
    display: block;
    height: 40px;
    width: auto;
    max-width: min(220px, 70vw);
    object-fit: contain;
    object-position: left center;
}

.brand-copy {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 48px;
    right: auto;
    width: calc(100% - 96px);
    max-width: none;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    text-align: left;
}

.login-brand h1,
.login-brand .brand-sub {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    text-align: left;
    text-indent: 0;
}

.login-brand h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -.4px;
    line-height: 1.25;
    margin-top: 0;
    margin-bottom: 0;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
}

.brand-sub {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.45;
    color: rgba(255, 255, 255, .72);
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: manual;
}

.brand-chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.brand-chips li {
    font-size: 12.5px;
    line-height: 1.2;
    color: rgba(255, 255, 255, .88);
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
}

.brand-footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    margin-top: auto;
}

.login-brand .brand-footer-mark {
    display: block;
    height: 32px;
    width: auto;
    max-width: 120px;
    flex-shrink: 0;
    margin-left: auto;
    object-fit: contain;
    opacity: 0.4;
    transition: opacity .2s ease;
}

.login-brand .brand-footer-mark:hover,
.login-brand .brand-footer-mark:focus {
    opacity: 1;
}

.brand-footer-note {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, .55);
}

.brand-footer-note a {
    color: inherit;
    text-decoration: none;
}

.brand-footer-note a:hover {
    text-decoration: underline;
}

.login-form-panel {
    display: grid;
    place-items: center;
    padding: 40px 24px;
    position: relative;
    background: #f4f6f8;
}

.login-theme-slot {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.sm-theme-switch--login {
    box-shadow: 0 2px 8px rgba(6, 62, 72, .12);
}

.sm-theme-switch-locked-hint {
    font-size: 11px;
    line-height: 1.3;
    max-width: 168px;
    text-align: right;
    color: var(--sm-text-soft, #566268);
    opacity: 0.85;
}

.login-card {
    width: 100%;
    max-width: 400px;
    min-width: 0;
    background: var(--sm-surface, #fff);
    border: 1px solid var(--sm-border, #dbe7ea);
    border-radius: 14px;
    box-shadow: var(--sm-shadow, 0 10px 30px rgba(6, 62, 72, .12));
    padding: 40px 36px;
}

/* Login padrão: campos soltos sobre o fundo claro, sem um cartão único. */
.login-page--default .login-card {
    max-width: 420px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 8px 0 0;
}

.login-card form {
    min-width: 0;
}

.login-card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.3px; margin: 0; color: #1a1d21; }

.login-hint { margin: 6px 0 22px; font-size: 14.5px; color: #667085; }
.login-help-note { margin: 18px 0 0; font-size: 13px; text-align: center; color: var(--sm-text-soft, #566268); }

.login-help-note a,
.login-forgot-password {
    color: var(--brand-700, #0b7f92);
    font-weight: 600;
    text-decoration: none;
}

.login-help-note a:hover,
.login-forgot-password:hover {
    text-decoration: underline;
}

.login-card label.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-text, #1c2b30);
    margin: 16px 0 6px;
}

.login-card label.field-label:first-of-type { margin-top: 0; }

.login-field {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    border: 1px solid #e1e4ea;
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    overflow: hidden;
}

.login-field:focus-within {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(18, 175, 200, .18);
}

.login-field__prefix {
    flex-shrink: 0;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa5b5;
    font-size: 14px;
    pointer-events: none;
}

.login-field input {
    display: block;
    flex: 1;
    min-width: 0;
    width: 0;
    padding: 12px 14px 12px 0;
    font-size: 15px;
    font-family: inherit;
    border: none;
    border-radius: 0 8px 8px 0;
    outline: none;
    background: transparent;
    color: var(--sm-text, #1c2b30);
    box-shadow: none;
}

.login-field input:focus {
    outline: none;
    box-shadow: none;
}

.login-field.login-field--password input {
    padding-right: 0;
    border-radius: 0;
}

.password-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 4px;
    cursor: pointer;
    color: #9aa5b5;
    font-size: 15px;
    background: none;
    border: 0;
    padding: 0;
    line-height: 1;
}

.password-toggle:hover { color: var(--brand-700); }

/* Identidade lembrada ("Lembrar-me neste dispositivo"): apelido + avatar + identificador
   mascarado, com a tela pedindo somente a senha. O rastro não autentica — ver
   Semed\Core\Support\RememberedIdentity. */
.login-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin: 0 0 6px;
    border: 1px solid #e6e8ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.login-identity__avatar {
    flex-shrink: 0;
    display: block;
    width: 48px;
    height: 48px;
}

.login-identity__avatar .login-identity__img,
.login-identity__avatar .pm-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-identity__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.login-identity__name {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--sm-text, #1c2b30);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.login-identity__id {
    font-size: 12.5px;
    color: var(--sm-text-soft, #566268);
    overflow-wrap: anywhere;
}

.login-page--remembered .login-card label.field-label:first-of-type {
    margin-top: 16px;
}

.login-forget-identity {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    margin: 14px 0 0;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-800, #0b5c6b);
    text-decoration: none;
    background: transparent;
    border: 1px solid #c5d3da;
    border-radius: 8px;
    box-sizing: border-box;
    transition: background .15s ease, border-color .15s ease;
}

.login-forget-identity:hover,
.login-forget-identity:focus {
    background: #e7eef1;
    color: var(--brand-800, #0b5c6b);
    border-color: #8ea3ad;
    text-decoration: none;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--sm-text-soft, #566268);
    cursor: pointer;
    user-select: none;
}

.login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand-600, #0f9cb3);
    cursor: pointer;
    flex-shrink: 0;
}

.btn-login-submit {
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    margin-top: 18px;
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    background: var(--brand-600, #0f9cb3);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background .15s, box-shadow .15s;
}

.btn-login-submit:hover {
    background: var(--brand-700, #0b7f92);
    box-shadow: 0 8px 18px rgba(11, 127, 146, .28);
}

html[data-theme] a.btn-login-submit,
html[data-theme] a.btn-login-submit:hover,
html[data-theme] a.btn-login-submit:focus {
    color: #fff;
    text-decoration: none;
    box-sizing: border-box;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fdeeee;
    border: 1px solid #f3c8c8;
    color: #b3362f;
    font-size: 13.5px;
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
    color: var(--sm-text-soft, #566268);
    font-size: 12.5px;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--sm-border, #dbe7ea);
}

.login-secondary-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.login-role-shortcuts {
    gap: 8px;
    flex-wrap: nowrap;
}

.login-role-shortcuts .btn-login-secondary {
    min-width: 0;
    flex: 1 1 0;
    flex-direction: column;
    gap: 4px;
    padding: 10px 4px;
    font-size: 12px;
    line-height: 1.2;
}

.login-role-shortcuts .btn-login-secondary i {
    font-size: 14px;
}

.login-role-shortcuts .btn-login-secondary span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .login-role-shortcuts {
        flex-direction: column;
        flex-wrap: wrap;
    }

    .login-role-shortcuts .btn-login-secondary {
        flex: 1 1 auto;
        flex-direction: row;
        min-height: 44px;
        padding: 12px;
        font-size: 13.5px;
        gap: 8px;
    }

    .login-role-shortcuts .btn-login-secondary span {
        overflow: visible;
        text-overflow: clip;
    }
}

.btn-login-secondary[aria-current="page"] {
    background: color-mix(in srgb, var(--brand-500) 18%, #fff);
    border-color: color-mix(in srgb, var(--brand-500) 45%, #fff);
    color: var(--brand-900);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 25%, transparent);
}

.btn-login-secondary {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    line-height: 1.3;
    transition: all .15s;
    border: 1.5px solid transparent;
    cursor: pointer;
}

.btn-login-secondary--cyan {
    background: color-mix(in srgb, var(--brand-500) 12%, #fff);
    border-color: color-mix(in srgb, var(--brand-500) 30%, #fff);
    color: var(--brand-800);
}

.btn-login-secondary--cyan:hover {
    background: color-mix(in srgb, var(--brand-500) 20%, #fff);
    color: var(--brand-900);
    text-decoration: none;
}

.btn-login-secondary--ghost {
    background: var(--sm-surface, #fff);
    border-color: var(--sm-border, #dbe7ea);
    color: var(--sm-text-soft, #566268);
}

.btn-login-secondary--ghost:hover {
    background: var(--sm-surface-2, #f4f8f9);
    color: var(--sm-text, #1c2b30);
    text-decoration: none;
}

.login-info {
    /* bloco de fluxo (não flex): ícone + texto + link ficam no mesmo parágrafo
       e o telefone não vira coluna estreita à direita */
    display: block;
    background: color-mix(in srgb, var(--brand-500) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--brand-500) 28%, #fff);
    color: var(--brand-900, #0b5c6b);
    font-size: 13.5px;
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    line-height: 1.5;
}

.login-info::after {
    content: "";
    display: table;
    clear: both;
}

.login-info > i:first-child {
    float: left;
    margin: 2px 10px 0 0;
}

.login-info a {
    white-space: nowrap;
}

/* Formulários públicos largos (solicitações) */
.login-page--wide .login-split {
    grid-template-columns: minmax(280px, 34%) 1fr;
}

.login-page--wide .login-card {
    max-width: 920px;
    padding: 32px 28px;
}

/* Totens / controle de acesso / painéis densos */
.login-page--panel .login-split {
    grid-template-columns: minmax(240px, 28%) 1fr;
}

.login-page--panel .login-form-panel {
    place-items: start center;
    padding: 24px 16px 40px;
}

.login-page--panel .login-card {
    max-width: 1100px;
    padding: 28px 24px;
}

.login-page--wide .login-card .form-control,
.login-page--panel .login-card .form-control {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--sm-text, #1c2b30);
    background: var(--sm-surface, #fff);
    border: 1.5px solid var(--sm-border, #dbe7ea);
    border-radius: 10px;
    box-shadow: none;
}

.login-page--wide .login-card .form-control:focus,
.login-page--panel .login-card .form-control:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(18, 175, 200, .18);
}

.login-page--wide .login-card label,
.login-page--panel .login-card label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-text, #1c2b30);
}

.login-page--wide .login-card .btn,
.login-page--panel .login-card .btn {
    border-radius: 10px;
    font-weight: 600;
    min-height: 44px;
}

.login-page--wide .login-card .btn-primary,
.login-page--panel .login-card .btn-primary,
.login-page--wide .login-card .btn-success,
.login-page--panel .login-card .btn-success {
    background: var(--pm-gradient-primary, linear-gradient(135deg, var(--brand-600), var(--brand-500)));
    border-color: transparent;
}

.login-public-clock {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--brand-700, #0f6b7a);
    font-variant-numeric: tabular-nums;
}

.login-public-kicker {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sm-text, #1c2b30);
}

.login-public-meta {
    margin: 0 0 18px;
    font-size: .95rem;
    color: var(--sm-text-soft, #566268);
}

@media (max-width: 860px) {
    .login-split { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-form-panel {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 32px 20px 36px;
    }
    .login-mobile-brand {
        display: flex;
        width: min(420px, 100%);
        margin: 0;
        justify-content: flex-start;
    }
    .login-card,
    .login-page--default .login-card {
        width: min(420px, 100%);
        max-width: 420px;
        margin: 22px 0 0;
    }
    .login-page--wide .login-split,
    .login-page--panel .login-split {
        grid-template-columns: 1fr;
    }
    .login-page--wide .login-card,
    .login-page--panel .login-card {
        width: min(100% - 32px, 920px);
        max-width: 920px;
    }
}

@media (max-width: 575px) {
    .login-identity {
        gap: 12px;
        padding: 11px 12px;
    }

    .login-identity__avatar,
    .login-identity__avatar .login-identity__img,
    .login-identity__avatar .pm-avatar-placeholder {
        width: 42px;
        height: 42px;
    }

    .login-identity__name { font-size: 14.5px; }
}

/* Dark mode */
html[data-theme="dark"] .login-form-panel {
    background: var(--sm-bg);
}

html[data-theme="dark"] .login-card {
    background: var(--sm-surface);
    border-color: var(--sm-border);
    box-shadow: var(--sm-shadow);
}

html[data-theme="dark"] .login-page--default .login-card {
    background: transparent;
    border: none;
    box-shadow: none;
}

html[data-theme="dark"] .login-card h2,
html[data-theme="dark"] .login-card label.field-label {
    color: var(--sm-text);
}

html[data-theme="dark"] .sm-theme-switch-locked-hint {
    color: var(--sm-text-soft, #9bb4b8);
}

html[data-theme="dark"] .login-hint,
html[data-theme="dark"] .login-help-note,
html[data-theme="dark"] .login-remember,
html[data-theme="dark"] .login-divider {
    color: var(--sm-text-soft);
}

html[data-theme="dark"] .login-field {
    background: var(--sm-surface-2);
    border-color: var(--sm-border);
}

html[data-theme="dark"] .login-field input {
    background: transparent;
    color: var(--sm-text);
}

html[data-theme="dark"] .login-field__prefix,
html[data-theme="dark"] .password-toggle {
    color: var(--sm-text-soft);
}

html[data-theme="dark"] .login-error {
    background: rgba(220, 38, 38, .12);
    border-color: rgba(220, 38, 38, .28);
    color: #fca5a5;
}

html[data-theme="dark"] .btn-login-secondary--cyan {
    background: rgba(18, 175, 200, .12);
    border-color: rgba(18, 175, 200, .28);
    color: var(--brand-300);
}

html[data-theme="dark"] .btn-login-secondary[aria-current="page"] {
    background: rgba(18, 175, 200, .22);
    border-color: rgba(18, 175, 200, .45);
    color: var(--brand-200, #9ee7f0);
    box-shadow: none;
}

html[data-theme="dark"] .btn-login-secondary--ghost {
    background: var(--sm-surface-2);
    border-color: var(--sm-border);
    color: var(--sm-text-soft);
}

html[data-theme="dark"] .btn-login-secondary--ghost:hover {
    background: var(--sm-surface);
    color: var(--sm-text);
}

html[data-theme="dark"] .login-divider::before,
html[data-theme="dark"] .login-divider::after {
    background: var(--sm-border);
}

html[data-theme="dark"] .login-info {
    background: rgba(18, 175, 200, .12);
    border-color: rgba(18, 175, 200, .28);
    color: var(--brand-300);
}

html[data-theme="dark"] .login-identity {
    background: rgba(18, 175, 200, .10);
    border-color: var(--sm-border);
}

html[data-theme="dark"] .login-identity__name {
    color: var(--sm-text);
}

html[data-theme="dark"] .login-identity__id {
    color: var(--sm-text-soft);
}

html[data-theme="dark"] .login-forget-identity {
    color: var(--brand-300);
    background: transparent;
    border-color: currentColor;
}

html[data-theme="dark"] .login-forget-identity:hover,
html[data-theme="dark"] .login-forget-identity:focus {
    background: transparent;
    color: var(--brand-300);
    border-color: currentColor;
}

/* Autopreenchimento do navegador — mantém cores do tema nos inputs */
.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus,
.login-field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--sm-surface, #fff) inset !important;
    box-shadow: 0 0 0 1000px var(--sm-surface, #fff) inset !important;
    -webkit-text-fill-color: var(--sm-text, #1c2b30) !important;
    caret-color: var(--sm-text, #1c2b30);
    border-radius: 0 8px 8px 0;
    transition: background-color 99999s ease-in-out 0s;
}

html[data-theme="dark"] .login-field input:-webkit-autofill,
html[data-theme="dark"] .login-field input:-webkit-autofill:hover,
html[data-theme="dark"] .login-field input:-webkit-autofill:focus,
html[data-theme="dark"] .login-field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--sm-surface-2) inset !important;
    box-shadow: 0 0 0 1000px var(--sm-surface-2) inset !important;
    -webkit-text-fill-color: var(--sm-text) !important;
    caret-color: var(--sm-text);
    border-radius: 0 8px 8px 0;
}

.login-field.login-field--password input:-webkit-autofill,
.login-field.login-field--password input:-webkit-autofill:hover,
.login-field.login-field--password input:-webkit-autofill:focus,
.login-field.login-field--password input:-webkit-autofill:active,
html[data-theme="dark"] .login-field.login-field--password input:-webkit-autofill,
html[data-theme="dark"] .login-field.login-field--password input:-webkit-autofill:hover,
html[data-theme="dark"] .login-field.login-field--password input:-webkit-autofill:focus,
html[data-theme="dark"] .login-field.login-field--password input:-webkit-autofill:active {
    border-radius: 0;
}
