/* Eurowin2026 · mismo sistema de diseño que la capa de gestión sobre SAP (colores, tipografía, componentes). */
:root {
  --marino: #1a2c6c; --marino2: #15428b; --negro: #2d2e30; --sel: #1672c0; --boton: #e8f1fc; --boton-borde: #a8c6ee;
  --cian: #0879bd; --verde: #2fbf68; --rojo: #ff6f61; --gris: #e6e6e6; --gris2: #c8c8c8; --gris3: #b4b4b4; --tinta: #1b2a5e;
  --fondo: #eef0f4; --borde: #d5d8de; --texto: #1c1d21; --suave: #6b7280;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: 'Poppins', 'Segoe UI', Arial, sans-serif; font-size: 13px; color: var(--texto); background: var(--fondo); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--marino2); text-decoration: none; }
[hidden] { display: none !important; }
svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
svg[fill="none"], svg [fill="none"] { fill: none; }
.logo { font-weight: 600; letter-spacing: .28em; color: #fff; font-size: 1.1rem; display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; flex: none; }
.logo i { font-style: normal; letter-spacing: .08em; font-size: .7rem; background: radial-gradient(circle at 40% 40%, #35c8ff, #0b62c9); border-radius: 50%; width: 2rem; height: 2rem; display: inline-grid; place-items: center; }
.d { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: #d32f2f; }
.suave { color: var(--suave); }
.peq { font-size: .85em; }

/* ---------- inicio de sesión ---------- */
#login { height: 100%; display: grid; place-items: center; background: linear-gradient(160deg, #0b63c5, #1378d6 60%, #0a4fa3); }
.login-caja { width: min(46rem, 94vw); background: #e4e5e9; box-shadow: 0 .6rem 2.5rem #0007; }
.login-cab { background: var(--marino); color: #fff; height: 3.4rem; display: flex; align-items: center; padding: 0 1.2rem; gap: 1rem; }
.login-cab b { flex: 1; text-align: center; font-weight: 400; font-size: 1.05rem; }
.login-cuerpo { padding: 2rem 4rem 1.4rem; }
.login-tit { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.4rem; }
.login-tit svg { font-size: 3rem; color: var(--marino); }
.login-tit b { display: block; font-size: 1.1rem; font-weight: 500; } .login-tit span { font-size: .9rem; }
.login-campo { display: flex; align-items: center; background: #fff; height: 3rem; margin-bottom: .3rem; border-bottom: .15rem solid transparent; }
.login-campo:focus-within { border-bottom-color: var(--marino); }
.login-campo svg { font-size: 1.8rem; margin: 0 .6rem; color: #e39a12; }
.login-campo select { flex: 1; min-width: 0; border: 0; outline: 0; height: 100%; font: inherit; font-size: 1rem; background: transparent; color: inherit; cursor: pointer; }
.login-campo input { flex: 1; border: 0; outline: 0; height: 100%; font-size: 1rem; background: transparent; }
.login-error { color: #c62828; min-height: 1.4rem; margin: .5rem 0; font-weight: 500; }
.login-botones { display: flex; gap: 1rem; }
.login-botones button { width: 10rem; height: 3.2rem; border: 0; color: #fff; font-size: 2rem; line-height: 1; }
.b-verde { background: var(--verde); } .b-rojo { background: var(--rojo); }

/* ---------- estructura ---------- */
#app { height: 100%; display: grid; grid-template-rows: 3.2rem auto 1fr 1.5rem; grid-template-columns: minmax(0, 1fr); }
.barra { background: var(--marino); color: #fff; display: flex; align-items: center; padding: 0 .4rem 0 .9rem; gap: 1.4rem; }
#menu { display: flex; gap: .15rem; flex: 1; height: 100%; align-items: stretch; }
#menu a, #menu .grupo > button { color: #dfe6f5; padding: 0 .8rem; display: flex; align-items: center; font-weight: 500; font-size: .86rem; letter-spacing: .02em; white-space: nowrap; cursor: pointer; }
#menu a:hover, #menu .grupo:hover > button { background: #ffffff18; color: #fff; }
#menu .grupo > button { background: none; border: 0; }
#menu a.activo { background: var(--sel); color: #fff; }
#menu .grupo { position: relative; display: flex; }
#menu .grupo .sub { display: none; position: absolute; top: 100%; left: 0; background: #fff; color: var(--texto); min-width: 14rem; box-shadow: 0 .5rem 1.5rem #0004; z-index: 20; padding: .3rem 0; }
@media (hover: hover) and (min-width: 64.0625rem) { #menu .grupo:hover .sub { display: block; } }
#menu .grupo.abierto .sub { display: block; }
#menu .sub a { color: var(--texto); padding: .45rem 1rem; font-weight: 400; }
#menu .sub a:hover { background: var(--boton); color: var(--marino); }
#menu .sub hr { border: 0; border-top: 1px solid var(--borde); margin: .3rem 0; }
#menu .sub small { display: block; padding: .3rem 1rem 0; color: var(--suave); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.barra-datos { font-size: .75rem; display: grid; text-align: right; line-height: 1.3; }
.apagar { background: none; border: 0; color: #fff; font-size: 1.9rem; display: grid; place-items: center; padding: 0 .3rem; }
footer { background: var(--marino2); color: #fff; font-size: .7rem; display: flex; align-items: center; padding: 0 .9rem; gap: 1.5rem; }
footer #pie-ayuda { flex: 1; text-align: center; opacity: .85; }
main { overflow: auto; padding: .8rem 1rem; min-height: 0; }

/* ---------- componentes ---------- */
h1 { font-size: 1.15rem; font-weight: 500; color: var(--marino); margin: 0 0 .6rem; display: flex; align-items: center; gap: .8rem; }
h1 small { font-weight: 400; color: var(--suave); font-size: .8rem; }
h2 { font-size: .8rem; font-weight: 600; color: var(--marino2); text-transform: uppercase; letter-spacing: .06em; margin: 1rem 0 .4rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: end; margin-bottom: .6rem; }
.filtros label { display: grid; gap: .15rem; font-size: .72rem; color: var(--suave); }
.filtros input, .filtros select { height: 2.1rem; border: 1px solid var(--borde); background: #fff; padding: 0 .5rem; border-radius: .2rem; min-width: 8rem; }
.filtros input.principal { min-width: 22rem; font-size: .95rem; }
.filtros input:focus, .filtros select:focus { outline: 2px solid var(--sel); outline-offset: -1px; }
.filtros .n { align-self: center; color: var(--suave); font-size: .78rem; margin-left: auto; }
.bt { height: 2.1rem; padding: 0 .9rem; border: 1px solid var(--boton-borde); background: var(--boton); color: var(--marino); border-radius: .2rem; font-weight: 500; font-size: .82rem; }
.bt:hover { background: #d8e8fb; }
.bt.primario { background: var(--sel); color: #fff; border-color: var(--sel); }
.bt.peligro { background: #fff1f0; border-color: #f3b1a8; color: #b3261e; }
.bt:disabled { opacity: .5; cursor: default; }
.panel { background: #fff; border: 1px solid var(--borde); border-radius: .25rem; }
.lista { background: #fff; border: 1px solid var(--borde); border-radius: .25rem; overflow: auto; max-height: calc(var(--vh, 100vh) - 12rem); }
table { border-collapse: collapse; width: 100%; }
th { background: var(--negro); color: #fff; font-weight: 500; font-size: .68rem; text-align: left; padding: .4rem .5rem; position: sticky; top: 0; white-space: nowrap; z-index: 1; }
th.d { text-align: right; }
td { padding: .3rem .5rem; border-bottom: 1px solid #eef0f3; font-size: .8rem; vertical-align: top; }
tbody tr { cursor: default; }
tbody tr:hover td { background: #f3f7fd; }
tbody tr.sel td { background: var(--sel); color: #fff; }
tbody tr.sel td a, tbody tr.sel .neg, tbody tr.sel .suave { color: #fff; }
tr.cerrado td { color: var(--suave); }
tr.anulado td { color: #b3261e; text-decoration: line-through; }
.vacio { padding: 2rem; text-align: center; color: var(--suave); }
.etiqueta { display: inline-block; padding: .05rem .45rem; border-radius: .7rem; font-size: .68rem; font-weight: 500; background: var(--gris); color: #333; white-space: nowrap; }
.etiqueta.abierto { background: #e3f3e8; color: #1b6b3a; }
.etiqueta.cerrado { background: var(--gris); color: #555; }
.etiqueta.anulado { background: #fde3e0; color: #b3261e; }
.etiqueta.vencida { background: #fff3cd; color: #8a5a00; }
.etiqueta.aviso { background: #fff3cd; color: #8a5a00; }

/* ficha */
.ficha { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: .8rem; align-items: start; }
.ficha.ancha { grid-template-columns: 1fr; }
.datos { background: #fff; border: 1px solid var(--borde); border-radius: .25rem; padding: .7rem .9rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .35rem 1.2rem; }
.datos label { display: grid; font-size: .68rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.datos label b { font-weight: 500; color: var(--texto); font-size: .85rem; text-transform: none; letter-spacing: 0; white-space: pre-line; }
.datos label.doble { grid-column: span 2; }
.lateral { display: grid; gap: .8rem; }
.cifras { background: #fff; border: 1px solid var(--borde); border-radius: .25rem; padding: .6rem .9rem; display: grid; gap: .3rem; }
.cifras div { display: flex; justify-content: space-between; font-size: .82rem; }
.cifras div b { font-weight: 600; }
.cifras div.total { border-top: 1px solid var(--borde); padding-top: .3rem; margin-top: .2rem; font-size: .9rem; }
.pestanas { display: flex; gap: .15rem; border-bottom: 2px solid var(--marino); margin-top: .9rem; flex-wrap: wrap; }
.pestanas button { background: #dde2ea; border: 0; padding: .4rem .9rem; font-size: .8rem; font-weight: 500; color: #333; border-radius: .25rem .25rem 0 0; }
.pestanas button.activa { background: var(--marino); color: #fff; }
.pestanas a.bt-pest { background: #dde2ea; padding: .4rem .9rem; font-size: .8rem; font-weight: 500; color: #333; border-radius: .25rem .25rem 0 0; text-decoration: none; white-space: nowrap; }
.pestanas a.bt-pest.activa { background: var(--marino); color: #fff; }
#cc-vistas { margin-bottom: .7rem; }
.cc-barra { display: inline-block; width: 90px; height: 8px; background: var(--linea, #ddd); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.cc-barra i { display: block; height: 100%; background: var(--primario, #2a6); }
.ce-res-lin .hecho { color: var(--ok, #2a7); font-weight: 600; }
.tpv-atajos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tpv-atajos .bt { flex: 1 1 auto; }
.panel-aviso.suave { background: #eef1f6; border-left-color: #9aa7bd; color: #3b4658; }
.pestanas button small { font-weight: 400; opacity: .8; margin-left: .3rem; }
.pest-cuerpo { background: #fff; border: 1px solid var(--borde); border-top: 0; max-height: 50vh; overflow: auto; }
.pest-cuerpo table th { position: sticky; }

/* mapa relacional */
.mapa { display: grid; grid-template-columns: 1fr auto 1fr; gap: .8rem; align-items: center; background: #fff; border: 1px solid var(--borde); border-radius: .25rem; padding: .7rem .9rem; }
.mapa .col { display: grid; gap: .35rem; }
.mapa .col h3 { margin: 0; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); font-weight: 600; }
.mapa .doc { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .6rem; align-items: center; border: 1px solid var(--borde); border-radius: .25rem; padding: .35rem .6rem; background: #f8f9fb; font-size: .8rem; }
.mapa .doc.este { background: var(--marino); color: #fff; border-color: var(--marino); }
.mapa .doc.este a, .mapa .doc.este .suave { color: #fff; }
.mapa .doc b { font-weight: 600; }
.mapa .doc.anulado { opacity: .7; text-decoration: line-through; }
.mapa .centro { display: flex; align-items: center; gap: .5rem; }
.mapa .flecha { font-size: 1.6rem; color: var(--gris3); }
.mapa .nada { color: var(--suave); font-size: .78rem; font-style: italic; }

/* inicio */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.tarjeta { background: #fff; border: 1px solid var(--borde); border-left: .3rem solid var(--marino2); border-radius: .25rem; padding: .6rem .9rem; display: grid; gap: .1rem; color: inherit; }
.tarjeta:hover { background: #f3f7fd; }
.tarjeta span { font-size: .72rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.tarjeta b { font-size: 1.5rem; font-weight: 600; color: var(--marino); line-height: 1.2; }
.tarjeta small { font-size: .78rem; color: var(--texto); }
.tarjeta.aviso { border-left-color: #e39a12; } .tarjeta.aviso b { color: #a35b00; }
.tarjeta.alerta { border-left-color: #d32f2f; } .tarjeta.alerta b { color: #b3261e; }
.tarjeta.ok { border-left-color: var(--verde); }

/* formularios */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .6rem 1rem; background: #fff; border: 1px solid var(--borde); border-radius: .25rem; padding: .8rem 1rem; max-width: 60rem; }
.form label { display: grid; gap: .15rem; font-size: .72rem; color: var(--suave); }
.form input, .form select { height: 2.1rem; border: 1px solid var(--borde); padding: 0 .5rem; border-radius: .2rem; }
.form .marcas { display: flex; flex-wrap: wrap; gap: .4rem .9rem; grid-column: 1 / -1; }
.form .marcas label { flex-direction: row; display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--texto); }
.form .acciones { grid-column: 1 / -1; display: flex; gap: .6rem; }

#aviso { position: fixed; left: 50%; bottom: 2.4rem; transform: translateX(-50%); background: var(--marino); color: #fff; padding: .6rem 1.2rem; border-radius: .3rem; box-shadow: 0 .4rem 1.2rem #0005; z-index: 50; font-size: .85rem; max-width: 60vw; }
#aviso.error { background: #b3261e; }
#aviso.ok { background: #1b6b3a; }
.cargando { opacity: .5; pointer-events: none; }
kbd.en-primario, .bt.primario kbd { color: var(--marino); }
kbd { font-family: inherit; border: 1px solid var(--gris3); border-radius: .2rem; padding: 0 .3rem; font-size: .7rem; background: #fff; }

/* editor de documentos */
.cab-editor { max-width: none; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.cab-editor label.ic { grid-column: span 2; }
.cab-editor label.doble { grid-column: span 2; }
.cab-editor label b { font-weight: 500; color: var(--texto); font-size: .85rem; min-height: 1.1rem; }
.buscador { position: relative; }
.buscador input { width: 100%; }
.sugerencias { position: absolute; left: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid var(--borde); box-shadow: 0 .5rem 1.5rem #0004; min-width: 100%; width: max-content; max-width: 48rem; max-height: 18rem; overflow: auto; }
.sugerencias .sug { padding: .35rem .6rem; font-size: .8rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugerencias .sug.sel, .sugerencias .sug:hover { background: var(--sel); color: #fff; }
.sugerencias .sug.sel .suave, .sugerencias .sug:hover .suave { color: #dbe8f8; }
/* Buscador de artículos del documento: una fila por artículo, en columnas. */
.sugerencias.arts { max-width: min(78rem, calc(100vw - 1.2rem)); max-height: 24rem; }
.sugerencias .art { display: grid; grid-template-columns: 8.5rem minmax(8rem, 24rem) minmax(7rem, 17rem) 5.5rem 8.5rem 8.5rem; gap: .7rem; align-items: baseline; }
.sugerencias .art > span { overflow: hidden; text-overflow: ellipsis; }
.sugerencias .art .d { text-align: right; font-variant-numeric: tabular-nums; }
.sugerencias .art small { color: var(--suave); font-size: .7rem; }
.sugerencias .art.baja .nom { color: var(--suave); }
.sugerencias .art .alms { white-space: normal; display: flex; flex-wrap: wrap; gap: .15rem .3rem; }
.sugerencias .art .exi { border: 1px solid var(--borde); border-radius: .2rem; padding: 0 .3rem; font-size: .72rem; background: #f6f8fb; color: var(--texto); font-variant-numeric: tabular-nums; }
.sugerencias .art .exi.mio { border-color: var(--sel); background: #e3f0fc; }
.sugerencias .art .exi.neg b { color: #c0392b; }
.sugerencias .art .exi.tot { border-style: dashed; background: #fff; }
.sugerencias .sug-cab { position: sticky; top: 0; z-index: 1; background: #eef2f7; border-bottom: 1px solid var(--borde); padding: .25rem .6rem; font-size: .68rem; letter-spacing: .03em; text-transform: uppercase; color: var(--suave); white-space: nowrap; }
.sugerencias .sug.sel small, .sugerencias .sug:hover small { color: #dbe8f8; }
.sugerencias .art.c4 { grid-template-columns: 8.5rem minmax(8rem, 24rem) minmax(7rem, 17rem) 6.5rem; }
.sugerencias.estrecha .sug-cab { display: none; }
.sugerencias.estrecha .art, .sugerencias.estrecha .art.c4 { grid-template-columns: minmax(7rem, 1.3fr) 1fr 1fr 1fr; gap: .1rem .7rem; }
.sugerencias.estrecha .art .cod { grid-column: 1; } .sugerencias.estrecha .art .nom { grid-column: 2 / -1; white-space: normal; }
.sugerencias.estrecha .art .alms { grid-column: 1; }
.editor.tpv .lineas-editor .sugerencias.arts { max-height: 19rem; }
.sugerencias.estrecha .art [data-t]::before { content: attr(data-t) ' '; margin-right: .3rem; font-size: .62rem; text-transform: uppercase; color: var(--suave); }
.sugerencias.estrecha .art .alms[data-t]::before { display: none; }
.sugerencias.estrecha .art .d { text-align: left; }
.sugerencias.estrecha .sug.sel [data-t]::before, .sugerencias.estrecha .sug:hover [data-t]::before { color: #dbe8f8; }
.acciones-editor { display: flex; gap: .5rem; margin: .6rem 0; flex-wrap: wrap; }
.lineas-editor { max-height: calc(var(--vh, 100vh) - 26rem); }
.lineas-editor td { padding: .15rem .3rem; }
.lineas-editor input, .lineas-editor select { height: 1.9rem; border: 1px solid transparent; background: #f7f8fa; padding: 0 .35rem; border-radius: .15rem; width: 100%; min-width: 4rem; }
.lineas-editor input[readonly] { background: transparent; }
.lineas-editor input:focus, .lineas-editor select:focus { outline: 2px solid var(--sel); outline-offset: -1px; background: #fff; }
.lineas-editor td:nth-child(2) { width: 11rem; } .lineas-editor td:nth-child(3) { min-width: 16rem; }
.lineas-editor td:nth-child(4), .lineas-editor td:nth-child(5), .lineas-editor td:nth-child(6) { width: 6.5rem; }
.lineas-editor td:nth-child(9) { width: 4.5rem; } .lineas-editor td:nth-child(10) { width: 12rem; }
.lineas-editor tr.nueva td { background: #fbfcfe; }
.quitar { background: none; border: 0; color: #b3261e; font-size: .9rem; }
.acciones.cifras { gap: .4rem; }
.acciones .bt { text-align: center; display: block; }
.aviso-corr { background: #fff3cd; color: #6b4600; padding: .4rem .8rem; border-radius: .25rem; margin: 0 0 .6rem; font-size: .82rem; }
#modal { position: fixed; inset: 0; background: #0006; z-index: 40; display: grid; place-items: center; }
.modal-caja { background: var(--fondo); border-radius: .3rem; padding: 1rem 1.2rem; width: min(70rem, 92vw); box-shadow: 0 1rem 3rem #0006; }
.modal-caja h2 { margin-top: 0; }
.cifras label.peq { display: grid; gap: .15rem; color: var(--suave); }
.cifras label.peq select, .cifras label.peq input { height: 1.9rem; border: 1px solid var(--borde); border-radius: .2rem; padding: 0 .4rem; width: 100%; }
.total-fila td { font-weight: 600; border-top: 2px solid var(--marino); background: #f3f5f9; }
.barra-datos { font-size: .7rem; max-width: 18rem; }
.filtros input[type=checkbox] { min-width: auto; height: auto; width: 1rem; }

/* ---------- ficha de interlocutor (centro de consulta) ---------- */
.cab-ficha { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.cab-ficha h1 { margin: 0; flex-wrap: wrap; }
.botonera { display: flex; gap: .4rem; flex-wrap: wrap; }
.botonera .bt { display: inline-flex; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .5rem; margin-bottom: .7rem; }
.kpi { background: #fff; border: 1px solid var(--borde); border-left: .25rem solid var(--marino2); border-radius: .25rem; padding: .45rem .7rem; display: grid; gap: .05rem; min-width: 0; }
.kpi span { font-size: .66rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.kpi b { font-size: 1.15rem; font-weight: 600; color: var(--marino); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { font-size: .7rem; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.neg b, .kpi.alerta b { color: #b3261e; } .kpi.alerta { border-left-color: #d32f2f; } .kpi.aviso { border-left-color: #e39a12; } .kpi.ok { border-left-color: var(--verde); }
.barra-credito { display: inline-block; width: 100%; height: .3rem; background: var(--gris); border-radius: .2rem; margin: .15rem 0 .1rem; overflow: hidden; }
.barra-credito i { display: block; height: 100%; background: var(--marino2); } .kpi.alerta .barra-credito i { background: #d32f2f; } .kpi.aviso .barra-credito i { background: #e39a12; }
.ficha2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: .7rem; align-items: stretch; }
.ficha2 > .seccion { order: 1; } .ficha2 > .seccion.ancho { grid-column: 1 / -1; order: 2; }
.col-datos, .col-lateral { display: grid; gap: .7rem; min-width: 0; }
.seccion { background: #fff; border: 1px solid var(--borde); border-radius: .25rem; padding: .55rem .8rem .7rem; min-width: 0; }
.seccion h3 { margin: 0 0 .4rem; font-size: .72rem; font-weight: 600; color: var(--marino2); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: .5rem; }
.seccion h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.seccion .con-scroll { max-height: 16rem; overflow: auto; }
.seccion h4 { margin: .8rem 0 .3rem; font-size: .72rem; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: .5rem; }
.datos2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.datos1 { display: grid; }
.fila { display: flex; justify-content: space-between; gap: .8rem; padding: .22rem 0; border-bottom: 1px dotted #e4e6eb; font-size: .8rem; min-width: 0; }
.fila:last-child { border-bottom: 0; }
.fila span { color: var(--suave); white-space: nowrap; }
.fila b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.fila.total { border-top: 1px solid var(--borde); margin-top: .2rem; font-weight: 600; }
.observaciones { margin-top: .5rem; background: #fff8e1; border-left: .2rem solid #e39a12; padding: .4rem .6rem; font-size: .8rem; white-space: pre-line; border-radius: .2rem; }
.direcciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem; }
.dir { border: 1px solid var(--borde); border-radius: .25rem; padding: .4rem .6rem; font-size: .8rem; display: grid; gap: .1rem; background: #f8f9fb; }
.dir.defecto { border-color: var(--boton-borde); background: var(--boton); }
.dir span { font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); } .dir b { font-weight: 500; }
.banco { padding: .3rem 0; border-bottom: 1px dotted #e4e6eb; display: grid; font-size: .8rem; } .banco:last-child { border-bottom: 0; }
.banco b { font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.cond-fact { display: grid; gap: .35rem; }
.cond-fact label.peq { display: grid; gap: .15rem; color: var(--suave); }
.cond-fact select, .cond-fact input { height: 1.9rem; border: 1px solid var(--borde); border-radius: .2rem; padding: 0 .4rem; width: 100%; }
.resumen { padding: .6rem; display: grid; gap: .6rem; }
.tres { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .6rem; }
.tres .panel h4 { margin: 0; padding: .4rem .6rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--marino2); border-bottom: 1px solid var(--borde); }
tr.detalle td { background: #f6f8fc; padding: .3rem 1.5rem; }
tr.detalle table th { position: static; background: #dde2ea; color: #333; }
@media (max-width: 70rem) { .ficha2 { grid-template-columns: 1fr; } .datos2, .datos3 { grid-template-columns: 1fr; } }

/* ---------- formulario de interlocutor ---------- */
.form-ic { display: grid; gap: .6rem; }
.form-ic .g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .5rem .7rem; }
.form-ic label { display: grid; gap: .15rem; font-size: .7rem; color: var(--suave); min-width: 0; align-content: start; }
.form-ic input, .form-ic select, .form-ic textarea { height: 2rem; border: 1px solid var(--borde); padding: 0 .45rem; border-radius: .2rem; width: 100%; min-width: 0; background: #fff; }
.form-ic textarea { height: auto; padding: .3rem .45rem; resize: vertical; font-size: .8rem; }
.form-ic input:focus, .form-ic select:focus, .form-ic textarea:focus { outline: 2px solid var(--sel); outline-offset: -1px; }
.form-ic input[readonly] { background: #f3f4f6; color: var(--suave); }
.form-ic label.marca { display: flex; align-items: center; gap: .4rem; align-self: end; height: 2rem; font-size: .8rem; color: var(--texto); }
.form-ic label.marca input { width: 1rem; height: 1rem; }
.form-ic .fila-rep { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)) 4rem; gap: .4rem .7rem; padding: .35rem 0; border-top: 1px dotted #e4e6eb; align-items: end; }
.form-ic .fila-rep:first-child { border-top: 0; }
.form-ic .fila-rep .fin { grid-column: 13; display: flex; align-items: center; justify-content: flex-end; gap: .3rem; height: 2rem; font-size: .7rem; color: var(--suave); white-space: nowrap; }
.form-ic .fila-rep .fin label { display: flex; align-items: center; gap: .2rem; } .form-ic .fila-rep .fin input[type=radio] { width: .9rem; height: .9rem; }
.form-ic .nombre-banco { font-size: .68rem; }
.bt.mini { height: 1.5rem; padding: 0 .5rem; font-size: .7rem; text-transform: none; letter-spacing: 0; }
.form-ic .acciones { display: flex; gap: .6rem; }

/* botón atrás global */
.atras { float: left; margin: .1rem .7rem .4rem 0; height: 1.7rem; padding: 0 .6rem; border: 1px solid var(--borde); background: #fff; color: var(--marino2); border-radius: .2rem; font-size: .75rem; font-weight: 500; }
.atras:hover { background: var(--boton); }
.barra-tabla { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; border-bottom: 1px solid var(--borde); background: #f8f9fb; position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.barra-tabla .hueco { flex: 1; }
.barra-tabla label { display: flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--suave); }
.barra-tabla select, .barra-tabla input { height: 1.6rem; border: 1px solid var(--borde); border-radius: .2rem; padding: 0 .3rem; font-size: .75rem; }
.pest-cuerpo .barra-tabla + table th { top: 2.3rem; }

/* ficha compacta: tres columnas, direcciones en línea, condiciones en dos columnas */
.datos3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.4rem; }
.datos2c { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.datos2c .fila#cond-fact, .datos2c .fila.ancha, .datos2c .ancha-wrap { grid-column: 1 / -1; } .ancha-wrap { display: contents; } .datos2c .ancha-wrap .fila { grid-column: 1 / -1; }
.datos2c .fila b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.datos2c .fila#cond-fact b { white-space: normal; }
.dir-lineas { display: grid; gap: .15rem; }
.dir-linea { display: grid; grid-template-columns: 4.5rem minmax(8rem, 16rem) 1fr; gap: .6rem; font-size: .8rem; padding: .18rem 0; border-bottom: 1px dotted #e4e6eb; align-items: baseline; }
.dir-linea:last-child { border-bottom: 0; }
.dir-linea span { font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); } .dir-linea b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dir-linea i { font-style: normal; color: var(--texto); }
.grupo-bt { display: inline-flex; align-items: center; border: 1px dashed var(--boton-borde); border-radius: .25rem; padding: .15rem .3rem .15rem .5rem; gap: .25rem; }
.grupo-bt-t { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin-right: .2rem; }
.grupo-bt .bt { height: 1.8rem; padding: 0 .6rem; }
.kpi { position: relative; cursor: pointer; }
.kpi:hover { box-shadow: 0 .15rem .6rem #0002; }
.kpi.arrastrando { opacity: .4; } .kpi.destino { outline: 2px dashed var(--sel); outline-offset: -2px; }
.kpi-menu { position: absolute; right: .2rem; top: .1rem; border: 0; background: none; color: var(--gris3); font-size: .9rem; line-height: 1; padding: .1rem .3rem; border-radius: .2rem; }
.kpi:hover .kpi-menu { color: var(--marino2); } .kpi-menu:hover { background: var(--boton); }
.kpi-selector { position: absolute; left: .3rem; right: .3rem; top: 1.4rem; z-index: 6; height: 1.8rem; font-size: .78rem; border: 1px solid var(--sel); border-radius: .2rem; background: #fff; }
.cuadro td a { color: var(--marino2); } .cuadro tbody tr:hover td { background: #f3f7fd; }
.cu-detalle { border-top: 2px solid var(--marino); margin-top: .3rem; }
rect.barra { cursor: pointer; } rect.barra:hover { opacity: .8; }
.aviso-pruebas { background: #fff3cd; color: #6b4600; font-size: .72rem; padding: .15rem .6rem; text-align: center; border-bottom: 1px solid #f0d58a; }
.aviso-pruebas.real { background: #e6f0fb; color: #14265c; border-bottom-color: #b9d2ee; }

/* listados: chips de recientes/favoritos, filtro activo, acciones por fila, filas dudosas */
.chips { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: 0 0 .5rem; }
.chips-t { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 0 .2rem 0 .3rem; }
.chip { display: inline-block; background: #fff; border: 1px solid var(--borde); border-radius: 1rem; padding: .1rem .6rem; font-size: .75rem; color: var(--texto); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { border-color: var(--sel); color: var(--marino2); } .chip.fav { background: #fff8e1; border-color: #f0d58a; }
.activo-filtro { background: var(--marino2); color: #fff; border-radius: 1rem; padding: .15rem .3rem .15rem .7rem; font-size: .75rem; align-self: center; display: inline-flex; align-items: center; gap: .3rem; }
.activo-filtro button { border: 0; background: #fff3; color: #fff; border-radius: 50%; width: 1.2rem; height: 1.2rem; line-height: 1; }
.kpis + .filtros { margin-top: .2rem; }
.acc { white-space: nowrap; text-align: right; }
.acc a, .acc button { display: inline-block; height: 1.45rem; line-height: 1.45rem; padding: 0 .45rem; border: 1px solid var(--boton-borde); background: var(--boton); color: var(--marino); border-radius: .2rem; font-size: .68rem; margin-left: .15rem; visibility: hidden; }
tr:hover .acc a, tr:hover .acc button, tr.sel .acc a, tr.sel .acc button { visibility: visible; }
tr.sel .acc a, tr.sel .acc button { background: #fff; color: var(--marino); }
.senal { display: inline-block; font-size: .7rem; margin-right: .15rem; cursor: help; }
tr.dudoso td { color: var(--gris3); font-style: italic; }
.fav-bt { border: 0; background: none; font-size: 1.2rem; color: var(--gris3); cursor: pointer; line-height: 1; padding: 0 .2rem; } .fav-bt.on { color: #e39a12; }
.panel-aviso { background: #fff3cd; border-left: .3rem solid #e39a12; color: #5a3d00; padding: .45rem .8rem; border-radius: .25rem; margin-bottom: .6rem; font-size: .82rem; white-space: pre-line; }
.alm-lineas { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .4rem; }
.alm { border: 1px solid var(--borde); border-radius: .25rem; padding: .35rem .6rem; display: grid; grid-template-columns: 1fr auto; gap: 0 .6rem; font-size: .8rem; background: #f8f9fb; }
.alm.defecto { border-color: var(--boton-borde); background: var(--boton); }
.alm span { color: var(--suave); font-size: .72rem; } .alm b { font-size: 1rem; grid-row: 1 / 3; align-self: center; } .alm i { font-style: normal; font-size: .7rem; color: var(--suave); }
/* Ficha de documento v2: desglose de IVA + totales bajo las líneas; cabecera del editor en rejilla fija; artículos habituales. */
.resumen-doc { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: .8rem; padding: .6rem .6rem .7rem; border-top: 1px solid var(--borde); background: #fafbfc; align-items: start; }
.resumen-doc table.iva { width: auto; min-width: 22rem; font-size: .78rem; } .resumen-doc table.iva th { background: #eef0f4; color: var(--suave); font-weight: 600; } .resumen-doc table.iva td, .resumen-doc table.iva th { padding: .2rem .6rem; }
.resumen-doc .cifras { padding: .4rem .7rem; }
.cab-ficha h1 .etiqueta { vertical-align: middle; }
.cab-editor { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .4rem .7rem; }
.cab-editor label { grid-column: span 2; min-width: 0; } .cab-editor label.ic { grid-column: span 4; } .cab-editor label.doble { grid-column: span 4; } .cab-editor label.triple { grid-column: span 3; } .cab-editor label.simple { grid-column: span 1; }
.cab-editor label.ic b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor .lateral .cifras .fila { font-size: .78rem; }
.habituales { background: #fff; border: 1px solid var(--borde); border-radius: .25rem; margin-top: .6rem; }
.habituales .barra-tabla { position: static; }
.habituales table { font-size: .78rem; } .habituales td { padding: .18rem .5rem; } .habituales tbody tr { cursor: pointer; } .habituales tbody tr:hover td { background: #eef3fb; }
.habituales .cuerpo { max-height: 15rem; overflow: auto; }
.habituales .añadir { font-size: .68rem; color: var(--marino2); white-space: nowrap; }
.editor .ficha { grid-template-columns: minmax(0, 1fr) 19rem; }
.lista td:has(> .senal) { white-space: nowrap; }
.lista td .peq.nota, .lista .nota-corta { display: inline-block; max-width: 22rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.datos2c .fila.ancha b { white-space: normal; }
.panel-aviso.recortado { max-height: 2.9rem; overflow: hidden; text-overflow: ellipsis; cursor: pointer; position: relative; }
.panel-aviso.recortado::after { content: '… más'; position: absolute; right: .6rem; bottom: .2rem; background: #fff3cd; padding-left: .5rem; font-size: .7rem; color: #8a5a00; }
.lista .acc a.peligro { color: #b3261e; border-color: #e7b8b5; background: #fff5f5; }
/* Inicio: flujos de trabajo en baldosas (estilo Fiori) */
.flujos { display: grid; gap: .55rem; margin-bottom: .8rem; }
.flujo { background: #fff; border: 1px solid var(--borde); border-radius: .3rem; padding: .45rem .7rem .55rem; }
.flujo h3 { margin: 0 0 .35rem; font-size: .7rem; font-weight: 600; color: var(--marino2); text-transform: uppercase; letter-spacing: .07em; }
.flujo .pasos { display: flex; align-items: stretch; gap: .25rem; overflow-x: auto; }
.flujo .flecha { align-self: center; color: var(--gris3); font-size: 1.4rem; line-height: 1; padding: 0 .1rem; }
.baldosa { position: relative; flex: 1 1 0; min-width: 9rem; display: grid; gap: .05rem; align-content: start; background: #f6f8fb; border: 1px solid var(--borde); border-top: .22rem solid var(--marino2); border-radius: .3rem; padding: .45rem .65rem .5rem; color: inherit; text-decoration: none; transition: box-shadow .12s, transform .12s; }
.baldosa:hover { box-shadow: 0 .2rem .7rem #0002; transform: translateY(-1px); background: #fff; text-decoration: none; }
.baldosa .bd-t { font-size: .68rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 1.2rem; }
.baldosa b { font-size: 1.25rem; font-weight: 600; color: var(--marino); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.5rem; }
.baldosa small { font-size: .7rem; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.baldosa.aviso { border-top-color: #e39a12; } .baldosa.alerta { border-top-color: #d32f2f; } .baldosa.alerta b { color: #b3261e; } .baldosa.ok { border-top-color: var(--verde); }
.baldosa .bd-mas { position: absolute; right: .35rem; top: .3rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--marino2); color: #fff; font-size: .95rem; line-height: 1.2rem; text-align: center; opacity: .55; }
.baldosa:hover .bd-mas { opacity: 1; } .baldosa .bd-mas:hover { background: var(--marino); }
/* Inicio: organigrama de procesos por módulo */
.organigrama { background: #fff; border: 1px solid var(--borde); border-radius: .3rem; margin-bottom: .8rem; }
.org-modulos { display: flex; gap: .2rem; align-items: center; padding: .35rem .6rem; border-bottom: 1px solid var(--borde); background: #f6f8fb; border-radius: .3rem .3rem 0 0; flex-wrap: wrap; }
.org-modulos button { border: 0; background: none; padding: .35rem .8rem; border-radius: .25rem; font: inherit; font-size: .8rem; font-weight: 600; color: var(--marino2); cursor: pointer; }
.org-modulos button:hover { background: #e9eef7; } .org-modulos button.activa { background: var(--marino); color: #fff; }
.org-lienzo { position: relative; padding: .9rem 1rem 1rem; min-height: 9rem; }
.org-flechas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.org-rejilla { display: grid; gap: 1.1rem 2.4rem; position: relative; }
.nodo { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: .5rem; align-items: center; background: #f6f8fb; border: 1px solid var(--borde); border-left: .25rem solid var(--marino2); border-radius: .35rem; padding: .45rem .6rem .5rem; color: inherit; text-decoration: none; min-width: 0; transition: box-shadow .12s, transform .12s; z-index: 1; }
.nodo:hover { box-shadow: 0 .25rem .8rem #0002; transform: translateY(-1px); background: #fff; text-decoration: none; }
.nodo .icono { grid-row: 1 / 4; font-size: 1.5rem; line-height: 1; width: 1.9rem; text-align: center; filter: grayscale(.2); }
.nodo .nd-t { font-size: .68rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 1.1rem; }
.nodo b { font-size: 1.2rem; font-weight: 600; color: var(--marino); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.35rem; }
.nodo small { font-size: .68rem; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nodo.peq { padding: .3rem .5rem .35rem; background: #fbfcfe; } .nodo.peq .icono { font-size: 1.15rem; width: 1.5rem; } .nodo.peq b { font-size: .95rem; min-height: 1.1rem; }
.nodo.aviso { border-left-color: #e39a12; } .nodo.alerta { border-left-color: #d32f2f; } .nodo.alerta b { color: #b3261e; } .nodo.ok { border-left-color: var(--verde); } .nodo.gris { opacity: .55; border-left-color: var(--gris3); }
.nodo .bd-mas { position: absolute; right: .3rem; top: .25rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--marino2); color: #fff; font-size: .9rem; line-height: 1.15rem; text-align: center; opacity: .55; }
.nodo:hover .bd-mas { opacity: 1; } .nodo .bd-mas:hover { background: var(--marino); }

/* Ficha de documento: trazabilidad compacta en una línea (09-11-2026) */
.cadena { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: -.2rem 0 .55rem; font-size: .76rem; }
.cadena-t { font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); font-weight: 600; margin-right: .2rem; }
.cadena .eslabon { display: inline-flex; gap: .3rem; align-items: baseline; border: 1px solid var(--borde); border-radius: 1rem; padding: .08rem .55rem; background: #f6f8fb; white-space: nowrap; }
.cadena .eslabon b { font-weight: 600; color: var(--marino2); }
.cadena .eslabon.este { background: var(--marino); border-color: var(--marino); color: #fff; } .cadena .eslabon.este b { color: #fff; }
.cadena .eslabon.anulado { opacity: .6; text-decoration: line-through; }
.cadena .flecha { color: var(--gris3); }
.cadena .sep { width: 1px; height: 1rem; background: var(--borde); margin: 0 .3rem; }
.cadena .cadena-t { border: 0; background: none; padding: 0; cursor: pointer; font-family: inherit; }
.cadena .cadena-t:hover { color: var(--marino2); }
.cadena button.eslabon.mas { cursor: pointer; font: inherit; color: var(--marino2); background: #fff; border-style: dashed; }
/* Mapa completo de la cadena documental */
.modal-caja.mapa-caja { width: 96vw; max-width: none; max-height: 92vh; display: flex; flex-direction: column; }
.mapa-cab { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; } .mapa-cab h2 { margin: 0; } .mapa-cab .bt { margin-left: auto; }
.mapa-lienzo { position: relative; overflow: auto; flex: 1; background: #fff; border: 1px solid var(--borde); border-radius: .3rem; padding: .8rem 1rem 1rem; }
.mapa-flechas { position: absolute; left: 0; top: 0; pointer-events: none; }
.mapa-rejilla { display: grid; gap: .6rem 3rem; position: relative; align-items: start; }
.carril-t { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--suave); font-weight: 600; border-bottom: 1px dashed var(--borde); padding-bottom: .15rem; margin-top: .3rem; }
.nodo-doc { position: relative; z-index: 1; display: grid; gap: .05rem; background: #f6f8fb; border: 1px solid var(--borde); border-left: .25rem solid var(--marino2); border-radius: .3rem; padding: .35rem .55rem; color: inherit; text-decoration: none; font-size: .78rem; }
.nodo-doc:hover { background: #fff; box-shadow: 0 .2rem .6rem #0002; text-decoration: none; }
.nodo-doc b { font-weight: 600; color: var(--marino); } .nodo-doc small { color: var(--suave); font-size: .7rem; } .nodo-doc small.ic { color: #8a5a00; }
.nodo-doc.este { background: var(--marino); border-color: var(--marino); } .nodo-doc.este b, .nodo-doc.este small { color: #fff; }
.nodo-doc.anulado { opacity: .6; } .nodo-doc.anulado b { text-decoration: line-through; }
.nodo-doc.oculto { border-left-color: var(--gris3); background: #f1f1f1; }

/* Editor: ficha lateral del artículo (09-11-2026) */
.ficha-art { gap: .25rem; }
.ficha-art .fa-cab { display: flex; justify-content: space-between; align-items: baseline; }
.ficha-art .fa-cab b { color: var(--marino); font-size: .9rem; }
.ficha-art .fa-nombre { display: block; font-weight: 600; font-size: .82rem; line-height: 1.25; }
.ficha-art .fa-img { display: block; max-width: 100%; max-height: 10rem; object-fit: contain; margin: .2rem auto; background: #fff; border: 1px solid var(--borde); border-radius: .25rem; }
.ficha-art .fa-meta { display: block; }
.ficha-art .fa-aviso { display: block; background: #fff3cd; color: #8a5a00; font-size: .72rem; padding: .25rem .4rem; border-radius: .2rem; }
.ficha-art .fa-hist { display: block; margin-top: .25rem; border-top: 1px solid var(--borde); padding-top: .3rem; }
.ficha-art .fa-t { display: block; font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); margin-bottom: .15rem; }
.ficha-art .fa-hist table { width: 100%; border-collapse: collapse; font-size: .72rem; }
.ficha-art .fa-hist td { padding: .1rem .2rem; border-bottom: 1px solid #eef1f6; }
.ficha-art .fa-aviso[hidden] { display: none; }



/* Inicio: días pulsables en la gráfica de ventas */
.graf-dias .g-dia { cursor: pointer; } .graf-dias .g-dia:hover .g-zona { fill: #15428b14; } .graf-dias .g-dia.sel .g-zona { fill: #e39a1226; }
#dia-detalle { margin-top: .5rem; border: 1px solid var(--borde); border-radius: .25rem; background: #fff; }
#dia-detalle .cuerpo { max-height: 18rem; overflow: auto; }


/* Sistema: barreras de escritura (misma tira que las direcciones, con la primera columna para la etiqueta) */
.dir-lineas.barreras .dir-linea { grid-template-columns: 6.2rem 1fr; align-items: center; padding: .35rem 0; row-gap: .1rem; }
.dir-lineas.barreras .dir-linea i { color: var(--suave); grid-column: 2; }

/* Editor de Eurowin2026: columnas # · Código · Descripción · Cantidad · Precio · Dto · Dto 2 · IVA · Importe · ✕ */
.editor .lineas-editor td:nth-child(7) { width: 6.5rem; }
.editor .lineas-editor td:nth-child(8) { width: 4rem; white-space: nowrap; }
.editor .lineas-editor td:nth-child(9) { width: 7rem; white-space: nowrap; }
.editor .lineas-editor td:nth-child(10) { width: 2rem; }
.editor .lineas-editor td.desc .peq { padding: 0 .35rem .1rem; }
.editor #resultado .panel-aviso { margin-top: .6rem; }
.cab-editor input, .cab-editor select { width: 100%; min-width: 0; box-sizing: border-box; }
.filtros a.bt { display: inline-flex; align-items: center; box-sizing: border-box; text-decoration: none; }

/* Fase 3: entrega de pedidos y regularizaciones (mismas tablas de casillas que el editor) */
.lineas-editor.servir td:nth-child(n+4) { width: 6rem; } .lineas-editor.servir td:nth-child(8) { width: 7rem; } .lineas-editor.servir td:nth-child(9) { width: 7rem; white-space: nowrap; }
.lineas-editor.servir td { padding: .25rem .45rem; } .lineas-editor.servir td:nth-child(8) { padding: .15rem .3rem; }
.lineas-editor.servir input[data-servir] { background: #fff; border-color: var(--boton-borde); font-weight: 600; }
.lineas-editor input.mal { outline: 2px solid #d32f2f; outline-offset: -1px; }
.editor .lineas-editor.regulariza td:nth-child(n+4) { width: 6.5rem; white-space: nowrap; } .editor .lineas-editor.regulariza td:nth-child(10) { width: 2rem; }
.lineas-editor.regulariza td.d { padding: .25rem .45rem; }

/* ---------- TPV: terminal, cobro y arqueo (mismas piezas que el editor; solo lo propio) ---------- */
.tpv-total { background: var(--marino); color: #fff; border-radius: .25rem; padding: .6rem .9rem .7rem; display: grid; }
.tpv-total span { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.tpv-total b { font-size: 2.3rem; font-weight: 600; line-height: 1.2; text-align: right; white-space: nowrap; }
.tpv-total small { text-align: right; font-size: .7rem; opacity: .8; }
.tpv-total.neg { background: #b3261e; }
.tpv-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.tpv-acciones .bt.cobrar { grid-column: 1 / -1; height: 3.2rem; font-size: 1.05rem; }
.tpv-acciones #vaciar { grid-column: 1 / -1; }
.tpv-opcion { display: flex; align-items: center; gap: .35rem; }
.tpv-ultimo-bt { justify-content: flex-end !important; gap: .3rem; margin-top: .2rem; }
.tpv-ultimo-bt .bt { display: inline-flex; align-items: center; text-decoration: none; }
.cifras div.cambio b { font-size: 1.25rem; color: var(--verde); }
.editor.tpv .lineas-editor { max-height: calc(var(--vh, 100vh) - 21rem); min-height: 14rem; }
.editor.tpv .lineas-editor td:nth-child(1) { width: 2rem; } .editor.tpv .lineas-editor td:nth-child(2) { width: 13rem; }
.editor.tpv .lineas-editor td:nth-child(4), .editor.tpv .lineas-editor td:nth-child(5), .editor.tpv .lineas-editor td:nth-child(6) { width: 6.5rem; }
.editor.tpv .lineas-editor td:nth-child(7) { width: 7rem; white-space: nowrap; padding-right: .6rem; font-size: .9rem; } .editor.tpv .lineas-editor td:nth-child(8) { width: 2rem; }
.editor.tpv .lineas-editor tr.nueva input[data-l="articulo"] { background: #fff; border-color: var(--sel); height: 2.2rem; font-size: .9rem; }
.tpv-cajas { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; margin-bottom: .6rem; } .tpv-cajas a { text-decoration: none; }
.modal-caja.tpv-modal { width: min(46rem, 94vw); max-height: 92vh; overflow: auto; }
.modal-caja.tpv-modal.media { width: min(38rem, 94vw); } .modal-caja.tpv-modal.ancha { width: min(60rem, 94vw); }
.tpv-modal h2 { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--marino); display: flex; align-items: baseline; gap: .7rem; }
.tpv-modal h2 small { font-weight: 400; color: var(--suave); font-size: .78rem; }
.tpv-modal .form { max-width: none; } .tpv-modal .acciones-editor { align-items: center; margin-bottom: 0; }
.tpv-cobro { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: .8rem; align-items: start; }
.tpv-formas td { padding: .25rem .5rem; vertical-align: middle; } .tpv-formas td:nth-child(2) { width: 9rem; } .tpv-formas td:nth-child(3) { width: 4rem; }
.tpv-formas input { height: 2.2rem; width: 100%; border: 1px solid var(--borde); border-radius: .2rem; padding: 0 .5rem; font-size: .95rem; }
.tpv-formas input:focus { outline: 2px solid var(--sel); outline-offset: -1px; }
.tpv-billetes { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .5rem; } .tpv-billetes .bt.mini { height: 1.9rem; padding: 0 .7rem; font-size: .78rem; }
.tpv-tipos { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.tpv-pend { max-height: 60vh; overflow: auto; }
@media (max-width: 60rem) { .tpv-cobro { grid-template-columns: 1fr; } }
.editor.tpv .lineas-editor { height: calc(var(--vh, 100vh) - 21rem); }
.editor.tpv .lineas-editor .sugerencias { max-height: 13rem; }
.tpv-modal .form input, #cierre.cifras label.peq input { font-size: .95rem; color: var(--texto); height: 2.2rem; }

/* VeriFactu */
code.huella { font-family: Consolas, 'SFMono-Regular', Menlo, monospace; font-size: .72rem; color: var(--marino2); background: #f1f4f9; border-radius: .2rem; padding: .05rem .3rem; }
code.huella.larga { display: block; white-space: normal; word-break: break-all; padding: .25rem .4rem; font-weight: 400; }
.qr-vf { display: flex; justify-content: center; padding: .6rem 0 .2rem; } .qr-vf svg { width: 11rem; height: 11rem; }
.url-vf { margin-top: .5rem; word-break: break-all; }

/* ================= Aspecto adaptable · escalón 1 =================
   Nada se corta en tableta ni en móvil; a partir de 80rem (1280 px) con ratón todo queda como estaba.
   Cortes: < 80rem tableta apaisada (menú completo, más apretado) · ≤ 64rem menú en panel y una columna · ≤ 40rem móvil.
   Lo que no cabe (tablas, pestañas, circuito) se desplaza dentro de su caja, nunca la página. */
.b-menu { display: none; }

@media (max-width: 79.9375rem) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .barra { gap: .5rem; }
  .barra .logo { letter-spacing: .14em; font-size: 1rem; }
  #menu a, #menu .grupo > button { padding: 0 .55rem; }
  .barra-datos { min-width: 0; flex: 0 1 auto; }
  .barra-datos span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  h1 { flex-wrap: wrap; row-gap: .1rem; }
  .filtros input.principal { min-width: min(22rem, 100%); }
  .organigrama { overflow-x: auto; }
  .org-modulos { position: sticky; left: 0; }
  .org-lienzo { min-width: 70rem; }
  .seccion h3, .seccion h4 { flex-wrap: wrap; }
  .botonera { min-width: 0; }
  .grupo-bt { flex-wrap: wrap; }
  main :not(td):has(> table), #modal :not(td):has(> table) { overflow-x: auto; }
}

@media (max-width: 64rem) {
  /* menú: botón ☰ y panel vertical */
  .barra { position: relative; padding: 0 .2rem 0 .1rem; gap: .3rem; }
  .b-menu { display: grid; place-items: center; order: -1; flex: none; width: 2.75rem; height: 2.75rem; background: none; border: 0; color: #fff; font-size: 1.6rem; border-radius: .25rem; }
  .barra.menu-abierto .b-menu { background: #ffffff22; }
  .barra-datos { margin-left: auto; }
  #menu { display: none; position: absolute; top: 100%; left: 0; z-index: 30; flex: none; flex-direction: column; gap: 0; width: min(20rem, 100vw); height: auto; max-height: calc(100vh - 3.2rem); max-height: calc(100dvh - 3.2rem); overflow-y: auto; overscroll-behavior: contain; background: var(--marino); box-shadow: 0 .6rem 1.6rem #0006; padding: .3rem 0 .6rem; }
  .barra.menu-abierto #menu { display: flex; }
  #menu a, #menu .grupo > button { min-height: 2.75rem; padding: 0 1.1rem; font-size: .95rem; flex: none; }
  #menu .grupo { flex-direction: column; flex: none; }
  #menu .grupo > button { width: 100%; justify-content: space-between; text-align: left; }
  #menu .grupo.abierto > button { background: #ffffff18; color: #fff; }
  #menu .grupo .sub { position: static; min-width: 0; box-shadow: none; padding: .2rem 0; }
  #menu .sub a { min-height: 2.6rem; padding: 0 1.1rem 0 1.9rem; font-size: .9rem; }

  /* pie: solo la ruta y la hora */
  #pie-ayuda { display: none; }
  #pie-ruta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #reloj { white-space: nowrap; }

  /* una columna */
  .ficha, .editor .ficha, .resumen-doc { grid-template-columns: minmax(0, 1fr); }
  .resumen-doc > * { min-width: 0; overflow-x: auto; }
  .ficha2[style] { grid-template-columns: minmax(0, 1fr) !important; }
  /* terminal de venta en una columna: las líneas no se comen la pantalla y el total queda a la vista */
  .editor.tpv .lineas-editor { height: 40vh; height: 40dvh; max-height: none; }
  .pestanas { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .pestanas button { flex: none; white-space: nowrap; }
  #aviso { left: .8rem; right: .8rem; transform: none; max-width: none; text-align: center; }
}

@media (max-width: 40rem) {
  main { padding: .6rem; }
  .barra .logo { letter-spacing: .06em; font-size: .92rem; gap: .3rem; }
  .barra .logo i { width: 1.6rem; height: 1.6rem; }
  .barra-datos { max-width: 8.5rem; }
  .aviso-pruebas { font-size: .68rem; }
  .login-cuerpo { padding: 1.4rem 1.2rem 1.2rem; }
  .login-cab b { font-size: .8rem; }
  .login-botones button { flex: 1; width: auto; }

  /* filtros apilados a ancho completo; los botones, de dos en dos */
  .filtros { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filtros > * { min-width: 0; }
  .filtros > label, .filtros > .n, .filtros > .activo-filtro { grid-column: 1 / -1; }
  .filtros input, .filtros select { width: 100%; min-width: 0; }
  .filtros input.principal { min-width: 0; }
  .filtros .bt { justify-content: center; text-align: center; }
  .filtros .n { margin-left: 0; justify-self: start; }
  .filtros > .activo-filtro { justify-self: start; }

  /* fichas y formularios */
  .datos1, .datos2, .datos3, .datos2c { grid-template-columns: minmax(0, 1fr); }
  .fila b { min-width: 0; }
  .fila b, .fila b span, .fila b i { white-space: normal; overflow-wrap: anywhere; }
  .datos label.doble { grid-column: auto; }
  .dir-linea { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .dir-linea i { grid-column: 2; }
  .form label[style*="span"] { grid-column: 1 / -1 !important; }
  .cab-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cab-editor label, .cab-editor label.simple { grid-column: auto; }
  .cab-editor label.ic, .cab-editor label.doble, .cab-editor label.triple { grid-column: 1 / -1; }
  .tpv-tipos { grid-template-columns: repeat(2, 1fr); }
  .modal-caja { padding: .8rem; max-height: 94vh; max-height: 94dvh; overflow: auto; }
  .sugerencias { max-width: calc(100vw - 1.2rem); }
}

/* Pantallas táctiles: 40 px de alto útil en filas, enlaces y botones */
@media (pointer: coarse) {
  #pie-ayuda { display: none; }
  #pie-ruta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bt, .bt.mini, .grupo-bt .bt, .atras, .org-modulos button, .pestanas button, .tpv-billetes .bt.mini { min-height: 2.5rem; }
  .atras { padding: 0 .9rem; }
  .filtros input, .filtros select, .form input, .form select, .cond-fact select, .cond-fact input, .cifras label.peq select, .cifras label.peq input, .barra-tabla select, .barra-tabla input, .lineas-editor input, .lineas-editor select { min-height: 2.5rem; }
  .filtros input[type=checkbox], .form input[type=checkbox], .barra-tabla input[type=checkbox] { min-height: 0; width: 1.4rem; height: 1.4rem; }
  tbody td { height: 2.5rem; vertical-align: middle; }
  .apagar { min-width: 2.5rem; min-height: 2.5rem; }
  .barra .logo { min-height: 2.5rem; }
  td a, .fila a, .cadena .eslabon, .cadena .eslabon a, h1 a, h3 a { display: inline-flex; align-items: center; min-height: 2.5rem; }
  .acc a, .acc button { display: inline-flex; align-items: center; height: 2.5rem; padding: 0 .7rem; }
  .chip { padding: 0 .8rem; line-height: 2.4rem; }
  .kpi-menu, .fav-bt, .quitar, .activo-filtro button { min-width: 2.5rem; min-height: 2.5rem; }
  .activo-filtro button { border-radius: 50%; }
  .sugerencias .sug { padding: .75rem .7rem; }
}

/* ================= Aspecto adaptable · escalón 2 (móvil de consulta) =================
   Listados como tarjetas en ≤ 40rem, acciones de fila a la vista en táctil, filtros plegables, cuenta dentro del menú,
   encabezado de tabla fijo en tableta e inicio sin cajas bajas. A partir de 80rem con ratón no cambia nada. */
.bt.b-filtros, #menu .menu-cuenta { display: none; }
.seccion .con-scroll.ultimos { max-height: 9.5rem; }

/* Con el dedo no hay fila «bajo el puntero»: las acciones de fila se ven en todas */
@media (pointer: coarse) { .acc a, .acc button { visibility: visible; } }

/* Tableta (una columna): «Últimos documentos» a su altura */
@media (max-width: 64rem) { .seccion .con-scroll.ultimos { max-height: none; } }

/* Tableta: las cajas que el escalón 1 dejó con desplazamiento lateral pasan a tener alto propio, y así el encabezado de la
   tabla vuelve a quedar fijo dentro de ellas; la barra de exportar deja de pegarse para no taparlo. */
@media (min-width: 40.0625rem) and (max-width: 79.9375rem) {
  main :not(td):has(> table) { max-height: calc(100vh - 8.5rem); max-height: calc(100dvh - 8.5rem); }
  .barra-tabla { position: static; }
  .pest-cuerpo .barra-tabla + table th { top: 0; }
}

@media (max-width: 40rem) {
  /* --- cuenta dentro del panel del menú --- */
  .barra-datos, .apagar { display: none; }
  #menu .menu-cuenta { display: grid; gap: .1rem; flex: none; margin-top: .4rem; padding: .7rem 1.1rem .2rem; border-top: 1px solid #ffffff2e; color: #c9d3ea; font-size: .78rem; line-height: 1.35; }
  #menu .menu-cuenta b { color: #fff; font-weight: 500; font-size: .86rem; }
  #menu .menu-cuenta .bt { justify-self: start; margin-top: .55rem; min-height: 2.5rem; padding: 0 1rem; }

  /* --- filtros plegables: búsqueda a la vista y botón «Filtros» con el número de filtros puestos --- */
  .bt.b-filtros { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; grid-column: 1 / -1; }
  .b-filtros::after { content: '▾'; font-size: .7rem; }
  .b-filtros[aria-expanded=true]::after { content: '▴'; }
  .b-filtros small { background: var(--sel); color: #fff; border-radius: 1rem; min-width: 1.3rem; padding: 0 .35rem; font-size: .7rem; line-height: 1.3rem; text-align: center; }
  .b-filtros small[hidden] { display: none; }
  .filtros:not(.f-abiertos) > .f-sec { display: none !important; } /* la casilla trae su «display» en línea */

  /* --- listados como tarjetas --- */
  .lista:has(> table.tj), .pest-cuerpo:has(> table.tj), main :not(td):has(> table.tj) { background: none; border: 0; max-height: none; overflow: visible; }
  :has(> table.tj) > .barra-tabla { position: static; background: #fff; border: 1px solid var(--borde); border-radius: .4rem; margin-bottom: .45rem; }
  table.tj, table.tj tbody { display: block; }
  table.tj thead { display: none; }
  table.tj tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .8rem; padding: .55rem .75rem; margin-bottom: .45rem; background: #fff; border: 1px solid var(--borde); border-radius: .4rem; }
  table.tj tbody tr td { display: block; order: 4; min-width: 0; height: auto; padding: 0; border: 0; background: none; color: var(--texto); font-size: .78rem; text-align: left; vertical-align: baseline; }
  table.tj tbody tr td a { color: var(--marino2); }
  table.tj tbody tr .neg { color: #d32f2f; }
  table.tj tbody tr .suave, table.tj tbody tr.cerrado td { color: var(--suave); }
  table.tj td:not(.tj-acc) a { min-height: 1.7rem; }
  table.tj tbody tr td.tj-no, table.tj tbody tr td.tj-vacia { display: none; }
  table.tj tbody tr td.tj-cod { order: 1; font-weight: 600; font-size: .86rem; }
  table.tj tbody tr td.tj-imp { order: 2; margin-left: auto; font-weight: 600; font-size: .9rem; }
  table.tj tbody tr td.tj-tit { order: 3; flex: 0 0 100%; font-size: .88rem; white-space: normal; overflow-wrap: anywhere; }
  table.tj td.tj-dato::before { content: attr(data-t) ' '; color: var(--suave); font-size: .68rem; }
  table.tj tbody tr td.tj-acc { order: 5; margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; align-self: flex-end; white-space: normal; }
  table.tj .tj-acc a, table.tj .tj-acc button { visibility: visible; margin-left: 0; background: var(--boton); color: var(--marino); }
  table.tj .nota-corta, table.tj .peq.nota { max-width: 100%; }
}
/* En móvil con ratón o teclado, la tarjeta elegida se distingue por el borde */
@media (max-width: 40rem) and (pointer: fine) { table.tj tbody tr.sel { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); } }

/* ================= Aspecto adaptable · escalón 3 =================
   Móvil: exportar e imprimir en un menú «⋯», búsqueda y «Filtros» en una línea, tablas de las fichas como tarjetas y
   nombre del artículo en una línea. Tableta: barra de acciones de la ficha siempre a la vista. Listas largas: «cargar más».
   A partir de 80rem con ratón no cambia nada: los envoltorios nuevos (.mas, .f-linea) no pintan caja. */
.b-mas { display: none; }
.mas, .mas-menu, .f-linea { display: contents; }
.mas-filas { display: flex; align-items: center; justify-content: flex-end; gap: .8rem; flex-wrap: wrap; padding: .5rem .6rem; border-top: 1px solid var(--borde); background: #f8f9fb; }

/* Tableta: la cabecera de la ficha (título y botones) y las acciones del editor se quedan arriba al desplazar. No se tocan
   márgenes (la cabecera va al lado de «Atrás», que flota): el fondo es una sombra que llena el ancho y el hueco de arriba,
   recortada para que no baje de la barra. */
@media (min-width: 40.0625rem) and (max-width: 79.9375rem) {
  main .cab-ficha, main .acciones-editor:not(.tpv-modal *, .editor.tpv *) { position: sticky; top: 0; z-index: 5; background: var(--fondo); box-shadow: 0 0 0 100vmax var(--fondo); clip-path: inset(-.8rem -100vmax -.3rem); }
  main:has(.cab-ficha) > .atras { position: sticky; top: .1rem; z-index: 6; }
}

@media (max-width: 40rem) {
  /* --- menú «⋯» con exportar e imprimir --- */
  .mas { display: inline-flex; position: relative; flex: none; }
  .mas:not(:has(.mas-menu > :enabled, .mas-menu > a)) { display: none; }   /* nada que exportar: sin menú */
  .bt.b-mas { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; min-height: 2.5rem; height: auto; padding: 0 0 .35rem; font-size: 1.3rem; line-height: 1; letter-spacing: .05em; }
  .mas.abierto > .b-mas { background: #d8e8fb; }
  .mas-menu { display: none; position: absolute; top: calc(100% + .25rem); right: 0; z-index: 8; flex-direction: column; gap: .1rem; min-width: 10rem; padding: .3rem; background: #fff; border: 1px solid var(--borde); border-radius: .4rem; box-shadow: 0 .5rem 1.4rem #0004; }
  .mas.abierto > .mas-menu { display: flex; }
  .mas-menu .bt, .mas-menu .bt.mini, .filtros .mas-menu .bt { width: 100%; height: auto; min-height: 2.6rem; padding: 0 .8rem; justify-content: flex-start; text-align: left; font-size: .88rem; border: 0; background: none; border-radius: .25rem; }
  .mas-menu .bt:active { background: var(--boton); }
  .pest-cuerpo:has(.mas.abierto), .lista:has(.mas.abierto) { min-height: 9.5rem; }   /* que la caja con desplazamiento no recorte el menú */

  /* --- búsqueda y «Filtros» en una línea; el «⋯» de la lista, a su derecha --- */
  .filtros { position: relative; }
  .filtros > .f-linea { display: flex; align-items: stretch; gap: .4rem; grid-column: 1 / -1; min-width: 0; }
  .f-linea > label { flex: 1 1 0; min-width: 0; gap: 0; font-size: 0; }   /* el rótulo no se pinta: lo dice el propio campo */
  .f-linea > label input { font-size: .95rem; height: 2.5rem; }
  .f-linea > .bt.b-filtros { flex: none; height: auto; min-height: 2.5rem; padding: 0 .7rem; }
  .filtros > .mas { grid-column: 1 / -1; justify-self: end; }
  .filtros:has(> .f-linea) > .mas { position: absolute; top: 0; right: 0; }
  .filtros:has(> .f-linea):has(> .mas) > .f-linea { padding-right: 2.9rem; }

  /* --- tablas de las fichas como tarjetas: lo que acompaña a la tabla (totales, IVA, «cargar más») conserva su caja --- */
  .pest-cuerpo:has(> table.tj) > .resumen-doc, :has(> table.tj) > .mas-filas { background: #fff; border: 1px solid var(--borde); border-radius: .4rem; margin-bottom: .45rem; }
  :has(> table.tj) > .barra-tabla { padding: .3rem .3rem .3rem .75rem; }
  .mas-filas { justify-content: space-between; }

  /* --- nombre en una sola línea en las tarjetas de los listados (el texto entero, al abrir la ficha) --- */
  .lista > table.tj tbody tr td.tj-tit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
}

/* ---------- documento a la manera clásica: cabecera de campos, líneas en el centro y totales al pie, todo en una pantalla ---------- */
.doc-form { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: .3rem .5rem; background: #fff; border: 1px solid var(--borde); border-radius: .25rem; padding: .5rem .7rem .6rem; margin-bottom: .5rem; }
.campo-ew { display: flex; flex-direction: column; gap: .08rem; min-width: 0; grid-column: span 1; }
.campo-ew.c2 { grid-column: span 2; } .campo-ew.c3 { grid-column: span 3; } .campo-ew.c4 { grid-column: span 6; } .campo-ew.todo { grid-column: 1 / -1; }
.campo-ew > span, .doc-pie .caja > span { font-size: .62rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.campo-ew > b { border: 1px solid var(--borde); background: #f6f8fb; border-radius: .2rem; padding: .22rem .45rem; min-height: 1.75rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.campo-ew.fuerte > b { font-weight: 600; color: var(--marino2); }
.campo-ew.obs > b { white-space: pre-line; background: #fff8e1; border-color: #ecd9a0; font-weight: 400; max-height: 3.6rem; overflow: auto; }
.doc-lineas { border-top: 1px solid var(--borde); border-radius: .25rem .25rem 0 0; max-height: none; min-height: 7rem; }
.doc-lineas .barra-tabla + table th { top: 2.3rem; }
.doc-pie { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; background: #fff; border: 1px solid var(--borde); border-top: 2px solid var(--marino); border-radius: 0 0 .25rem .25rem; padding: .45rem .7rem .55rem; margin-bottom: .45rem; }
.doc-pie .cajas { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; align-items: flex-end; } .doc-pie .cajas.izq { margin-left: 0; }
.doc-pie .caja { display: flex; flex-direction: column; gap: .08rem; min-width: 6.5rem; }
.doc-pie .cajas.izq .caja { min-width: 4.5rem; }
.doc-pie .caja > b { border: 1px solid var(--borde); background: #f6f8fb; border-radius: .2rem; padding: .22rem .5rem; min-height: 1.75rem; text-align: right; font-weight: 600; white-space: nowrap; }
.doc-pie .caja > b small { font-weight: 400; color: var(--suave); }
.doc-pie .caja.total { min-width: 9rem; } .doc-pie .caja.total > b { background: var(--marino); border-color: var(--marino); color: #fff; font-size: 1.15rem; padding: .2rem .6rem; }
.doc-pie .caja.aviso > b { background: #fff4d6; border-color: #e8c66a; } .doc-pie .caja.alerta > b { background: #fde8e8; border-color: #e5a3a3; color: #a11; }
.doc-pie table.iva { width: auto; font-size: .74rem; align-self: flex-end; } .doc-pie table.iva th { background: #eef0f4; color: var(--suave); font-weight: 600; } .doc-pie table.iva td, .doc-pie table.iva th { padding: .12rem .55rem; }
.doc-pie .nota-pie { flex-basis: 100%; margin: 0; }
.doc-pantalla .cadena { margin: 0; }
@media (min-width: 64rem) and (min-height: 34rem) {
  main:has(> .doc-pantalla) { display: flex; flex-direction: column; overflow: hidden; position: relative; padding-bottom: .5rem; }
  main:has(> .doc-pantalla) > .atras { position: absolute; left: 1rem; top: .8rem; margin: 0; float: none; }
  .doc-pantalla { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .doc-pantalla > .cab-ficha { padding-left: 5rem; position: static; box-shadow: none; clip-path: none; margin-bottom: .5rem; flex-wrap: nowrap; }
  .doc-pantalla > .cab-ficha h1 { white-space: nowrap; }
  .doc-pantalla > .doc-lineas { flex: 1; min-height: 0; overflow: auto; }
  .doc-pantalla > .doc-form, .doc-pantalla > .doc-pie, .doc-pantalla > .cadena { flex: none; }
}
@media (max-width: 63.9375rem) {
  .doc-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .campo-ew, .campo-ew.c2, .campo-ew.c3 { grid-column: span 2; } .campo-ew.c4 { grid-column: 1 / -1; }
  .doc-pie .cajas { margin-left: 0; width: 100%; } .doc-pie .caja { flex: 1 1 6rem; }
}
.bt.traspaso { font-weight: 600; } .bt.traspaso[disabled] { opacity: .55; cursor: not-allowed; }
.panel-aviso.fino { padding: .25rem .6rem; margin: 0 0 .4rem; font-size: .76rem; }
/* editor con la misma disposición: campos arriba, líneas en el centro, artículo y totales al pie */
.editor.doc-pantalla .cab-editor.doc-form { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .3rem .6rem; max-width: none; }
.editor.doc-pantalla .cab-editor.doc-form label { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: var(--suave); }
.editor.doc-pantalla .cab-editor.doc-form label b { text-transform: none; letter-spacing: 0; }
.editor.doc-pantalla .lineas-editor.docx { max-height: none; margin: 0; }
.editor .lineas-editor.docx td.c-n { width: 2rem; } .editor .lineas-editor.docx td.c-cod { width: 9rem; } .editor .lineas-editor.docx td.c-desc { width: auto; min-width: 14rem; }
.editor .lineas-editor.docx td.c-num { width: 6.5rem; } .editor .lineas-editor.docx td.c-dto { width: 4.8rem; } .editor .lineas-editor.docx td.c-st { width: 5.5rem; white-space: nowrap; color: var(--suave); padding-right: .6rem; }
.editor .lineas-editor.docx td.c-st.neg { color: #c62828; font-weight: 600; }
.editor .lineas-editor.docx td.c-iva { width: 4rem; white-space: nowrap; } .editor .lineas-editor.docx td.c-imp { width: 6.5rem; white-space: nowrap; } .editor .lineas-editor.docx td.c-ac { width: 5.2rem; white-space: nowrap; text-align: right; }
.editor .lineas-editor.docx input { min-width: 0; }
.lineas-editor .quitar.mv { font-size: .6rem; padding: 0 .2rem; color: var(--marino2); } .lineas-editor .quitar.mv[disabled] { opacity: .25; cursor: default; }
.doc-art { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem 1.3rem; background: #f6f8fb; border: 1px solid var(--borde); border-top: 0; border-bottom: 0; padding: .3rem .7rem; min-height: 2rem; font-size: .76rem; }
.doc-art > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1.3rem; } .doc-art > div > div { display: flex; gap: .35rem; align-items: baseline; }
.doc-art span { color: var(--suave); } .doc-art b { font-weight: 600; }
.doc-art .ficha-art:not([hidden]) + .ic-info { display: none; }
.doc-art .ficha-art .fa-cab, .doc-art .ficha-art .fa-nombre, .doc-art .ficha-art .fa-aviso { display: flex; } .doc-art .fa-nombre { font-size: .76rem; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor.doc-pantalla .doc-pie { margin-bottom: .3rem; } .ayuda-ed { margin: 0; }
@media (min-width: 64rem) and (min-height: 34rem) {
  .editor.doc-pantalla > .doc-art, .editor.doc-pantalla > .ayuda-ed, .editor.doc-pantalla > #resultado, .editor.doc-pantalla > .panel-aviso { flex: none; }
  .editor.doc-pantalla > form { flex: none; }
}
.editor .lineas-editor.docx td { vertical-align: middle; } .editor .lineas-editor.docx td.c-n { text-align: center; color: var(--suave); }
/* ---------- pantalla de documento con la distribución del programa original: documento | cliente | observaciones; líneas; botones; existencias; totales ---------- */
.ew-pantalla { font-size: .78rem; }
.ew-top { display: grid; grid-template-columns: minmax(21rem, 27rem) minmax(22rem, 1fr) minmax(11rem, 19rem); gap: .35rem; margin-bottom: .35rem; }
.ew-blq { background: #fff; border: 1px solid var(--gris3); border-radius: .2rem; padding: .3rem .4rem; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.ew-blq > header { display: flex; align-items: center; gap: .4rem; background: var(--marino); color: #fff; margin: -.3rem -.4rem 0; padding: .16rem .5rem; border-radius: .15rem .15rem 0 0; min-height: 1.5rem; }
.ew-blq > header b { font-weight: 600; letter-spacing: .02em; margin-right: auto; white-space: nowrap; }
.ew-obs > header { background: #dfe9e4; color: var(--texto); }
.ew-g { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .2rem .4rem; }
.ewc { display: flex; align-items: center; gap: .3rem; min-width: 0; grid-column: span 12; }
.ewc.s3 { grid-column: span 3; } .ewc.s4 { grid-column: span 4; } .ewc.s5 { grid-column: span 5; } .ewc.s6 { grid-column: span 6; } .ewc.s7 { grid-column: span 7; } .ewc.s8 { grid-column: span 8; }
.ewc > span { flex: none; width: 3.9rem; text-align: right; color: #444; white-space: nowrap; font-size: .72rem; }
.ewc.corto > span { width: auto; }
.ewc > b { flex: 1; min-width: 0; border: 1px solid var(--gris2); background: #f3f4f6; padding: .08rem .35rem; height: 1.45rem; line-height: 1.25rem; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ewc > b i { font-style: normal; font-weight: 600; margin-right: .2rem; } .ewc > b small { color: var(--suave); }
.ewc.fuerte > b { font-weight: 600; background: #fff; }
.ew-bts { display: flex; gap: .3rem; justify-content: flex-end; margin-top: auto; }
.ew-bts .bt, .ew-barra .bt { padding: .15rem .6rem; min-height: 1.6rem; font-size: .76rem; display: inline-flex; align-items: center; }
.ew-menu { position: relative; }
.ew-ops { position: absolute; z-index: 30; left: 0; top: 100%; min-width: 17rem; background: #f3f3f3; border: 1px solid var(--gris3); box-shadow: 0 .3rem 1rem #0004; padding: 0 0 .25rem; display: flex; flex-direction: column; }
.ew-ops-t { background: #d6dfe9; text-align: center; font-size: .64rem; letter-spacing: .05em; text-transform: uppercase; padding: .2rem; margin-bottom: .15rem; }
.ew-op { padding: .16rem 1.1rem; color: var(--texto); cursor: pointer; white-space: nowrap; } a.ew-op:hover { background: var(--sel); color: #fff; }
.ew-op.no { color: #9aa0a8; cursor: default; } .ew-ops hr { border: 0; border-top: 1px solid var(--gris2); margin: .2rem .8rem; width: auto; }
.ew-margen { display: flex; justify-content: space-between; gap: 1rem; background: #ffffa8; border: 1px solid #d9d98a; padding: .08rem .5rem; font-size: .7rem; text-transform: uppercase; margin-top: auto; }
.ew-margen.malo { background: #ffd9d4; border-color: #e5a3a3; }
.ew-obs-t { flex: 1; min-height: 2.5rem; white-space: pre-line; overflow: auto; background: #fbfbfb; border: 1px solid var(--gris); padding: .2rem .35rem; }
.ew-lineas { position: relative; border: 1px solid var(--gris3); border-radius: 0; background: #fff; min-height: 7rem; max-height: none; padding: 0; margin: 0; }
.ew-lineas .barra-tabla { display: none; } .ew-lineas .barra-tabla + table th, .ew-lineas table th { top: 0; }
.ew-lineas table { font-size: .78rem; } .ew-lineas table th { padding: .16rem .45rem; font-weight: 500; } .ew-lineas table td { padding: .12rem .45rem; border-right: 1px solid #eceef1; }
.ew-lineas tbody tr { cursor: default; } .ew-lineas tbody tr.elegida td { background: #dcebf9; }
.ew-est { display: inline-block; padding: 0 .4rem; border-radius: .2rem; font-size: .68rem; font-weight: 600; background: var(--gris); color: #444; white-space: nowrap; }
.ew-est.res { background: #e3f3e8; color: #1b6b3a; } .ew-est.ppr { background: #fff3cd; color: #8a5a00; } .ew-est.pco { background: #e2ecfb; color: #174a9c; }
.ew-est.alb { background: #e9e4f7; color: #4b3a8f; } .ew-est.fac { background: var(--gris); color: #555; } .ew-est.anu { background: #fde3e0; color: #b3261e; }
.ew-sello { position: absolute; left: 6rem; top: 2.2rem; transform: rotate(-9deg); border: .3rem solid #e06b72; color: #e06b72; font-size: 2.4rem; font-weight: 700; padding: 0 1rem; opacity: .75; pointer-events: none; letter-spacing: .03em; }
.ew-barra { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; background: #e9ebef; border: 1px solid var(--gris3); border-top: 0; padding: .25rem .4rem; }
.ew-barra .hueco { flex: 1; } .ew-barra .sep { width: 1px; align-self: stretch; background: var(--gris3); margin: 0 .2rem; }
.ew-barra .bt.nav { min-width: 2rem; justify-content: center; padding: .15rem .3rem; color: #0b7a53; font-size: .85rem; } .ew-barra .bt.nav.apagado { opacity: .35; cursor: default; }
.ew-barra .bt.navmodo { padding: .15rem .45rem; font-size: .8rem; } .ew-barra .bt.navmodo.activo { background: #0b7a53; color: #fff; border-color: #0b7a53; }
.ew-barra .bt.salir { background: var(--marino2); color: #fff; border-color: var(--marino2); margin-left: .4rem; }
.ew-stock { display: flex; flex-wrap: wrap; background: #fff; border: 1px solid var(--gris3); border-top: 0; }
.ew-stock > div { display: flex; flex-direction: column; min-width: 6.4rem; border-right: 1px solid var(--gris2); }
.ew-stock > div > span { font-size: .66rem; color: #444; padding: .02rem .35rem; border-bottom: 1px solid var(--gris); white-space: nowrap; }
.ew-stock > div > b { text-align: right; padding: .04rem .4rem; font-weight: 500; min-height: 1.25rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ew-stock > div.art > b, .ew-stock > div.enl > b { text-align: left; } .ew-stock > div.enl { flex: 1; border-right: 0; } .ew-stock > div.st > b { background: #ffffa8; } .ew-stock > div.neg > b { color: #c62828; font-weight: 700; }
.ew-pie { display: flex; flex-wrap: wrap; align-items: stretch; gap: .4rem .8rem; background: #7f8287; color: #fff; padding: .35rem .5rem; margin-top: .35rem; border-radius: .2rem; }
.ew-tot { display: grid; gap: .1rem; align-content: end; } .ew-tot > div { display: flex; align-items: center; gap: .35rem; }
.ew-tot span { width: 5.4rem; text-align: right; font-size: .72rem; } .ew-tot b { width: 6.5rem; background: #f3f4f6; color: var(--texto); text-align: right; padding: 0 .35rem; height: 1.25rem; line-height: 1.25rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.ew-pie table.iva { width: auto; align-self: flex-end; border-collapse: collapse; font-size: .74rem; }
.ew-pie table.iva th { background: none; color: #fff; font-weight: 400; padding: 0 .5rem .1rem; position: static; border: 0; } .ew-pie table.iva td { background: #fff; color: var(--texto); padding: .05rem .5rem; border: 1px solid var(--gris2); min-width: 4.2rem; height: 1.25rem; }
.ew-pie .cajas { display: flex; gap: .35rem; align-items: flex-end; } .ew-pie .caja { display: flex; flex-direction: column; min-width: 4.4rem; }
.ew-pie .caja > span { font-size: .66rem; white-space: nowrap; } .ew-pie .caja > b { background: #f3f4f6; color: var(--texto); text-align: right; padding: 0 .4rem; height: 1.25rem; line-height: 1.25rem; font-weight: 600; }
.ew-pie .caja.aviso > b { background: #ffe9a8; }
.ew-notas { flex: 1; min-width: 12rem; display: flex; flex-direction: column; justify-content: flex-end; gap: .15rem; } .ew-notas .nota-pie { margin: 0; color: #f1f1f1; }
.ew-notas .cadena { margin: 0; background: #fff; color: var(--texto); padding: .15rem .4rem; border-radius: .15rem; font-size: .72rem; }
.ew-total { display: flex; flex-direction: column; justify-content: space-between; background: #4f7a70; margin: -.35rem -.5rem -.35rem 0; padding: .3rem .6rem; min-width: 11rem; border-radius: 0 .2rem .2rem 0; }
.ew-total span { font-weight: 600; } .ew-total small { font-weight: 400; } .ew-total b { background: #f3f4f6; color: var(--texto); text-align: right; font-size: 1.15rem; font-style: italic; padding: 0 .5rem; }
@media (min-width: 64rem) and (min-height: 34rem) {
  main:has(> .ew-pantalla) { padding: .4rem .5rem; } main:has(> .ew-pantalla) > .atras { display: none; }
  .doc-pantalla.ew-pantalla > .ew-top, .ew-pantalla > .ew-barra, .ew-pantalla > .ew-stock, .ew-pantalla > .ew-pie { flex: none; }
}
@media (max-width: 63.9375rem) {
  .ew-top { grid-template-columns: 1fr; } .ew-total { margin: 0; width: 100%; border-radius: .2rem; } .ew-stock > div { flex: 1 1 30%; }
}
.ew-top { grid-template-columns: minmax(25rem, 31rem) minmax(22rem, 1fr) minmax(11rem, 17rem); }
.ew-lineas table td { white-space: nowrap; line-height: 1.15rem; } .ew-lineas table td.tj-tit { max-width: 0; width: 38%; overflow: hidden; text-overflow: ellipsis; }
.ew-barra .bt { min-height: 1.5rem; padding: .1rem .55rem; } .ew-barra { padding: .2rem .4rem; }
.ew-barra .bt[disabled] { opacity: .45; cursor: not-allowed; }
/* Alta y modificación con la misma distribución: las casillas editables ocupan el sitio de los datos. */
.ewc > input, .ewc > select, .ewc > .buscador { flex: 1; min-width: 0; }
.ewc input, .ewc select { width: 100%; height: 1.45rem; padding: 0 .3rem; font-size: .78rem; border: 1px solid var(--gris3); border-radius: 0; background: #fff; margin: 0; }
.ewc input[readonly], .ewc select[disabled] { background: #f3f4f6; }
.ewc .buscador { position: relative; } .ewc .sugerencias { min-width: 24rem; }
textarea.ew-obs-t { resize: none; font: inherit; white-space: pre-wrap; width: 100%; margin: 0; border-radius: 0; }
.ew-aviso-cli { background: #fff3cd; border: 1px solid #e6cf85; padding: .05rem .4rem; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ew-ayuda { color: #555; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .4rem; min-width: 0; }
.ew-stock > div.aviso > b { color: #b3261e; font-weight: 600; }
.ew-pantalla > .panel-aviso.fino, .ew-pantalla > #resultado > .panel-aviso { margin: 0 0 .3rem; padding: .2rem .5rem; font-size: .76rem; }
.ew-pantalla > #resultado:empty { display: none; }
.ew-lineas.lineas-editor input { height: 1.4rem; padding: 0 .3rem; font-size: .78rem; border-radius: 0; margin: 0; }
.ew-lineas.lineas-editor table td { padding: .06rem .25rem; }
@media (min-width: 64rem) and (min-height: 34rem) { .ew-pantalla > .panel-aviso, .ew-pantalla > #resultado { flex: none; } }
.ew-barra .bt kbd { background: none; border: 0; color: inherit; opacity: .75; font-size: .68rem; padding: 0 0 0 .3rem; }
.ew-menu.arriba .ew-ops { top: auto; bottom: 100%; }

/* Línea de texto (nota) en un documento: azul y en cursiva, como la pinta el programa original. */
.ew-nota { color: #1d4ea8; font-style: italic; }

/* Diálogo de entregas a cuenta del pedido. */
.ent-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .5rem 0 .7rem; }
.ent-res > div { background: var(--gris1, #eef1f5); border: 1px solid var(--gris2); padding: .35rem .6rem; display: flex; flex-direction: column; }
.ent-res span { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: #5b6470; } .ent-res b { font-size: 1.15rem; text-align: right; font-variant-numeric: tabular-nums; }
.ent-res .falta { background: #fff6d6; border-color: #e6cf7a; }
.ent-lista { max-height: 14rem; overflow: auto; }
.ent-nueva { border: 1px solid var(--gris2); margin: .7rem 0 0; padding: .5rem .7rem .7rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .8rem; align-items: end; }
.ent-nueva legend { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: 0 .3rem; }
.ent-nueva label { display: flex; flex-direction: column; gap: .15rem; font-size: .75rem; min-width: 0; } .ent-nueva select, .ent-nueva input { width: 100%; }
.ent-nueva .bt { grid-column: 2; justify-self: end; }

/* Pantalla de factura: pestañas Giros / Observaciones en el bloque de la derecha */
.ew-obs.fac-lado { gap: 0; padding-top: 0; }
.fac-pest { display: flex; gap: .15rem; margin: 0 -.4rem .25rem; padding: .2rem .3rem 0; background: #dfe9e4; border-bottom: 1px solid var(--gris3); }
.fac-pest button { border: 1px solid transparent; border-bottom: 0; background: none; padding: .12rem .6rem; font: inherit; font-size: .76rem; cursor: pointer; border-radius: .2rem .2rem 0 0; color: var(--texto); }
.fac-pest button.activa { background: #fff; border-color: var(--gris3); font-weight: 600; margin-bottom: -1px; }
.fac-giros { flex: 1; min-height: 2.5rem; overflow: auto; border: 1px solid var(--gris); background: #fbfbfb; }
.fac-giros table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.fac-giros th { position: sticky; top: 0; background: #eef0f3; color: var(--texto); font-weight: 500; text-align: left; padding: .1rem .35rem; }
.fac-giros td { padding: .1rem .35rem; border-bottom: 1px solid #eceef1; white-space: nowrap; }
.fac-giros th.d, .fac-giros td.d { text-align: right; }
.fac-giros tr.cobrado td { color: var(--suave); } .fac-giros tr.vencido td:first-child { color: #b3261e; font-weight: 600; }
@media (max-width: 63.9375rem) { main:has(> .ew-pantalla) > .atras { float: none; display: inline-flex; align-items: center; margin-bottom: .4rem; } .ew-pantalla { clear: both; } }
/* Móvil (contingencia): la rejilla de la pantalla se pinta como tarjetas; se deshacen el ancho fijo y el recorte de escritorio. */
@media (max-width: 40rem) {
  .ew-lineas { border: 0; background: none; min-height: 0; }
  .ew-lineas table.tj td { white-space: normal; border-right: 0; line-height: 1.35; }
  .ew-lineas table.tj td.tj-tit { max-width: none; width: auto; overflow: visible; }
}
@media (max-width: 63.9375rem) { .ew-pantalla > .ew-top { grid-template-columns: minmax(0, 1fr); } .ew-pantalla > .ew-top > * { min-width: 0; overflow-x: auto; } }

/* ── Mantenimientos (clientes, proveedores, artículos) con la distribución del original: pestañas, código y nombre, cuerpo y barra ── */
.ew-mant-tit { display: flex; align-items: center; gap: .5rem; background: var(--marino); color: #fff; padding: .2rem .6rem; border-radius: .2rem .2rem 0 0; min-height: 1.7rem; flex: none; }
.ew-mant-tit b { font-weight: 600; letter-spacing: .02em; margin-right: auto; }
.ew-pest { display: flex; flex-wrap: wrap; gap: .15rem; padding: .3rem .4rem 0; background: #dfe5ee; border: 1px solid var(--gris3); border-width: 0 1px; flex: none; }
.ew-pest button { border: 1px solid var(--gris3); border-bottom: 0; background: #eef1f6; padding: .2rem .8rem; font: inherit; font-size: .78rem; cursor: pointer; border-radius: .25rem .25rem 0 0; color: var(--texto); }
.ew-pest button:hover { background: #fff; } .ew-pest button.activa { background: #fff; font-weight: 600; margin-bottom: -1px; padding-bottom: calc(.2rem + 1px); color: var(--marino2); }
/* Archivos (mantenimientos de cada módulo): índice, lista y ficha editable */
.ewc.s2 { grid-column: span 2; } .ewc.s12 { grid-column: span 12; }
.ew-pest a { border: 1px solid var(--gris3); border-bottom: 0; background: #eef1f6; padding: .2rem .8rem; font-size: .78rem; border-radius: .25rem .25rem 0 0; color: var(--texto); text-decoration: none; }
.ew-pest a:hover { background: #fff; } .ew-pest a.activa { background: #fff; font-weight: 600; margin-bottom: -1px; padding-bottom: calc(.2rem + 1px); color: var(--marino2); }
.ew-arch-mod { border-width: 1px 1px 0; border-radius: .2rem .2rem 0 0; }
.ew-arch-grupos { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem; align-items: start; background: #fff; border: 1px solid var(--gris3); padding: .6rem; }
.ew-arch-grupos nav { display: flex; flex-direction: column; } .ew-arch-grupos nav > * { padding: .22rem .3rem; border-bottom: 1px solid var(--gris); text-decoration: none; color: var(--texto); }
.ew-arch-grupos nav > a:hover { background: #eef3fb; color: var(--marino2); } .ew-arch-grupos nav > .apagado { color: #9aa1ab; cursor: default; } .ew-arch-grupos nav > .apagado.sin-uso { text-decoration: line-through; opacity: .75; }
.ew-arch-nota { margin: .4rem 0 0; font-size: .74rem; }
.ew-arch-lista tr[data-ir] { cursor: pointer; }
.ew-arch .ewc.memo { align-items: flex-start; } .ew-arch .ewc textarea { flex: 1; min-width: 0; font: inherit; font-size: .78rem; border: 1px solid var(--gris3); border-radius: 0; margin: 0; padding: .15rem .3rem; resize: vertical; }
.ew-arch .ewc input:disabled, .ew-arch .ewc select:disabled, .ew-arch .ewc textarea:disabled { background: #f3f4f6; color: var(--texto); opacity: 1; -webkit-text-fill-color: var(--texto); }
.ew-arch .ewc input.num { text-align: right; font-variant-numeric: tabular-nums; }
.ew-arch .ewc.chk input { width: 1rem; height: 1rem; flex: none; }
.ew-arch .ewc input.ref-cod { flex: 0 0 7.5rem; width: 7.5rem; } .ew-arch .ewc .ref-nom { flex: 1; min-width: 0; font-style: normal; font-size: .74rem; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ew-arch .ewc .ref-nom.malo { color: #b3261e; font-weight: 600; }
.ew-arch .ewc.fuerte input { font-weight: 600; }
.ew-arch-det { max-width: 26rem; } .ew-arch-det.ew-art-ancho, .ew-art-ancho { max-width: 52rem; } .ew-art-ancho select { width: 100%; height: 1.45rem; font: inherit; font-size: .76rem; } .ew-art-ancho td i { font-style: normal; font-weight: 600; } .ew-arch-det.ew-art-ancho .d { width: 6.5rem; } .ew-art-ancho input:disabled { background: var(--gris-claro, #eef0f3); color: inherit; opacity: .8; } .ew-art-rejillas { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; } .ew-art-rejillas > section { flex: 1 1 22rem; margin: 0; } .ew-art-rejillas > .ew-art-ancho { flex: 2 1 34rem; } .ew-arch-det table { width: 100%; border-collapse: collapse; } .ew-arch-det th, .ew-arch-det td { padding: .1rem .3rem; font-size: .76rem; text-align: left; } .ew-arch-det .d { text-align: right; width: 3.5rem; }
.ew-arch-det input { width: 100%; height: 1.45rem; padding: 0 .3rem; border: 1px solid var(--gris3); text-align: right; } .ew-arch-det .bt { min-height: 1.3rem; padding: 0 .45rem; }
.ew-arch-det.ew-det-txt { max-width: 64rem; } .ew-det-txt input[data-txt] { text-align: left; } .ew-det-txt .d { width: 5.5rem; } .ew-det-txt td.corto { width: 8.5rem; } .ew-det-txt td:last-child, .ew-det-txt th:last-child { width: 2.2rem; }
.ew-pregunta { margin: .6rem 0 1rem; line-height: 1.4; }
/* Tarifa de compra del artículo, listas de los diálogos de T.C.P.'s y «Act. Artículos» */
.ew-art-rejillas > .ter-rej { flex: 1 1 100%; max-width: 64rem; overflow-x: auto; } .ter-rej table { min-width: 34rem; } .ter-rej input[type=text] { text-align: left; } .ter-rej select { width: 100%; height: 1.45rem; font: inherit; font-size: .76rem; }
.ter-rej td.n, .ter-rej th.n { width: 2.6rem; text-align: right; color: var(--gris6, #667); } .ter-rej td.corto { width: 8.5rem; } .ter-rej td.tipo { width: 5rem; } .ter-rej .c { width: 3.6rem; text-align: center; } .ter-rej .c input { width: auto; height: auto; }
.ter-rej td:last-child, .ter-rej th:last-child { width: 2.2rem; } .ter-rej tr.pred input[type=text] { font-weight: 600; }
.ew-art-rejillas > .ew-art-prov { flex: 1 1 100%; max-width: none; overflow-x: auto; } .ew-art-prov table { min-width: 52rem; } .ew-art-prov .d { width: 5.6rem; } .ew-art-prov .c { text-align: center; } .ew-art-prov .c input { width: auto; height: auto; }
.ew-art-prov header .suave { margin-left: auto; margin-right: .6rem; font-size: .74rem; } .ew-art-prov .pv-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.ew-tcp-lista { max-height: 50vh; overflow: auto; max-width: none; } .ew-tcp-lista input[type=checkbox] { width: auto; height: auto; } .ew-act-art { margin: .4rem 0; } .ew-act-art .ewc > span { width: 6.2rem; }
@media (max-width: 63.9375rem) { .ew-mant .ewc.s2 { grid-column: span 3; } .ew-arch .ewc input.ref-cod { flex-basis: 6rem; } }
.ew-mant-id { background: #fff; border: 1px solid var(--gris3); border-bottom: 0; padding: .4rem .5rem .1rem; flex: none; }
.ewc.s9 { grid-column: span 9; } .ew-mant-id .ewc > b { font-size: .86rem; } .ew-mant-id .fav-bt { flex: none; }
.ew-mant .ewc > span { width: 6.6rem; } .ew-mant .ewc.s3 > span, .ew-mant .ewc.s4 > span { width: 5.2rem; }
.ew-mant .ewc.num > b { text-align: right; font-variant-numeric: tabular-nums; } .ew-mant .ewc.malo > b { color: #b3261e; font-weight: 600; }
.ew-mant .ewc.chk { gap: .35rem; } .ew-mant .ewc.chk > span { width: auto; text-align: left; white-space: normal; }
.ew-mant .cas { flex: none; width: 1rem; height: 1rem; border: 1px solid var(--gris3); background: #fff; display: inline-grid; place-items: center; font-style: normal; font-size: .72rem; line-height: 1; color: #0b7a53; font-weight: 700; }
.ew-mant-cuerpo { background: #fff; border: 1px solid var(--gris3); padding: .45rem .5rem; display: flex; flex-direction: column; gap: .4rem; min-height: 16rem; }
.ew-mant-cuerpo .ew-blq { background: #fafbfc; } .ew-mant-cuerpo .ew-blq > header { background: #dfe9e4; color: var(--texto); }
.ew-mant-cuerpo .ew-blq.crece { flex: 1; min-height: 0; } .ew-mant-cuerpo .ew-blq.crece > .ew-mini { flex: 1; }
.ew-cols { display: grid; gap: .4rem; align-items: start; } .ew-cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ew-cols.c3 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr); }
.ew-cols.est { grid-template-columns: minmax(22rem, 34rem) minmax(16rem, 26rem); }
.ew-col { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.ew-mini { min-height: 3.2rem; max-height: 15rem; overflow: auto; } .ew-blq.crece > .ew-mini { max-height: none; }
.ew-mini .vacio { padding: .6rem; font-size: .76rem; }
.ew-lista { list-style: none; margin: 0; padding: .1rem .2rem; background: #fff; border: 1px solid var(--gris2); min-height: 3.2rem; } .ew-lista li { padding: .05rem .3rem; }
.ew-botones { display: flex; flex-wrap: wrap; gap: .3rem; } .ew-botones .bt { padding: .15rem .6rem; min-height: 1.6rem; font-size: .76rem; display: inline-flex; align-items: center; gap: .3rem; }
.ew-botones .bt[disabled] { opacity: .45; cursor: not-allowed; } .ew-barra .bt small, .ew-botones .bt small { background: var(--marino2); color: #fff; border-radius: .6rem; padding: 0 .35rem; font-size: .66rem; margin-left: .25rem; }
.ew-opc { display: flex; align-items: center; gap: .9rem; font-size: .76rem; } .ew-opc > span { color: #444; } .ew-opc label { display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; } .ew-opc input { margin: 0; }
table.ew-meses { width: 100%; border-collapse: collapse; font-size: .78rem; background: #fff; border: 1px solid var(--gris2); }
table.ew-meses th { position: static; padding: .16rem .5rem; font-weight: 500; } table.ew-meses td { padding: .1rem .5rem; border-top: 1px solid #eceef1; font-variant-numeric: tabular-nums; }
table.ew-meses tfoot td { font-weight: 700; background: #ffffa8; border-top: 1px solid #d9d98a; } table.ew-meses .barra-h { width: 30%; padding-left: 0; }
table.ew-meses .barra-h i { display: block; height: .55rem; background: #7fa7d6; border-radius: .1rem; min-width: 0; }
.ew-obs-t.corta { min-height: 2.6rem; flex: none; } .ew-mant-cuerpo .ew-obs-t { min-height: 8rem; background: #fff; }
.ew-mant-cuerpo .ew-obs-t.corta { min-height: 2.6rem; }
.ew-formula { margin: .1rem 0 0; font-size: .7rem; color: #555; } .ew-vacio { margin: 2rem auto; }
.ew-foto { display: grid; place-items: center; min-height: 9rem; background: #fff; border: 1px dashed var(--gris3); color: var(--suave); }
.ew-mant > .ew-aviso-cli { margin-top: .3rem; white-space: normal; } .ew-mant > .ew-stock { margin-top: .3rem; border-top: 1px solid var(--gris3); }
.ent-lista.alta { max-height: min(24rem, 55vh); }
@media (min-width: 64rem) and (min-height: 34rem) { .ew-mant > .ew-aviso-cli { flex: none; } .ew-mant-cuerpo { min-height: 0; } }
@media (max-width: 63.9375rem) {
  .ew-cols.c2, .ew-cols.c3, .ew-cols.est { grid-template-columns: minmax(0, 1fr); } .ew-mant-cuerpo { min-height: 0; }
  .ew-pest { flex-wrap: nowrap; overflow-x: auto; } .ew-pest button { white-space: nowrap; flex: none; min-height: 2.2rem; }
}
@media (max-width: 40rem) {
  .ew-mant .ew-g { grid-template-columns: repeat(6, minmax(0, 1fr)); } .ew-mant .ewc, .ew-mant .ewc.s3, .ew-mant .ewc.s4, .ew-mant .ewc.s5, .ew-mant .ewc.s6, .ew-mant .ewc.s7, .ew-mant .ewc.s8, .ew-mant .ewc.s9 { grid-column: span 6; }
  .ew-mant .ewc.s3, .ew-mant .ewc.s4.num, .ew-mant .ewc.s6.num, .ew-mant .ewc.chk.s3, .ew-mant .ewc.chk.s4 { grid-column: span 3; } .ew-mant .ewc.num > span { width: 4.6rem; white-space: normal; line-height: 1; }
  .ew-mant-id .ewc.s3 { grid-column: span 6; } .ew-mini { max-height: none; }
}
.ew-datos-ter { display: flex; flex-direction: column; gap: .4rem; } .ew-datos-ter .ew-aviso-cli { white-space: normal; } .ew-datos-ter .ew-obs-t { min-height: 5rem; max-height: 12rem; overflow: auto; background: #fff; white-space: pre-wrap; }
.ew-cli > .ew-aviso-cli { margin: .15rem .3rem 0; font-weight: 600; }

.ew-datos-ter table td { max-width: 13rem !important; overflow: hidden; text-overflow: ellipsis; } .ew-datos-ter .con table td:first-child { min-width: 8rem; }

/* Mantenimiento de empresas: subpestañas y rejilla de «Opciones generales» (títulos de grupo en amarillo y activas en verde, como el original). */
.ew-pest.sub { border-width: 0 0 1px; background: none; padding: 0; margin-bottom: .1rem; flex: none; }
.ew-sub-cuerpo { min-width: 0; display: flex; flex-direction: column; gap: .4rem; flex: 1; min-height: 0; }
.ew-ogen-barra { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: none; }
.ew-ogen-barra input[type=search] { flex: 1 1 14rem; min-width: 0; height: 1.6rem; margin: 0; padding: 0 .4rem; font-size: .8rem; border: 1px solid var(--gris3); border-radius: 0; }
.ew-ogen-solo { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; white-space: nowrap; } .ew-ogen-solo input { width: 1rem; height: 1rem; margin: 0; }
.ew-ogen { min-width: 0; flex: 1; min-height: 12rem; overflow: auto; border: 1px solid var(--gris3); background: #fff; }
.ew-ogen table { table-layout: fixed; width: 100%; border-collapse: collapse; font-size: .8rem; }
.ew-ogen th { position: sticky; top: 0; background: #dfe5ee; color: var(--texto); text-align: left; padding: .2rem .5rem; border-bottom: 1px solid var(--gris3); font-weight: 600; z-index: 1; }
.ew-ogen th.c, .ew-ogen td.c { text-align: center; width: 4.5rem; }
.ew-ogen td { padding: .14rem .5rem; border-bottom: 1px solid #eceff3; }
.ew-ogen tr.tit td { background: #fff3a6; font-weight: 700; letter-spacing: .02em; }
.ew-ogen tr.on td { background: #d9f2df; } .ew-ogen tr.cambiada td:first-child { font-weight: 600; box-shadow: inset 3px 0 0 #d97706; }
.ew-ogen tbody tr.sel td { background: #cfe0f7; color: var(--texto); } .ew-ogen tr[data-c] { cursor: default; }
.ew-ogen input[type=checkbox] { width: 1rem; height: 1rem; margin: 0; vertical-align: middle; } .ew-ogen.edicion input[type=checkbox] { cursor: pointer; }
.ew-ogen-exp { flex: none; border: 1px solid var(--gris3); background: #fafbfc; padding: .3rem .5rem; font-size: .8rem; min-height: 3.6rem; }
.ew-ogen-exp b { display: block; font-size: .72rem; color: #444; } .ew-ogen-exp small { color: var(--suave); margin-right: .3rem; }
.ew-ogen-nota { flex: none; margin: 0; font-size: .74rem; color: #7a4b00; background: #fff8e6; border: 1px solid #f1d9a0; padding: .25rem .5rem; }
.ew-mant.editando .ew-pest:not(.sub) button:not(.activa) { opacity: .55; }
/* Pantallas de 1280 a 1376 px: el menú se aprieta para que la cabecera no ensanche la página. */
@media (min-width: 64.0625rem) and (max-width: 86rem) { .barra { gap: .7rem; } #menu a, #menu .grupo > button { padding: 0 .5rem; } }
.ew-emp .ewc > span, .ew-emp .ewc.s3 > span, .ew-emp .ewc.s4 > span { width: auto; min-width: 5.2rem; }

/* Opciones generales: qué hace la aplicación con cada opción, y pantallas de pedido sin existencias (opción WL_EXIS). */
.ew-uso { display: inline-block; font-size: .66rem; font-weight: 600; line-height: 1.5; padding: 0 .4rem; border-radius: .6rem; border: 1px solid; white-space: nowrap; }
.ew-uso.conectada { color: #0b6b2f; background: #e3f6e8; border-color: #9bd3ab; } .ew-uso.fija { color: #1f4f8f; background: #e6eefb; border-color: #a9c1e8; }
.ew-uso.pendiente { color: #7a4b00; background: #fff4d6; border-color: #ecd08a; } .ew-uso.descartada { color: #666; background: #eee; border-color: #ccc; }
.ew-ogen tr.tit.propia td { background: #1f4f8f; color: #fff; } .ew-ogen-uso { margin-top: .2rem; } .ew-ogen-nota .ew-uso { margin-left: .15rem; }
.sin-exis .ew-stock > div.ex, .sin-exis .c-st { display: none; }

/* Mantenimiento de empresas en edición */
.ew-emp label.ewc.chk { cursor: pointer; } .ew-emp .ewc.chk input { width: 1rem; height: 1rem; flex: none; margin: 0 .2rem 0 0; }
.ew-emp .ewc.chk.ed > span { width: auto; text-align: left; }
.ew-emp .ewc input.num, .ew-emp .ew-mini td input.num { text-align: right; font-variant-numeric: tabular-nums; }
.ew-emp .ewc.cambiada input, .ew-emp .ewc.cambiada select, .ew-emp .ew-mini td input.cambiada { background: #fff8e1; border-color: #d9a400; }
.ew-emp .ewc.chk.cambiada > span { background: #fff8e1; }
.ew-emp .ew-mini td input { width: 100%; min-width: 6.5rem; height: 1.45rem; padding: 0 .3rem; font-size: .78rem; border: 1px solid var(--gris3); border-radius: 0; margin: 0; }

/* ---------- escritorio de ventanas (web/ventanas.js) ---------- */
#escritorio { min-height: 0; display: flex; isolation: isolate; }
.esc-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.esc-zona { position: relative; flex: 1; min-height: 0; display: flex; }
.esc-zona > main { flex: 1; min-width: 0; }
#ventanas { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
body:not(.con-ventanas) #ventanas, body:not(.con-ventanas) #tareas { display: none; }
#tareas { flex: none; display: flex; gap: .25rem; padding: .2rem .5rem; background: #dfe5ee; border-top: 1px solid var(--borde); overflow-x: auto; }
#tareas:empty { display: none; }
#tareas button.t-v { display: flex; align-items: center; gap: .4rem; }
#tareas button.t-v span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#tareas button.t-v i { flex: none; font-style: normal; font-size: .65rem; opacity: .55; padding: .1rem .2rem; border-radius: .15rem; }
#tareas button.t-v i:hover { opacity: 1; background: #d93a2b; color: #fff; }
#tareas .t-hueco { flex: 1; }
#tareas button.t-u { flex: none; min-width: 0; background: none; border-color: transparent; color: var(--marino); }
#tareas button.t-u:hover { background: #fff; border-color: var(--borde); }
#tareas button { flex: 0 1 13rem; min-width: 5rem; height: 1.6rem; padding: 0 .6rem; border: 1px solid var(--borde); border-radius: .2rem; background: #fff; color: inherit; font-size: .74rem; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
#tareas button.activa { background: var(--marino); border-color: var(--marino); color: #fff; font-weight: 500; }
#tareas button.min { opacity: .65; font-style: italic; }
#b-modo { height: 1.15rem; margin-left: .8rem; padding: 0 .5rem; border: 1px solid #ffffff55; border-radius: .2rem; background: none; color: inherit; font: inherit; cursor: pointer; }
#b-modo:hover { background: #ffffff22; }
@media (max-width: 64rem) { #b-modo { display: none; } }
.ventana { position: absolute; display: flex; flex-direction: column; min-width: 22rem; min-height: 7rem; background: var(--fondo); border: 1px solid #8793ad; border-radius: .35rem; box-shadow: 0 .3rem 1rem #0003; pointer-events: auto; resize: both; overflow: hidden; }
.ventana.activa { border-color: var(--marino); box-shadow: 0 .7rem 2.2rem #0006; }
.ventana.min { display: none; }
.ventana.max { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; max-height: none !important; border-radius: 0; resize: none; }
.ventana.cargando > main { opacity: .6; }
.ventana > main { flex: 1; min-height: 0; }
.v-cab { flex: none; display: flex; align-items: center; height: 1.8rem; padding-left: .7rem; background: #8793ad; color: #fff; font-size: .78rem; cursor: move; user-select: none; touch-action: none; }
.ventana.activa > .v-cab { background: var(--marino); }
.v-cab b { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-cab button { width: 2.1rem; height: 100%; border: 0; background: none; color: #fff; font-size: .85rem; cursor: pointer; }
.v-cab button:hover { background: #ffffff2e; }
.v-cab .v-x:hover { background: #d93a2b; }
.ventana { animation: v-abre .14s ease-out; transition: box-shadow .15s, border-color .15s; }
@keyframes v-abre { from { opacity: 0; transform: scale(.97) translateY(.4rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ventana { animation: none; } }
.ventana:not(.activa) > main { filter: saturate(.75); }
.ventana::after { content: ""; position: absolute; right: 0; bottom: 0; width: .9rem; height: .9rem; pointer-events: none; background: linear-gradient(135deg, transparent 50%, #8793ad 50%, #8793ad 58%, transparent 58%, transparent 70%, #8793ad 70%, #8793ad 78%, transparent 78%); }
.ventana.max::after { display: none; }
.v-cab::before { content: ""; flex: none; width: .55rem; height: .55rem; margin-right: .55rem; border-radius: 50%; background: #ffffff66; }
.ventana.activa > .v-cab::before { background: #5ec2ff; }
body.con-ventanas #vista { transition: opacity .2s, filter .2s; }
body.hay-ventanas #vista { opacity: .55; filter: saturate(.5); }
/* Dentro de una ventana: el título ya está en la cabecera, y las listas se ajustan al alto de la ventana. */
.ventana { --vh: calc(var(--v-alto, 100vh) + 2.9rem); }
.ventana > main > :not(.atras) > h1:first-child, .ventana .cab-ficha > h1 { font-size: 0; gap: 0; margin-bottom: .45rem; min-height: 0; }
.ventana > main > :not(.atras) > h1:first-child > * + *, .ventana .cab-ficha > h1 > * + * { margin-left: .7rem; }
.ventana > main > :not(.atras) > h1:first-child > *, .ventana .cab-ficha > h1 > * { line-height: 1.5; }
.ventana > main > :not(.atras) > h1:first-child { margin-top: .1rem; margin-bottom: .55rem; }
.ventana > main > :not(.atras) > h1:first-child:not(:has(*)), .ventana .cab-ficha > h1:not(:has(*)) { display: none; }
.ventana .ew-mant-tit:not(:has(> :not(b))) { display: none; }
.ventana > main:has(> :not(.atras) > .lista#cuerpo) { display: flex; flex-direction: column; overflow: hidden; }
.ventana > main > :has(> .lista#cuerpo) { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ventana > main > * > .lista#cuerpo { flex: 0 1 auto; min-height: 6rem; max-height: none; }

/* El documento, a todo el alto disponible: las líneas se llevan lo que sobra. */
.ventana:not(.max):has(> main > .doc-pantalla) { height: var(--v-alto); }
/* Vista rápida */
.bt.b-rapida[aria-pressed=true] { background: var(--marino); border-color: var(--marino); color: #fff; }
.ventana.rapida > .v-cab { background: #5d7a6b; }
.ventana.rapida.activa > .v-cab { background: #2f6b4f; }
.ventana.rapida { border-color: #5d7a6b; }
/* La barra de ventanas está siempre: el escritorio no cambia de alto al abrir la primera. */
body.con-ventanas #tareas, body.con-ventanas #tareas:empty { display: flex; min-height: calc(2rem + 1px); box-sizing: border-box; }
.lista#cuerpo:focus { outline: none; }

/* Adjuntos de incidencias (compras) */
.bt.b-adj small { margin-left: .35rem; background: #c62828; color: #fff; border-radius: 1rem; min-width: 1.1rem; padding: 0 .3rem; font-size: .66rem; line-height: 1.1rem; text-align: center; }
.bt.b-adj small[hidden] { display: none; }
.bt.b-adj.con { border-color: #c62828; font-weight: 600; }
.adj { display: flex; flex-direction: column; gap: .7rem; }
.adj-alta { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; padding: .6rem; border: 1px dashed var(--borde); border-radius: .3rem; background: #fff; }
.adj-nota { flex: 1 1 18rem; display: flex; flex-direction: column; gap: .15rem; font-size: .74rem; color: var(--suave); }
.adj-nota input { height: 2rem; padding: 0 .5rem; border: 1px solid var(--boton-borde, var(--borde)); border-radius: .2rem; font: inherit; color: var(--texto, inherit); }
.adj-boton { cursor: pointer; display: inline-flex; align-items: center; height: 2rem; padding: 0 .9rem; }
.adj-sobre { outline: 3px dashed var(--sel); outline-offset: -6px; }
.adj-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .7rem; max-height: 55vh; overflow: auto; }
.adj-lista > .vacio { grid-column: 1 / -1; }
.adj-uno { margin: 0; background: #fff; border: 1px solid var(--borde); border-radius: .3rem; overflow: hidden; display: flex; flex-direction: column; }
.adj-uno > a { display: grid; place-items: center; height: 8.5rem; background: #eef0f4; }
.adj-uno img { width: 100%; height: 8.5rem; object-fit: cover; display: block; }
.adj-ico { font-weight: 700; font-size: 1.1rem; letter-spacing: .05em; color: var(--marino); border: 2px solid var(--marino); border-radius: .3rem; padding: .7rem .6rem; background: #fff; }
.adj-uno figcaption { display: flex; flex-direction: column; gap: .15rem; padding: .4rem .5rem; font-size: .74rem; min-width: 0; }
.adj-uno figcaption b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adj-uno .adj-n { color: #8a4b00; }
.adj-uno small { color: var(--suave); font-size: .68rem; }
.adj-ac { display: flex; gap: .8rem; margin-top: .15rem; }
.adj-ac button.enlace { border: 0; background: none; padding: 0; font: inherit; color: #c62828; cursor: pointer; }
/* En ventana, las pantallas que acaban en una tabla (o en pestañas con tabla): se desplaza la tabla, no la ventana entera. */
.ventana > main:has(> :not(.atras) > :is(#tabla, #pestanas):last-child) { display: flex; flex-direction: column; overflow: hidden; }
.ventana > main > :not(.atras):has(> :is(#tabla, #pestanas):last-child) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ventana > main > :not(.atras):has(> :is(#tabla, #pestanas):last-child) > * { flex: none; }
.ventana > main > :not(.atras) > #tabla:last-child { flex: 1 1 auto; min-height: 9rem; overflow: auto; }
.ventana > main > :not(.atras) > #pestanas:last-child { flex: 1 1 auto; min-height: 11rem; display: flex; flex-direction: column; }
.ventana > main > :not(.atras) > #pestanas:last-child > .pest-cuerpo { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
/* Factura de tiques en ventana: se desplaza la lista de días, no la ventana. */
.ventana > main:has(> .editor #dias) { display: flex; flex-direction: column; overflow: hidden; }
.ventana > main > .editor:has(#dias) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ventana > main > .editor:has(#dias) > .ficha { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.ventana > main > .editor > .ficha > div:has(> #dias) { display: flex; flex-direction: column; min-height: 0; align-self: stretch; }
.ventana > main > .editor > .ficha > div:has(> #dias) > * { flex: none; }
.ventana > main > .editor > .ficha > div > #dias { flex: 1 1 auto; min-height: 8rem; max-height: none; height: auto; overflow: auto; }
.ventana > main > .editor > .ficha > div:has(> #dias) > p { margin-bottom: 0; }
/* El subtítulo de la ventana no se encoge (se montaba sobre los filtros de las listas). */
.ventana > main > :not(.atras) > h1:first-child { flex: none; }

/* Ordenar por el título de la columna. */
th.ord { cursor: pointer; user-select: none; }
th.ord:hover { background: #45474b; }
th.ord .o-fl { margin-left: .3rem; font-style: normal; font-size: .62rem; opacity: .35; }
th.ord[aria-sort] { background: #3a4a78; }
th.ord[aria-sort] .o-fl { opacity: 1; color: #ffd166; }
/* Chips de pendientes y alertas de cada cliente o proveedor en su lista. */
.sit { display: inline-flex; flex-wrap: wrap; gap: .2rem; }
.sit a.etiqueta { text-decoration: none; }
.sit a.etiqueta:hover { filter: brightness(.93); }

/* ---------- panel lateral (web/lateral.js): módulos con iconos, favoritos y accesos rápidos ---------- */
#lateral { flex: none; width: 12.2rem; min-height: 0; display: flex; flex-direction: column; background: #eef2f8; border-right: 1px solid var(--borde); font-size: .78rem; }
@media (max-width: 64rem) { #lateral { display: none; } }
.lat-cab { flex: none; display: flex; align-items: center; height: 1.7rem; padding-left: .7rem; background: var(--marino2); color: #fff; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.lat-cab b { flex: 1; font-weight: 500; }
.lat-cab button { width: 1.9rem; height: 100%; border: 0; background: none; color: #fff; font-size: .9rem; cursor: pointer; }
.lat-cab button:hover { background: #ffffff2e; }
.lat-cuerpo { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.lat-g h4 { margin: 0; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.lat-g.fijo h4 { display: flex; align-items: center; gap: .45rem; height: 1.65rem; padding: 0 .55rem; color: var(--marino2); background: #dfe7f3; border-bottom: 1px solid var(--borde); }
.lat-g.fijo h4 .lat-ic { color: #c98a00; }
.lat-g h4 > button { display: flex; align-items: center; gap: .45rem; width: 100%; height: 1.85rem; padding: 0 .55rem; border: 0; border-top: 1px solid #ffffff30; border-bottom: 1px solid #0f1d4d; background: linear-gradient(#2a3f85, var(--marino)); color: #fff; font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.lat-g h4 > button:hover { background: linear-gradient(#34499a, #22357c); }
.lat-g h4 > button i { margin-left: auto; font-style: normal; font-size: .65rem; transition: transform .15s; transform: rotate(-90deg); }
.lat-g.abierto h4 > button i { transform: none; }
.lat-ic { flex: none; width: 1.35rem; text-align: center; font-size: 1rem; line-height: 1; font-style: normal; }
.lat-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lat-g[data-g]:not(.abierto) > .lat-ops { display: none; }
.lat-ops, .lat-g.fijo { background: #fff; }
.lat-g.fijo { padding-bottom: .15rem; border-bottom: 1px solid var(--borde); }
.lat-op { display: flex; align-items: center; border-left: .2rem solid transparent; }
.lat-op > a { flex: 1; min-width: 0; display: flex; align-items: center; gap: .45rem; height: 1.8rem; padding: 0 .2rem 0 .35rem; color: var(--texto); }
.lat-op:hover { background: var(--boton); }
.lat-op.activo { border-left-color: var(--sel); background: #e3eefb; }
.lat-op.activo > a { color: var(--marino); font-weight: 500; }
.lat-fav { flex: none; width: 1.5rem; height: 1.5rem; margin-right: .15rem; padding: 0; border: 0; border-radius: .2rem; background: none; color: #9aa3b5; font-size: .85rem; line-height: 1; cursor: pointer; opacity: 0; }
.lat-op:hover .lat-fav, .lat-fav:focus-visible, .lat-fav.on { opacity: 1; }
.lat-fav.on { color: #e0a100; }
.lat-fav:hover { background: #fff; color: var(--marino); }
.lat-quitar:hover { background: #d93a2b; color: #fff; }
.lat-vacio { margin: .35rem .6rem; color: #7a8395; font-size: .7rem; line-height: 1.35; }
.lat-mas { display: flex; align-items: center; gap: .45rem; width: 100%; height: 1.7rem; padding: 0 .2rem 0 .55rem; border: 0; background: none; color: var(--marino2); font: inherit; font-size: .72rem; text-align: left; cursor: pointer; }
.lat-mas:hover { background: var(--boton); }
/* Plegado: solo los iconos. */
#lateral.plegado { width: 2.7rem; }
#lateral.plegado .lat-t, #lateral.plegado .lat-cab b, #lateral.plegado .lat-fav, #lateral.plegado .lat-vacio, #lateral.plegado h4 i, #lateral.plegado .lat-g[data-g] > .lat-ops { display: none; }
#lateral.plegado .lat-cab { padding: 0; } #lateral.plegado .lat-cab button { width: 100%; transform: scaleX(-1); }
#lateral.plegado .lat-g h4, #lateral.plegado .lat-g h4 > button, #lateral.plegado .lat-op > a, #lateral.plegado .lat-mas { justify-content: center; padding: 0; gap: 0; }
#lateral.plegado .lat-op { border-left-width: .15rem; }

/* Rejilla de líneas: columnas que se arrastran, subtotales, comentarios y modo edición de la casilla */
.ew-lineas th.th-col { cursor: grab; user-select: none; }
.ew-lineas th.th-col.arrastrando { opacity: .45; }
.ew-lineas th.th-col.sobre { box-shadow: inset 3px 0 0 #ffd54f; } .ew-lineas th.th-col.sobre-d { box-shadow: inset -3px 0 0 #ffd54f; }
.editor .lineas-editor.docx td.c-x { width: 6.2rem; white-space: nowrap; color: var(--suave); padding-right: .6rem; }
.editor .lineas-editor.docx td.c-x.neg { color: #c62828; font-weight: 600; }
.ew-lineas tbody tr.subtotal td { background: #eef2f8; border-top: 1px solid #b9c4d6; border-bottom: 1px solid #b9c4d6; }
.ew-lineas tbody tr.subtotal input { font-weight: 700; text-align: right; background: transparent; }
.ew-lineas tbody tr.subtotal td.c-imp b { font-size: .84rem; }
.ew-lineas tbody tr.texto td.c-desc input { font-style: italic; color: #37475f; }
.lineas-editor input[data-ed] { outline: 2px solid #f9a825; outline-offset: -1px; background: #fffde7; }
.cols-lista { display: grid; gap: .15rem; max-height: 55vh; overflow: auto; margin: .4rem 0; }
.cols-una { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .15rem .4rem; border: 1px solid var(--gris3); background: #fff; }
.cols-una label { display: flex; align-items: center; gap: .45rem; } .cols-una .bt { padding: 0 .45rem; min-height: 1.5rem; font-size: .65rem; margin-left: .2rem; }
.cols-una input[type=checkbox] { width: auto; min-height: 0; height: auto; margin: 0; } .cols-una .bt { min-height: 1.4rem; height: 1.4rem; }

/* Ancho de las columnas de cualquier rejilla: se tira del borde derecho del título */
th.th-col { cursor: grab; user-select: none; } th.th-col.arrastrando { opacity: .45; }
th.th-col.sobre { box-shadow: inset 3px 0 0 #ffd54f; } th.th-col.sobre-d { box-shadow: inset -3px 0 0 #ffd54f; }
th[data-c].borde-ancho, body.tirando-ancho, body.tirando-ancho * { cursor: col-resize !important; }
body.tirando-ancho { user-select: none; }
th.ancho-fijo, td.ancho-fijo { overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
td.ancho-fijo input:not([type=checkbox]) { width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
.lista.fra-prov tr:focus { outline: 2px solid var(--acento, #2f6fd0); outline-offset: -2px; }
.lista.fra-prov tr.marcado td { background: rgba(47, 111, 208, .08); }
/* Rejillas de la recepción de compra, del terminal de venta y de la vista del documento: mismas columnas configurables */
.lineas-editor th.th-col { cursor: grab; user-select: none; } .lineas-editor th.th-col.arrastrando { opacity: .45; }
.lineas-editor th.th-col.sobre { box-shadow: inset 3px 0 0 #ffd54f; } .lineas-editor th.th-col.sobre-d { box-shadow: inset -3px 0 0 #ffd54f; }
.editor .lineas-editor.docx td[data-c]:not(.c-desc) { min-width: 0; }
.editor .lineas-editor.docx td.c-q, .editor.tpv .lineas-editor td.c-q { width: 2rem; }
.editor.tpv .lineas-editor td[data-c] { width: auto; min-width: 0; padding-right: .3rem; font-size: inherit; white-space: normal; }
.editor.tpv .lineas-editor td.t-cod { width: 13rem; } .editor.tpv .lineas-editor td.t-desc { min-width: 12rem; } .editor.tpv .lineas-editor td.t-num { width: 6.5rem; }
.editor.tpv .lineas-editor td.t-imp { width: 7rem; white-space: nowrap; padding-right: .6rem; font-size: .9rem; }
.editor.tpv .lineas-editor td.t-x { width: 6rem; white-space: nowrap; color: var(--suave); padding-right: .6rem; }
.ew-lineas table.tj tbody tr.subtotal td { font-weight: 700; }

/* Sin ventanas: «Atrás» está siempre a la vista, también en las fichas y los documentos con forma de pantalla. */
main:has(> .ew-pantalla) > .atras { position: static; height: 1.45rem; display: inline-flex; float: none; align-items: center; margin: 0 0 .25rem; flex: none; align-self: flex-start; }
#b-modo.apagado { background: #f5c542; color: #1b2a4a; font-weight: 600; border-color: transparent; }
#b-modo.apagado:hover { background: #ffd866; }
/* Factura de venta: líneas del albarán desplegadas bajo su fila */
#albaranes td.alb-ver { white-space: nowrap; text-align: right; }
#albaranes tr.alb-det > td { background: #f6f8fb; padding: .25rem .4rem .55rem; white-space: normal; cursor: default; }
.alb-lin { width: 100%; border-collapse: collapse; font-size: .76rem; }
.alb-lin th { text-align: left; font-weight: 500; color: var(--suave); border-bottom: 1px solid var(--gris3); padding: .1rem .35rem; background: none; }
.alb-lin td { padding: .1rem .35rem; border-bottom: 1px solid #eceef1; }
.alb-lin th.d, .alb-lin td.d { text-align: right; }

/* Documento ya hecho: la rejilla se recorre con los cursores; la celda en la que se está lleva recuadro */
#doc-lineas:focus { outline: none; }
#doc-lineas:focus tbody tr.elegida td.celda { box-shadow: inset 0 0 0 2px #1f6fc4; background: #fff; }
#doc-lineas tbody tr.elegida td.celda { box-shadow: inset 0 0 0 1px #8fb4dc; }

/* Cambio de empresa y traspaso de albaranes entre empresas */
#b-empresa.cambia { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
#b-empresa.cambia:hover, #b-empresa.cambia:focus-visible { text-decoration-style: solid; outline: none; }
.emp-lista { display: flex; flex-direction: column; gap: .4rem; margin: .5rem 0; } .emp-lista .bt { text-align: left; justify-content: flex-start; }
.tr-emp { display: flex; align-items: center; gap: .5rem; margin: .3rem 0 .6rem; font-weight: 500; } .tr-emp select { flex: 1; min-width: 0; }
.tr-lista { max-height: 46vh; overflow: auto; } .tr-lista input.tr-u { width: 6.5rem; }
.tr-casillas { display: flex; gap: 1.4rem; flex-wrap: wrap; margin: .55rem 0 .2rem; } .tr-casillas label { display: inline-flex; gap: .35rem; align-items: center; }
.tr-res { margin: .35rem 0; min-height: 1.3rem; }
.ew-traspaso { flex: none; display: flex; flex-direction: column; gap: .15rem; background: #fff6d6; border: 1px solid #e6cf7a; padding: .25rem .6rem; font-size: .8rem; margin: .2rem 0; }

/* Listas de tiques y albaranes con estado: colores de las etiquetas y casillas de recuento. */
.etiqueta.e-ok { background: #e3f3e8; color: #1b6b3a; }
.etiqueta.e-pend { background: #fff3cd; color: #8a5a00; }
.etiqueta.e-apar { background: #e1ebfb; color: #1b3a7a; }
.etiqueta.e-fin { background: var(--gris); color: #555; }
.est-resumen { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .5rem; }
.est-casilla { display: flex; align-items: center; gap: .45rem; padding: .25rem .55rem; border: 1px solid var(--borde, #cfd4dc); border-radius: .4rem; background: #fff; cursor: pointer; font: inherit; }
.est-casilla:hover { background: #f3f6fb; }
.est-casilla.activa { border-color: #1b3a7a; box-shadow: inset 0 0 0 1px #1b3a7a; }
.est-casilla b { font-variant-numeric: tabular-nums; }
b.debe { color: #b3261e; }

/* Trazabilidad del documento en una ventana: diagrama de origen → documento → destino. */
.modal-caja.tpv-modal.traza-modal { width: min(60rem, 94vw); }
.traza { display: flex; align-items: stretch; gap: .6rem; margin: .8rem 0; overflow-x: auto; }
.traza-col { flex: 1 1 0; min-width: 12rem; display: flex; flex-direction: column; gap: .4rem; align-items: stretch; border: 1px solid var(--borde); border-radius: .4rem; padding: .6rem; background: #f6f8fb; }
.traza-col h4 { margin: 0 0 .2rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); }
.traza-fl { align-self: center; font-size: 1.5rem; color: var(--gris3, #9aa3b2); }
.traza .eslabon { display: flex; gap: .4rem; align-items: baseline; justify-content: space-between; border: 1px solid var(--borde); border-radius: .35rem; padding: .4rem .6rem; background: #fff; white-space: nowrap; }
.traza .eslabon b { color: var(--marino2); }
.traza .eslabon.este { background: var(--marino); border-color: var(--marino); color: #fff; } .traza .eslabon.este b { color: #fff; }
.traza .eslabon.anulado { opacity: .6; text-decoration: line-through; }
.traza-dat, .traza-vacio { font-size: .8rem; color: var(--suave); }
.traza-proc { font-size: .8rem; border-left: 3px solid var(--marino2); padding-left: .45rem; }
.bt.con-traza small { background: var(--marino); color: #fff; border-radius: 1rem; padding: 0 .4rem; font-size: .7rem; }

/* Mapa de trazabilidad: diagrama de flujo de la cadena de un documento (14-11-2026) */
.modal-caja.tpv-modal.mapa-doc { width: min(96vw, 88rem); height: min(88vh, 52rem); max-width: 100vw; max-height: 100vh; min-width: 22rem; min-height: 16rem; display: flex; flex-direction: column; overflow: hidden; }
.modal-caja.tpv-modal.mapa-doc.suelta { position: fixed; margin: 0; resize: both; }
.modal-caja.tpv-modal.mapa-doc.max { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100vh !important; height: 100dvh !important; border-radius: 0; resize: none; }
.mapa-tit { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; user-select: none; } .mapa-tit h3 { margin: 0; margin-right: auto; }
.suelta:not(.max) .mapa-tit { cursor: move; }
.mapa-herr { display: flex; gap: .25rem; flex-wrap: wrap; } .mapa-herr .bt { padding: .2rem .55rem; min-width: 2rem; } #mapa-cien { min-width: 3.6rem; font-variant-numeric: tabular-nums; } #mapa-max { margin-left: .5rem; }
.mapa-hoja { position: relative; display: flex; flex-direction: column; gap: .9rem; width: max-content; }
.mapa-lienzo { cursor: grab; outline: none; } .mapa-lienzo.arrastrando { cursor: grabbing; user-select: none; } .mapa-lienzo.arrastrando * { pointer-events: none; }
.mapa-doc .modal-pie { flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.mapa-ley { margin: .1rem 0 .5rem; }
.mapa-lienzo { position: relative; flex: 1 1 0; min-height: 6rem; overflow: auto; border: 1px solid var(--borde); border-radius: .4rem; background: #f3f5f9; padding: .6rem; display: flex; flex-direction: column; gap: .9rem; }
.mapa-svg { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; max-width: none; overflow: visible; }
.mapa-svg path[data-de] { fill: none; stroke: #7d8aa3; stroke-width: 1.6; }
.mapa-svg path.cruce { stroke-dasharray: 5 4; stroke: #b07a1a; }
.mapa-svg marker path { fill: #7d8aa3; stroke: none; }
.mapa-svg path.viva { stroke: var(--marino); stroke-width: 2.6; }
.mapa-banda { display: flex; gap: .5rem; min-width: 62rem; }
.mapa-rot { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: #fff; background: var(--marino); border-radius: .3rem; padding: .5rem .15rem; }
.mapa-c .mapa-rot { background: #8a5a00; }
.mapa-cols { flex: 1 1 auto; display: grid; grid-template-columns: repeat(4, minmax(13.5rem, 1fr)); column-gap: 3.2rem; }
.mapa-col { display: flex; flex-direction: column; gap: .7rem; justify-content: flex-start; min-width: 0; }
.mapa-col h5 { margin: 0; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--suave); min-height: .9rem; }
.mapa-n { position: relative; z-index: 2; background: #fff; border: 1px solid var(--borde); border-left: 4px solid #d9a21b; border-radius: .4rem; padding: .4rem .55rem; font-size: .78rem; display: flex; flex-direction: column; gap: .18rem; box-shadow: 0 1px 2px rgba(20, 30, 60, .08); }
.mapa-n.cerrado { border-left-color: #9aa3b2; }
.mapa-n.anulado { border-left-color: #b3261e; opacity: .75; }
.mapa-n.este { border-color: var(--marino); border-left-color: var(--marino); box-shadow: 0 0 0 2px var(--marino); }
.mapa-n-cab { display: flex; gap: .35rem; align-items: baseline; flex-wrap: wrap; }
.mapa-n-cab b { color: var(--marino2); } .mapa-n-cab small { margin-left: auto; font-size: .6rem; text-transform: uppercase; letter-spacing: .06em; background: var(--marino); color: #fff; border-radius: 1rem; padding: 0 .4rem; }
.mapa-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.mapa-n-ter { color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapa-n-dat { display: flex; justify-content: space-between; gap: .5rem; font-variant-numeric: tabular-nums; } .mapa-n-dat small { font-weight: 400; color: var(--suave); }
.mapa-proc { list-style: none; margin: .15rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .12rem; font-size: .72rem; }
.mapa-proc li { display: flex; justify-content: space-between; gap: .5rem; border-left: 3px solid #c5ccd8; padding-left: .4rem; }
.mapa-proc li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mapa-proc li.e-ok { border-left-color: #2e9a5b; } .mapa-proc li.e-pend { border-left-color: #d9a21b; } .mapa-proc li.e-fin { border-left-color: #9aa3b2; } .mapa-proc li.e-apar { border-left-color: #2f5fc4; }
.mapa-mas { font-size: .7rem; color: var(--suave); font-style: italic; }
.mapa-lienzo.resalta .mapa-n:not(.toca) { opacity: .45; }
.mapa-n { cursor: pointer; user-select: none; } .mapa-n:hover { border-color: var(--marino2); } .mapa-n.movida { z-index: 3; box-shadow: 0 .4rem 1rem rgba(20, 30, 60, .3); cursor: grabbing; }
.mapa-proc li[data-ir] span { text-decoration: underline; text-decoration-color: #9aa3b2; text-underline-offset: 2px; } .mapa-proc li[data-ir]:hover { background: #e8eefb; }
.mapa-clave { margin-right: auto; display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; } .mapa-clave i { font-style: normal; }

/* Terminal como centro: selector de documento y ventana «T.P.V.» */
.tpv-modo { grid-column: 1 / -1; display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.tpv-modo button { background: #dde2ea; border: 0; padding: .4rem 1.1rem; font-size: .8rem; font-weight: 600; letter-spacing: .04em; color: #333; border-radius: .25rem; }
.tpv-modo button.activa { background: var(--marino); color: #fff; }
.tpv-modo #modo-nota { margin-left: .6rem; }
.tpv.modo-doc .tpv-total { background: #7a4a00; }
.panel-aviso.bien { background: #e3f4ea; border-left-color: #1f7a4d; color: #12452b; }
.tpv-centro .ce-pest { margin-top: .2rem; }
.tpv-centro .ce-barra { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.tpv-centro .ce-barra .buscador { flex: 1 1 16rem; max-width: 26rem; } .tpv-centro .ce-barra input:not([type=checkbox]) { width: 100%; box-sizing: border-box; }
.tpv-centro .ce-q { flex: 1 1 14rem; max-width: 22rem; }
.tpv-centro .ce-barra input.ce-imp:not([type=checkbox]) { width: 7rem; margin-left: .3rem; }
.tpv-contado { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem .8rem; margin-top: .6rem; }
.tpv-contado label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; } .tpv-contado label:first-child { grid-column: span 2; }
.tpv-contado input { width: 100%; box-sizing: border-box; } .tpv-contado .acciones-editor { grid-column: 1 / -1; }
.tpv-centro .ce-cuerpo { min-height: 14rem; max-height: 58vh; }
.tpv-centro .ce-bt { white-space: nowrap; } .tpv-centro .ce-bt .bt { margin-left: .2rem; }
.tpv-centro tr.ce-det > td { background: rgba(127, 127, 127, .08); padding: .5rem .8rem; }
.tpv-centro .ce-lin { width: 100%; font-size: .8rem; }
.tpv-centro .ce-ent { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; } .tpv-centro .ce-ent input { width: 7rem; }
.tpv-centro .ce-bt a.bt { display: inline-block; overflow: visible; text-overflow: clip; max-width: none; }

/* Aviso de versión nueva (la página abierta no se recarga sola) */
#version-nueva { position: fixed; left: 50%; top: .5rem; transform: translateX(-50%); z-index: 5000; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 2rem); background: #7a4a00; color: #fff; padding: .5rem .9rem; border-radius: .35rem; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); font-size: .85rem; }
/* Menú superior opcional (opción AE_MENUSUP): se oculta solo donde hay panel lateral */
@media (min-width: 64.0625rem) { .barra.sin-menu #menu { visibility: hidden; } }
/* Documento abierto = editable: el editor va incrustado en la pantalla del documento y la barra de acciones del documento queda bajo la del editor */
.doc-editable > .editor { display: contents; }
.doc-editable > .ew-top, .doc-editable > #doc-lineas, .doc-editable > .ew-stock, .doc-editable > #doc-pie { display: none; }
.doc-editable > .ew-barra { gap: .2rem; } .doc-editable > .ew-barra .bt { padding-inline: .34rem; font-size: .73rem; } .doc-editable > .ew-barra .bt.salir { margin-left: .1rem; } .doc-editable > .ew-barra .bt.nav { min-width: 1.6rem; padding-inline: .2rem; } .doc-editable > .ew-barra .sep { margin: 0 .05rem; }
.doc-editable > .editor > * { order: 1; } .doc-editable > .ew-barra { order: 2; } .doc-editable > .editor > .ew-stock, .doc-editable > .editor > #resultado, .doc-editable > .editor > .ew-pie { order: 3; }

/* Tique a albarán o factura de un cliente */
.tq-alb { display: flex; flex-direction: column; gap: .7rem; min-width: min(34rem, 86vw); }
.tq-cifras { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; padding: .5rem .7rem; background: #f3f5fa; border: 1px solid #d5dbe8; border-radius: 4px; }
.tq-alb > label { display: flex; flex-direction: column; gap: .2rem; } .tq-alb > label b { font-weight: 600; margin-left: .4rem; }
.tq-que { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; } .tq-que label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }

/* ---------- gráficos e indicadores (graficos.js, análisis e inicio) ---------- */
.kpi { border-radius: .5rem; border-left-width: .2rem; box-shadow: 0 1px 2px #1a2c6c14, 0 .2rem .7rem #1a2c6c0f; transition: box-shadow .15s, transform .15s; }
.kpi:not(.fijo):hover { box-shadow: 0 1px 2px #1a2c6c1f, 0 .45rem 1.2rem #1a2c6c26; transform: translateY(-1px); }
.kpi.con-ico { grid-template-columns: auto minmax(0, 1fr); column-gap: .65rem; align-items: center; padding: .55rem .8rem; }
.kpi.con-ico > span, .kpi.con-ico > b, .kpi.con-ico > small { grid-column: 2; }
.kpi-ico { grid-row: 1 / 4; grid-column: 1; width: 2.3rem; height: 2.3rem; border-radius: .6rem; display: grid; place-items: center; background: #e8f0fb; color: var(--marino2); font-style: normal; }
.kpi-ico .ico { width: 1.3rem; height: 1.3rem; }
.kpi.ok .kpi-ico { background: #e3f6ea; color: #1c7c43; } .kpi.aviso .kpi-ico { background: #fdf1d8; color: #8a5a00; } .kpi.alerta .kpi-ico { background: #fde7e5; color: #b3261e; }
.var { font-weight: 600; white-space: nowrap; } .var.sube { color: #1c7c43; } .var.baja { color: #b3261e; }
.seccion { box-shadow: 0 1px 2px #1a2c6c0d, 0 .15rem .5rem #1a2c6c0a; border-radius: .4rem; }
.grafico { position: relative; min-width: 0; }
.grafico svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafico .g-zona { fill: transparent; } .grafico .g-cat:hover .g-zona { fill: #15428b12; }
.graf-dias .g-cat { cursor: pointer; } .graf-dias .g-cat.sel .g-zona { fill: #e39a1230; }
.g-ley { display: flex; gap: 1rem; justify-content: flex-end; font-size: .72rem; color: var(--texto); margin: 0 0 .15rem; flex-wrap: wrap; }
.g-ley span { display: inline-flex; align-items: center; gap: .35rem; } .g-ley i { width: .7rem; height: .7rem; border-radius: .2rem; display: inline-block; }
.g-tip { position: fixed; z-index: 9000; pointer-events: none; background: #fff; color: var(--texto); border: 1px solid var(--borde); border-radius: .4rem; box-shadow: 0 .4rem 1.4rem #1a2c6c33; padding: .4rem .6rem; font-size: .75rem; display: grid; gap: .1rem; max-width: 20rem; }
.g-tip b { color: var(--marino); font-weight: 600; } .g-tip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-rank { display: grid; gap: .1rem; }
.g-fila { display: grid; grid-template-columns: minmax(6rem, 13rem) minmax(3rem, 1fr) auto minmax(4.2rem, auto); gap: .6rem; align-items: center; padding: .22rem .3rem; border-radius: .25rem; color: inherit; font-size: .78rem; text-decoration: none; }
.g-fila:hover { background: #15428b0f; text-decoration: none; }
.g-fila .g-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .g-fila .g-n small { color: var(--suave); }
.g-fila .g-b { height: .7rem; display: block; } .g-fila .g-b i { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.g-fila b { font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; } .g-fila em { font-style: normal; color: var(--suave); font-size: .7rem; text-align: right; white-space: nowrap; }
.analisis .an-pest { margin: .2rem 0 .7rem; }
.analisis .seccion { margin-bottom: .7rem; }
.an-dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .7rem; }
.an-sem { margin-top: .5rem; }
.ini-sub { margin-top: .8rem !important; padding-top: .6rem; border-top: 1px solid var(--borde); }
@media (max-width: 64rem) { .an-dos { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 40rem) { .g-fila { grid-template-columns: minmax(0, 1fr) auto; } .g-fila .g-b { grid-column: 1 / -1; order: 3; } .g-fila em { display: none; } }
.kpis:has(.con-ico) { grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); }
.an-kpis .kpi small { white-space: normal; line-height: 1.3; }

/* Web del negocio (gestión) */
.web-neg { max-width: 68rem; }
.web-neg .cab-ficha .acciones { display: flex; gap: .5rem; }
.web-neg .cab-ficha a.bt { display: inline-flex; align-items: center; text-decoration: none; }
.web-neg form { display: grid; gap: .7rem; }
.wn-url { margin: 0 0 .6rem; font-size: .8rem; overflow-wrap: anywhere; }
.wn-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .55rem .9rem; }
.wn-campos label, .wn-pag label { display: grid; gap: .15rem; font-size: .74rem; color: var(--suave); min-width: 0; }
.wn-campos label small, .wn-pag label small, .web-neg h4 small { font-weight: 400; text-transform: none; letter-spacing: 0; }
.wn-campos input:not([type=checkbox]), .wn-campos select, .wn-campos textarea, .wn-pag input:not([type=checkbox]), .wn-pag textarea { width: 100%; font: inherit; font-size: .84rem; padding: .35rem .5rem; border: 1px solid var(--borde); border-radius: .2rem; background: #fff; color: inherit; }
.wn-campos textarea, .wn-pag textarea { resize: vertical; line-height: 1.4; }
.wn-ancho { grid-column: 1 / -1; }
.wn-campos label.wn-casilla, .wn-pag label.wn-casilla { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: inherit; flex-wrap: wrap; }
.wn-marcas { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .2rem .8rem; font-size: .8rem; }
.wn-marcas label { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.wn-lista { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .25rem; font-size: .82rem; }
.wn-lista li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .25rem .5rem; border: 1px solid var(--borde); border-radius: .2rem; background: #fafbfd; min-width: 0; }
.wn-lista li.suave { border-style: dashed; background: none; }
.wn-bts { display: flex; gap: .3rem; flex: none; }
.wn-bts .bt { height: 1.7rem; padding: 0 .55rem; }
.wn-busca { position: relative; max-width: 30rem; }
.wn-busca input { width: 100%; }
.wn-pag { border: 1px solid var(--borde); border-radius: .3rem; padding: .6rem .7rem; margin-bottom: .6rem; display: grid; gap: .5rem; background: #fafbfd; }
.wn-pag-cab { display: grid; grid-template-columns: minmax(10rem, 1.2fr) minmax(10rem, 1fr) auto auto; gap: .6rem; align-items: end; }
.web-neg .seccion h3 .bt { margin-left: auto; height: 1.7rem; text-transform: none; letter-spacing: 0; }
@media (max-width: 720px) { .wn-pag-cab { grid-template-columns: 1fr; } }
.aviso-banda { margin: 0 0 .6rem; padding: .4rem .7rem; background: #fff3cd; color: #8a5a00; border-radius: .25rem; font-size: .82rem; }
