/* El rediseño del portal (5.50): la letra de GestioERP, los colores que manda la app de ventas (--ge-1 claro, --ge-2 oscuro) y el
   ancho de la pantalla aprovechado. Va después de portal-movil.css: en el móvil casi todo se queda como estaba; el cambio grande es
   a partir de 768 px (cabecera con el menú dentro, resumen, tarjetas en rejilla, documento con el PDF al lado). */

:root {
    --pg-g: var(--ge-1, #16bd95);
    --pg-gd: var(--ge-2, #0b6b58);
    --pg-gdd: color-mix(in srgb, var(--pg-gd) 78%, #000);
    --pg-linea: #e3ebe8;
    --pg-mut: #5b6b78;
    --pg-radio: 18px;
    --pg-sombra: 0 1px 2px rgba(12, 42, 71, .05), 0 6px 18px rgba(12, 42, 71, .04);
}

body { font-family: "Inter", var(--ge-letra, system-ui), -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

/* ---------------------------------------------------------- piezas sueltas */
.pg-etiqueta {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase; color: var(--pg-gd); background: color-mix(in srgb, var(--pg-g) 16%, #fff);
    border-radius: 7px; padding: 3px 8px;
}
.pg-estado { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 10px; background: #eef2f1; color: var(--pg-mut); white-space: nowrap; }
.pg-estado.pendiente { background: #fef3c7; color: #92400e; }
.pg-estado.aceptado, .pg-estado.pagada { background: color-mix(in srgb, var(--pg-g) 18%, #fff); color: var(--pg-gd); }
.pg-estado.rechazado, .pg-estado.vencida { background: #fee2e2; color: #991b1b; }

.pg-minis { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.pg-minis img, .pg-minis .pg-mas {
    width: 58px; height: 50px; object-fit: contain; border: 1px solid var(--pg-linea); border-radius: 10px; background: #fff; padding: 3px;
}
.pg-minis .pg-mas { display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--pg-mut); background: #f3f8f6; }

.pg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 16px;
    font: 700 14px/1.1 inherit; background: var(--pg-gd); color: #fff; cursor: pointer; text-decoration: none;
}
.pg-btn.sec { background: #fff; color: var(--pg-gd); border: 1.5px solid color-mix(in srgb, var(--pg-g) 35%, #fff); }

/* ------------------------------------------------------- inicio: resumen */
.pg-banda { display: none; }
.pg-kpis { display: none; }
.pg-volver { display: none; }

/* la tarjeta de un documento */
.pg-doc { display: grid; gap: 8px; }
.pg-doc .pg-fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pg-doc .pg-cod { font-weight: 800; font-size: 16px; }
.pg-doc .pg-imp { font-weight: 800; font-size: 22px; letter-spacing: -.01em; white-space: nowrap; }
.pg-doc .pg-fecha { font-size: 13px; color: var(--pg-mut); }
.pg-doc .pg-acciones { display: flex; gap: 8px; margin-top: 4px; }
.pg-doc .pg-acciones .pg-btn { padding: 9px 14px; }
.pg-doc .pg-acciones .pg-btn:first-child { flex: 1; }

/* el aviso «pagar ahora» y el contacto */
.pg-pagar { background: linear-gradient(160deg, var(--pg-gd), var(--pg-gdd)); color: #fff; border-radius: var(--pg-radio); padding: 20px; }
.pg-pagar small { color: rgba(255, 255, 255, .72); display: block; }
.pg-pagar .pg-grande { font-size: 30px; font-weight: 800; margin: 8px 0 12px; letter-spacing: -.02em; }
.pg-pagar .pg-btn { width: 100%; background: var(--pg-g); }
.pg-contacto { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 18px 20px; font-size: 14px; }
.pg-contacto div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; }
.pg-contacto div span { color: var(--pg-mut); }

/* ---------------------------------------- un documento con el PDF al lado */
.pg-dos { display: grid; gap: 16px; }
.pg-visor { display: none; }
.pg-visor iframe { width: 100%; height: 100%; min-height: 74vh; border: 0; background: #dfe8e4; border-radius: 14px; }
.pg-visor .pg-barra { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.pg-linea { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--pg-linea); }
.pg-linea:last-child { border-bottom: 0; }
.pg-linea img { width: 64px; height: 54px; object-fit: contain; border: 1px solid var(--pg-linea); border-radius: 10px; background: #fff; padding: 3px; flex: none; }
.pg-linea .pg-t { flex: 1; min-width: 0; }
.pg-linea .pg-t b { display: block; font-size: 14.5px; }
.pg-linea .pg-t span { font-size: 12.5px; color: var(--pg-mut); }
.pg-linea .pg-i { text-align: right; font-weight: 800; white-space: nowrap; }
.pg-foto3d { width: 100%; border-radius: 14px; display: block; margin: 12px 0 4px; }
.pg-firma { border: 2px solid var(--pg-g); border-radius: var(--pg-radio); padding: 16px; background: #fff; margin-top: 14px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--pg-g) 12%, transparent); }
.pg-firma h3 { margin: 0 0 8px; font-size: 17px; }
.pg-firma input[type=text] { width: 100%; border: 1.5px solid var(--pg-linea); border-radius: 12px; padding: 12px 14px; font: inherit; margin-bottom: 10px; }

/* ------------------------------------------------------------- tickets */
.pm-comentario { border-radius: 16px !important; }

/* ===================================================== tableta y ordenador */
@media (min-width: 768px) {
    body { background: #f3f8f6; }

    /* la cabecera: marca, menú y cuenta en una sola barra */
    .pm-cabecera {
        background: linear-gradient(168deg, var(--pg-gd), var(--pg-gdd));
        padding: 0 3vw;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 18px;
    }
    .pm-cabecera-fila { display: contents; }
    .pm-atras, .pm-titulo-caja { display: none; }
    .pg-marca { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: #fff; height: 68px; }
    .pg-marca img { height: 38px; width: auto; max-width: 160px; object-fit: contain; border-radius: 8px; }
    .pg-marca i { width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-style: normal; font-size: 18px; }
    .pm-menu {
        grid-column: 2; background: none; border: 0; padding: 0; margin: 0; max-width: none; display: flex; gap: 6px; flex-wrap: wrap;
    }
    .pm-menu a, .pm-menu a.on { border: 0; margin: 0; border-radius: 10px; padding: 10px 14px; color: rgba(255, 255, 255, .85); font-size: 14.5px; font-weight: 600; }
    .pm-menu a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
    .pm-menu a.on { background: rgba(255, 255, 255, .18); color: #fff; }
    .pm-menu a[href*="p=cesta"] { margin-left: auto; }
    .pm-menu b { background: #fff; color: var(--pg-gd); }
    .pm-acciones { grid-column: 3; display: flex; gap: 6px; align-items: center; }
    .pm-acciones a, .pm-acciones button { color: #fff; }

    /* el lienzo, a todo lo ancho */
    .pm-lienzo { max-width: none; padding: 24px 3vw 60px; }
    .pm-lienzo > .pm-linea, .pm-lienzo > .pm-tarjeta, .pm-lienzo > .pm-totales, .pm-lienzo > form { max-width: none; }

    .pg-volver { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--pg-mut); margin-bottom: 14px; }

    /* el saludo y el resumen de la portada */
    .pg-banda { display: block; margin: -24px -3vw 0; padding: 24px 3vw 58px; background: linear-gradient(168deg, var(--pg-gd), var(--pg-gdd)); color: #fff; }
    .pg-banda h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
    .pg-banda p { margin: 6px 0 0; color: rgba(255, 255, 255, .8); }
    .pg-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: -34px 0 22px; position: relative; }
    .pg-kpi { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 16px 18px; box-shadow: var(--pg-sombra); }
    .pg-kpi small { display: block; color: var(--pg-mut); font-size: 12.5px; font-weight: 600; }
    .pg-kpi strong { font-size: 24px; letter-spacing: -.02em; }
    .pg-kpi.alerta strong { color: #b91c1c; }

    /* la portada: documentos y, al lado, lo que hay que pagar */
    .pg-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
    .pg-cuerpo > aside { display: grid; gap: 16px; position: sticky; top: 84px; }

    /* las pestañas de tipo de documento, en píldoras */
    .pm-subpestanas { display: flex; gap: 8px; flex-wrap: wrap; border: 0; background: none; padding: 0; margin: 0 0 16px; }
    .pm-subpestanas a, .pm-subpestanas a.on {
        padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--pg-mut); background: #fff; border: 1px solid var(--pg-linea);
    }
    .pm-subpestanas a.on { background: var(--pg-gd); border-color: var(--pg-gd); color: #fff; }
    .pm-subpestanas b { opacity: .7; margin-left: 4px; font-weight: 700; background: none; color: inherit; }

    /* las tarjetas, en rejilla */
    .pg-lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .pm-tarjeta { border-radius: var(--pg-radio); border: 1px solid var(--pg-linea); box-shadow: var(--pg-sombra); padding: 18px; background: #fff; }

    /* el documento, en dos columnas con el PDF */
    .pg-dos { grid-template-columns: minmax(420px, 1fr) minmax(460px, 1fr); align-items: start; }
    .pg-visor { display: block; position: sticky; top: 84px; }
    .pg-abrir-movil { display: none; }

    /* la tienda: rejilla ancha */
    .pm-rejilla { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .pm-articulo { border-radius: var(--pg-radio); box-shadow: var(--pg-sombra); border-color: var(--pg-linea); overflow: hidden; }
    .pm-precio { font-size: 20px; font-weight: 800; }
    .pm-anadir { background: var(--pg-gd); border-radius: 12px; }
}

@media (min-width: 1500px) {
    .pg-lista { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pm-rejilla { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 1099px) {
    .pg-cuerpo { grid-template-columns: 1fr; }
    .pg-cuerpo > aside { position: static; }
    .pg-kpis { grid-template-columns: repeat(2, 1fr); }
    .pg-lista { grid-template-columns: 1fr; }
}

/* ===================================================== la entrada (login) */
.pg-login { position: fixed; inset: 0; background: #0c2a47 var(--pg-fondo, none) center / cover no-repeat; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; overflow: auto; }
.pg-login::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, color-mix(in srgb, var(--pg-gd, #0b6b58) 82%, transparent), color-mix(in srgb, var(--pg-gdd, #07463a) 72%, transparent) 45%, rgba(12, 42, 71, .78)); }
.pg-login > * { position: relative; }
.pg-login .pg-lado { padding: 6vw; color: #fff; }
.pg-login .pg-lado h1 { font-size: clamp(32px, 4vw, 54px); line-height: 1.05; margin: 22px 0 12px; font-weight: 800; letter-spacing: -.02em; }
.pg-login .pg-lado p { font-size: 18px; max-width: 30ch; opacity: .92; line-height: 1.5; }
.pg-login .pg-lado ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; font-weight: 600; }
.pg-login .pg-lado li::before { content: "✓"; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .2); margin-right: 10px; }
.pg-login .pg-logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 22px; }
.pg-login .pg-logo img { height: 44px; width: auto; max-width: 220px; object-fit: contain; }
.pg-login .pg-caja { display: grid; place-items: center; padding: 24px; background: none; border: 0; border-radius: 0; box-shadow: none; margin-bottom: 0; }
.pg-login .login-form { max-width: 420px; width: 100%; }
.pg-login .login-form .card { border: 0; border-radius: 24px; box-shadow: 0 30px 80px rgba(4, 47, 41, .45); overflow: hidden; }
.pg-login .login-form .card-body { padding: 30px 30px 8px; }
.pg-login .login-form .card-footer { background: #fff; border: 0; padding: 8px 30px 28px; }
.pg-login .login-form .form-control { text-align: left !important; padding: 14px; border-radius: 12px; border: 1.5px solid var(--pg-linea); background: #fbfdfc; }
.pg-login .login-form .btn-primary { background: var(--pg-gd); border-color: var(--pg-gd); border-radius: 12px; padding: 14px; font-weight: 700; }
.pg-login .login-form h1 { font-size: 22px !important; font-weight: 800; color: #0f2433 !important; text-align: left !important; }
.pg-login .ge-portal-logo { display: none; }
@media (max-width: 860px) {
    .pg-login { grid-template-columns: 1fr; }
    .pg-login .pg-lado { display: none; }
    .pg-login .ge-portal-logo { display: block; }
}

.pg-marca { display: none; }
@media (min-width: 768px) {
    .pg-marca { display: flex; grid-column: 1; grid-row: 1; }
    .pm-menu { grid-row: 1; }
    .pm-acciones { grid-row: 1; }
}

/* el formulario de entrada: etiquetas arriba, campos claros (sin el amarillo de los avisos del navegador) */
.pg-login .login-form .form-control,
.pg-login .login-form .form-control:-webkit-autofill {
    background-color: #fbfdfc !important; -webkit-box-shadow: 0 0 0 40px #fbfdfc inset !important; color: #0f2433 !important;
}
.pg-login .login-form .form-control:focus { border-color: var(--pg-g); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pg-g) 22%, transparent) !important; }
.pg-login .login-form .card-footer { background: #fff !important; }
.pg-login .login-form .pg-sub { color: var(--pg-mut); font-size: 14px; margin: 4px 0 18px; text-align: left; }
.pg-login .login-form .pg-label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: #0f2433; }
.pg-login .pg-enlace { color: var(--pg-gd); font-weight: 700; font-size: 13.5px; text-align: center; text-decoration: underline; }
.pg-login .pg-primera { margin: 0; text-align: center; font-size: 13px; color: var(--pg-mut); }
.pg-login .pg-logo img { height: 34px; }

.pg-login .login-form .pg-titulo { font-size: 24px; font-weight: 800; color: #0f2433; letter-spacing: -.02em; }
.pg-login .login-form .form-control:focus, .pg-login .login-form .form-control:active { background-color: #fbfdfc !important; background-image: none !important; }
.pg-login .pg-logo { font-size: 18px; }
.pg-login .pg-logo img { height: 34px; width: 34px; border-radius: 10px; }

/* tickets como conversación */
.pg-chat-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.pg-chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pg-burbuja { max-width: 82%; padding: 12px 14px; border-radius: 18px; background: #fff; border: 1px solid var(--pg-linea); box-shadow: var(--pg-sombra); }
.pg-burbuja small { display: block; margin-top: 6px; font-size: 11.5px; color: var(--pg-mut); }
.pg-burbuja.mio { align-self: flex-end; background: color-mix(in srgb, var(--pg-g) 14%, #fff); border-color: color-mix(in srgb, var(--pg-g) 35%, #fff); border-bottom-right-radius: 6px; }
.pg-burbuja.de-ellos { align-self: flex-start; border-bottom-left-radius: 6px; }
.pg-responder { display: flex; gap: 10px; align-items: flex-end; position: sticky; bottom: 0; background: #f3f8f6; padding: 10px 0; }
.pg-responder textarea { flex: 1; border: 1.5px solid var(--pg-linea); border-radius: 14px; padding: 10px 12px; font: inherit; resize: vertical; }
@media (min-width: 768px) { .pg-chat, .pg-chat-cab, .pg-responder { max-width: 820px; } }

/* pago parcial */
.pg-partes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.pg-parte { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; border-radius: 14px; border: 1.5px solid var(--pg-linea); background: #fff; font-weight: 800; color: var(--pg-gd); text-decoration: none; }
.pg-parte small { font-weight: 600; color: var(--pg-mut); }
.pg-parte.on { background: var(--pg-gd); color: #fff; border-color: var(--pg-gd); }
.pg-parte.on small { color: rgba(255, 255, 255, .8); }
.pg-otro { display: flex; gap: 10px; margin-bottom: 14px; }
.pg-otro input { flex: 1; border: 1.5px solid var(--pg-linea); border-radius: 12px; padding: 10px 12px; font: inherit; }

/* la tienda, con el formato de la tienda online: filtros de familias a un lado, tarjetas con marca, precio y «+» redondo */
.pg-tienda { display: block; }
.pg-filtros { display: none; }
.pg-cuenta { display: flex; justify-content: space-between; align-items: center; color: var(--pg-mut); margin: 6px 0 12px; font-size: 14px; }
.pg-cuenta strong { color: #0f2433; }
.pg-mios { font-weight: 700; color: var(--pg-gd); }
.pg-rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pg-art { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--pg-sombra); }
.pg-art:hover { box-shadow: 0 8px 26px rgba(12, 42, 71, .12); }
.pg-art-foto { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; padding: 14px; background: #fff; }
.pg-art-foto img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pg-art-foto i { font-size: 40px; color: var(--pg-g); opacity: .35; }
.pg-nuevo { position: absolute; top: 12px; left: 12px; background: var(--pg-g); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; border-radius: 999px; padding: 4px 10px; z-index: 1; }
.pg-art-datos { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pg-marca-art { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--pg-gd); }
.pg-art-nombre { font-weight: 600; font-size: 14px; line-height: 1.35; color: #0f2433; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pg-art-pie { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.pg-art-precio { font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.pg-art-pie small { color: var(--pg-mut); font-size: 11.5px; }
.pg-mas { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--pg-gd); color: #fff; font-size: 16px; cursor: pointer; display: grid; place-items: center; }
.pg-migas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--pg-mut); margin-bottom: 14px; }
.pg-migas i { font-size: 10px; opacity: .6; }
.pg-migas span { color: #0f2433; }
.pg-ficha { display: grid; gap: 18px; }
.pg-ficha-foto { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); display: grid; place-items: center; padding: 18px; min-height: 280px; }
.pg-ficha-foto img { max-width: 100%; max-height: 520px; object-fit: contain; }
.pg-ficha-titulo { font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 8px; }
.pg-ficha-ref { color: var(--pg-mut); font-size: 13.5px; }
.pg-ficha-precio { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin-top: 18px; }
.pg-ficha-iva { color: var(--pg-mut); }
.pg-stock { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-size: 14px; font-weight: 600; }
.pg-stock i { width: 9px; height: 9px; border-radius: 50%; background: var(--pg-g); }
.pg-stock.no i { background: #d97706; }
.pg-comprar { display: flex; gap: 12px; align-items: stretch; margin: 6px 0 18px; }
.pg-cant { display: flex; align-items: center; border: 1.5px solid var(--pg-linea); border-radius: 12px; background: #fff; }
.pg-cant button { width: 38px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--pg-mut); }
.pg-cant input { width: 48px; border: 0; text-align: center; font: 700 16px/1 inherit; -moz-appearance: textfield; }
.pg-btn.pg-grande { flex: 1; padding: 14px 18px; font-size: 15px; }
.pg-ficha-desc { border-top: 1px solid var(--pg-linea); padding-top: 14px; line-height: 1.6; color: #2a3b48; }

@media (min-width: 768px) {
    .pg-rejilla { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
    .pg-ficha { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 26px; }
}
@media (min-width: 1100px) {
    .pg-tienda { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
    .pg-filtros { display: block; position: sticky; top: 84px; }
    .pg-chips-movil { display: none; }
    .pg-limpiar { display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--pg-g) 14%, #fff); color: var(--pg-gd); font-weight: 700; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
    .pg-fams { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 14px 8px; max-height: 70vh; overflow: auto; }
    .pg-fams-t { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pg-mut); padding: 0 10px 8px; }
    .pg-fams a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 10px; font-weight: 600; font-size: 14px; color: #0f2433; }
    .pg-fams a small { color: var(--pg-mut); font-weight: 600; }
    .pg-fams a:hover { background: #f3f8f6; }
    .pg-fams a.on { background: color-mix(in srgb, var(--pg-g) 16%, #fff); color: var(--pg-gd); }
}
@media (min-width: 1500px) { .pg-rejilla { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* la cesta, con el formato de la tienda online: el pedido a la izquierda y el resumen a la derecha */
.pg-cesta { display: grid; gap: 16px; }
.pg-caja { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 18px; box-shadow: var(--pg-sombra); margin-bottom: 16px; }
.pg-caja-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pg-caja-cab h2 { font-size: 18px; font-weight: 800; margin: 0; }
.pg-vaciar { background: none; border: 0; color: var(--pg-mut); font-weight: 600; cursor: pointer; }
.pg-lin { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px 12px; align-items: center; border: 1px solid var(--pg-linea); border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.pg-lin-foto { width: 64px; height: 64px; display: grid; place-items: center; background: #fff; border: 1px solid var(--pg-linea); border-radius: 12px; overflow: hidden; }
.pg-lin-foto img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pg-lin-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pg-lin-txt b { font-size: 14px; }
.pg-lin-txt span { font-size: 12.5px; color: var(--pg-mut); }
.pg-lin .pg-cant { grid-column: 2; justify-self: start; }
.pg-lin .pg-cant form { display: contents; }
.pg-lin .pg-cant > span { min-width: 40px; text-align: center; font-weight: 800; }
.pg-lin-imp { font-weight: 800; font-size: 16px; justify-self: end; }
.pg-lin-x { border: 0; background: none; color: var(--pg-mut); cursor: pointer; font-size: 16px; }
.pg-campo { display: block; font-size: 12.5px; font-weight: 700; color: var(--pg-mut); margin-bottom: 12px; }
.pg-campo select { display: block; width: 100%; margin-top: 6px; border: 1.5px solid var(--pg-linea); border-radius: 12px; padding: 11px 12px; font: 600 14px/1.2 inherit; background: #fff; color: #0f2433; }
.pg-cupon { display: flex; gap: 10px; }
.pg-cupon input { flex: 1; border: 1.5px solid var(--pg-linea); border-radius: 12px; padding: 10px 12px; font: inherit; }
.pg-res { display: flex; justify-content: space-between; padding: 7px 0; color: #2a3b48; }
.pg-res.total { border-top: 1px solid var(--pg-linea); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 20px; color: #0f2433; margin-bottom: 14px; }
@media (min-width: 1000px) {
    .pg-cesta { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
    .pg-cesta-der { position: sticky; top: 84px; }
    .pg-lin { grid-template-columns: 64px 1fr auto auto 28px; }
    .pg-lin .pg-cant { grid-column: auto; justify-self: auto; }
}

/* un documento: las líneas y los totales a la izquierda; el pago, el PDF y la firma en la columna de la derecha */
.pg-doc-total { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pg-doc-total small { color: var(--pg-mut); font-weight: 600; }
.pg-doc-total strong { font-size: 30px; letter-spacing: -.02em; }
.pg-doc-lado .pm-boton { width: 100%; max-width: none; margin: 0 0 10px; }
@media (min-width: 1000px) {
    .pg-doc2 { grid-template-columns: minmax(0, 1fr) 380px; }
    .pg-doc-lado { position: sticky; top: 84px; }
}

/* pagar: a dos columnas y sin estirarse (el importe a la izquierda, las formas de pago a la derecha) */
.pg-pago { max-width: 1060px; margin: 0 auto; display: grid; gap: 16px; }
.pg-pago-der .pm-pasarelas { max-width: 520px; }
.pg-pago-izq .pm-boton { max-width: none; width: 100%; margin-top: 8px; }
@media (min-width: 900px) {
    .pg-pago { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

/* las páginas de dos columnas no se estiran en pantallas muy anchas */
.pg-doc2, .pg-cesta, .pg-ficha { max-width: 1180px; margin-left: auto; margin-right: auto; }

/* mi perfil en pantalla ancha: datos del cliente, contactos y conversaciones, en tres columnas */
.pg-cuenta3 { display: grid; gap: 16px; }
.pg-col-t { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pg-mut); margin: 4px 0 10px; }
.pg-conv { display: block; background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 12px; margin-bottom: 12px; color: inherit; box-shadow: var(--pg-sombra); }
.pg-conv-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pg-conv .pg-burbuja { max-width: 92%; margin-bottom: 6px; padding: 8px 12px; border-radius: 14px; }
@media (min-width: 1100px) {
    .pg-cuenta3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; max-width: 1400px; margin: 0 auto; }
}
@media (min-width: 700px) and (max-width: 1099px) {
    .pg-cuenta3 { max-width: 640px; margin: 0 auto; }
}

/* pagos: en pantalla ancha la lista a la izquierda y, al lado, el PDF del documento que se señala, para saber qué se paga */
.pg-pagos-visor { display: none; }
.pg-rec-acc { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pg-rec-acc .pg-btn { flex: 1; }
.pg-rec.on { border-color: var(--pg-g); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pg-g) 22%, transparent); }
@media (min-width: 1100px) {
    .pg-pagos { display: grid; grid-template-columns: minmax(380px, 460px) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1400px; margin: 0 auto; }
    .pg-pagos-visor { display: block; position: sticky; top: 84px; }
    .pg-pagos-visor .pg-visor { display: block; }
    .pg-pagos-visor iframe { height: 78vh; }
    .pg-solo-movil { display: none; }
    .pg-rec { cursor: pointer; }
}

/* las familias de la tienda, con su imagen */
@media (min-width: 1100px) {
    .pg-fams a { align-items: center; justify-content: flex-start; }
    .pg-fams a span { flex: 1; }
    .pg-fam-img { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--pg-linea); padding: 2px; flex: none; }
    .pg-fam-ico { display: grid; place-items: center; font-size: 14px; color: var(--pg-g); opacity: .6; }
}

/* «Volver» en pantalla ancha (en el móvil está la flecha de la cabecera) */
.pg-volver { display: none; }
@media (min-width: 768px) {
    .pg-volver { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--pg-mut); margin-bottom: 12px; }
    .pg-volver:hover { color: var(--pg-gd); }
}

/* el filtro por años de los documentos */
.pg-anios { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.pg-anios a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--pg-linea); background: #fff; font-weight: 700; font-size: 13px; color: var(--pg-mut); }
.pg-anios a.on { background: var(--pg-gd); border-color: var(--pg-gd); color: #fff; }

/* un documento en pantalla ancha: acciones y líneas a la izquierda, el PDF abierto en la segunda columna */
.pg-sinfoto { display: grid; place-items: center; color: var(--pg-g); opacity: .7; background: #f3f8f6; }
.pg-doc-pdf { display: none; }
.pg-doc-lado { margin-bottom: 14px; }
@media (min-width: 1000px) {
    .pg-doc2 { grid-template-columns: minmax(380px, 520px) minmax(0, 1fr); max-width: 1500px; }
    .pg-doc-lado { position: static; }
    .pg-doc-pdf { display: block; position: sticky; top: 84px; }
    .pg-doc-pdf iframe { height: 80vh; }
}

/* filtros de la tienda: subfamilias, fabricantes, stock, precio y características */
.pg-filtros .pg-fams { margin-bottom: 14px; }
.pg-fams a.pg-nivel1 { padding-left: 30px; font-weight: 500; }
.pg-fams a.pg-nivel2 { padding-left: 48px; font-weight: 500; font-size: 13px; }
.pg-chk { gap: 8px; }
.pg-chk i { color: var(--pg-mut); }
.pg-chk.on i { color: var(--pg-gd); }
.pg-precio { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; padding: 0 8px; }
.pg-precio input { width: 100%; border: 1.5px solid var(--pg-linea); border-radius: 10px; padding: 8px; font: inherit; }
.pg-precio button { grid-column: 1 / -1; }
.pg-filtrar-movil { margin: 0 0 10px; }
@media (max-width: 1099px) {
    .pg-filtros.abierto { display: block; margin-bottom: 14px; }
    .pg-filtros.abierto .pg-fams { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 12px 8px; }
    .pg-filtros.abierto .pg-fams a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; color: #0f2433; font-weight: 600; }
    .pg-filtros.abierto .pg-fams a.on { color: var(--pg-gd); }
    .pg-filtros.abierto .pg-fams-t { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pg-mut); padding: 0 10px 6px; }
    .pg-filtros.abierto .pg-fams a { align-items: center; justify-content: flex-start; }
    .pg-filtros.abierto .pg-fams a span { flex: 1; }
    .pg-filtros.abierto .pg-fam-img { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--pg-linea); padding: 2px; flex: none; }
    .pg-filtros.abierto .pg-fam-ico { display: grid; place-items: center; font-size: 14px; color: var(--pg-g); opacity: .6; }
}
@media (min-width: 1100px) { .pg-filtrar-movil { display: none; } }

/* el PDF de la segunda columna aprovecha todo el alto y el ancho que queda */
@media (min-width: 1000px) {
    .pg-doc2 { max-width: none; grid-template-columns: minmax(380px, 480px) minmax(0, 1fr); }
    .pg-doc-pdf iframe { height: calc(100vh - 150px); min-height: 560px; }
}

/* firmar: en pantalla ancha el documento a la izquierda y, al lado, la firma (sin estirarse); en el móvil, como estaba */
.pg-firmar { display: grid; gap: 16px; }
.pg-firmar-der canvas { max-width: 100%; border-radius: 12px; }
@media (min-width: 1000px) {
    .pg-firmar { grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); align-items: start; max-width: 1400px; margin: 0 auto; }
    .pg-firmar-izq .pg-doc-pdf { display: block; position: static; }
    .pg-firmar-izq .pg-doc-pdf iframe { height: calc(100vh - 230px); min-height: 520px; }
    .pg-firmar-der { position: sticky; top: 84px; }
}

/* los tipos de documento, cada uno de su color y con su dibujito */
.pm-subpestanas a { display: inline-flex; align-items: center; gap: 8px; }
.pg-t-ico { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; color: var(--tc); background: color-mix(in srgb, var(--tc) 16%, #fff); }
.pg-t-facturas { --tc: #0f9d6b; }
.pg-t-pedidos { --tc: #e27d12; }
.pg-t-albaranes { --tc: #2f7fd8; }
.pg-t-presupuestos { --tc: #8a5cd6; }
.pm-subpestanas a.on[class*="pg-t-"], .pm-subpestanas a.on[class*="pg-t-"]:hover { background: var(--tc); border-color: var(--tc); color: #fff; }
.pm-subpestanas a.on .pg-t-ico { background: rgba(255, 255, 255, .22); color: #fff; }
.pm-subpestanas a[class*="pg-t-"]:not(.on):hover { border-color: var(--tc); }

/* el lateral de la tienda: todo en un solo scroll, y cada bloque se pliega pulsando su título */
@media (min-width: 1100px) {
    .pg-filtros { max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
    .pg-filtros .pg-fams { max-height: none; overflow: visible; }
}
.pg-fams-t { cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.pg-fams-t::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 10px; opacity: .55; transition: transform .15s; }
.pg-fams.plegado .pg-fams-t::after { transform: rotate(-90deg); }
.pg-fams.plegado > :not(.pg-fams-t) { display: none !important; }

/* lo que más compra el cliente */
.pg-pestanas-tienda { display: flex; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.pg-pestanas-tienda a { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--pg-linea); background: #fff; font-weight: 700; font-size: 13.5px; color: var(--pg-mut); }
.pg-pestanas-tienda a.on { background: var(--pg-gd); border-color: var(--pg-gd); color: #fff; }
.pg-consumo { font-size: 12px; color: var(--pg-gd); font-weight: 600; }
.pg-consumo i { margin-right: 4px; }

/* pagar a tres columnas: el importe, el detalle de lo que se paga (con imágenes) y las formas de pago */
.pg-pago-det { display: none; }
.pg-det-cab { font-weight: 800; margin-bottom: 10px; }
.pg-nav:focus-visible, .pg-nav:focus { outline: none; border-color: var(--pg-g); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pg-g) 28%, transparent); }
@media (min-width: 900px) {
    .pg-pago-det { display: block; }
    .pg-pago { max-width: 1060px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "izq der" "det der"; }
    .pg-pago-izq { grid-area: izq; }
    .pg-pago-det { grid-area: det; }
    .pg-pago-der { grid-area: der; }
}
@media (min-width: 1300px) {
    .pg-pago { max-width: 1500px; grid-template-columns: minmax(280px, .9fr) minmax(340px, 1.2fr) minmax(300px, 1fr); grid-template-areas: "izq det der"; }
}

/* tickets: la lista a la izquierda, el chat con los datos de la empresa a la derecha (en el móvil, una cosa cada vez) */
.pg-tk { display: grid; gap: 16px; }
.pg-tk-item.on { border-color: var(--pg-g); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pg-g) 22%, transparent); }
.pg-empresa { margin-bottom: 14px; }
.pg-empresa-n { font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.pg-dato { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.pg-dato i { width: 18px; color: var(--pg-mut); text-align: center; }
.pg-dato span { flex: 1; min-width: 0; }
.pg-dato .pg-btn { padding: 6px 12px; font-size: 13px; flex: none; }
.pg-btn.pg-wa { background: #1fa855; color: #fff; border-color: #1fa855; }
.pg-wa-ancho { width: 100%; margin-top: 10px; }
@media (min-width: 1000px) {
    .pg-tk { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); align-items: start; max-width: 1300px; margin: 0 auto; }
    .pg-tk-lista { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
    .pg-tk .pg-chat, .pg-tk .pg-chat-cab, .pg-tk .pg-responder { max-width: none; }
}
@media (max-width: 999px) { .pg-solo-ancho { display: none; } }

/* en el móvil, todo más simple: la tarjeta de la empresa son solo sus botones (llamar, WhatsApp, correo, mapa) */
@media (max-width: 999px) {
    .pg-empresa { padding: 12px; }
    .pg-empresa-n { font-size: 15px; margin-bottom: 8px; }
    .pg-empresa-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .pg-dato { display: contents; }
    .pg-dato i, .pg-dato span { display: none; }
    .pg-dato .pg-btn { width: 100%; justify-content: center; padding: 10px; }
    .pg-tk .pg-chat-cab { margin-top: 4px; }
    .pg-tk .pg-burbuja { max-width: 90%; }
}

/* editar el perfil: en pantalla ancha, tres columnas (personales, contacto, dirección y redes) y la contraseña debajo */
.pg-perfil-acciones { margin: 8px 0 18px; max-width: 360px; }
.pg-clave { background: #fff; border: 1px solid var(--pg-linea); border-radius: var(--pg-radio); padding: 16px; margin-bottom: 24px; }
.pg-clave-campos { display: grid; gap: 0 12px; }
@media (min-width: 1100px) {
    .pg-perfil .pg-cuenta3 { max-width: 1400px; }
    .pg-clave { max-width: 1400px; margin-left: auto; margin-right: auto; }
    .pg-clave-campos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pg-perfil-acciones { max-width: 1400px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 700px) and (max-width: 1099px) { .pg-perfil .pg-cuenta3 { max-width: none; } }

/* la cabecera con el logotipo de la empresa en blanco (sobre el verde) y una barra algo más alta */
.pg-logo-blanco { filter: brightness(0) invert(1); }
@media (min-width: 768px) {
    .pg-marca { height: 88px; }
    .pg-marca .pg-logo-blanco { height: 54px; max-width: 240px; border-radius: 0; }
    .pm-menu a, .pm-menu a.on { padding: 12px 16px; font-size: 15px; }
}
@media (max-width: 767px) {
    .pg-marca .pg-logo-blanco { height: 30px; width: auto; max-width: 140px; object-fit: contain; }
}

/* las ventanas de las pasarelas de pago (transferencia, etc.): cerradas hasta que se pulsa su botón */
.modal { display: none; position: fixed; inset: 0; z-index: 1055; background: rgba(15, 36, 51, .55); overflow: auto; padding: 16px; }
.modal.show { display: block; }
.modal-dialog { max-width: 560px; margin: 6vh auto; }
.modal-content { background: #fff; border-radius: var(--pg-radio, 16px); box-shadow: 0 30px 80px rgba(4, 47, 41, .35); overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--pg-linea); }
.modal-title { margin: 0; font-size: 17px; font-weight: 800; }
.modal-body { padding: 18px 20px; }
.modal-footer { padding: 12px 20px 18px; display: flex; justify-content: flex-end; }
.modal .btn-close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #eef3f1; color: #0f2433; cursor: pointer; font-size: 0; position: relative; }
.modal .btn-close::before { content: "\00d7"; font-size: 22px; line-height: 34px; }

/* quién ha entrado (la empresa del cliente), en la barra de cualquier pantalla del portal */
.pg-quien { display: none; }
@media (min-width: 768px) {
    .pm-acciones a.pg-quien { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 10px; max-width: 280px; text-align: right; }
    .pg-quien strong { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .pg-quien small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}

/* el nombre de la empresa en la barra no se recorta: ocupa lo que mide (hasta 320 px) */
@media (min-width: 768px) {
    .pm-acciones a.pg-quien { flex: 0 0 auto; min-width: max-content; max-width: 320px; }
    .pg-quien strong, .pg-quien small { max-width: 320px; }
}

/* el logotipo de la empresa, en blanco, a la izquierda del acceso */
.pg-login .pg-logo img.pg-logo-grande { flex: none; width: min(360px, 90%); height: auto; max-width: none; border-radius: 0; }
.pg-login .pg-lado.con-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: 0; margin: 18px 0 8px; }

/* perfil: columna 1 datos personales + contacto, columna 2 dirección y redes, columna 3 empresa; guardar y firmar en una fila */
.pg-colstack { display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 1100px) {
    .pg-perfil-acciones.pg-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 1400px; }
}
.pg-perfil-acciones.pg-dos { max-width: none; }
.pg-perfil-acciones.pg-dos .pm-boton { margin: 0; }
@media (max-width: 1099px) { .pg-perfil-acciones.pg-dos { display: grid; gap: 10px; } }

/* móvil: «quién ha entrado» ya sale bajo el título (la regla .pm-acciones a lo volvía a enseñar encima de los iconos);
   la tienda no repite «Mis últimos consumos / Todo el catálogo» (ya están en las fichas de arriba) y el «38 artículos» va junto */
@media (max-width: 767px) {
    .pm-acciones a.pg-quien { display: none; }
}
@media (max-width: 1099px) { .pg-chips-movil ~ .pg-pestanas-tienda { display: none; } }
.pg-cuenta { justify-content: flex-start; gap: 5px; }

/* pantalla grande: el menú en una sola línea (antes «Mi perfil» caía debajo); sin el hueco antes de «Cesta» */
@media (min-width: 768px) {
    .pm-menu { flex-wrap: nowrap; gap: 2px; min-width: 0; }
    .pm-menu a, .pm-menu a.on { white-space: nowrap; padding: 10px 12px; }
    .pm-menu a[href*="p=cesta"] { margin-left: 0; }
}
@media (min-width: 768px) and (max-width: 1499px) {
    .pm-acciones a.pg-quien { max-width: 230px; min-width: 0; }
    .pg-quien strong, .pg-quien small { max-width: 230px; }
}
@media (min-width: 768px) and (max-width: 1279px) {
    .pm-menu a, .pm-menu a.on { padding: 8px 8px; font-size: 13.5px; }
    .pm-acciones a.pg-quien { display: none; }
}

/* tablet (768-1099): no caben marca, menú e iconos en una fila → el menú baja a una segunda fila de la cabecera;
   el perfil, a dos columnas (la tercera cae debajo de la primera) */
@media (min-width: 768px) and (max-width: 1099px) {
    .pm-cabecera { grid-template-columns: auto 1fr; row-gap: 0; }
    .pm-acciones { grid-column: 2; grid-row: 1; justify-self: end; }
    .pm-menu { grid-column: 1 / -1; grid-row: 2; justify-content: center; padding: 0 0 10px; }
    .pm-menu a, .pm-menu a.on { padding: 8px 12px; font-size: 14px; }
    .pm-acciones a.pg-quien { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 8px; max-width: 300px; }
    .pg-marca { height: 64px; }
    .pg-cuenta3, .pg-perfil .pg-cuenta3 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; max-width: none; }
}
