
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eaeff5;
  --border: #d3dbe4;
  --ink: #1a2230;
  --ink-2: #4c5665;
  --ink-3: #667082;          /* v4.13 · 4,99:1 sobre blanco y 4,57:1 sobre el fondo (antes 3,89:1) */
  --brand: #0057B8;          /* Pantone 2935 C (azul ALPACE) */
  --brand-strong: #003e85;
  --brand-soft: #e3edf9;
  --gold: #EAAA00;           /* Pantone 124 C */
  --celeste: #6CACE4;        /* Pantone 284 C */
  --accent: #1f68c0;         /* barras de datos (serie única) · v4.13: 4,6:1 sobre la pista */
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a6400;
  --warn-soft: #fdf3d0;
  --ok: #1e6b2e;
  --ok-soft: #e2f2e0;
  --info-soft: #e3edf9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28,33,27,.06), 0 4px 14px rgba(28,33,27,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .4rem 0; }

/* ---- estructura ---- */
.topbar {
  background: var(--brand-strong); color: #fff; display: flex; align-items: center;
  gap: 1rem; padding: 0 1rem; min-height: 54px; flex-wrap: wrap;
}
.topbar .logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.02rem; color: #fff; letter-spacing: .3px; }
.topbar .logo img { height: 30px; background: #fff; border-radius: 6px; padding: 2px 7px; display: block; }
.topbar { border-bottom: 3px solid var(--gold); }
.topbar nav { display: flex; gap: .1rem; flex-wrap: wrap; }
.topbar nav a {
  color: #d9e6f5; padding: .45rem .65rem; border-radius: 8px; font-size: .92rem;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.topbar nav a[aria-current="page"] { background: rgba(255,255,255,.18); color: #fff; }
.topbar .spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: .6rem; color: #d9e6f5; font-size: .88rem; }
.userbox form { margin: 0; }
.bell { position: relative; color: #fff; font-size: 1.05rem; padding: .3rem .45rem; border-radius: 8px; }
.bell:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.bell .dot {
  position: absolute; top: 0; right: 0; background: #e34948; color: #fff; border-radius: 999px;
  font-size: .66rem; line-height: 1; padding: .18rem .32rem; font-weight: 700;
}
main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .sub { color: var(--ink-2); font-size: .92rem; }

/* ---- tarjetas y tablas ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
/* v4.6 · Reportes: tabla ancha a la izquierda (~65%), gráficos a la derecha (~35%).
   Clase propia: no se toca .grid.cols-2, que usan otras pantallas. */
.reports-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1180px) {
  .reports-layout { grid-template-columns: minmax(680px, 1.85fr) minmax(340px, 1fr); align-items: start; }
}
/* pantallas medianas: primero la tabla, después los gráficos (una columna) */
.reports-layout > .card { min-width: 0; }
.reports-layout .table-wrap { overflow-x: auto; }
@media (min-width: 1180px) {
  /* el código y el nombre no se recortan: la tabla usa todo el ancho disponible */
  .reports-layout table.data { table-layout: auto; width: 100%; }
  .reports-layout table.data th, .reports-layout table.data td { padding: .5rem .5rem; }
}

/* v4.9 · usuarios: con la columna «Invitación» la tabla tiene siete columnas,
   dos de ellas con controles de formulario, y en media pantalla se cortaban
   las acciones. Clase propia (no se toca .grid.cols-2, que usan otras
   pantallas): la tabla ocupa TODO el ancho y los formularios van debajo,
   repartidos en tarjetas. El desplazamiento horizontal, si hace falta en
   móvil, queda dentro de la tabla y nunca en la página. */
.users-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.users-layout > * { min-width: 0; }
.users-layout .table-wrap { overflow-x: auto; }
.users-forms { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .users-forms { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
}

/* v4.5 · detalle de solicitud: columna izquierda angosta (~36%), derecha ancha (~64%) */
.grid.detail-split { grid-template-columns: 1fr; }
/* v4.13 · los hijos de una rejilla traen min-width:auto, así que un contenido
   ancho empujaba la tarjeta (616 px dentro de 371 px) y arrastraba la página
   entera 235 px de lado en el teléfono. Mismo remedio que en .users-layout. */
.grid.detail-split > * { min-width: 0; }
@media (min-width: 980px) {
  .grid.detail-split { grid-template-columns: minmax(300px, 36fr) 64fr; align-items: start; }
}

.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; background: var(--surface); }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; padding: .55rem .6rem;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--surface-2); vertical-align: top; }

