:root {
    --auth-bg-from: #eef2f9;
    --auth-bg-to: #dfe7f3;
    --auth-ink: #1b1f28;
    --auth-ink-soft: #5b6472;
    --auth-border: #e2e6ed;
    --auth-card: #ffffff;
    --auth-accent: #3558A2;
    --auth-accent-dark: #1D3F73;
    --auth-brand-orange: #E8762C;
    --auth-danger: #b00020;
    --auth-radius: 14px;
    --auth-shadow: 0 20px 45px -20px rgba(23, 33, 61, 0.35), 0 2px 8px rgba(23, 33, 61, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color: var(--auth-ink);
    background: linear-gradient(160deg, var(--auth-bg-from), var(--auth-bg-to));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* Pantalla de login: a pantalla completa, sin tarjeta flotando ni márgenes */
body.auth-fullbleed {
    padding: 0;
    height: 100vh;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
}

.auth-shell.auth-shell-wide {
    max-width: 960px;
}

body.auth-fullbleed .auth-shell.auth-shell-wide {
    max-width: none;
    height: 100vh;
}

.auth-card {
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: 40px 36px;
}

.auth-card.auth-card-wide { max-width: 560px; }

/* Pantalla de login: panel de acompañamiento (izq, grande) + panel de auth (der, ancho fijo) */
.auth-auth-grid {
    display: flex;
    height: 100%;
    background: var(--auth-card);
}

.auth-auth-visual {
    flex: 1;
    background: linear-gradient(160deg, #eef2fb, #dfe7f6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
    overflow: hidden;
}
.auth-auth-visual img { width: 100%; max-width: min(480px, 80%); height: auto; }
.auth-auth-visual .auth-visual-title {
    margin-top: 28px;
    font-size: 22px;
    font-weight: 600;
    color: var(--auth-accent-dark);
}
.auth-auth-visual .auth-visual-sub {
    margin-top: 8px;
    font-size: 14.5px;
    color: var(--auth-ink-soft);
    max-width: 360px;
    line-height: 1.6;
}

.auth-auth-panel {
    flex: 0 0 440px;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--auth-border);
    box-shadow: var(--auth-shadow);
}

.auth-panel-logo {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 32px;
}

@media (max-width: 900px) {
    .auth-auth-grid { flex-direction: column; height: auto; min-height: 100vh; }
    .auth-auth-visual { flex: none; padding: 40px 24px 32px; }
    .auth-auth-visual img { max-width: 220px; }
    .auth-auth-panel { flex: none; padding: 32px 28px 48px; border-left: none; box-shadow: none; }
}

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

.auth-brand .auth-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: block;
}

.auth-brand .auth-brand-text .auth-title { font-size: 16px; font-weight: 600; line-height: 1.2; color: var(--auth-accent-dark); }
.auth-brand .auth-brand-text .auth-subtitle { font-size: 12.5px; color: var(--auth-ink-soft); }

h1.auth-h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px;
}

p.auth-lead {
    font-size: 14px;
    color: var(--auth-ink-soft);
    line-height: 1.5;
    margin: 0 0 28px;
}

/* Botón oficial "Sign in with Microsoft" (guía de marca: fondo blanco, borde gris, logo de 4 cuadrados) */
.auth-ms-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 0;
    height: 44px;
    background: #ffffff;
    border: 1px solid #8c8c8c;
    border-radius: 4px;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #5e5e5e;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}
.auth-ms-btn:hover { background: #f6f6f6; }
.auth-ms-btn:active { background: #eeeeee; }
.auth-ms-btn svg { flex-shrink: 0; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--auth-ink-soft);
    font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-footnote {
    margin-top: 24px;
    font-size: 12px;
    color: var(--auth-ink-soft);
    text-align: center;
    line-height: 1.5;
}

/* Perfil (post-login) */
.auth-profile {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--auth-border);
}
.auth-profile img.auth-avatar,
.auth-profile .auth-avatar-fallback {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.auth-profile .auth-avatar-fallback {
    background: linear-gradient(135deg, var(--auth-accent), #6c9ff0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 22px;
}
.auth-profile .auth-name { font-size: 17px; font-weight: 600; }
.auth-profile .auth-meta { font-size: 13px; color: var(--auth-ink-soft); margin-top: 2px; }

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #147a41;
    background: #e5f6ec;
    border-radius: 20px;
    padding: 3px 10px;
    margin-top: 8px;
}
.auth-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #1ba854; }

.auth-actions { display: flex; flex-direction: column; gap: 10px; }

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
}
.auth-btn-primary { background: var(--auth-accent); color: #fff; }
.auth-btn-primary:hover { background: var(--auth-accent-dark); }
.auth-btn-outline { background: #fff; color: var(--auth-ink); border-color: var(--auth-border); }
.auth-btn-outline:hover { background: #f5f6f8; }

details.auth-raw { margin-top: 18px; }
details.auth-raw summary { cursor: pointer; font-size: 12.5px; color: var(--auth-ink-soft); }
details.auth-raw pre {
    background: #f7f8fa;
    border: 1px solid var(--auth-border);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin-top: 10px;
}

.auth-back {
    display: inline-block;
    font-size: 13px;
    color: var(--auth-ink-soft);
    text-decoration: none;
    margin-bottom: 18px;
}
.auth-back:hover { color: var(--auth-ink); }

label.auth-label { display: block; font-size: 13px; font-weight: 600; margin-top: 16px; margin-bottom: 6px; }
input.auth-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--auth-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
input.auth-input:focus { outline: 2px solid #bcd2f7; border-color: var(--auth-accent); }

.auth-checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: normal;
    margin-top: 18px;
}
.auth-checkline input { width: auto; }

.auth-error {
    background: #fdecec;
    border: 1px solid #f5c2c2;
    color: var(--auth-danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 18px;
}

.auth-success {
    background: #e9f7ef;
    border: 1px solid #b9e6c9;
    color: #146c33;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 18px;
}
