/* Shared auth layout for admin login + 2FA (Carto brand, administration focus) */

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

body.admin-auth-page {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #25224C;
    background: #EEF2F8 url('/static/fondo.png') center center / cover no-repeat fixed;
}

.admin-auth-overlay {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(
        135deg,
        rgba(238, 242, 248, 0.92) 0%,
        rgba(224, 234, 248, 0.88) 50%,
        rgba(236, 240, 250, 0.92) 100%
    );
}

.admin-auth-shell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.admin-auth-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(320px, 420px);
    gap: 48px;
    align-items: center;
    max-width: 960px;
    width: 100%;
}

.admin-auth-brand {
    padding: 8px 12px;
}

.admin-auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.admin-auth-logo img,
.admin-auth-logo-mark {
    width: 52px;
    height: 52px;
    object-fit: contain;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
    image-rendering: -webkit-optimize-contrast;
}

html[data-theme="dark"] .admin-auth-logo-mark {
    filter: drop-shadow(0 2px 8px rgba(12, 127, 224, 0.25));
}

.admin-auth-logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.admin-auth-logo-text .lucerum {
    color: #25224C;
}

.admin-auth-logo-text .carto {
    color: #0C7FE0;
}

.admin-auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(12, 127, 224, 0.1);
    border: 1px solid rgba(12, 127, 224, 0.22);
    color: #0B5FA8;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.admin-auth-kicker svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.admin-auth-headline {
    font-size: clamp(1.65rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    color: #25224C;
    margin-bottom: 14px;
}

.admin-auth-tagline {
    font-size: 1rem;
    line-height: 1.6;
    color: #5C5975;
    max-width: 34ch;
    margin-bottom: 24px;
}

.admin-auth-points {
    list-style: none;
    display: grid;
    gap: 10px;
}

.admin-auth-points li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.92rem;
    color: #4A4768;
    line-height: 1.45;
}

.admin-auth-points li::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0C7FE0, #10C4D3);
    flex-shrink: 0;
}

.admin-auth-card {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow:
        0 18px 48px rgba(37, 34, 76, 0.12),
        0 0 0 1px rgba(12, 127, 224, 0.08);
    padding: 32px 32px 28px;
    width: 100%;
}

.admin-auth-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #25224C;
    margin-bottom: 6px;
}

.admin-auth-card-subtitle {
    font-size: 0.9rem;
    color: #7A7792;
    margin-bottom: 24px;
    line-height: 1.5;
}

.admin-auth-alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
    margin-bottom: 16px;
    line-height: 1.45;
}

.admin-auth-alert-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.admin-auth-alert-info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

.admin-auth-field {
    margin-bottom: 16px;
}

.admin-auth-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #5C5975;
    margin-bottom: 6px;
}

.admin-auth-input-wrap {
    position: relative;
}

.admin-auth-input {
    width: 100%;
    border: 1.5px solid #D8DCE8;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #25224C;
    background: #FAFBFD;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-auth-input:focus {
    outline: none;
    border-color: #0C7FE0;
    box-shadow: 0 0 0 3px rgba(12, 127, 224, 0.15);
    background: #FFFFFF;
}

.admin-auth-input.has-toggle {
    padding-right: 44px;
}

.admin-auth-toggle-password {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #9290A5;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
}

.admin-auth-toggle-password:hover {
    color: #0C7FE0;
}

.admin-auth-submit {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 13px 16px;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    cursor: pointer;
    background: linear-gradient(135deg, #0C7FE0 0%, #10C4D3 100%);
    box-shadow: 0 8px 20px rgba(12, 127, 224, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.admin-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(12, 127, 224, 0.34);
}

.admin-auth-submit:active {
    transform: translateY(0);
}

.admin-auth-secondary {
    display: inline-block;
    margin-top: 18px;
    font-size: 0.88rem;
    color: #0C7FE0;
    text-decoration: none;
}

.admin-auth-secondary:hover {
    text-decoration: underline;
}

.admin-auth-footer {
    text-align: center;
    padding: 16px 20px 24px;
    font-size: 0.78rem;
    color: #9290A5;
}

.admin-auth-footer a {
    color: #0C7FE0;
    text-decoration: none;
}

.admin-auth-footer a:hover {
    text-decoration: underline;
}

.admin-auth-code-input {
    letter-spacing: 0.35em;
    font-size: 1.45rem;
    text-align: center;
    font-weight: 600;
}

.admin-auth-actions-stack {
    display: grid;
    gap: 10px;
}

.admin-auth-btn-outline {
    width: 100%;
    border: 1.5px solid #D8DCE8;
    border-radius: 12px;
    padding: 10px 14px;
    background: #FFFFFF;
    color: #4A4768;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.admin-auth-btn-outline:hover {
    border-color: #0C7FE0;
    color: #0C7FE0;
}

/* API home (welcome) — same portal shell as admin auth */
.admin-auth-layout-home {
    max-width: 1040px;
    grid-template-columns: minmax(280px, 1fr) minmax(340px, 520px);
}

.api-home-card {
    padding: 28px 28px 24px;
}

.api-home-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #9290A5;
    margin-bottom: 12px;
}

.api-home-session {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #D8DCE8;
    background: #F8FAFD;
    margin-bottom: 22px;
}

.api-home-session-signed-in {
    border-color: rgba(12, 127, 224, 0.25);
    background: rgba(12, 127, 224, 0.06);
}

.api-home-session-guest {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
}

.api-home-session-text {
    font-size: 0.9rem;
    color: #4A4768;
    line-height: 1.45;
    margin: 0;
}

.api-home-session-text strong {
    color: #25224C;
}

.api-home-role {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.api-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.api-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.api-home-btn-primary {
    color: #FFFFFF;
    background: linear-gradient(135deg, #0C7FE0 0%, #10C4D3 100%);
    box-shadow: 0 6px 16px rgba(12, 127, 224, 0.25);
}

.api-home-btn-primary:hover {
    transform: translateY(-1px);
    color: #FFFFFF;
}

.api-home-btn-danger {
    color: #FFFFFF;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.api-home-btn-danger:hover {
    transform: translateY(-1px);
    color: #FFFFFF;
}

.api-home-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.api-home-links-single {
    grid-template-columns: 1fr;
}

.api-home-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    border: 1.5px solid #E2E8F0;
    background: #FAFBFD;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.api-home-link:hover {
    border-color: #0C7FE0;
    box-shadow: 0 8px 20px rgba(12, 127, 224, 0.12);
    transform: translateY(-1px);
    color: inherit;
}

.api-home-link-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 127, 224, 0.1);
    color: #0C7FE0;
    flex-shrink: 0;
}

