/* Login, registro y cambio de contraseña — responsive con modo oscuro */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --border-input: #d5dbe5;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --ring: rgba(37, 99, 235, 0.18);
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --ok: #15803d;
    --ok-soft: #f0fdf4;
    --ok-border: #bbf7d0;
    color-scheme: light;
}
/* Modo oscuro: por el sistema (si el usuario no ha elegido modo claro) o elegido con el botón (JS/tema.js) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1120;
        --surface: #111827;
        --border-input: #334155;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --primary: #3b82f6;
        --primary-hover: #2563eb;
        --ring: rgba(59, 130, 246, 0.35);
        --danger: #f87171;
        --danger-soft: rgba(248, 113, 113, 0.1);
        --danger-border: rgba(248, 113, 113, 0.3);
        --ok: #4ade80;
        --ok-soft: rgba(74, 222, 128, 0.1);
        --ok-border: rgba(74, 222, 128, 0.3);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #111827;
    --border-input: #334155;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --ring: rgba(59, 130, 246, 0.35);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.1);
    --danger-border: rgba(248, 113, 113, 0.3);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --ok-border: rgba(74, 222, 128, 0.3);
    color-scheme: dark;
}

/* Botón flotante de tema: luna en claro, sol en oscuro (solo con JS, que pone data-theme) */
button.btn-tema {
    position: fixed; top: 16px; right: 16px; z-index: 10;
    width: 42px; height: 42px; margin: 0; padding: 0;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--surface); color: var(--muted);
    border: 1px solid var(--border-input);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
button.btn-tema:hover { background: var(--surface); color: var(--primary); border-color: var(--primary); }
html:not([data-theme]) .btn-tema { display: none; }
.btn-tema .icono-sol { display: none; }
[data-theme="dark"] .btn-tema .icono-luna { display: none; }
[data-theme="dark"] .btn-tema .icono-sol { display: block; }

*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0; min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg); color: var(--text);
    display: grid; grid-template-columns: minmax(0, 1fr);
}

.icono { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Panel de marca (solo pantallas anchas) */
.marca {
    display: none;
    position: relative; overflow: hidden;
    padding: 56px;
    background: radial-gradient(circle at 20% 10%, #1e3a8a 0%, transparent 55%),
                radial-gradient(circle at 90% 90%, #0e7490 0%, transparent 50%),
                #0f172a;
    color: #e2e8f0;
    flex-direction: column; justify-content: space-between;
}
.marca-logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; color: #fff; text-decoration: none; }
.logo { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.02em; }
.logo-movil { text-decoration: none; }
.volver-inicio { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.volver-inicio:hover { color: var(--primary); }
.volver-inicio .icono { width: 16px; height: 16px; }
.rol { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; background: rgba(37, 99, 235, 0.1); color: var(--primary); margin-bottom: 20px; }
.rol .icono { width: 14px; height: 14px; }
.marca-logo .logo { width: 40px; height: 40px; border-radius: 12px; background: #2563eb; display: grid; place-items: center; }
.marca h2 { margin: 0 0 14px; font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -0.02em; color: #fff; }
.marca p { margin: 0; color: #94a3b8; max-width: 420px; line-height: 1.6; }
.marca ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.marca li { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; }
.marca li .icono { color: #60a5fa; }
.marca-pie { font-size: 0.8rem; color: #64748b; }

/* Formulario */
.contenedor { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.caja {
    width: 100%; max-width: 400px;
    background: var(--surface); border-radius: 18px;
    padding: clamp(24px, 5vw, 36px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.08);
}
.logo-movil { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-weight: 700; color: var(--primary); }
.logo-movil .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.logo-movil .icono { width: 18px; height: 18px; }

h1 { margin: 0 0 6px; font-size: 1.5rem; letter-spacing: -0.02em; }
.sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 24px; }

label { display: block; margin-bottom: 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
input {
    width: 100%; padding: 11px 13px; margin-bottom: 16px;
    border: 1px solid var(--border-input); border-radius: 10px;
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
select {
    width: 100%; padding: 11px 13px; margin-bottom: 6px;
    border: 1px solid var(--border-input); border-radius: 10px;
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 0.95rem;
}
.ayuda { margin: 0 0 16px; font-size: 0.78rem; color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

button {
    width: 100%; margin-top: 4px; padding: 12px;
    border: none; border-radius: 10px;
    background: var(--primary); color: #fff;
    font: inherit; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; transition: background 0.15s;
}
button:hover { background: var(--primary-hover); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.error, .exito { padding: 11px 13px; border-radius: 10px; font-size: 0.87rem; margin-bottom: 18px; border: 1px solid; }
.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.exito { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }

/* Etiqueta con enlace a la derecha ("¿Has olvidado tu contraseña?") */
.fila-etiqueta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fila-etiqueta label { margin-bottom: 0; }
.enlace-secundario { font-size: 0.8rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.enlace-secundario:hover { text-decoration: underline; }

/* Recuperación de contraseña: icono de estado, nota y botón-enlace */
.icono-grande { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 18px; }
.icono-grande .icono { width: 26px; height: 26px; }
.icono-grande.ok { background: var(--ok-soft); color: var(--ok); }
.icono-grande.error-icono { background: var(--danger-soft); color: var(--danger); }
.sub strong { color: var(--text); font-weight: 600; word-break: break-all; }
.nota-info { padding: 14px 16px; border-radius: 10px; background: var(--bg); font-size: 0.85rem; color: var(--muted); line-height: 1.55; }
.nota-info p { margin: 0; }
.nota-info p + p { margin-top: 8px; }
.nota-info a { color: var(--primary); font-weight: 600; }
.boton-enlace {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px;
    border-radius: 10px; background: var(--primary); color: #fff; font-weight: 600; font-size: 0.95rem; text-decoration: none;
}
.boton-enlace:hover { background: var(--primary-hover); }
.boton-enlace .icono { width: 18px; height: 18px; }

/* Mi cuenta: secciones y preferencias de avisos */
.titulo-seccion { font-size: 1rem; margin: 26px 0 14px; padding-top: 20px; border-top: 1px solid var(--border-input); }
.rol + .titulo-seccion { margin-top: 4px; padding-top: 0; border-top: 0; }
.casilla-aviso { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 12px; padding: 12px; border: 1px solid var(--border-input); border-radius: 10px; cursor: pointer; }
.casilla-aviso input { width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--primary); }
.casilla-aviso span { display: flex; flex-direction: column; gap: 2px; }
.casilla-aviso strong { font-size: 0.9rem; color: var(--text); }
.casilla-aviso small { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.preferencias .ayuda { margin: 4px 0 12px; }

.pie { text-align: center; font-size: 0.87rem; margin: 22px 0 0; color: var(--muted); }
.pie a { color: var(--primary); font-weight: 600; text-decoration: none; }
.pie a:hover { text-decoration: underline; }

@media (min-width: 960px) {
    body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .marca { display: flex; }
    .logo-movil { display: none; }
}
