:root {
    --bg-body: #09090b;
    --bg-card: #18181b;
    --bg-card-soft: #202024;
    --accent: #c48c53;
    --accent-hover: #a87644;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --border: rgba(255, 255, 255, 0.08);
    --danger: #ef6464;
    --warning: #e3a857;
    --success: #61c995;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(
            circle at 50% -20%,
            rgba(196, 140, 83, 0.12),
            transparent 60%
        );
    color: var(--text-main);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input,
select {
    font: inherit;
}

.tarjeta-principal {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background-color: var(--bg-card);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(196, 140, 83, 0.04);
    text-align: center;
}

.tarjeta-titulo {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tarjeta-subtitulo {
    margin: 0.5rem 0 2.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.contenedor-botones {
    display: flex;
    gap: 1rem;
}

.btn-caramelo {
    flex: 1;
    padding: 1rem;
    border: 0;
    border-radius: 8px;
    background-color: var(--accent);
    color: var(--bg-body);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    text-decoration: none;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

a.btn-caramelo:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 15px rgba(196, 140, 83, 0.3);
    transform: translateY(-2px);
}

.btn-deshabilitado {
    cursor: not-allowed;
    filter: grayscale(0.6);
    opacity: 0.35;
}
.tarjeta-modulos {
    max-width: 560px;
    text-align: left;
}

.marca-principal {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.marca-principal .tarjeta-subtitulo {
    margin-bottom: 0;
}

.marca-indicador {
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    margin-top: 0.65rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 18px rgba(196, 140, 83, 0.65);
}

.contenedor-modulos {
    display: grid;
    gap: 0.8rem;
}

.modulo-acceso {
    min-height: 82px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(9, 9, 11, 0.38);
    color: var(--text-main);
    text-decoration: none;
    transition:
        border-color 0.18s ease,
        background-color 0.18s ease,
        transform 0.18s ease;
}

a.modulo-acceso:hover {
    border-color: rgba(196, 140, 83, 0.45);
    background: rgba(196, 140, 83, 0.07);
    transform: translateY(-2px);
}

.modulo-icono {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(196, 140, 83, 0.22);
    border-radius: 11px;
    background: rgba(196, 140, 83, 0.07);
    color: var(--accent);
}

.modulo-icono svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.modulo-contenido {
    min-width: 0;
    display: grid;
    gap: 0.25rem;
}

.modulo-contenido strong {
    font-size: 0.95rem;
}

.modulo-contenido small {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.modulo-flecha {
    color: var(--accent);
    font-size: 1.15rem;
}

.modulo-deshabilitado {
    cursor: not-allowed;
    opacity: 0.42;
}

.modulo-proximamente {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.volver-inicio {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.4rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 1.3rem;
    text-decoration: none;
    transition:
        border-color 0.18s ease,
        color 0.18s ease;
}

.volver-inicio:hover {
    border-color: rgba(196, 140, 83, 0.45);
    color: var(--accent);
}

@media (max-width: 560px) {
    .modulo-acceso {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .modulo-flecha,
    .modulo-proximamente {
        display: none;
    }

    .contenedor-botones {
        flex-direction: column;
    }
}

/* =========================================================
   AJUSTE VISUAL FINAL DE FORMULARIOS OPERATIVOS
   ========================================================= */

.cabecera-operativa {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.4rem;
}

.cabecera-operativa-titulo {
    min-width: 0;
}

.cabecera-operativa h1 {
    margin: 0.2rem 0 0;
    font-size: clamp(1.55rem, 3vw, 2rem);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.btn-volver,
.candado-admin {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    background:
        linear-gradient(
            145deg,
            rgba(29, 29, 33, 0.95),
            rgba(17, 17, 20, 0.95)
        );
    color: var(--text-muted);
    text-decoration: none;
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);
    transition:
        color 0.18s ease,
        border-color 0.18s ease,
        background-color 0.18s ease,
        transform 0.18s ease;
}

.btn-volver:hover,
.candado-admin:hover {
    border-color: rgba(196, 140, 83, 0.48);
    color: var(--accent);
    transform: translateY(-1px);
}

.btn-volver svg,
.candado-admin svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.panel-operativo {
    padding: clamp(1.5rem, 4vw, 2.2rem);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 17px;
    background:
        linear-gradient(
            145deg,
            rgba(25, 25, 29, 0.98),
            rgba(20, 20, 23, 0.98)
        );
    box-shadow:
        0 30px 75px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

fieldset {
    min-width: 0;
    margin: 0 0 1.6rem;
    padding: 0;
    border: 0;
}

legend {
    width: 100%;
    margin-bottom: 1.15rem;
    padding: 0 0 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
    color: #f4f4f5;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.095em;
    text-transform: uppercase;
}

.campo label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #e4e4e7;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.015em;
}

.campo label span {
    color: #71717a;
    font-size: 0.68rem;
    font-weight: 500;
}

.campo input,
.campo select,
.input-escaner {
    width: 100%;
    min-height: 52px;
    padding: 0 1rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    outline: none;
    background:
        linear-gradient(
            180deg,
            rgba(13, 13, 16, 0.97),
            rgba(10, 10, 12, 0.97)
        );
    color: #fafafa;
    font-size: 0.92rem;
    font-weight: 550;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.018),
        0 8px 20px rgba(0, 0, 0, 0.12);
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.campo input:hover,
.campo select:hover,
.input-escaner:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

.campo input:focus,
.campo select:focus,
.input-escaner:focus {
    border-color: rgba(196, 140, 83, 0.85);
    background: #0d0d0f;
    box-shadow:
        0 0 0 3px rgba(196, 140, 83, 0.11),
        0 10px 25px rgba(0, 0, 0, 0.18);
}

.campo input::placeholder,
.input-escaner::placeholder {
    color: #606068;
    font-weight: 450;
}

.campo select {
    cursor: pointer;
    color-scheme: dark;
}

.campo select option {
    background: #18181b;
    color: #ffffff;
}

.campo input:-webkit-autofill,
.campo input:-webkit-autofill:hover,
.campo input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    box-shadow: 0 0 0 1000px #0d0d0f inset;
    transition: background-color 9999s ease-out;
}

.form-egreso {
    width: min(100%, 520px);
    margin: 0 auto;
}

.form-egreso .campo input {
    min-height: 58px;
    padding: 0 1.1rem;
    font-size: 1.12rem;
    font-weight: 650;
    letter-spacing: 0.055em;
    text-align: center;
}

.instruccion-egreso {
    max-width: 480px;
    margin: 0 auto 1.5rem;
    color: #a1a1aa;
    font-size: 0.83rem;
    line-height: 1.6;
    text-align: center;
}

.acciones-formulario {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 0.4rem;
}

.btn-registrar {
    min-height: 54px;
    flex: 1;
    max-width: none;
    padding: 0 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    background:
        linear-gradient(
            180deg,
            #d09a60,
            var(--accent)
        );
    color: #111114;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    box-shadow:
        0 12px 26px rgba(196, 140, 83, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition:
        background-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease,
        opacity 0.18s ease;
}

.btn-registrar:hover:not(:disabled) {
    background:
        linear-gradient(
            180deg,
            #d7a36c,
            #b98049
        );
    box-shadow:
        0 15px 32px rgba(196, 140, 83, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.btn-registrar:active:not(:disabled) {
    transform: translateY(0);
}

.btn-registrar:disabled {
    cursor: wait;
    opacity: 0.6;
}

.zona-escaner {
    margin-bottom: 1.8rem;
    padding: 1.25rem;
    border: 1px solid rgba(196, 140, 83, 0.22);
    border-radius: 13px;
    background:
        linear-gradient(
            140deg,
            rgba(196, 140, 83, 0.075),
            rgba(9, 9, 11, 0.22)
        );
}

.escaner-controles {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-secundario {
    min-height: 52px;
    padding: 0 1.2rem;
    border: 1px solid rgba(196, 140, 83, 0.32);
    border-radius: 10px;
    background: rgba(196, 140, 83, 0.06);
    color: var(--accent);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease;
}

.btn-secundario:hover {
    border-color: rgba(196, 140, 83, 0.62);
    background: rgba(196, 140, 83, 0.12);
}

.campo-error {
    margin: 0.5rem 0 0;
    color: #ff8f8f;
    font-size: 0.75rem;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .cabecera-operativa {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        gap: 0.7rem;
    }

    .btn-volver,
    .candado-admin {
        width: 42px;
        height: 42px;
    }

    .panel-operativo {
        padding: 1.25rem;
    }

    .grilla-formulario,
    .grilla-ingreso,
    .escaner-controles {
        grid-template-columns: 1fr;
    }

    .acciones-formulario {
        flex-direction: column-reverse;
    }
}
.conexion-overlay[hidden] {
    display: none !important;
}

.conexion-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(
            circle at 50% 30%,
            rgba(196, 140, 83, 0.08),
            transparent 45%
        ),
        rgba(5, 5, 7, 0.94);
    backdrop-filter: blur(10px);
}

.conexion-card {
    width: min(100%, 460px);
    padding: 2.2rem;
    border: 1px solid rgba(196, 140, 83, 0.28);
    border-radius: 17px;
    background:
        linear-gradient(
            145deg,
            rgba(28, 28, 32, 0.99),
            rgba(17, 17, 20, 0.99)
        );
    box-shadow:
        0 35px 90px rgba(0, 0, 0, 0.7),
        0 0 55px rgba(196, 140, 83, 0.05);
    text-align: center;
}

.conexion-indicador {
    width: 13px;
    height: 13px;
    display: block;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #ef6464;
    box-shadow: 0 0 18px rgba(239, 100, 100, 0.7);
}

.conexion-etiqueta {
    margin: 0;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.conexion-card h2 {
    margin: 0.45rem 0 0.8rem;
    font-size: 1.45rem;
    letter-spacing: -0.025em;
}

.conexion-card > p:not(.conexion-etiqueta) {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.87rem;
    line-height: 1.6;
}

.conexion-reintentando {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    align-items: center;
    margin-top: 1.4rem;
    color: #d4d4d8;
    font-size: 0.78rem;
    font-weight: 650;
}

.conexion-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(196, 140, 83, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: conexion-girar 0.8s linear infinite;
}

.conexion-reintentar {
    min-height: 43px;
    margin-top: 1.3rem;
    padding: 0 1.2rem;
    border: 1px solid rgba(196, 140, 83, 0.35);
    border-radius: 8px;
    background: rgba(196, 140, 83, 0.08);
    color: var(--accent);
    cursor: pointer;
    font-weight: 750;
}

.conexion-reintentar:hover {
    border-color: var(--accent);
    background: rgba(196, 140, 83, 0.14);
}

@keyframes conexion-girar {
    to {
        transform: rotate(360deg);
    }
}