.api-home-link-icon i {
    font-size: 1.05rem;
    line-height: 1;
}

.api-home-link-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.api-home-link-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #25224C;
    margin-bottom: 2px;
}

.api-home-link-desc {
    font-size: 0.8rem;
    color: #7A7792;
    line-height: 1.4;
}

.api-home-link-arrow {
    display: flex;
    align-items: center;
    color: #0C7FE0;
    flex-shrink: 0;
}

.api-home-link-arrow i {
    font-size: 0.95rem;
    line-height: 1;
}

.api-home-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.25);
    color: #15803d;
    font-size: 0.82rem;
    font-weight: 700;
}

.api-home-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22C55E;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.api-home-brand-footer {
    margin-top: 28px;
}

@media (max-width: 860px) {
    .admin-auth-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        max-width: 440px;
    }

    .admin-auth-brand {
        text-align: center;
    }

    .admin-auth-logo,
    .admin-auth-kicker {
        justify-content: center;
    }

    .admin-auth-tagline,
    .admin-auth-points {
        margin-left: auto;
        margin-right: auto;
    }

    .admin-auth-points {
        max-width: 360px;
        text-align: left;
    }

    .admin-auth-layout-home {
        max-width: 440px;
    }

    .api-home-links {
        grid-template-columns: 1fr;
    }
}

html[data-theme="dark"] body.admin-auth-page {
    color: #E8E6FF;
}

html[data-theme="dark"] .admin-auth-overlay {
    background: linear-gradient(
        135deg,
        rgba(11, 11, 26, 0.94) 0%,
        rgba(18, 18, 40, 0.92) 100%
    );
}

html[data-theme="dark"] .admin-auth-logo-text .lucerum,
html[data-theme="dark"] .admin-auth-headline,
html[data-theme="dark"] .admin-auth-card-title {
    color: #FFFFFF;
}

html[data-theme="dark"] .admin-auth-tagline,
html[data-theme="dark"] .admin-auth-points li,
html[data-theme="dark"] .admin-auth-card-subtitle {
    color: #B4B2C8;
}

html[data-theme="dark"] .admin-auth-card {
    background: #1A1A2E;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .admin-auth-input {
    background: #23204A;
    border-color: #3D3A66;
    color: #E8E6FF;
}

html[data-theme="dark"] .admin-auth-input:focus {
    background: #23204A;
}

html[data-theme="dark"] .admin-auth-btn-outline {
    background: #23204A;
    border-color: #3D3A66;
    color: #B4B2C8;
}

html[data-theme="dark"] .admin-auth-kicker {
    background: rgba(12, 127, 224, 0.15);
    border-color: rgba(12, 127, 224, 0.35);
    color: #7EC8FF;
}

html[data-theme="dark"] .admin-auth-label {
    color: #B4B2C8;
}

html[data-theme="dark"] .admin-auth-footer {
    color: #9290A5;
}

html[data-theme="dark"] .api-home-session {
    background: #23204A;
    border-color: #3D3A66;
}

html[data-theme="dark"] .api-home-session-text,
html[data-theme="dark"] .api-home-link-title {
    color: #E8E6FF;
}

html[data-theme="dark"] .api-home-session-text strong {
    color: #FFFFFF;
}

html[data-theme="dark"] .api-home-link {
    background: #23204A;
    border-color: #3D3A66;
}

html[data-theme="dark"] .api-home-link-desc {
    color: #9290A5;
}

html[data-theme="dark"] .api-home-section-title {
    color: #9290A5;
}

html[data-theme="dark"] .portal-theme-toggle {
    background: rgba(26, 26, 46, 0.92);
    border-color: #3D3A66;
    color: #E8E6FF;
}

html[data-theme="dark"] .portal-theme-toggle:hover {
    border-color: #0C7FE0;
    color: #7EC8FF;
}

/* Theme toggle control */
.portal-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1.5px solid #D8DCE8;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    color: #4A4768;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 34, 76, 0.08);
    transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.portal-theme-toggle:hover {
    border-color: #0C7FE0;
    color: #0C7FE0;
    box-shadow: 0 6px 18px rgba(12, 127, 224, 0.15);
}

.portal-theme-toggle svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (max-width: 520px) {
    .portal-theme-toggle-label {
        display: none;
    }

    .portal-theme-toggle {
        padding: 10px;
        border-radius: 12px;
    }
}