/* ---- v4.4 · encabezados ordenables (mismo patrón visual que Clientes) ---- */
table.data th .sort-link {
  color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .15rem;
}
table.data th .sort-link:hover { color: var(--brand, #0057B8); text-decoration: underline; }
table.data th .sort-link .sort-ind { opacity: .38; font-size: .78em; }
table.data th .sort-link.sort-active { color: var(--brand, #0057B8); }
table.data th .sort-link.sort-active .sort-ind { opacity: 1; }
table.data th[aria-sort='ascending'], table.data th[aria-sort='descending'] {
  border-bottom-color: var(--brand, #0057B8);
}
table.data tr:hover td { background: #f5f8fc; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- etiquetas de estado y prioridad (color + texto, nunca solo color) ---- */
.tag {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; padding: .14rem .6rem; white-space: nowrap;
  border: 1px solid transparent;
}
.tag::before { content: "●"; font-size: .6rem; }
.tag.prio-ALTA { background: var(--danger-soft); color: var(--danger); border-color: #edc2be; }
.tag.prio-MEDIA { background: var(--warn-soft); color: var(--warn); border-color: #ecd9a0; }
.tag.prio-BAJA { background: var(--ok-soft); color: var(--ok); border-color: #bfdcba; }
.tag.st-BORRADOR { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.tag.st-NO_INICIADO { background: #ececf5; color: #45457e; border-color: #cfcfe6; }
.tag.st-EN_PROGRESO { background: var(--info-soft); color: #1c5cab; border-color: #bcd4ef; }
.tag.st-EN_ESPERA { background: var(--warn-soft); color: var(--warn); border-color: #ecd9a0; }
.tag.st-BLOQUEADO { background: var(--danger-soft); color: var(--danger); border-color: #edc2be; }
.tag.st-CANCELADO { background: var(--surface-2); color: var(--ink-3); border-color: var(--border); }
.tag.st-COMPLETADO, .tag.st-ENTREGADO { background: var(--ok-soft); color: var(--ok); border-color: #bfdcba; }
.tag.st-INSTALADO { background: #dcf1ea; color: #0d5c46; border-color: #b2ddd0; }
.tag.st-DEVUELTO { background: #fbe9f1; color: #97255c; border-color: #eec4d7; }
.tag.ast-INSTALADO { background: var(--ok-soft); color: var(--ok); border-color: #bfdcba; }
.tag.ast-PENDIENTE_INSTALACION { background: var(--warn-soft); color: var(--warn); border-color: #ecd9a0; }
.tag.ast-RETIRADO, .tag.ast-TRASLADADO { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.tag.ast-MANTENIMIENTO { background: var(--info-soft); color: #1c5cab; border-color: #bcd4ef; }
.tag.ast-BODEGA { background: #efeaf9; color: #563d92; border-color: #d8cbf0; }
.tag.ast-BAJA { background: var(--danger-soft); color: var(--danger); border-color: #edc2be; }
.tag.rev-ENVIADO { background: var(--info-soft); color: #1c5cab; border-color: #bcd4ef; }
.tag.rev-VALIDADO, .tag.rev-VINCULADO { background: var(--ok-soft); color: var(--ok); border-color: #bfdcba; }
.tag.rev-RECHAZADO { background: var(--danger-soft); color: var(--danger); border-color: #edc2be; }
.tag.rev-POSIBLE_DUPLICADO, .tag.rev-PENDIENTE_INFO { background: var(--warn-soft); color: var(--warn); border-color: #ecd9a0; }
.tag.rev-BORRADOR { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.warn-inline { color: var(--warn); font-weight: 600; font-size: .85rem; }
.badge-soft { background: var(--surface-2); border-radius: 6px; padding: .1rem .45rem; font-size: .8rem; color: var(--ink-2); }

/* ---- formularios ---- */
form.stack { display: grid; gap: .9rem; }
fieldset {
  border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem 1.1rem;
  margin: 0; background: var(--surface);
}
legend { font-weight: 600; color: var(--brand-strong); padding: 0 .4rem; font-size: .95rem; }
label.field { display: grid; gap: .25rem; font-size: .88rem; color: var(--ink-2); font-weight: 500; }
.field-row { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password],
input[type=search], input[type=file], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
textarea { min-height: 90px; resize: vertical; }
.hint { font-size: .8rem; color: var(--ink-3); font-weight: 400; }

button, .btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  padding: .5rem .95rem; border-radius: 8px; font: inherit; font-weight: 600; font-size: .92rem;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-strong); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--brand-strong); border-color: var(--border); }
.btn.secondary:hover, button.secondary:hover { background: var(--surface-2); }
.btn.danger, button.danger { background: #fff; color: var(--danger); border-color: #e5b6b2; }
.btn.danger:hover, button.danger:hover { background: var(--danger-soft); }
.btn.big { font-size: 1rem; padding: .65rem 1.2rem; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ---- avisos ---- */
.flash { border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; font-size: .92rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfdcba; }
.flash.err { background: var(--danger-soft); color: var(--danger); border-color: #edc2be; }
.empty {
  text-align: center; color: var(--ink-3); padding: 2.2rem 1rem; border: 1px dashed var(--border);
  border-radius: var(--radius); background: var(--surface);
}

/* ---- dashboard ---- */
.stat { padding: .9rem 1rem; }
.stat .label { font-size: .8rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .value { font-size: 1.7rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .note { font-size: .8rem; color: var(--ink-3); }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 3.2rem; gap: .5rem; align-items: center; font-size: .86rem; margin: .28rem 0; }
/* v4.13 · el nombre se recortaba («Devuelto al vendedor (…», «GU002 · RACK
   GUANA…»). Ahora se acomoda en dos renglones: el ancho de la barra no cambia,
   que es lo que hace comparables las gráficas. */
.hbar .name { color: var(--ink-2); overflow-wrap: anywhere; line-height: 1.25; }
.hbar .track { background: var(--surface-2); border-radius: 4px; height: 14px; position: relative; }
.hbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px 4px 4px 4px; min-width: 2px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

/* ---- catálogo visual ---- */
.catalog-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.cat-card .img { aspect-ratio: 4/3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.cat-card .img img { width: 100%; height: 100%; object-fit: contain; }
.cat-card .img .noimg { color: var(--ink-3); font-size: .85rem; }
.cat-card .body { padding: .7rem .8rem .9rem; display: grid; gap: .25rem; }
.cat-card .code { font-weight: 700; color: var(--brand-strong); font-size: .85rem; }
.cat-card.selected { outline: 3px solid var(--brand); }

/* ---- detalle: línea de tiempo ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; border-left: 2px solid var(--border); margin-left: .5rem; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: .2rem; width: 12px; height: 12px;
  border-radius: 999px; background: var(--brand); border: 2px solid #fff;
}
.timeline .when { font-size: .78rem; color: var(--ink-3); }
/* ---- v4.5 · selector compacto de exhibidores ---- */
.exh-picker {
  border: 1px solid var(--border); border-radius: 10px; max-height: 380px; overflow-y: auto;
  background: var(--surface);
}
.exh-row {
  display: flex; align-items: center; gap: .7rem; padding: .45rem .6rem;
  border-bottom: 1px solid var(--surface-2); cursor: pointer;
}
.exh-row:last-child { border-bottom: none; }
.exh-row:hover { background: #f5f8fc; }
.exh-row.selected { background: #eaf1fa; box-shadow: inset 3px 0 0 var(--brand, #0057B8); }
.exh-row .thumb {
  width: 64px; height: 64px; flex: 0 0 64px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden;
}
.exh-row .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.exh-row .thumb .noimg { font-size: .62rem; color: var(--ink-2); text-align: center; }
.exh-row .info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.exh-row .info .code {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--brand, #0057B8);
}
.exh-row .info strong { font-size: .92rem; }
@media (max-width: 640px) {
  .exh-picker { max-height: 320px; }
  .exh-row .thumb { width: 56px; height: 56px; flex-basis: 56px; }
}

.photo-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.photo-grid figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-grid figcaption { font-size: .78rem; color: var(--ink-2); padding: .4rem .5rem; }

.tabs { display: flex; gap: .2rem; border-bottom: 2px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; border-radius: 8px 8px 0 0; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--brand-strong); border: 2px solid var(--border); border-bottom: 2px solid var(--surface); margin-bottom: -2px; }
.tabs a:hover { text-decoration: none; background: var(--surface-2); }

/* ---- filtros ---- */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters label.field { min-width: 130px; flex: 0 1 auto; }
.pagination { display: flex; gap: .4rem; align-items: center; margin-top: 1rem; font-size: .9rem; flex-wrap: wrap; }
.pagination a, .pagination span.cur { padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.pagination span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }

.kv { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: .3rem .8rem; font-size: .92rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }
.warn-banner { background: var(--warn-soft); border: 1px solid #ecd9a0; color: var(--warn); border-radius: 8px; padding: .5rem .8rem; font-size: .88rem; }
.ok-banner { background: var(--ok-soft); border: 1px solid #bfdcba; color: var(--ok); border-radius: 8px; padding: .5rem .8rem; font-size: .88rem; }

/* ---- selector de clientes ---- */
.client-picker { position: relative; }
.client-results { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); max-height: 300px; overflow: auto; margin-top: .3rem; }
.client-results button {
  display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--surface-2);
  color: var(--ink); padding: .55rem .7rem; font-weight: 400; border-radius: 0; cursor: pointer;
}
.client-results button:hover { background: var(--brand-soft); }
.client-results .code { font-weight: 700; color: var(--brand-strong); margin-right: .4rem; }
.client-selected { border: 2px solid var(--brand); border-radius: 8px; padding: .6rem .8rem; background: var(--brand-soft); font-size: .9rem; }

/* ---- firma ---- */
.sign-pad { border: 2px dashed var(--border); border-radius: 10px; background: #fff; touch-action: none; width: 100%; max-width: 560px; height: 200px; display: block; }
.contract-text { white-space: pre-wrap; font-size: .92rem; line-height: 1.65; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; max-height: 460px; overflow-y: auto; }
.login-logo { display: block; margin: 0 auto 1rem; max-width: 240px; }

/* ===== v4.13 · interfaz en el teléfono ================================== */

/* ---- franja de atención del panel ---- */
.atencion { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); margin-bottom: 1rem; }
.atencion a, .atencion .nada {
  display: flex; align-items: center; gap: .75rem; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--warn);
  border-radius: var(--radius); padding: .7rem .9rem; box-shadow: var(--shadow); color: var(--ink);
}
.atencion a:hover { text-decoration: none; border-left-color: var(--danger); background: #fffcf2; }
.atencion .n { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.atencion .q { font-size: .85rem; color: var(--ink-2); line-height: 1.35; }
.atencion .nada, .atencion a.cero { border-left-color: var(--ok); }
.atencion a.cero .n { color: var(--ok); }

/* ---- bloques plegables (filtros, medidas, exportaciones) ----
   Se envían ABIERTOS desde el servidor: sin JavaScript todo se ve igual que
   siempre. Un guion de la plantilla los cierra solo en pantallas angostas. */
details.plegable { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
details.plegable > summary {
  cursor: pointer; padding: .55rem .9rem; font-weight: 600; font-size: .92rem;
  color: var(--brand-strong); list-style: none; display: flex; align-items: center; gap: .45rem; min-height: 44px;
}
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary::before { content: "▸"; display: inline-block; transition: transform .15s ease; }
details.plegable[open] > summary::before { transform: rotate(90deg); }
details.plegable > summary .cuenta {
  background: var(--brand-soft); color: var(--brand-strong); border-radius: 999px;
  font-size: .78rem; font-weight: 700; padding: .08rem .5rem;
}
details.plegable .cuerpo { padding: 0 .9rem .9rem; }
details.plegable .filters { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { details.plegable > summary::before { transition: none; } }

/* ---- lista de solicitudes en tarjetas (solo teléfono) ----
   La tabla de doce columnas mide 1 388 px: en una ventana de 369 px obligaba
   a arrastrar cada fila de lado, y estado y prioridad quedaban fuera. */
.lista-movil { display: none; list-style: none; margin: 0; padding: 0; }
.lista-movil > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.lista-movil a.fila { display: grid; gap: .3rem; padding: .7rem .8rem; color: var(--ink); }
.lista-movil a.fila:hover { text-decoration: none; background: #f5f8fc; }
.lista-movil .linea1 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.lista-movil .folio { font-weight: 700; color: var(--brand-strong); font-size: .95rem; letter-spacing: .01em; }
.lista-movil .cliente { font-weight: 600; line-height: 1.3; }
.lista-movil .meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem; font-size: .82rem; color: var(--ink-2); }
.lista-movil .meta .sep { color: var(--ink-3); }

@media (max-width: 720px) {
  main { padding: .8rem .6rem 2.5rem; }
  .kv { grid-template-columns: 1fr; }
  .page-head { align-items: start; flex-direction: column; }

  /* barra superior: una fila para identidad, otra para navegación.
     Antes envolvía en tres filas y ocupaba 195 px (23 % de la pantalla). */
  .topbar { padding: .3rem .6rem; gap: .5rem; row-gap: .2rem; min-height: 0; }
  .topbar .logo { order: 1; }
  .topbar .spacer { display: none; }
  .topbar .bell { order: 2; margin-left: auto; }
  .topbar .userbox { order: 3; gap: .4rem; min-width: 0; max-width: 48%; }
  .topbar .userbox > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
  .topbar .userbox small, .topbar .userbox br { display: none; }
  .topbar nav {
    order: 4; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; gap: .1rem;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; }

  /* el dedo necesita 44 px; los enlaces de 17-19 px dentro de tablas no sirven */
  .btn, button, .tabs a, .pagination a { min-height: 44px; }
  .btn, button { justify-content: center; }

  /* las cinco pestañas envolvían en tres filas: una sola fila que se desliza */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; }

  .lista-movil { display: grid; gap: .6rem; }
  .solo-ancha { display: none !important; }
  .exh-picker { max-height: none; overflow-y: visible; }   /* sin desplazamiento dentro del desplazamiento */
}

@media (min-width: 721px) {
  .solo-angosta { display: none !important; }
  /* En pantalla ancha, los bloques «plano» (filtros y exportaciones) se ven
     exactamente como antes: sin marco ni encabezado, siempre desplegados.
     El plegado es una ayuda del teléfono, no un cambio para el escritorio. */
  details.plegable.plano { border: 0; background: transparent; }
  details.plegable.plano > summary { display: none; }
  details.plegable.plano .cuerpo { padding: 0; }
}
@media print {
  .topbar, .filters, .btn, button, .tabs { display: none !important; }
  body { background: #fff; }
}
