/* =========================================================
   PosVentas · hoja de estilos
   Tokens → base → layout → componentes → módulos → utilidades
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
    --pv-fondo: #f3f5f9;
    --pv-superficie: #ffffff;
    --pv-superficie-2: #f8fafc;
    --pv-texto: #172033;
    --pv-texto-secundario: #5b6474;
    --pv-texto-tenue: #8a93a3;
    --pv-borde: #e2e6ee;
    --pv-borde-fuerte: #cdd3de;

    --pv-primario: #2456d3;
    --pv-primario-hover: #1c47b3;
    --pv-primario-suave: #e8eefc;
    --pv-primario-texto: #1a3f9c;

    --pv-exito: #1f7a3a;
    --pv-exito-suave: #e6f4ea;
    --pv-alerta: #8a5300;
    --pv-alerta-suave: #fdf3df;
    --pv-error: #b42318;
    --pv-error-suave: #fdecea;

    --pv-lateral: #0f1729;
    --pv-lateral-texto: #aab4c8;
    --pv-lateral-activo: #1e2a45;

    --pv-radio: 10px;
    --pv-radio-chico: 7px;
    --pv-sombra: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
    --pv-sombra-alta: 0 20px 45px rgba(16, 24, 40, 0.22);
    --pv-foco: 0 0 0 3px rgba(36, 86, 211, 0.22);
    --pv-ancho-lateral: 248px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--pv-fondo);
    color: var(--pv-texto);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; color: var(--pv-texto); }
h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 1rem; }
h1:focus { outline: none; } /* Blazor enfoca el título al navegar */
h2 { font-size: 1.1rem; font-weight: 650; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
small { color: var(--pv-texto-secundario); }

a { color: var(--pv-primario); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

/* Campos: estilo uniforme para todo input, select y textarea */
input:not([type=checkbox]):not([type=radio]):not([type=range]),
select,
textarea {
    font: inherit;
    color: var(--pv-texto);
    background: var(--pv-superficie);
    border: 1px solid var(--pv-borde-fuerte);
    border-radius: var(--pv-radio-chico);
    padding: 0.5rem 0.7rem;
    min-height: 40px;
    max-width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
select {
    appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6474' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pv-primario);
    box-shadow: var(--pv-foco);
}
input:disabled, select:disabled, textarea:disabled { background: var(--pv-superficie-2); color: var(--pv-texto-tenue); }
input[type=checkbox], input[type=radio] { width: 1.05rem; height: 1.05rem; accent-color: var(--pv-primario); }
input[type=number] { font-variant-numeric: tabular-nums; }
::placeholder { color: var(--pv-texto-tenue); }

/* ---------- Layout autenticado ---------- */
.app { min-height: 100vh; }

.lateral {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 800;
    width: var(--pv-ancho-lateral);
    display: flex;
    flex-direction: column;
    background: var(--pv-lateral);
    color: var(--pv-lateral-texto);
}

.marca { display: flex; align-items: center; gap: 0.7rem; padding: 1.1rem 1.1rem 1rem; }
.marca-logo {
    display: grid; place-items: center; flex: none;
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #3b74f0, #2140b8);
    color: #fff; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.02em;
}
.marca-texto { display: flex; flex-direction: column; font-weight: 700; font-size: 1.05rem; color: #fff; line-height: 1.2; }
.marca-texto small { font-weight: 500; font-size: 0.75rem; color: var(--pv-lateral-texto); }
.marca .lateral-cerrar { margin-left: auto; display: none; color: var(--pv-lateral-texto); }

.menu {
    flex: 1; overflow-y: auto; padding: 0.25rem 0.75rem 1rem; display: flex; flex-direction: column; gap: 2px;
    /* Barra de desplazamiento integrada al fondo oscuro del menú */
    scrollbar-width: thin;
    scrollbar-color: #2b3958 transparent;
}
.menu::-webkit-scrollbar { width: 8px; }
.menu::-webkit-scrollbar-track { background: transparent; }
.menu::-webkit-scrollbar-thumb { background: #2b3958; border-radius: 8px; border: 2px solid var(--pv-lateral); }
.menu::-webkit-scrollbar-thumb:hover { background: #3d4f78; }
.menu-grupo {
    padding: 1rem 0.65rem 0.35rem;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: #66728a;
}
.menu a {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.55rem 0.65rem; border-radius: 8px;
    color: var(--pv-lateral-texto); font-weight: 500; text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.menu a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.menu a.active { background: var(--pv-lateral-activo); color: #fff; box-shadow: inset 3px 0 0 #5b8cff; }
.menu a.active .icono { color: #7ea6ff; }

.lateral-pie {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.85rem 1rem; border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.avatar {
    display: grid; place-items: center; flex: none;
    width: 34px; height: 34px; border-radius: 50%;
    background: #2a3a5e; color: #fff; font-size: 0.8rem; font-weight: 700;
}
.usuario { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.usuario strong { color: #fff; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario small { color: var(--pv-lateral-texto); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lateral-pie .btn-icono { color: var(--pv-lateral-texto); }
.lateral-pie .btn-icono:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.lateral-fondo { display: none; }

.principal { margin-left: var(--pv-ancho-lateral); min-width: 0; }

/* Barra superior: degradé azul acero que se separa del área de trabajo clara */
.barra {
    position: sticky; top: 0; z-index: 700;
    display: flex; align-items: center; gap: 0.75rem;
    height: 58px; padding: 0 1.5rem;
    background: linear-gradient(90deg, #dce6fa 0%, #e8eefb 55%, #eef2fb 100%);
    border-bottom: 1px solid #c9d6f2;
    box-shadow: 0 2px 8px rgba(23, 32, 51, 0.06);
}
.barra-comercio { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; color: #1a2f66; }
.barra-comercio .icono { color: var(--pv-primario); }
.barra-info { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; color: #3b4d78; }
.barra-usuario { display: flex; align-items: center; gap: 0.5rem; }
.barra-usuario strong { font-weight: 600; color: #1a2f66; }
/* Avatar con las iniciales: mismo componente que el pie del menú, en el azul de la marca */
.avatar-barra {
    width: 36px; height: 36px; font-size: 0.82rem; letter-spacing: 0.02em;
    background: linear-gradient(135deg, #2456d3 0%, #1a3f9c 100%);
    box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(26, 63, 156, 0.35);
}
.barra-info .badge { background: rgba(255, 255, 255, 0.75); border-color: #bccbee; color: #1a3f9c; }
.barra .btn-menu { color: #1a2f66; }
.barra .btn-menu:hover { background: rgba(255, 255, 255, 0.6); }
.barra .btn-menu { display: none; }

.contenido { padding: 1.5rem; max-width: 1280px; margin: 0 auto; }

.icono { flex: none; }

/* ---------- Layout público (login / registro) ---------- */
.publico {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    /* Fondo azulado más marcado para que la tarjeta blanca se despegue */
    background:
        radial-gradient(1200px 520px at 10% -10%, #c4d5fb 0%, transparent 62%),
        radial-gradient(900px 520px at 110% 110%, #cddcfa 0%, transparent 58%),
        #e4eaf6;
}
.publico-marca { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.publico-marca .marca-texto { color: var(--pv-texto); font-size: 1.3rem; }
.publico-marca .marca-texto small { color: var(--pv-texto-secundario); font-size: 0.8rem; }
.publico-marca .marca-logo { width: 44px; height: 44px; font-size: 1.05rem; }
.publico-pie { margin-top: 1.5rem; font-size: 0.8rem; color: var(--pv-texto-tenue); }

.login {
    width: 100%; max-width: 420px; padding: 2rem;
    border: 1px solid #c3d1ef; border-top: 4px solid var(--pv-primario);
    box-shadow: 0 18px 45px rgba(26, 47, 102, 0.16), 0 2px 6px rgba(26, 47, 102, 0.06);
}
.login input { background: #fbfcff; border-color: #c9d3e6; }

/* Comercio: primero y destacado. Recordado → ficha con "Cambiar"; si no, campo con ayuda. */
.etiqueta-con-icono { display: inline-flex; align-items: center; gap: 0.35rem; }
.etiqueta-con-icono .icono { width: 17px; height: 17px; color: var(--pv-primario); }
.campo-comercio .ayuda { font-size: 0.8rem; font-weight: 400; }
.comercio-recordado {
    display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.1rem;
    padding: 0.7rem 0.9rem; border-radius: var(--pv-radio-chico);
    background: var(--pv-primario-suave); border: 1px solid #c3d3f6;
}
.comercio-recordado-icono { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--pv-primario); flex: none; }
.comercio-recordado-texto { display: flex; flex-direction: column; line-height: 1.25; margin-right: auto; min-width: 0; }
.comercio-recordado-texto small { font-size: 0.75rem; color: var(--pv-texto-secundario); text-transform: uppercase; letter-spacing: 0.04em; }
.comercio-recordado-texto strong { color: var(--pv-primario-texto); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login h1 { font-size: 1.4rem; margin-bottom: 0.35rem; }
.login > .ayuda:first-of-type { margin-bottom: 1.25rem; }
.login h1 + form { margin-top: 1.25rem; }
.login label { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; font-weight: 500; font-size: 0.9rem; }
.login .btn-primario { margin-top: 0.5rem; min-height: 44px; }
.login > .ayuda:last-child { margin: 1.25rem 0 0; text-align: center; }

/* ---------- Tarjetas ---------- */
.tarjeta {
    background: var(--pv-superficie);
    border: 1px solid var(--pv-borde);
    border-radius: var(--pv-radio);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--pv-sombra);
    min-width: 0;
}
.tarjeta + .tarjeta { margin-top: 1rem; }
.tarjeta > h1:first-child, .tarjeta > h2:first-child { margin-top: 0; }

.encabezado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.encabezado h1, .encabezado h2 { margin: 0; margin-right: auto; }

/* ---------- Botones ---------- */
.btn-primario, .btn-secundario, .btn-peligro, .btn-buscar, .btn-agregar {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: 40px; padding: 0.5rem 1rem;
    font: inherit; font-weight: 600; font-size: 0.9rem; line-height: 1.2;
    border-radius: var(--pv-radio-chico);
    cursor: pointer; white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn-primario:active, .btn-secundario:active, .btn-peligro:active { transform: translateY(1px); }
.btn-primario:focus-visible, .btn-secundario:focus-visible, .btn-peligro:focus-visible, .btn-icono:focus-visible, .btn-link:focus-visible { outline: none; box-shadow: var(--pv-foco); }

.btn-primario { width: 100%; border: 1px solid var(--pv-primario); background: var(--pv-primario); color: #fff; box-shadow: 0 1px 2px rgba(36, 86, 211, 0.3); }
.btn-primario:hover:not(:disabled) { background: var(--pv-primario-hover); border-color: var(--pv-primario-hover); }
.btn-primario:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-primario.ancho-auto { width: auto; }

.btn-secundario { border: 1px solid var(--pv-borde-fuerte); background: var(--pv-superficie); color: var(--pv-texto); }
.btn-secundario:hover:not(:disabled) { background: var(--pv-superficie-2); border-color: #b9c1cf; }
.btn-secundario:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-peligro { border: 1px solid var(--pv-error); background: var(--pv-error); color: #fff; }
.btn-peligro:hover:not(:disabled) { background: #951c13; }
.btn-peligro:disabled { opacity: 0.55; cursor: not-allowed; }

/* Acciones frecuentes de mostrador: color propio para que no se pierdan sobre el blanco */
.btn-buscar { border: 1px solid var(--pv-primario); background: var(--pv-primario); color: #fff; box-shadow: 0 1px 2px rgba(36, 86, 211, 0.3); }
.btn-buscar:hover:not(:disabled) { background: var(--pv-primario-hover); border-color: var(--pv-primario-hover); }
.btn-buscar:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-agregar { min-height: 36px; padding: 0.4rem 0.85rem; border: 1px solid #16a34a; background: #16a34a; color: #fff; box-shadow: 0 1px 2px rgba(22, 163, 74, 0.3); }
.btn-agregar:hover:not(:disabled) { background: #12803b; border-color: #12803b; }
.btn-buscar:active, .btn-agregar:active { transform: translateY(1px); }
.btn-buscar:focus-visible, .btn-agregar:focus-visible { outline: none; box-shadow: var(--pv-foco); }

.btn-link { border: none; background: none; padding: 0; color: var(--pv-primario); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

.btn-icono {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; padding: 0;
    border: none; border-radius: 8px; background: transparent; color: var(--pv-texto-secundario);
    cursor: pointer;
}
.btn-icono:hover { background: var(--pv-superficie-2); color: var(--pv-texto); }

/* ---------- Mensajes ---------- */
.error { color: var(--pv-error); }
.ok { color: var(--pv-exito); }
p.error[role=alert], p.ok[role=status] {
    padding: 0.6rem 0.85rem; border-radius: var(--pv-radio-chico); font-weight: 500;
}
p.error[role=alert] { background: var(--pv-error-suave); border: 1px solid #f6c9c4; }
p.ok[role=status] { background: var(--pv-exito-suave); border: 1px solid #bfe1c9; }
.aviso { padding: 0.6rem 0.85rem; border-radius: var(--pv-radio-chico); background: var(--pv-alerta-suave); color: #5c3b00; border: 1px solid #f0d9a8; }
.ayuda { font-size: 0.85rem; color: var(--pv-texto-secundario); margin-bottom: 0; }
.validation-message { color: var(--pv-error); font-size: 0.82rem; font-weight: 500; }
.valid.modified:not([type=checkbox]) { border-color: #6cc287 !important; }
.invalid { border-color: var(--pv-error) !important; }
.invalid:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18) !important; }

.badge {
    display: inline-flex; align-items: center;
    font-size: 0.75rem; font-weight: 600; line-height: 1.5;
    padding: 0.05rem 0.55rem; border-radius: 999px;
    border: 1px solid var(--pv-borde); background: var(--pv-superficie-2); color: var(--pv-texto-secundario);
    white-space: nowrap;
}
.badge.activo { background: var(--pv-exito-suave); color: var(--pv-exito); border-color: #bfe1c9; }
.badge.baja { background: #f1f2f4; color: #5a5f69; }
.badge.rol-administrador { background: var(--pv-primario-suave); color: var(--pv-primario-texto); border-color: #c8d6f7; }
.badge.rol-supervisor { background: var(--pv-alerta-suave); color: var(--pv-alerta); border-color: #f0d9a8; }
.badge.rol-cajero { background: var(--pv-superficie); }
.badge.alerta { background: var(--pv-error-suave); color: var(--pv-error); border-color: #f6c9c4; margin-left: 0.35rem; }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 1rem; font-size: 0.9rem; }
th {
    padding: 0.6rem 0.75rem; text-align: left;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    /* Tinte suave del azul de la marca (los paneles del dashboard y el carrito usan su propio acento) */
    color: var(--pv-primario-texto); background: color-mix(in srgb, var(--pv-primario) 10%, #ffffff);
    border-bottom: 1px solid color-mix(in srgb, var(--pv-primario) 24%, #ffffff);
}
th:first-child { border-top-left-radius: var(--pv-radio-chico); }
th:last-child { border-top-right-radius: var(--pv-radio-chico); }
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--pv-borde); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: #fafbfd; }
td small { color: var(--pv-texto-tenue); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, th.num { white-space: nowrap; }
tr.inactivo td { color: var(--pv-texto-tenue); }
tr.fila-stock-bajo td { background: #fff8f7; }
.acciones-fila { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; align-items: center; }
/* En una celda, flex rompe la tabla: se alinea en línea y sin cortes */
td.acciones-fila { display: table-cell; text-align: right; white-space: nowrap; }
td.acciones-fila > * + * { margin-left: 0.4rem; }
.acciones-fila .btn-secundario, .acciones-fila .btn-primario, .acciones-fila .btn-peligro { min-height: 34px; padding: 0.35rem 0.7rem; font-size: 0.82rem; }
td.orden { justify-content: flex-start; }

/* ---------- Formularios ---------- */
.buscador { display: flex; gap: 0.5rem; flex: 1 1 280px; max-width: 460px; }
.buscador input { flex: 1; min-width: 0; }

.fila-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-top: 1rem; }
.fila-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; font-size: 0.88rem; }
.fila-form label.ancho { flex: 1 1 220px; }
.fila-form .btn-primario { width: auto; }

.grilla-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0.85rem 1rem; align-items: end; }
.grilla-form label, .modal label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; font-size: 0.88rem; }
label.check, .modal label.check, .grilla-form label.check {
    flex-direction: row; align-items: center; gap: 0.45rem;
    font-weight: 500; font-size: 0.88rem; color: var(--pv-texto-secundario); cursor: pointer;
}
.acciones { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }

/* ---------- Modal ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(15, 23, 41, 0.5); backdrop-filter: blur(2px); z-index: 900; animation: aparecer 0.15s ease-out; }
.modal {
    position: fixed; z-index: 901; top: 8vh; left: 50%; transform: translateX(-50%);
    width: min(480px, calc(100vw - 2rem)); max-height: 84vh; overflow-y: auto;
    background: var(--pv-superficie); border-radius: 14px; padding: 1.5rem;
    box-shadow: var(--pv-sombra-alta);
    animation: subir 0.18s ease-out;
}
.modal.modal-ancho { width: min(760px, calc(100vw - 2rem)); max-width: none; }
.modal h2 { margin-top: 0; font-size: 1.2rem; }
.modal form > * { margin-bottom: 0.85rem; }
.modal .acciones { justify-content: flex-end; margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--pv-borde); }
.modal .btn-primario { width: auto; }
.modal small { font-weight: 400; color: var(--pv-texto-secundario); }
.modal .grilla-form label.ancho { grid-column: 1 / -1; }
.modal textarea { resize: vertical; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Caja ---------- */
.caja { margin-bottom: 1rem; }
.estado { font-size: 0.8rem; font-weight: 600; padding: 0.15rem 0.65rem; border-radius: 999px; border: 1px solid var(--pv-borde); }
.estado.abierta { background: var(--pv-exito-suave); color: var(--pv-exito); border-color: #bfe1c9; }
.estado.cerrada { background: #f1f2f4; color: var(--pv-texto-secundario); }
.destacado { margin-top: 1rem; font-size: 1.05rem; }
.resultado-cierre { margin-bottom: 1rem; border-color: var(--pv-primario); box-shadow: 0 0 0 3px var(--pv-primario-suave); }
.cifras { display: grid; grid-template-columns: auto auto; gap: 0.4rem 0; margin: 0.5rem 0 1rem; }
.cifras dt { color: var(--pv-texto-secundario); padding-right: 1.5rem; }
.cifras dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.cifras .total { font-size: 1.3rem; font-weight: 700; color: var(--pv-texto); padding-top: 0.4rem; border-top: 1px solid var(--pv-borde); }
.sobrante { color: var(--pv-primario); font-weight: 600; }
.faltante { color: var(--pv-error); font-weight: 500; }
.exacto { color: var(--pv-exito); font-weight: 600; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1.25rem; align-items: start; }
.pos .cobro { position: sticky; top: 74px; }
.pos > .tarjeta + .tarjeta { margin-top: 0; }
.pos > .tarjeta > label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; margin-bottom: 0.75rem; }
.caja-activa { margin-top: 0; color: var(--pv-texto-secundario); }
/* Resultados de búsqueda: fondo azulado tenue para distinguirlos del carrito */
.resultados { list-style: none; padding: 0; margin: 0.75rem 0; background: #f2f6fe; border: 1px solid #d3def8; border-radius: var(--pv-radio-chico); overflow: hidden; }
.resultados li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.6rem 0.75rem; border-bottom: 1px solid #dfe7fa; }
.resultados li:hover { background: #e6eefd; }
.resultados li:last-child { border-bottom: none; }
.resultados li > span:first-child { flex: 1 1 200px; font-weight: 500; }
.resultados li small { font-weight: 400; }
/* Carrito: degradé verde agua para diferenciarlo de los resultados de búsqueda (azulados) */
table.carrito {
    background: linear-gradient(180deg, #e3f6f2 0%, #f2fbf9 100%);
    border: 1px solid #bfe6dd;
    border-radius: var(--pv-radio-chico);
}
table.carrito th { background: rgba(178, 228, 216, 0.45); color: #1f5f55; border-bottom-color: #bfe6dd; }
table.carrito td { border-bottom-color: #d3eee8; }
table.carrito tbody tr:hover td { background: rgba(255, 255, 255, 0.5); }
table.carrito input.cantidad { background: #ffffff; }
.cantidad { width: 6.5rem; text-align: right; }
input.cantidad { min-height: 34px; padding: 0.3rem 0.5rem; }
.cobro h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pv-texto-secundario); margin: 1rem 0 0.5rem; }
.cobro > label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; font-size: 0.88rem; margin-bottom: 0.85rem; }
.cobro .btn-primario { min-height: 50px; font-size: 1.05rem; }
.pago { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.pago select { flex: 0 1 46%; min-width: 0; }
.pago input { flex: 1; min-width: 0; text-align: right; }
.vuelto { color: var(--pv-exito); font-weight: 700; }
.resumen-cobro { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.5rem 0 1rem; color: var(--pv-texto-secundario); }
.resumen-cobro > span { display: flex; justify-content: space-between; align-items: baseline; }
.resumen-cobro strong { color: var(--pv-texto); font-variant-numeric: tabular-nums; }
.saldo-cobro { padding: 0.6rem 0.8rem; border-radius: var(--pv-radio-chico); font-weight: 600; }
.saldo-cobro strong { font-size: 1.35rem; color: inherit; }
.saldo-cobro.vuelto { background: var(--pv-exito-suave); border: 1px solid #bfe1c9; }
.saldo-cobro.faltante { background: var(--pv-error-suave); border: 1px solid #f6c9c4; }
.venta-ok { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 1rem; border-color: #9fd3b0; background: var(--pv-exito-suave); }

/* ---------- Inventario y compras ---------- */
.alerta-stock { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; border-color: #f6c9c4; background: #fff6f5; margin-bottom: 1rem; }
.alerta-stock + .tarjeta { margin-top: 0; }
.minimo-form { display: inline-flex; gap: 0.35rem; justify-content: flex-end; }
.vista-precio { padding: 0.65rem 0.85rem; border-radius: var(--pv-radio-chico); background: var(--pv-primario-suave); color: var(--pv-primario-texto); }
.acciones-encabezado { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn-excel {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: 40px; padding: 0.5rem 0.9rem;
    font: inherit; font-weight: 600; font-size: 0.9rem; white-space: nowrap; cursor: pointer;
    border-radius: var(--pv-radio-chico); border: 1px solid #a7d7b8; background: #eaf7ef; color: #17693a;
    transition: background 0.15s, border-color 0.15s;
}
.btn-excel .icono { width: 18px; height: 18px; }
.btn-excel:hover:not(:disabled) { background: #d8f0e1; border-color: #84c79c; }
.btn-excel:disabled { opacity: 0.6; cursor: wait; }
.btn-excel:focus-visible { outline: none; box-shadow: var(--pv-foco); }

/* Importación desde Excel */
.ayuda-importacion { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--pv-texto-secundario); font-size: 0.88rem; }
.ayuda-importacion li + li { margin-top: 0.25rem; }
.selector-archivo {
    position: relative; display: flex !important; align-items: center; gap: 0.75rem;
    padding: 1.1rem 1rem; border: 2px dashed #b8c6e6; border-radius: var(--pv-radio); background: #f5f8fe;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.selector-archivo:hover { border-color: var(--pv-primario); background: #eef3fd; }
.selector-archivo.con-archivo { border-style: solid; border-color: #a7d7b8; background: #f0f9f3; }
.selector-archivo input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.selector-archivo-texto { display: flex; flex-direction: column; }
.selector-archivo-texto small { font-weight: 400; }
.resumen-importacion { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.75rem; }
.resumen-importacion span { padding: 0.35rem 0.75rem; border-radius: 999px; background: var(--pv-superficie-2); border: 1px solid var(--pv-borde); font-size: 0.88rem; }
.resumen-importacion .nuevo { background: var(--pv-exito-suave); border-color: #bfe1c9; color: var(--pv-exito); }
.resumen-importacion .actualizado { background: var(--pv-primario-suave); border-color: #c8d6f7; color: var(--pv-primario-texto); }
.errores-importacion { max-height: 240px; overflow: auto; border: 1px solid #f6c9c4; border-radius: var(--pv-radio-chico); }
.errores-importacion table { margin-top: 0; font-size: 0.85rem; }
.errores-importacion td { white-space: normal; }

/* Roles y permisos */
.subtitulo { margin: -0.5rem 0 1rem; max-width: 820px; }
.badge.rol-personalizado { background: #f1ebfd; color: #5b30b8; border-color: #d9c9f7; }
.grilla-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 1rem; align-items: start; }
.grilla-roles .tarjeta + .tarjeta { margin-top: 0; }
.tarjeta-rol { border-top: 3px solid #6d3fd6; display: flex; flex-direction: column; gap: 0.6rem; }
.tarjeta-rol.es-admin { border-top-color: var(--pv-primario); background: linear-gradient(180deg, #eef3fd 0%, #ffffff 120px); }
.tarjeta-rol.inactivo { opacity: 0.6; border-top-color: var(--pv-borde-fuerte); }
.tarjeta-rol-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.tarjeta-rol-cabecera h2 { margin: 0 0 0.3rem; }
.tarjeta-rol-cabecera .badge + .badge { margin-left: 0.3rem; }
.cantidad-usuarios { font-size: 1.4rem; font-weight: 700; line-height: 1; text-align: right; white-space: nowrap; }
.cantidad-usuarios small { display: block; font-size: 0.72rem; font-weight: 500; }
.permisos-resumen { margin: 0; padding-left: 1rem; font-size: 0.86rem; color: var(--pv-texto-secundario); }
p.permisos-resumen { padding-left: 0; }
.permisos-resumen li + li { margin-top: 0.2rem; }
.tarjeta-rol .acciones-fila { justify-content: flex-start; margin-top: auto; }
.permisos-encabezado { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0 0.5rem; }
.acciones-permisos { display: flex; gap: 1rem; }
.grilla-permisos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0.75rem; }
.grupo-permisos { margin: 0; padding: 0.6rem 0.8rem 0.75rem; border: 1px solid var(--pv-borde); border-radius: var(--pv-radio-chico); background: var(--pv-superficie-2); }
.grupo-permisos legend { padding: 0 0.3rem; font-weight: 700; }
.grupo-permisos legend label.check { color: var(--pv-texto); font-weight: 700; }
.modal label.permiso { flex-direction: row; align-items: flex-start; gap: 0.55rem; padding: 0.4rem 0.2rem; font-weight: 400; cursor: pointer; border-radius: 6px; }
.modal label.permiso:hover { background: #ffffff; }
.modal label.permiso input { margin-top: 0.2rem; }
.modal label.permiso span { display: flex; flex-direction: column; }
.modal label.permiso strong { font-size: 0.88rem; font-weight: 600; }
.modal label.permiso small { font-size: 0.78rem; }
.modal label.permiso.no-otorgable { opacity: 0.55; cursor: not-allowed; }

/* Auditoría */
.filtros-auditoria { margin-top: 0; margin-bottom: 1rem; }
.nowrap { white-space: nowrap; }
.detalle-auditoria { white-space: normal; min-width: 260px; color: var(--pv-texto-secundario); }
.badge.accion-rol { background: #f1ebfd; color: #5b30b8; border-color: #d9c9f7; }
.badge.accion-usuario { background: var(--pv-primario-suave); color: var(--pv-primario-texto); border-color: #c8d6f7; }
.badge.accion-venta { background: #fdecec; color: #a52323; border-color: #f5c6c6; }
.badge.accion-cajasesion { background: #e9f7ef; color: #1d7044; border-color: #c3e8d2; }
.badge.accion-producto { background: #fff4e0; color: #8a5300; border-color: #f6dcae; }
.badge.accion-comercio { background: #eef1f4; color: #3d4a57; border-color: #d3dae1; }
.paginador { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 1rem; color: var(--pv-texto-secundario); }
.paginador > span:first-child { margin-right: auto; }

.enlace-invitacion { flex: 1 1 320px; min-width: 0; font-size: 0.85rem; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ---------- Facturación electrónica ---------- */
.aviso-fiscal { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; border-color: #f0d9a8; background: #fffaf0; margin-bottom: 1rem; }
.comprobante { max-width: 820px; margin: 0 auto 1rem; padding: 1.5rem; background: var(--pv-superficie); border: 1px solid var(--pv-borde); border-radius: var(--pv-radio); box-shadow: var(--pv-sombra); }
.comprobante-cabecera { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--pv-borde); }
.comprobante-emisor { font-size: 1.15rem; }
.comprobante-letra { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 4rem; height: 4rem; border: 2px solid var(--pv-texto); border-radius: 4px; }
.comprobante-letra span { font-size: 2rem; font-weight: 700; line-height: 1; }
.comprobante-letra small { font-size: 0.7rem; }
.comprobante-datos { text-align: right; }
.comprobante-receptor { padding: 0.75rem 0; border-bottom: 1px solid var(--pv-borde); }
.comprobante-totales { margin-left: auto; max-width: 320px; }
.comprobante-pie { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding-top: 0.75rem; border-top: 1px solid var(--pv-borde); }
.comprobante-qr { width: 120px; height: 120px; image-rendering: pixelated; }
.sello-anulada { display: inline-block; margin: 0.25rem 0; padding: 0.1rem 0.6rem; border: 2px solid var(--pv-error); border-radius: 4px; color: var(--pv-error); font-weight: 700; letter-spacing: 0.08em; }
.lista-efectos { margin: 0.5rem 0 0.75rem; padding-left: 1.2rem; color: var(--pv-texto-secundario); }

/* ---------- Dashboard y reportes ---------- */
.selector-periodo { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.selector-periodo .btn-secundario { min-height: 34px; padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.selector-periodo .activo { background: var(--pv-primario); color: #fff; border-color: var(--pv-primario); }
.selector-periodo .activo:hover:not(:disabled) { background: var(--pv-primario-hover); }
.periodo { color: var(--pv-texto-secundario); margin: 0.25rem 0 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi {
    display: flex; flex-direction: column; gap: 0.25rem; padding: 1.1rem 1.2rem;
    background: var(--pv-superficie); border: 1px solid var(--pv-borde); border-radius: var(--pv-radio); box-shadow: var(--pv-sombra);
}
.kpi-etiqueta { font-size: 0.82rem; font-weight: 500; color: var(--pv-texto-secundario); }
.kpi-valor { font-size: 1.7rem; font-weight: 700; color: var(--pv-texto); line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-detalle { font-size: 0.8rem; color: var(--pv-texto-secundario); }
.grilla-reportes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grilla-reportes .tarjeta + .tarjeta { margin-top: 0; }
.grilla-reportes table { margin-top: 0.5rem; }
.grilla-reportes small { color: var(--pv-texto-secundario); margin-left: 0.25rem; }
.col-participacion { width: 34%; white-space: nowrap; }
.medidor { display: inline-block; vertical-align: middle; width: calc(100% - 3.5rem); height: 8px; border-radius: 4px; background: var(--pv-primario-suave); overflow: hidden; }
.medidor-relleno { display: block; height: 100%; border-radius: 4px; background: var(--pv-primario); }
.medidor-valor { display: inline-block; width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--pv-texto-secundario); font-size: 0.85rem; }
.cifras-cajas { grid-template-columns: repeat(8, auto); }
.cifras-cajas dd { padding-right: 2rem; }
.cifras-cajas dd:last-of-type { padding-right: 0; }
/* Tablas de reportes: más compactas y, si no entran, se desplazan dentro del panel */
.grilla-reportes > .tarjeta { overflow-x: auto; }
.grilla-reportes table { font-size: 0.85rem; }
.grilla-reportes th, .grilla-reportes td { padding: 0.5rem 0.45rem; }
.grilla-reportes th { font-size: 0.68rem; letter-spacing: 0.03em; }

/* Matices del dashboard: cada indicador y panel lleva su color, en degradé hacia blanco */
.kpi { --acento: var(--pv-primario); --matiz: #e8eefc; position: relative; overflow: hidden; border-top: 3px solid var(--acento); background: linear-gradient(135deg, var(--matiz) 0%, #ffffff 75%); }
.kpi::after { content: ""; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--acento); opacity: 0.07; }
.kpi .kpi-etiqueta { color: var(--acento); font-weight: 600; }
.kpi-azul { --acento: #2456d3; --matiz: #e4ecfd; }
.kpi-verde { --acento: #15803d; --matiz: #e1f4e7; }
.kpi-violeta { --acento: #6d3fd6; --matiz: #ede6fc; }
.kpi-ambar { --acento: #b45309; --matiz: #fcefdc; }

.panel-dashboard > .tarjeta, .panel-dashboard-unico { --acento: var(--pv-primario); --matiz: #eef3fd; border-top: 3px solid var(--acento); background: linear-gradient(180deg, var(--matiz) 0%, #ffffff 160px); }
.panel-dashboard > .tarjeta:nth-child(1) { --acento: #2456d3; --matiz: #eaf0fd; }
.panel-dashboard > .tarjeta:nth-child(2) { --acento: #6d3fd6; --matiz: #f1ebfd; }
.panel-dashboard > .tarjeta:nth-child(3) { --acento: #15803d; --matiz: #e8f6ed; }
.panel-dashboard > .tarjeta:nth-child(4) { --acento: #c2410c; --matiz: #fdeee6; }
.panel-dashboard-unico { --acento: #0e7490; --matiz: #e3f4f8; }
.panel-dashboard > .tarjeta h2, .panel-dashboard-unico h2 { color: var(--acento); }
/* Encabezados de tabla teñidos con el acento de su panel: contrastan con el fondo sin dejar de ser suaves */
.panel-dashboard th, .panel-dashboard-unico th {
    background: color-mix(in srgb, var(--acento) 13%, #ffffff);
    color: color-mix(in srgb, var(--acento) 80%, #172033);
    border-bottom: 1px solid color-mix(in srgb, var(--acento) 28%, #ffffff);
}
.panel-dashboard tbody tr:hover td, .panel-dashboard-unico tbody tr:hover td { background: rgba(255, 255, 255, 0.6); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .lateral {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: none;
    }
    .menu-abierto .lateral { transform: none; box-shadow: var(--pv-sombra-alta); }
    .marca .lateral-cerrar { display: inline-grid; }
    .menu-abierto .lateral-fondo { display: block; position: fixed; inset: 0; z-index: 790; background: rgba(15, 23, 41, 0.45); }
    .principal { margin-left: 0; }
    .barra .btn-menu { display: inline-grid; margin-left: -0.5rem; }
    .barra { padding: 0 1rem; }
    .contenido { padding: 1.25rem 1rem; }
}

@media (max-width: 900px) {
    .pos { grid-template-columns: 1fr; }
    .pos .cobro { position: static; }
}

@media (max-width: 760px) {
    body { font-size: 14.5px; }
    h1 { font-size: 1.3rem; }
    .barra-info { display: none; }
    .tarjeta { padding: 1rem; }
    .encabezado { align-items: stretch; }
    .encabezado h1 { width: 100%; }
    .buscador { max-width: none; }
    /* Las tablas anchas se desplazan dentro de su tarjeta en vez de romper la página */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .grilla-reportes { grid-template-columns: 1fr; }
    .cifras-cajas { grid-template-columns: auto auto; }
    .comprobante { padding: 1rem; }
    .comprobante-cabecera { grid-template-columns: 1fr; }
    .comprobante-datos { text-align: left; }
    .modal { top: auto; bottom: 0; transform: translateX(-50%); width: 100vw; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 1.25rem 1rem; animation: subir-hoja 0.2s ease-out; }
    .modal.modal-ancho { width: 100vw; }
    .login { padding: 1.5rem 1.25rem; }
    @keyframes subir-hoja { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
}

/* ---------- Impresión ---------- */
@media print {
    .lateral, .lateral-fondo, .barra, .no-imprimir, #blazor-error-ui { display: none !important; }
    .principal { margin-left: 0; }
    body { background: #fff; }
    .contenido { padding: 0; max-width: none; }
    .comprobante { border: none; margin: 0; max-width: none; box-shadow: none; }
}

/* ---------- Plantilla Blazor (carga y errores) ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: #fff4d6;
    color: #5c3b00;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
    display: none;
    left: 0;
    padding: 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "Ocurrió un error inesperado."; }

.loading-progress {
    position: absolute;
    display: block;
    width: 6rem;
    height: 6rem;
    inset: 32vh 0 auto 0;
    margin: 0 auto;
}
.loading-progress circle {
    fill: none;
    stroke: #e2e6ee;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--pv-primario);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    color: var(--pv-texto-secundario);
    inset: calc(32vh + 7rem) 0 auto 0;
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Cargando"); }

code { color: #b4235f; font-size: 0.9em; }

/* ---------- Suscripción ---------- */
.aviso-suscripcion { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; padding: 0.55rem 1.5rem; font-size: 0.9rem; border-bottom: 1px solid var(--pv-borde); }
/* Enlace como pastilla suave: se distingue del texto sin competir con el resto de la pantalla */
.aviso-suscripcion a {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.2rem 0.75rem; border-radius: 999px;
    font-weight: 600; font-size: 0.84rem; text-decoration: none; color: inherit;
    background: rgba(255, 255, 255, 0.7); border: 1px solid currentColor;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.aviso-suscripcion a::after { content: "→"; transition: transform 0.15s ease; }
.aviso-suscripcion a:hover { background: #fff; box-shadow: 0 1px 4px rgba(23, 32, 51, 0.12); }
.aviso-suscripcion a:hover::after { transform: translateX(2px); }
.aviso-suscripcion a:focus-visible { outline: none; box-shadow: var(--pv-foco); }
.aviso-suscripcion.susc-prueba a { color: #2456d3; border-color: #b9cbf5; }
.aviso-suscripcion.susc-gracia a { color: #8a5300; border-color: #edd09a; }
.aviso-suscripcion.susc-bloqueada a { color: var(--pv-error); border-color: #f2bcb6; }
.aviso-suscripcion.susc-prueba { background: var(--pv-primario-suave); color: var(--pv-primario-texto); }
.aviso-suscripcion.susc-gracia { background: var(--pv-alerta-suave); color: #5c3b00; }
.aviso-suscripcion.susc-bloqueada { background: var(--pv-error-suave); color: var(--pv-error); font-weight: 600; }

.badge.susc-prueba { background: var(--pv-primario-suave); color: var(--pv-primario-texto); border-color: #c8d6f7; }
.badge.susc-activa { background: var(--pv-exito-suave); color: var(--pv-exito); border-color: #bfe1c9; }
.badge.susc-gracia { background: var(--pv-alerta-suave); color: var(--pv-alerta); border-color: #f0d9a8; }
.badge.susc-bloqueada { background: var(--pv-error-suave); color: var(--pv-error); border-color: #f6c9c4; }

.resumen-suscripcion { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 1.25rem; }
.resumen-suscripcion > div { display: flex; flex-direction: column; gap: 0.3rem; }
.resumen-suscripcion .etiqueta { font-size: 0.8rem; font-weight: 600; color: var(--pv-texto-secundario); text-transform: uppercase; letter-spacing: 0.04em; }
.resumen-suscripcion .dato-grande { font-size: 1.4rem; }
.resumen-suscripcion small { font-weight: 400; color: var(--pv-texto-secundario); }
.resumen-suscripcion .badge { align-self: flex-start; }

.barra-uso { height: 6px; border-radius: 999px; background: var(--pv-borde); overflow: hidden; }
.barra-uso span { display: block; height: 100%; background: var(--pv-primario); border-radius: inherit; }
.barra-uso.casi span { background: #d97706; }
.barra-uso.lleno span { background: var(--pv-error); }

.tabla-scroll { overflow-x: auto; }
.comparativa-planes th[scope], .comparativa-planes tbody th { text-align: left; font-weight: 500; color: var(--pv-texto-secundario); }
.comparativa-planes td { text-align: center; }
.comparativa-planes .plan-actual { background: var(--pv-primario-suave); }
.comparativa-planes thead .badge { margin-left: 0.35rem; }

.kpi-filtro { font: inherit; text-align: left; cursor: pointer; border-left: 1px solid var(--pv-borde); border-right: 1px solid var(--pv-borde); border-bottom: 1px solid var(--pv-borde); }
.kpi-filtro.seleccionado { box-shadow: var(--pv-foco); }
.kpi-filtro:focus-visible { outline: none; box-shadow: var(--pv-foco); }
.fila-checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 1rem 0 0.5rem; }

@media (max-width: 640px) {
    .aviso-suscripcion { padding: 0.55rem 1rem; }
}
.fila-debito { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.fila-debito .badge { margin-left: 0.35rem; }
.campo-email-mp { display: flex; flex-direction: column; gap: 0.3rem; max-width: 22rem; margin: 0.75rem 0 1rem; font-weight: 500; }
