/* ─────────────────────────────────────────────────────────────────────────
   NetfiberPal — Main stylesheet
   Brand: Netfiber S.L. (netfiber.es)
   ───────────────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
/* Lo que escribe en Holded no se ofrece a la empresa que no lo tiene conectado (js/con-holded.js). */
body.sin-holded .solo-holded { display: none !important; }

:root {
  /* Netfiber corporate palette */
  --nf-navy:        #0d3c6e;
  --nf-navy-dark:   #082a52;
  --nf-navy-light:  #1a5598;
  --nf-orange:      #f07a1f;
  --nf-orange-dark: #d96710;
  --nf-orange-soft: #fde2cc;

  /* Corporate lilac (used to differentiate import flows) */
  --nf-lilac:       #6e3c9c;
  --nf-lilac-dark:  #4e2879;
  --nf-lilac-light: #9166bf;
  --nf-lilac-soft:  #ece3f7;

  /* Neutral */
  --bg:        #f4f6fa;
  --surface:   #ffffff;
  --border:    #e3e8ef;
  --text:      #1a2231;
  --text-soft: #5a6478;
  --text-mute: #8a93a6;

  --ok:    #21a36b;
  --warn:  #d99800;
  --err:   #d23a3a;

  --radius:  10px;
  --radius-lg: 16px;
  --shadow:    0 1px 2px rgba(13, 60, 110, 0.06), 0 4px 12px rgba(13, 60, 110, 0.06);
  --shadow-lg: 0 8px 24px rgba(13, 60, 110, 0.12);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* JA: Inter no cubre CJK — pila de sistema japonesa (i18n.js pone <html lang="ja">). */
html[lang="ja"] { --font: 'Inter', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', sans-serif; }
/* AR: Inter no cubre el árabe — pila de sistema (i18n.js pone <html lang="ar" dir="rtl">).
   Inter va primero a propósito: cifras y marcas siguen en Inter y solo el alfabeto árabe
   cae a la siguiente fuente con glifos (Segoe UI en Windows, SF Arabic/Geeza Pro en Apple,
   Noto en Android/Linux). El espejo de la maqueta es F-AR-1 (docs/AR_PLAN.md §5). */
html[lang="ar"] { --font: 'Inter', 'Segoe UI', 'SF Arabic', 'Geeza Pro', 'Noto Sans Arabic', 'Noto Naskh Arabic', Tahoma, Arial, sans-serif; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--nf-navy); text-decoration: none; }
a:hover { color: var(--nf-navy-light); }

/* ── Header ───────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--nf-navy) 0%, var(--nf-navy-dark) 100%);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset,
              0 6px 18px rgba(8, 25, 50, 0.22);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  -webkit-backdrop-filter: saturate(140%);
  backdrop-filter: saturate(140%);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

/* White rounded pill containing the corporate Netfiber wordmark */
.header-logo-mark {
  background: #fff;
  border-radius: 12px;
  padding: 6px 14px;
  height: 48px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12),
              0 1px 0 rgba(255,255,255,0.6) inset;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.header-brand:hover .header-logo-mark {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.header-logo-mark img {
  height: 30px;
  width: auto;
  display: block;
}

/* Version badge — small subtle chip next to .brand-pal */
.brand-version {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .3px;
  color: rgba(255,255,255,.6);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: 3px 8px;
  border-radius: 999px;
  margin-inline-start: 6px;
  font-family: 'SF Mono', Monaco, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* On the login page, brand sits on a white card; adapt colors */
.login-card .brand-version {
  color: var(--text-mute);
  background: var(--bg);
  border-color: var(--border);
}

/* Internal-tool accent: ".Pal" suffix as orange chip */
.brand-pal {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--nf-orange) 0%, var(--nf-orange-dark) 100%);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(217, 103, 16, 0.35);
  text-shadow: 0 1px 0 rgba(0,0,0,0.08);
}

/* Legacy classes kept for any tool-specific includes that still use them */
.header-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--nf-navy);
  font-size: 18px;
  letter-spacing: -0.5px;
}
.header-brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-name {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.3px;
}
.brand-name .brand-suffix { color: var(--nf-orange); font-weight: 800; }
.brand-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.header-nav { display: flex; gap: 6px; align-items: center; }
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: 12px;
  padding-inline-start: 14px;
  border-inline-start: 1px solid rgba(255,255,255,.15);
}
.header-user-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-logout {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.15);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.header-logout:hover { background: rgba(255,255,255,.2); }
.header-nav a {
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.header-nav a:hover,
.header-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Botón hamburguesa: lo inyecta auth-ui.js y SOLO se ve en móvil (≤720px),
   donde abre el nav como desplegable. En escritorio no existe visualmente. */
.header-burger {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.10);
  color: #fff; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.header-burger:hover, .header-burger[aria-expanded="true"] { background: rgba(255,255,255,.24); }
.header-burger svg { width: 20px; height: 20px; }

/* ── Avatar de usuario + menú ─────────────────────────────────────────── */
.header-user { position: relative; }
.header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3);
  background: linear-gradient(135deg, var(--nf-orange) 0%, var(--nf-orange-dark) 100%);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
  cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.header-avatar:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.25); }
/* Foto de perfil dentro del botón (si no hay, se muestran las iniciales). */
.header-avatar { overflow: hidden; }
.header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* El avatar marca que la página actual cuelga del desplegable: su enlace ya no
   está en la barra y sin esto no queda ninguna pista de dónde estás. */
.header-avatar.hm-here { box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 4px 10px rgba(0,0,0,.25); }
/* Tareas pendientes. «Tareas» también pasó al desplegable, y su contador es lo
   único de ahí dentro que hay que poder ver sin abrirlo. Va FUERA del botón:
   .header-avatar lleva overflow:hidden para recortar la foto y lo cortaría. */
.header-user .hm-badge {
  position: absolute; top: -3px; inset-inline-end: -4px; z-index: 1;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  background: var(--nf-orange); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--nf-navy); pointer-events: none;
}
.header-user .hm-badge[hidden] { display: none; }
.header-menu {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0;
  min-width: 248px; max-width: 300px;
  background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 7px; z-index: 300;
  animation: conn-pop .22s cubic-bezier(.16,1,.3,1) both;
}
.header-menu .hm-info {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px 10px; margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.header-menu .hm-face {
  width: 36px; height: 36px; flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--nf-orange) 0%, var(--nf-orange-dark) 100%);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.header-menu .hm-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.header-menu .hm-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hm-name  { font-weight: 700; color: var(--nf-navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-email { font-size: 12px; color: var(--text-mute); word-break: break-all; }
/* Tres bloques: perfil · accesos del espacio · salir. La línea va solo ENTRE
   ellos, y el de accesos se oculta entero cuando el usuario no tiene ninguno. */
.header-menu .hm-sec + .hm-sec { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.header-menu .hm-sec[hidden] { display: none; }
/* Dos clases a propósito: el desplegable vive DENTRO del nav, así que una regla
   de una sola clase la pisaría `.header-nav a` (color, padding y radio). */
.header-menu .hm-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: start;
  padding: 9px 10px; border-radius: 9px;
  border: none; background: none; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--text); cursor: pointer; text-decoration: none;
}
.header-menu .hm-ico { width: 17px; height: 17px; flex: none; opacity: .7; }
/* Y aquí hacen falta TRES: `.header-nav a:hover` pintaba fondo translúcido y
   texto BLANCO sobre el panel blanco — el enlace desaparecía al pasar por él. */
.header-menu a.hm-item:hover, .header-menu a.hm-item:focus-visible,
.header-menu button.hm-item:hover, .header-menu button.hm-item:focus-visible {
  background: var(--bg); color: var(--text);
}
.header-menu a.hm-item.hm-on { background: #eef4ff; color: var(--nf-navy); font-weight: 700; }
.header-menu a.hm-item.hm-on .hm-ico { opacity: 1; }
/* «Tareas» lo inyecta js/chat.js como .hpt-btn y se le añade .hm-item al
   entrar aquí: su contador se va al extremo derecho de la fila. */
.header-menu .hm-item .hpt-badge { margin-inline-start: auto; }
.header-menu .hm-logout { color: var(--err); }
.header-menu button.hm-logout:hover, .header-menu button.hm-logout:focus-visible {
  background: #fef2f2; color: var(--err);
}
@media (prefers-reduced-motion: reduce) { .header-menu { animation: none; } }

/* ── Layout ───────────────────────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}
/* Páginas de datos anchas —los conectores (Holded, Nubelus, Atradius…) y Traslados Nubelus—:
   sus tablas enseñan muchas columnas, y cuanto más ancho, más se ven sin desplazar. Una sola
   regla para todas con `<body class="pagina-ancha">`; hasta v2.1.390 cada página ponía la suya
   (1200, 1500, 1560, 1600 o 1680 px). */
body.pagina-ancha main { max-width: min(2200px, 98vw); }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-mute);
  margin: 0 0 16px;
}

/* ── Activity table ──────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-top: 32px;
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--nf-navy);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.panel-header h2 { margin: 0; }
.panel-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--nf-navy-light);
}
.panel-link:hover { color: var(--nf-orange-dark); }
.muted-count {
  color: var(--text-mute);
  font-weight: 500;
  font-size: 13px;
  margin-inline-start: 4px;
}

/* ── Filters (activity page) ─────────────────────────────────────────── */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: end;
}
.filters-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.filters-grid label > span { padding-inline-start: 2px; }
.filters-grid input,
.filters-grid select {
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filters-grid input:focus,
.filters-grid select:focus {
  outline: none;
  border-color: var(--nf-navy-light);
  box-shadow: 0 0 0 3px rgba(26, 85, 152, 0.15);
}
.filters-search { grid-column: span 2; }
.filters-actions {
  display: flex;
  gap: 8px;
  grid-column: span 2;
  justify-content: flex-end;
}
@media (max-width: 800px) {
  .filters-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-search,
  .filters-actions { grid-column: span 2; }
}
@media (max-width: 480px) {
  .filters-grid { grid-template-columns: 1fr; }
  .filters-search,
  .filters-actions { grid-column: span 1; }
  .filters-actions { justify-content: stretch; }
  .filters-actions .btn { flex: 1; justify-content: center; }
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
}
.page-size select {
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-soft);
}
.page-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-controls .btn { padding: 6px 12px; font-size: 13px; }
.page-controls .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-current {
  font-weight: 600;
  color: var(--text);
}

table.activity {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.activity th {
  text-align: start;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-mute);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.activity td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
table.activity tr:last-child td { border-bottom: none; }

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-ok      { background: #e3f6ec; color: var(--ok); }
.status-error   { background: #fde6e6; color: var(--err); }
.status-warning { background: #fcefd6; color: var(--warn); }
.status-info    { background: #e7eefa; color: var(--nf-navy); }

.empty {
  text-align: center;
  color: var(--text-mute);
  padding: 24px;
  font-size: 14px;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-mute);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
footer .footer-legal { font-size: 11px; opacity: .85; }
footer .footer-legal a { color: inherit; text-decoration: underline; }
footer .footer-legal a:hover { color: var(--nf-navy, #0d3c6e); }
/* En el móvil la línea legal ocupa todo el ancho, y al bajar hasta el final el botón flotante del chat
   (js/chat.js: 58px, al lado de inicio y a --hp-chat-abajo del borde) le tapaba el arranque. El pie deja
   debajo de su texto la altura del botón más su relleno de siempre: donde la página sube el botón por
   encima de su barra fija, el pie sube con él. En el escritorio la línea cabe al lado y no cambia nada. */
@media (max-width: 720px) {
  footer { padding-block-end: calc(var(--hp-chat-abajo, 22px) + 58px + 24px); }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
}
.btn-primary {
  background: var(--nf-navy);
  color: #fff;
}
.btn-primary:hover { background: var(--nf-navy-light); }
.btn-accent {
  background: var(--nf-orange);
  color: #fff;
}
.btn-accent:hover { background: var(--nf-orange-dark); }
.btn-ghost {
  background: transparent;
  color: var(--nf-navy);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

/* ── Tool page common ────────────────────────────────────────────────── */
.tool-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
/* Caja base del icono: su único uso es la cabecera de las páginas de
   herramienta. Las hojas por página solo añaden variantes más específicas
   (.tool-page-header .tool-icon.is-img, .bic-tool-logo, .tsmc-tool-logo…). */
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--nf-navy) 0%, var(--nf-navy-light) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  margin-bottom: 4px;
}
.tool-page-header .tool-icon {
  width: 56px;
  height: 56px;
  font-size: 28px;
}
.tool-page-header h1 {
  margin: 0;
  font-size: 24px;
  color: var(--nf-navy);
}
.tool-page-header .breadcrumb {
  font-size: 13px;
  color: var(--text-mute);
}
.tool-page-header .breadcrumb a { color: var(--text-mute); }

/* ═══════════════════════════════════════════════════════════════════════
   Responsive (global) — tablet · móvil · plegables. Ordenado de MAYOR a
   MENOR ancho para que el breakpoint más pequeño tenga prioridad.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tablet y plegables desplegados (≤1024px) ── */
@media (max-width: 1024px) {
  main { padding: 22px; }
  /* Tablas anchas: scroll horizontal propio para no desbordar la página. Y `position:
     relative` porque al volverse scroller la tabla pasa a recortar lo de dentro, pero un
     `.sr-only` (absoluto, sin desplazamientos) solo lo recorta un ancestro que además sea su
     bloque contenedor: sin esto el «Acciones» de la última columna se queda en coordenadas de
     página —a 500, 666 o 744 px del origen, y a la izquierda del cero en árabe— y desborda la
     página entera aunque la tabla scrollee bien. Mismo motivo que en `.ed-scroll`. */
  table.activity { display: block; width: max-content; max-width: 100%; overflow-x: auto; position: relative; }
}

/* ── Móvil (≤720px) ── */
@media (max-width: 720px) {
  /* ── Cabecera: marca arriba, navegación que envuelve debajo ── */
  .header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .header-logo-mark { height: 38px; padding: 5px 10px; }
  .header-logo-mark img { height: 24px; }
  /* Sin botón (páginas públicas que no cargan auth-ui, p. ej. html/legal.html):
     la barra sigue envolviendo como antes — son 1-2 enlaces y caben. */
  .header-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 6px;
    margin-inline-start: auto;
  }
  .header-nav a { padding: 6px 10px; font-size: 13px; }
  .header-user { margin-inline-start: 6px; padding-inline-start: 8px; gap: 8px; }
  .header-user-name { max-width: 110px; font-size: 12px; }
  .header-logout { padding: 5px 10px; font-size: 12px; }

  /* ── Con botón hamburguesa (auth-ui lo inyecta y marca .has-burger en las
     páginas con sesión): el nav no cabe en un móvil y pasa a ser un panel bajo
     la cabecera, navy como ella. Es UNA lista de filas iguales (icono en su
     baldosa, texto y, al final, lo que cada una tenga: el estado de los
     conectores, la bandera, el interruptor del modo nocturno), en grupos:
       1. quién eres (la tarjeta del usuario, con su insignia de SuperAdmin);
       2. a dónde ir (Inicio, Conectores, Tienda);
       3. lo tuyo y lo del espacio (perfil, tareas, actividad, ajustes, ayuda);
       4. preferencias (modo nocturno, idioma);
       5. cerrar sesión.
     El desplegable del avatar no existe aquí: .header-user y .header-menu van
     con `display: contents`, así sus piezas son filas del propio panel y
     `order` las coloca en su grupo. ── */
  /* Sin tocar el position: el header es sticky y «sticky» ya ancla a los hijos
     absolutos (ponerle relative lo desclavaba y el panel se iba con el scroll). */
  .header.has-burger { flex-wrap: nowrap; }
  .header.has-burger .header-burger { display: inline-flex; }
  .header.has-burger .header-nav {
    display: none;
    position: absolute; top: calc(100% + 8px); inset-inline-start: 10px; inset-inline-end: 10px;
    /* Una sola columna: con el `wrap` de la barra sin hamburguesa (arriba), lo que no
       cabía en alto se iba a una segunda columna, fuera de la vista. */
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px;
    margin: 0; padding: 10px;
    background: linear-gradient(160deg, var(--nf-navy) 0%, var(--nf-navy-dark) 100%);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(4, 18, 42, .55);
    /* Por encima del botón flotante del chat (1300), que si no tapa el final
       del panel; por debajo del banner de cookies (1400). */
    z-index: 1350;
    /* En pantallas bajas no crece por debajo del viewport: se desplaza dentro. */
    max-height: calc(100vh - 84px); max-height: calc(100dvh - 84px);
    overflow-y: auto; overscroll-behavior: contain;
    animation: hp-menu-entra .2s cubic-bezier(.16,1,.3,1) both;
  }
  .header.has-burger .header-nav.open { display: flex; }
  /* Las filas no se encogen: si no caben, el panel se desplaza por dentro. (Con el
     encogido por defecto del flex, en un móvil bajo las últimas filas se montaban
     unas sobre otras: «Idioma» quedaba debajo de «Cerrar sesión».) */
  .header.has-burger .header-nav > *,
  .header.has-burger .header-nav .header-user > *,
  .header.has-burger .header-nav .header-menu > * { flex-shrink: 0; }
  /* Abierto, la cabecera sube por encima del botón flotante del chat (1300): su
     z-index es el de todo el panel, que vive dentro. El velo, justo debajo. */
  .header.has-burger.menu-abierto { z-index: 1350; }
  .hp-menu-velo:not([hidden]) { display: block; z-index: 1340; }
  @keyframes hp-menu-entra { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .header.has-burger .header-nav { animation: none; } }

  /* El avatar y su contador sobran: el usuario es la primera fila del panel, y
     las tareas pendientes se cuentan en su propia fila. */
  .header.has-burger .header-nav .header-user,
  .header.has-burger .header-nav .header-menu { display: contents; }
  .header.has-burger .header-nav .header-avatar,
  .header.has-burger .header-nav .header-user > .hm-badge,
  .header.has-burger .header-nav .header-user > .sa-badge { display: none; }

  /* ── 1. La tarjeta del usuario ── */
  .header.has-burger .header-nav .hm-info {
    order: 1;
    margin: 0 0 8px; padding: 12px; border: 0;
    background: rgba(255,255,255,.07); border-radius: 14px;
  }
  .header.has-burger .header-nav .hm-face { width: 44px; height: 44px; font-size: 15px; box-shadow: 0 0 0 2px rgba(255,255,255,.22); }
  .header.has-burger .header-nav .hm-name { color: #fff; font-size: 15.5px; }
  .header.has-burger .header-nav .hm-email { color: rgba(255,255,255,.62); }
  .header.has-burger .header-nav .hm-sa {
    display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; margin-top: 4px;
    font-size: 11px; font-weight: 800; letter-spacing: .3px; color: #5a3d00;
    background: linear-gradient(135deg, #ffe08a, #f4b21a); border-radius: 999px;
    padding-block: 2px; padding-inline: 8px;
  }

  /* ── Todas las filas: mismo alto, misma baldosa para el icono, mismo texto ── */
  .header.has-burger .header-nav > a,
  .header.has-burger .header-nav .conn-btn,
  .header.has-burger .header-nav .hp-tema,
  .header.has-burger .header-nav .hpl-btn,
  .header.has-burger .header-nav > .hpt-btn,
  .header.has-burger .header-nav .header-menu .hm-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 46px; margin: 0;
    padding-block: 6px; padding-inline: 8px 12px;
    border: 0; border-radius: 12px; background: none; box-shadow: none;
    font: inherit; font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.2;
    color: #fff; text-align: start; text-decoration: none; cursor: pointer;
    transition: background .15s;
  }
  .header.has-burger .header-nav > a:hover,
  .header.has-burger .header-nav .conn-btn:hover,
  .header.has-burger .header-nav .conn-btn[aria-expanded="true"],
  .header.has-burger .header-nav .hp-tema:hover,
  .header.has-burger .header-nav .hpl-btn:hover,
  .header.has-burger .header-nav .hpl-btn[aria-expanded="true"],
  .header.has-burger .header-nav > .hpt-btn:hover,
  .header.has-burger .header-nav .header-menu a.hm-item:hover,
  .header.has-burger .header-nav .header-menu a.hm-item:focus-visible,
  .header.has-burger .header-nav .header-menu button.hm-item:hover,
  .header.has-burger .header-nav .header-menu button.hm-item:focus-visible {
    background: rgba(255,255,255,.09); color: #fff; transform: none; box-shadow: none;
  }
  /* Dónde estás: la fila de la página actual. */
  .header.has-burger .header-nav > a.active,
  .header.has-burger .header-nav .header-menu a.hm-item.hm-on {
    background: rgba(255,255,255,.14); color: #fff; font-weight: 700; box-shadow: none;
  }
  /* La baldosa: el icono de cada fila en un cuadrado de 32 px. */
  .header.has-burger .header-nav > a::before,
  .header.has-burger .header-nav .conn-btn::before,
  .header.has-burger .header-nav .hp-tema svg,
  .header.has-burger .header-nav .hpl-ico,
  .header.has-burger .header-nav > .hpt-btn svg,
  .header.has-burger .header-nav .header-menu .hm-item > svg {
    flex: none; box-sizing: border-box; width: 32px; height: 32px; padding: 7px;
    border-radius: 9px; background-color: rgba(255,255,255,.09); opacity: 1;
  }
  /* «Inicio» viene del HTML de cada página, sin icono: se lo pone su baldosa. */
  .header.has-burger .header-nav > a::before {
    content: '';
    background-repeat: no-repeat; background-position: center; background-size: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.8 10.6L12 3.8l8.2 6.8'/%3E%3Cpath d='M6 9v10.2h12V9'/%3E%3Cpath d='M10 19.2v-5.4h4v5.4'/%3E%3C/svg%3E");
  }
  .header.has-burger .header-nav .conn-btn::before {
    content: '';
    background-repeat: no-repeat; background-position: center; background-size: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7.5V3.5M15 7.5V3.5'/%3E%3Cpath d='M6.5 7.5h11v3.2a5.5 5.5 0 0 1-11 0z'/%3E%3Cpath d='M12 16.2v4.3'/%3E%3C/svg%3E");
  }
  /* Lo que va al final de la fila (estado, bandera, interruptor, contador). */
  .header.has-burger .header-nav .conn-btn > span:not(.dot) { flex: 1; }
  .header.has-burger .header-nav .conn-btn .dot { order: 2; }
  .header.has-burger .header-nav .conn-btn > svg,
  .header.has-burger .header-nav .hpl-btn .car { order: 3; width: 14px; height: 14px; opacity: .6; }
  .header.has-burger .header-nav .header-menu .hm-item .hpt-badge,
  .header.has-burger .header-nav > .hpt-btn .hpt-badge { margin-inline-start: auto; }

  /* ── 2. A dónde ir ── */
  .header.has-burger .header-nav > a { order: 2; }
  .header.has-burger .header-nav .conn-menu,
  .header.has-burger .header-nav > .hpt-btn { order: 3; width: 100%; margin: 0; }
  /* La Tienda conserva su naranja en la baldosa, no en toda la fila. */
  .header.has-burger .header-nav .header-menu .hm-item[data-tool="tienda"] > svg {
    background: linear-gradient(135deg, var(--nf-orange) 0%, var(--nf-orange-dark) 100%);
    box-shadow: 0 3px 10px rgba(240, 122, 31, .35);
  }

  /* ── 3. Lo tuyo y lo del espacio: cada sección con su línea encima ── */
  .header.has-burger .header-nav .header-menu #hm-mio { order: 5; }
  .header.has-burger .header-nav .header-menu #hm-nav { order: 6; }
  .header.has-burger .header-nav .header-menu .hm-sec,
  .header.has-burger .header-nav .header-menu .hm-sec + .hm-sec {
    display: flex; flex-direction: column; gap: 2px;
    margin: 8px 0 0; padding: 8px 0 0;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .header.has-burger .header-nav .header-menu .hm-sec[hidden] { display: none; }

  /* Hermes: una fila de navegación con el icono en su baldosa, sin la de «Inicio» que traen las filas `> a`. */
  .header.has-burger .header-nav > a.hp-hermes::before { display: none; }
  .header.has-burger .header-nav > a.hp-hermes svg {
    flex: none; box-sizing: border-box; width: 32px; height: 32px; padding: 7px;
    border-radius: 9px; background-color: rgba(255,255,255,.09);
  }
  .header.has-burger .header-nav .hp-hermes-txt { display: inline; flex: 1; }

  /* ── 4. Preferencias ── */
  .header.has-burger .header-nav .hp-tema {
    order: 7;
    margin-top: 8px; border-top: 1px solid rgba(255,255,255,.12);
    border-start-start-radius: 0; border-start-end-radius: 0;
  }
  .header.has-burger .header-nav .hp-lang { order: 8; width: 100%; margin: 0; }
  .header.has-burger .header-nav .hpl-txt { display: inline; flex: 1; }
  .header.has-burger .header-nav .hpl-ico { display: block; }
  .header.has-burger .header-nav .hpl-cur { font-size: 13px; font-weight: 800; opacity: .85; }
  .header.has-burger .header-nav .hp-tema-txt { display: inline; flex: 1; }
  /* El interruptor: apagado gris, encendido naranja; el botón viaja al lado de fin. */
  .header.has-burger .header-nav .hp-tema-sw {
    display: inline-block; position: relative; flex: none;
    width: 42px; height: 24px; border-radius: 999px;
    background: rgba(255,255,255,.22); transition: background .18s;
  }
  .header.has-burger .header-nav .hp-tema-sw::after {
    content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s;
  }
  .header.has-burger .header-nav .hp-tema[aria-pressed="true"] .hp-tema-sw { background: var(--nf-orange); }
  .header.has-burger .header-nav .hp-tema[aria-pressed="true"] .hp-tema-sw::after { transform: translateX(18px); }
  html[dir="rtl"] .header.has-burger .header-nav .hp-tema[aria-pressed="true"] .hp-tema-sw::after { transform: translateX(-18px); }
  /* La luna o el sol, el que toque, en la baldosa. */
  .header.has-burger .header-nav .hp-tema .hp-tema-luna,
  .header.has-burger .header-nav .hp-tema .hp-tema-sol { display: none; }
  .header.has-burger .header-nav .hp-tema[aria-pressed="false"] .hp-tema-luna,
  .header.has-burger .header-nav .hp-tema[aria-pressed="true"] .hp-tema-sol { display: block; }

  /* ── 5. Cerrar sesión ── */
  .header.has-burger .header-nav .header-menu .hm-sec:last-child { order: 9; }
  .header.has-burger .header-nav .header-menu .hm-logout { color: #ffc9bf; }
  .header.has-burger .header-nav .header-menu .hm-logout > svg { background-color: rgba(239,68,68,.2); }
  .header.has-burger .header-nav .header-menu button.hm-logout:hover,
  .header.has-burger .header-nav .header-menu button.hm-logout:focus-visible {
    background: rgba(239,68,68,.18); color: #ffd9d1;
  }

  /* ── Los desplegables (conectores, idioma): en línea dentro del panel, bajo
     su fila, y no flotando fuera — así no tapan el menú ni se salen. ── */
  .header.has-burger .header-nav.open .conn-panel,
  .header.has-burger .header-nav.open .hpl-panel {
    position: static; width: auto; min-width: 0; max-width: none; max-height: none;
    margin: 2px 0 6px; padding: 6px; box-shadow: none; animation: none;
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  }
  .header.has-burger .header-nav.open .conn-eyebrow { color: rgba(255,255,255,.55); padding: 4px 4px 8px; }
  .header.has-burger .header-nav.open .conn-card,
  .header.has-burger .header-nav.open .conn-card.db {
    background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1);
  }
  .header.has-burger .header-nav.open .conn-panel a.conn-card:hover {
    background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); box-shadow: none; transform: none;
  }
  .header.has-burger .header-nav.open .conn-card .n { color: #fff; }
  .header.has-burger .header-nav.open .conn-card .s,
  .header.has-burger .header-nav.open .conn-vacio { color: rgba(255,255,255,.62); }
  .header.has-burger .header-nav.open .conn-card .ic { background: #fff; border-radius: 7px; }
  .header.has-burger .header-nav.open .conn-panel .conn-hub,
  .header.has-burger .header-nav.open .conn-panel .conn-hub:hover {
    background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); color: #fff;
  }
  /* Los idiomas, en una rejilla de dos columnas. */
  .header.has-burger .header-nav.open .hpl-panel:not([hidden]) { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .header.has-burger .header-nav.open .hpl-panel button { color: #fff; padding: 10px 12px; }
  .header.has-burger .header-nav.open .hpl-panel button:hover { background: rgba(255,255,255,.1); }
  .header.has-burger .header-nav.open .hpl-panel button.on { background: rgba(255,255,255,.16); color: #fff; }

  /* ── Contenedor principal ── */
  main { padding: 16px; }

  .tool-page-header { gap: 12px; margin-bottom: 18px; }
  .tool-page-header .tool-icon { width: 44px; height: 44px; font-size: 22px; }
  .tool-page-header h1 { font-size: 19px; }

  /* ── Paneles ── */
  .panel { padding: 16px; margin-top: 18px; }
  .panel-header { flex-wrap: wrap; gap: 8px; }
  .panel-header h2 { font-size: 15px; }

  /* ── Paginación apilada ── */
  .pagination { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-controls { justify-content: space-between; }
}

/* ── Móvil estrecho (≤480px) ── */
@media (max-width: 480px) {
  main { padding: 12px; }
}

/* ── Móviles plegables plegados (~280–360px) ── */
@media (max-width: 360px) {
  main { padding: 10px; }
  .header { padding: 8px 10px; gap: 6px; }
  .header-logo-mark { height: 32px; padding: 4px 8px; }
  .header-logo-mark img { height: 20px; }
  .header-nav a { padding: 5px 8px; font-size: 12px; }
  .header-user-name { max-width: 72px; }
  .header-logout { padding: 4px 8px; }
  .tool-page-header .tool-icon { width: 38px; height: 38px; font-size: 19px; }
  .tool-page-header h1 { font-size: 17px; }
  .panel { padding: 13px; }
  .btn { padding: 9px 14px; font-size: 13px; }
}

/* ── Banner de consentimiento de cookies (js/cookies-banner.js: login + inicio) ── */
.ck-banner { position: fixed; inset-inline-start: 0; inset-inline-end: 0; bottom: 0; z-index: 1400; padding: 16px;
  animation: ck-in .35s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes ck-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.ck-inner { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 18px 50px rgba(5, 26, 54, .35); padding: 20px 24px; }
.ck-text strong { font-size: 15px; color: var(--nf-navy); }
.ck-text p { margin: 6px 0 0; font-size: 13.5px; color: var(--text-soft); }
.ck-text a { color: var(--nf-navy); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ck-config { margin: 14px 0 2px; display: flex; flex-direction: column; gap: 10px; }
.ck-config[hidden] { display: none; }
.ck-cat { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-soft);
  cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.ck-cat input { margin-top: 2px; accent-color: var(--nf-navy); }
.ck-cat strong { color: var(--text); }
.ck-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ck-actions button { font: inherit; font-size: 14px; font-weight: 700; padding: 9px 18px;
  border-radius: 9px; cursor: pointer; transition: filter .15s ease, border-color .15s ease, color .15s ease; }
.ck-btn-primary { border: none; background: linear-gradient(135deg, var(--nf-navy), var(--nf-navy-light)); color: #fff; }
.ck-btn-primary:hover { filter: brightness(1.12); }
.ck-btn-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); }
.ck-btn-ghost:hover { border-color: var(--nf-navy-light); color: var(--nf-navy); }
@media (max-width: 560px) { .ck-actions button { flex: 1; white-space: normal; } }
@media (prefers-reduced-motion: reduce) { .ck-banner { animation: none; } }


/* ── Menú «Conectores» del header (v2.0.2, antes solo en el index v1.2.350) ──
   El botón imita los enlaces de .header-nav; el punto resume la salud de la BD
   (verde con pulso / rojo) y el panel muestra las tarjetas de los conectores.
   En el index lo pinta app.js; en el resto de páginas lo inyecta auth-ui.js. */
.conn-menu { position: relative; }
.conn-btn { display: inline-flex; align-items: center; gap: 8px; border: none; background: none;
  font: inherit; font-size: 14px; font-weight: 500; color: rgba(255,255,255,.85);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.conn-btn:hover, .conn-btn[aria-expanded="true"] { background: rgba(255,255,255,.12); color: #fff; }
.conn-btn svg { width: 13px; height: 13px; opacity: .7; transition: transform .18s; }
.conn-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.conn-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.55); animation: conn-pulse 2.2s infinite; }
.conn-btn .dot.unk { background: #94a3b8; animation: none; box-shadow: none; }
.conn-btn .dot.err { background: #e0382f; animation: none; box-shadow: 0 0 8px rgba(224,56,47,.8); }
@keyframes conn-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.conn-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 12px); z-index: 130; width: 344px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  box-shadow: 0 6px 18px rgba(13,60,110,.12), 0 18px 46px rgba(13,60,110,.18);
  animation: conn-pop .25s cubic-bezier(.16,1,.3,1) both; }
.conn-panel[hidden] { display: none; }
.conn-eyebrow { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-mute); padding: 0 2px 10px; }
.conn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.conn-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 11px; background: #fff; min-width: 0; }
.conn-card.db { grid-column: 1 / -1; background: #f2f6fc; border-color: #d7e4f7; }
/* Menú de conectores sin ninguno configurado: se dice dónde se configuran, en
   vez de dejar el hueco en blanco (que se lee como que algo se ha roto). */
.conn-vacio { grid-column: 1 / -1; padding: 14px 12px; text-align: center;
  color: var(--text-soft, #6b7a8d); font-size: .84rem; line-height: 1.5; }
.conn-card .ic { width: 26px; height: 26px; border-radius: 7px; flex: none; overflow: hidden;
  display: grid; place-items: center; font-size: 16px; }
.conn-card .ic img, .conn-card .ic svg { width: 100%; height: 100%; display: block; }
.conn-card .tx { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conn-card .n { font-size: 12.5px; font-weight: 800; color: var(--text); letter-spacing: -.1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-card .s { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  color: var(--text-mute); white-space: nowrap; overflow: hidden; }
.conn-card .s .dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; flex: none; }
.conn-card .s .dot.slow { background: #f4b12a; }
.conn-card .s .dot.off { background: #94a3b8; }
.conn-card .s .dot.err { background: #e0382f; }
/* Tarjeta clicable (v2.0.193): la de cada conector es un <a> que entra directo a su
   página. Prefijado con .conn-panel por lo mismo que .conn-hub: dentro del nav,
   `.header-nav a` pisaría el color, el padding y el fondo del hover. */
.conn-panel a.conn-card { padding: 9px 11px; color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.conn-panel a.conn-card:hover { background: #fff; border-color: var(--nf-navy-light);
  box-shadow: 0 4px 14px rgba(13,60,110,.14); transform: translateY(-1px); }
.conn-panel a.conn-card:focus-visible { outline: 2px solid var(--nf-navy); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .conn-panel a.conn-card { transition: none; }
  .conn-panel a.conn-card:hover { transform: none; }
}
/* Prefijado con .conn-panel: dentro del nav, .header-nav a (main.css) pisaría
   el color/padding de una sola clase. */
.conn-panel .conn-hub { display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px; padding: 9px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 800;
  color: var(--nf-navy); background: #eef4ff; border: 1px solid #d7e4f7; }
.conn-panel .conn-hub:hover { background: #e2edff; color: var(--nf-navy); }
.conn-panel .conn-hub[hidden] { display: none; }
@keyframes conn-pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ── Acceso a la Tienda ────────────────────────────────────────────────────
   Desde v3.0.282 no va en la barra: es una entrada del desplegable del avatar (auth-ui.js, solo
   administradores) y un apartado del inicio. En el desplegable conserva su naranja en el icono. */
.header-menu .hm-item[data-tool="tienda"] .hm-ico { color: var(--nf-orange); opacity: 1; }

/* ── Selector de idioma del header (v2, desplegable — escala a N idiomas) ──
   Lo inyecta auth-ui.js en todos los headers si config.langs trae más de un
   idioma. Sustituye a las píldoras ES/EN del index: con 5+ idiomas no caben.
   El order flex lo deja siempre al final del nav, delante del avatar. */
.header-nav .hp-lang { position: relative; order: 8; margin-inline-start: 8px; }
.header-nav .header-user { order: 9; }
.hpl-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.10); color: rgba(255,255,255,.85); font: inherit; font-size: 12px;
  font-weight: 800; letter-spacing: .3px; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  transition: background .18s, color .18s; }
.hpl-btn:hover, .hpl-btn[aria-expanded="true"] { background: rgba(255,255,255,.22); color: #fff; }
.hpl-btn .car { width: 11px; height: 11px; flex: none; opacity: .7; transition: transform .18s; }
/* Bandera SVG (resources/images/flags/): en trigger y opciones */
.hpl-flag { width: 18px; height: 12px; border-radius: 2.5px; object-fit: cover; flex: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.hpl-btn[aria-expanded="true"] .car { transform: rotate(180deg); }
.hpl-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 10px); z-index: 140; min-width: 118px;
  max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 6px; box-shadow: 0 6px 18px rgba(13,60,110,.12), 0 18px 46px rgba(13,60,110,.18);
  animation: conn-pop .25s cubic-bezier(.16,1,.3,1) both; }
.hpl-panel[hidden] { display: none; }
.hpl-panel button { display: flex; align-items: center; gap: 9px;
  width: 100%; border: none; background: none; font: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: .4px; color: var(--text); text-align: start; padding: 8px 11px; border-radius: 9px; cursor: pointer; }
.hpl-panel button:hover { background: #f2f6fc; }
.hpl-panel button.on { color: var(--nf-navy); font-weight: 800; background: #eef4ff; }

/* ── Modo nocturno: la luna de la barra (js/tema.js; el botón lo pone auth-ui.js) ──
   Redonda, con el mismo vidrio que el selector de idioma, justo delante de él.
   Con el nocturno puesto enseña un sol. En el menú móvil es una fila con su
   interruptor (más arriba, en el bloque ≤720px). */
.header-nav .hp-tema {
  order: 8; display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0; margin-inline-start: 8px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.10); color: rgba(255,255,255,.88);
  cursor: pointer; transition: background .18s, color .18s, transform .18s;
}
.header-nav .hp-tema:hover { background: rgba(255,255,255,.22); color: #fff; transform: rotate(-12deg); }
.header-nav .hp-tema:focus-visible { outline: 2px solid var(--nf-orange); outline-offset: 2px; }
.header-nav .hp-tema svg { width: 17px; height: 17px; grid-area: 1 / 1; }
/* Hermes, el agente de la casa (el enlace lo pone auth-ui.js, solo a su superadministrador): la misma pastilla que la luna. */
.header-nav .hp-hermes {
  order: 8; display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0; margin-inline-start: 8px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.10); color: rgba(255,255,255,.88);
  transition: background .18s, color .18s;
}
.header-nav .hp-hermes:hover { background: rgba(255,255,255,.22); color: #fff; }
.header-nav .hp-hermes:focus-visible { outline: 2px solid var(--nf-orange); outline-offset: 2px; }
.header-nav .hp-hermes svg { width: 18px; height: 18px; }
.hp-tema .hp-tema-sol,
.hp-tema[aria-pressed="true"] .hp-tema-luna { display: none; }
.hp-tema[aria-pressed="true"] .hp-tema-sol { display: block; }
@media (prefers-reduced-motion: reduce) { .header-nav .hp-tema:hover { transform: none; } }
/* Piezas que solo existen en el menú móvil: el texto y el interruptor del modo
   nocturno, el globo y «Idioma» del selector, y la insignia de SuperAdmin de la
   tarjeta del usuario. */
.hp-tema-txt, .hp-tema-sw, .hp-hermes-txt, .hpl-ico, .hpl-txt, .hm-sa { display: none; }
/* El velo que apaga la página con el menú móvil abierto: debajo de la cabecera (100). */
.hp-menu-velo { display: none; position: fixed; inset: 0; z-index: 99; background: rgba(4, 14, 32, .5); }

/* ── RTL (F-AR-1, docs/AR_PLAN.md §5): lo que las propiedades lógicas no espejan solas ──
   Lo que se lee siempre de izquierda a derecha aunque la pantalla sea árabe: correos,
   URL, teléfonos, contraseñas, números, código. `.ltr` es la clase para marcarlo a mano
   (IBAN, referencias, rutas de fichero). unicode-bidi: isolate evita que el bidi del
   párrafo árabe reordene el fragmento. */
html[dir="rtl"] input[type="email"], html[dir="rtl"] input[type="url"], html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="password"], html[dir="rtl"] .ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }
html[dir="rtl"] input[type="number"] { direction: ltr; }
/* Los campos de fecha y hora nativos se leen siempre de izquierda a derecha (06/09/2026, 14:05). */
html[dir="rtl"] input[type="date"], html[dir="rtl"] input[type="time"], html[dir="rtl"] input[type="datetime-local"], html[dir="rtl"] input[type="month"] { direction: ltr; }
html[dir="rtl"] code, html[dir="rtl"] kbd, html[dir="rtl"] pre { direction: ltr; unicode-bidi: isolate; text-align: start; }
/* Un icono con dirección (chevrón «siguiente», flecha «volver») se espeja con esta clase.
   Las flechas tipográficas de las claves las trae ya espejadas el diccionario árabe, y las
   que compone el JS pasan por I18N.flecha(). */
html[dir="rtl"] .rtl-espejo { display: inline-block; transform: scaleX(-1); }

/* ── Aviso de cobro (F2 del plan de contratación) ────────────────────────
   Lo inyecta js/auth-ui.js justo debajo de la cabecera, en todas las páginas, a quien paga
   por Stripe: rojo si el cobro ha fallado o la suscripción está suspendida (`.grave`), ámbar
   si solo termina al final del periodo. Sin botón de cerrar: sigue ahí hasta que se arregla.
   Con `position: relative` y z-index propio, como el `main` del inicio: su fondo es un
   `body::before` fijo (styles/index.css) que tapaba lo que no crea su propio contexto de
   apilamiento. Por debajo de la cabecera (z-index 100), que al hacer scroll pasa por encima. */
.hp-cobro {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
  padding-block: 10px; padding-inline: 32px;
  background: #fff4e5; color: #6b3d00; border-bottom: 1px solid #f5d3a5;
  font-size: .88rem; line-height: 1.45; text-align: center;
}
.hp-cobro.grave { background: #fdecec; color: #8a1f1f; border-bottom-color: #f4c1c1; }
.hp-cobro-btn {
  font: inherit; font-size: .82rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  border: 0; border-radius: 999px; padding-block: 7px; padding-inline: 14px;
  background: var(--nf-navy); color: #fff;
}
.hp-cobro.grave .hp-cobro-btn { background: var(--err); }
.hp-cobro-btn:hover { filter: brightness(1.08); }
/* El de la licencia rebasada es un enlace a la Tienda (#licencia), no un botón. */
a.hp-cobro-btn { display: inline-block; text-decoration: none; }
.hp-cobro-btn:focus-visible { outline: 2px solid var(--nf-orange); outline-offset: 2px; }
.hp-cobro-btn:disabled { opacity: .6; cursor: default; }
/* Por qué no se ha abierto el portal (el 429 del tope de aperturas): en su propia línea, debajo. */
.hp-cobro-err { flex-basis: 100%; font-size: .82rem; font-weight: 600; }
@media (max-width: 640px) { .hp-cobro { padding-inline: 16px; } }

/* ── El candado de la ficha abierta (js/candado-ficha.js) ─────────────────────
   Quien entra en una ficha que tiene abierta otra persona la ve en solo lectura con este aviso:
   quién está dentro y desde cuándo, y «Editar ahora» en cuanto queda libre. */
.cf-aviso {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin-block: 0 12px; padding-block: 10px; padding-inline: 14px;
  background: #fff4e5; color: #6b3d00; border: 1px solid #f5d3a5; border-radius: 12px;
  font-size: .86rem; line-height: 1.45;
}
.cf-aviso.cf-libre { background: #eaf7ef; color: #14532d; border-color: #b7e2c6; }
.cf-icono { font-size: 1.05rem; }
.cf-texto { flex: 1 1 240px; }
.cf-boton {
  margin-inline-start: auto;
  font: inherit; font-size: .82rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  border: 0; border-radius: 999px; padding-block: 6px; padding-inline: 14px;
  background: var(--nf-navy); color: #fff;
}
.cf-boton:hover { filter: brightness(1.08); }
.cf-boton:focus-visible { outline: 2px solid var(--nf-orange); outline-offset: 2px; }

/* ── Demo: el sector que se está enseñando (js/auth-ui.js; lib/demo-sectores.js, 7-nov-2026) ──
   Solo en Demo y a quien la enseña: «DEMO · Transporte» en una pastilla con el naranja de la marca, que lleva al
   selector para cambiar. En el menú móvil es la primera fila. */
.header-nav .hp-demo {
  order: 7; margin-inline-start: 8px; display: inline-flex; align-items: center; gap: 7px; height: 34px;
  padding-block: 0; padding-inline: 4px 10px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(240,122,31,.75); background: rgba(240,122,31,.16); color: #fff; font-size: 12.5px; font-weight: 700;
  transition: background .18s;
}
.header-nav .hp-demo:hover { background: rgba(240,122,31,.3); }
.header-nav .hp-demo:focus-visible { outline: 2px solid var(--nf-orange); outline-offset: 2px; }
.hpd-tag {
  background: var(--nf-orange); color: #fff; border-radius: 999px; padding-block: 3px; padding-inline: 8px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.hpd-n { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.hpd-ico { width: 15px; height: 15px; opacity: .8; flex: none; }
@media (max-width: 720px) {
  /* Con `> a.hp-demo`: las filas del menú (`> a`) traen su fondo y la baldosa de «Inicio», que aquí no van. */
  .header.has-burger .header-nav > a.hp-demo {
    order: 1; width: 100%; margin: 0; height: auto; min-height: 44px; border-radius: 12px;
    border: 1px solid rgba(240,122,31,.75); background: rgba(240,122,31,.16);
  }
  .header.has-burger .header-nav > a.hp-demo::before { display: none; }
  .header.has-burger .header-nav .hpd-n { flex: 1; max-width: none; }
}

/* ── Hubis: el saldo de la IA en la barra (js/auth-ui.js, cabeceraHubis; 18-oct-2026) ──
   Una pastilla de vidrio como la luna y el idioma, con la chispa naranja de Hubi; ámbar si quedan pocos y roja sin
   saldo. Al pulsarla, un desplegable con lo gastado este mes y para cuánto da. En el menú móvil es una fila más. */
.header-nav .hp-hubis { position: relative; order: 8; margin-inline-start: 8px; }
.hph-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding-block: 0; padding-inline: 4px 12px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(255,255,255,.10); color: #fff;
  font: inherit; cursor: pointer; transition: background .18s, border-color .18s;
}
.hph-btn:hover, .hph-btn[aria-expanded="true"] { background: rgba(255,255,255,.22); }
.hph-btn:focus-visible { outline: 2px solid var(--nf-orange); outline-offset: 2px; }
.hph-ico {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; color: #fff;
  background: linear-gradient(135deg, #f7a35c, var(--nf-orange-dark)); box-shadow: 0 0 10px rgba(240,122,31,.5);
}
.hph-ico svg { width: 14px; height: 14px; }
.hph-n { font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hph-txt { font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.72); }
.hp-hubis[data-nivel="poco"] .hph-btn { border-color: rgba(244,177,42,.85); background: rgba(244,177,42,.18); }
.hp-hubis[data-nivel="poco"] .hph-ico { background: linear-gradient(135deg, #f8cd5f, #d99800); box-shadow: 0 0 10px rgba(244,177,42,.55); }
.hp-hubis[data-nivel="cero"] .hph-btn { border-color: rgba(248,113,113,.9); background: rgba(210,58,58,.26); }
.hp-hubis[data-nivel="cero"] .hph-ico { background: linear-gradient(135deg, #f87171, #c0392b); animation: hph-latido 1.8s infinite; }
@keyframes hph-latido { 0% { box-shadow: 0 0 0 0 rgba(248,113,113,.7); } 70% { box-shadow: 0 0 0 8px rgba(248,113,113,0); } 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); } }
.hph-pop {
  position: absolute; top: calc(100% + 10px); inset-inline-end: -40px; z-index: 140; width: 320px; overflow: hidden;
  color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 16px; text-align: start;
  box-shadow: 0 6px 18px rgba(13,60,110,.12), 0 18px 46px rgba(13,60,110,.2); animation: conn-pop .25s cubic-bezier(.16,1,.3,1) both;
}
.hph-pop[hidden] { display: none; }
.hph-cab {
  position: relative; overflow: hidden; padding: 14px 16px 12px; color: #fff;
  background: linear-gradient(135deg, var(--nf-navy-dark), var(--nf-navy) 55%, var(--nf-navy-light));
}
.hph-cab::after { content: ""; position: absolute; inset-inline-end: -40px; top: -60px; width: 150px; height: 150px; border-radius: 50%; background: rgba(240,122,31,.22); }
.hph-cab > * { position: relative; z-index: 1; }
.hph-eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: rgba(255,255,255,.7); }
.hph-big { display: flex; align-items: baseline; gap: 7px; margin-top: 3px; }
.hph-big b { font-size: 28px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.hph-big span { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.75); }
.hph-ritmo { margin-top: 2px; font-size: 12.5px; color: #cfe0f5; }
.hph-cuerpo { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; }
.hph-fila { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.hph-fila span { color: var(--text-soft); }
.hph-fila b { font-variant-numeric: tabular-nums; }
.hph-aviso { margin: 0; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.45; }
.hph-aviso.poco { background: #fff3d9; color: #6e4a00; border: 1px solid #f1dcaa; }
.hph-aviso.cero { background: #fff1ef; color: #8f1d12; border: 1px solid #f6c9c3; }
.hph-nota { margin: 0; font-size: 12.5px; color: var(--text-mute); }
.hph-acc { display: flex; gap: 8px; }
.hph-b {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; padding: 9px 10px; border-radius: 11px;
  border: 1px solid var(--border); background: #fff; color: var(--nf-navy); font: inherit; font-size: 13px; font-weight: 800;
  text-decoration: none; cursor: pointer;
}
.hph-b:hover { background: #f6f9fd; border-color: #c9d6e6; color: var(--nf-navy); }
.hph-b.naranja { border: none; color: #fff; background: linear-gradient(135deg, #f68c39, #de6a10); box-shadow: 0 6px 16px rgba(240,122,31,.35); }
.hph-b.naranja:hover { color: #fff; filter: brightness(1.05); }
@media (max-width: 720px) {
  .header.has-burger .header-nav .hp-hubis { order: 4; width: 100%; margin: 0; }
  .header.has-burger .header-nav .hph-btn {
    display: flex; width: 100%; height: auto; min-height: 46px; gap: 12px; padding-block: 6px; padding-inline: 8px 12px;
    border: 0; border-radius: 12px; background: none; font-size: 15px; font-weight: 600;
  }
  .header.has-burger .header-nav .hph-btn:hover,
  .header.has-burger .header-nav .hph-btn[aria-expanded="true"] { background: rgba(255,255,255,.09); }
  .header.has-burger .header-nav .hph-ico { width: 32px; height: 32px; border-radius: 9px; box-shadow: none; }
  .header.has-burger .header-nav .hph-txt { order: 1; flex: 1; font-size: 15px; font-weight: 600; color: #fff; }
  .header.has-burger .header-nav .hph-n { order: 2; font-size: 14px; }
  .header.has-burger .header-nav .hph-pop { position: static; width: auto; margin-block: 4px 8px; box-shadow: none; animation: none; }
}
@media (prefers-reduced-motion: reduce) { .hp-hubis[data-nivel="cero"] .hph-ico, .hph-pop { animation: none; } }

/* ── Historial de Hubis (js/hubis-historial.js, solo administradores) ──
   La ventana de la casa: cabecera navy con blobs y eyebrow, y tarjetas blancas debajo. Por herramienta, por persona y
   día a día (al pulsar una barra se filtra), y el detalle de cada uso agrupado por día. */
.hbh-velo {
  position: fixed; inset: 0; z-index: 1360; display: grid; place-items: center; padding: 18px;
  background: rgba(10,16,28,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: hbh-fundido .25s ease both;
}
.hbh-velo[hidden] { display: none; }
@keyframes hbh-fundido { from { opacity: 0; } to { opacity: 1; } }
@keyframes hbh-sube { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hbh-card {
  width: min(1200px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border-radius: 22px; box-shadow: 0 30px 80px rgba(9,14,24,.4); animation: hbh-sube .4s cubic-bezier(.16,1,.3,1) both;
}
.hbh-head {
  position: relative; overflow: hidden; flex: none; padding: 20px 24px 18px; color: #fff;
  background: linear-gradient(135deg, var(--nf-navy-dark) 0%, var(--nf-navy) 55%, var(--nf-navy-light) 100%);
}
.hbh-head .hbh-blob { position: absolute; border-radius: 50%; pointer-events: none; }
.hbh-head .b1 { inset-inline-end: -70px; top: -90px; width: 240px; height: 240px; background: rgba(255,255,255,.07); }
.hbh-head .b2 { inset-inline-start: 35%; bottom: -120px; width: 200px; height: 200px; background: rgba(240,122,31,.18); }
.hbh-head > *:not(.hbh-blob) { position: relative; }
.hbh-top { display: flex; align-items: flex-start; gap: 14px; }
.hbh-eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: rgba(255,255,255,.7); }
.hbh-head h2 { margin: 3px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: #fff; }
.hbh-head p { margin: 3px 0 0; font-size: 13px; color: #cfe0f5; }
.hbh-cerrar {
  flex: none; margin-inline-start: auto; width: 36px; height: 36px; border-radius: 11px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.hbh-cerrar:hover { background: rgba(255,255,255,.2); }
.hbh-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; margin-top: 16px; align-items: stretch; }
.hbh-stat { padding: 10px 13px; border-radius: 13px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.13); }
.hbh-stat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.hbh-stat span { font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.7); }
.hbh-stats .hph-b { align-self: center; flex: none; padding: 11px 16px; }
.hbh-cuerpo { display: flex; flex-direction: column; gap: 14px; overflow: auto; padding: 18px 22px 22px; }
.hbh-cuerpo > * { flex-shrink: 0; }   /* columna con scroll: sin esto, la tabla se encoge a cero */
.hbh-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hbh-periodo { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.hbh-periodo button { border: none; background: none; padding: 6px 12px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-soft); cursor: pointer; }
.hbh-periodo button:hover { color: var(--nf-navy); }
.hbh-periodo button.on { background: var(--nf-navy); color: #fff; }
.hbh-sel {
  appearance: none; -webkit-appearance: none; padding-block: 7px; padding-inline: 11px 28px; border: 1px solid var(--border); border-radius: 10px;
  background-color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-soft); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 13px; background-position: right 9px center;
}
html[dir="rtl"] .hbh-sel { background-position: left 9px center; }
.hbh-sel.on { border-color: var(--nf-navy); color: var(--nf-navy); background-color: #eef4fc; }
.hbh-filtros .hbh-esp { flex: 1; }
.hbh-filtros .hph-b { flex: none; }
.hbh-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hbh-chips:empty { display: none; }
.hbh-chip { display: inline-flex; align-items: center; gap: 6px; padding-block: 4px; padding-inline: 10px 6px; border-radius: 999px; background: #e7effa; color: var(--nf-navy); font-size: 12px; font-weight: 700; }
.hbh-chip button { width: 18px; height: 18px; border: none; border-radius: 50%; background: rgba(13,60,110,.12); color: var(--nf-navy); font-size: 12px; line-height: 1; cursor: pointer; }
.hbh-res { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; }
.hbh-tarjeta { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px; border-radius: 16px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow); }
.hbh-tarjeta h3 { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 11.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--text-mute); }
.hbh-tarjeta h3 span { font-weight: 600; letter-spacing: 0; text-transform: none; }
.hbh-barra {
  display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 3px 10px; align-items: center; width: 100%; padding: 6px; border: none;
  border-radius: 10px; background: none; color: var(--text); text-align: start; font: inherit; cursor: pointer;
}
.hbh-barra:hover { background: #f5f8fc; }
.hbh-barra.on { background: #eef4fc; box-shadow: inset 0 0 0 1px #c9d9ee; }
.hbh-barra.apagada { opacity: .4; }
.hbh-barra .q { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 700; }
.hbh-barra .q > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hbh-barra .v { text-align: end; font-size: 13px; font-weight: 800; color: var(--nf-navy); font-variant-numeric: tabular-nums; }
.hbh-barra .pista { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: #eef2f7; overflow: hidden; }
.hbh-barra .pista i { display: block; height: 100%; border-radius: 6px; }
.hbh-barra .u { grid-column: 1 / -1; margin-top: -2px; font-size: 11px; font-weight: 600; color: var(--text-mute); }
.hbh-ico { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 7px; overflow: hidden; }
.hbh-ico img { display: block; width: 100%; height: 100%; }
.hbh-ico.hubi { color: #fff; background: linear-gradient(135deg, var(--nf-navy-light), var(--nf-orange)); }
.hbh-ico.auto { color: #fff; background: linear-gradient(135deg, var(--nf-lilac), var(--nf-lilac-light)); }
.hbh-ico svg { width: 14px; height: 14px; }
.hbh-ava { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 800; }
.hbh-dias { position: relative; flex: 1; min-height: 170px; }
.hbh-dias svg { display: block; overflow: visible; }
.hbh-dias svg text { font-family: var(--font); font-size: 10px; font-weight: 600; fill: var(--text-mute); }
.hbh-tip {
  position: absolute; z-index: 5; min-width: 170px; padding: 9px 11px; border-radius: 11px; pointer-events: none; opacity: 0;
  background: #0f2440; color: #fff; font-size: 12px; box-shadow: 0 10px 30px rgba(8,25,50,.35); transition: opacity .12s;
}
.hbh-tip.ver { opacity: 1; }
.hbh-tip h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: rgba(255,255,255,.65); }
.hbh-tip .fila { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.hbh-tip .fila.tot { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.14); font-weight: 800; font-size: 13px; }
.hbh-tabla { overflow: hidden; border-radius: 16px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow); }
.hbh-tcab, .hbh-r {
  display: grid; grid-template-columns: 64px minmax(150px, 1.1fr) minmax(170px, 1.2fr) minmax(0, 1.8fr) minmax(120px, .9fr) 74px;
  gap: 12px; align-items: center; padding: 9px 16px;
}
.hbh-tcab { background: #f8fafd; border-bottom: 1px solid var(--border); font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--text-mute); }
.hbh-tcab .n, .hbh-r .n { text-align: end; }
.hbh-dia { display: flex; justify-content: space-between; gap: 10px; padding: 8px 16px; background: #f3f7fc; border-block: 1px solid var(--border); font-size: 11.5px; font-weight: 800; color: var(--nf-navy); }
.hbh-dia:first-child { border-top: none; }
.hbh-dia span { font-variant-numeric: tabular-nums; }
.hbh-r { border-bottom: 1px solid #f0f3f7; font-size: 13px; }
.hbh-r:hover { background: #fafcfe; }
.hbh-r .hora { font-weight: 700; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.hbh-r .quien, .hbh-r .donde { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.hbh-r .quien span, .hbh-r .donde span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hbh-r .que { min-width: 0; }
.hbh-r .que b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.hbh-r .que small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11.8px; color: var(--text-mute); }
.hbh-r .emp { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--text-soft); }
.hbh-r .n b { font-weight: 800; color: var(--nf-navy); font-variant-numeric: tabular-nums; }
.hbh-mas { display: flex; justify-content: center; padding: 12px; }
.hbh-mas:empty { display: none; }
.hbh-vacio { padding: 22px 16px; color: var(--text-mute); font-size: 13px; text-align: center; }
.hbh-nota { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 12px; color: var(--text-mute); }
.hbh-nota svg { width: 15px; height: 15px; flex: none; }
@media (max-width: 1180px) {
  .hbh-res { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hbh-res .hbh-tarjeta:last-child { grid-column: 1 / -1; }
  .hbh-tcab, .hbh-r { grid-template-columns: 60px minmax(130px, 1fr) minmax(150px, 1.1fr) minmax(0, 1.8fr) 74px; }
  .hbh-tcab .emp, .hbh-r .emp { display: none; }
}
@media (max-width: 760px) {
  .hbh-velo { padding: 0; }
  .hbh-card { height: 100vh; max-height: 100vh; border-radius: 0; }
  .hbh-head { padding: 14px 16px; }
  .hbh-head p { display: none; }
  .hbh-head h2 { font-size: 19px; }
  .hbh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .hbh-stats .hph-b { grid-column: 1 / -1; padding: 9px; }
  .hbh-stat { padding: 7px 10px; }
  .hbh-stat b { font-size: 16px; }
  .hbh-cuerpo { padding: 14px; }
  .hbh-res { grid-template-columns: minmax(0, 1fr); }
  .hbh-tcab { display: none; }
  .hbh-r { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "donde n" "que que" "quien hora"; gap: 4px 10px; padding: 10px 14px; }
  .hbh-r .hora { grid-area: hora; text-align: end; }
  .hbh-r .quien { grid-area: quien; font-size: 12px; }
  .hbh-r .donde { grid-area: donde; }
  .hbh-r .que { grid-area: que; }
  .hbh-r .n { grid-area: n; }
  .hbh-r .emp { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hbh-velo, .hbh-card { animation: none; } }

/* ── Barra de acciones del móvil (js/barra-movil.js, 24-oct-2026) ──────────────────────────────────────────────
   En el móvil, lo que el escritorio lleva en la cabecera (el menú de Conectores, el avatar con su desplegable) y el
   botón flotante del chat bajan a una barra fija abajo —Inicio · Herramientas · Chat · Conectores · Más—, de la misma
   familia que la de Mi Portal (styles/portal-barra.css). La lleva <html class="con-barra-app">.
   Capas: la barra va en 50, por encima de lo que se desplaza (las cabeceras pegadas de las tablas: 1-40) y por debajo
   de la cabecera (100) y de TODO lo que flota —desplegables, avisos, ventanas: de 60 en adelante—, que así la tapa en
   vez de quedar tapado por ella. El chat sigue en 1300, las hojas de Herramientas y Conectores van en 1310 y el menú
   «Más», que es el de la cabecera, en 1350 sobre su velo (1340).
   Lo que una página pega abajo y tiene que seguir a la vista (una barra de guardar, un carrito, una selección) sube
   con `var(--hp-barra-alto, 0px)`, que fuera de este modo no existe. */
.bm-barra, .bm-hoja-cont { display: none; }

@media (max-width: 720px) {
  html.con-barra-app { --hp-barra-alto: calc(62px + env(safe-area-inset-bottom, 0px)); }
  /* El chat (panel y aviso de mensaje nuevo) sube por encima de la barra, y el pie le deja su hueco (más arriba). */
  html.con-barra-app body { --hp-chat-abajo: calc(var(--hp-barra-alto) + 10px); }

  /* ── La barra ── */
  html.con-barra-app .bm-barra {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
    /* En un móvil ancho (los «pasaporte», un plegable abierto) las pestañas no se separan más de 560 px. */
    padding-block: 6px calc(6px + env(safe-area-inset-bottom, 0px));
    padding-inline: max(4px, calc((100% - 560px) / 2));
    background: rgba(255,255,255,.96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); box-shadow: 0 -8px 28px rgba(13,60,110,.10);
    transition: translate .25s ease, opacity .2s ease;
    /* Sin rellenar después: la animación dejaría puesto su transform y el «translate» de abajo no la apartaría. */
    animation: bm-sube .32s cubic-bezier(.2,.8,.25,1) backwards;
  }
  @keyframes bm-sube { from { transform: translateY(100%); } to { transform: none; } }
  /* Con una hoja o el menú abiertos, la barra sube por delante de ellos y de su velo: las hojas terminan encima de
     ella, así que volver a tocar la pestaña la cierra (y no lo que la hoja tuviera debajo: en «Más», cerrar sesión). */
  html.con-barra-app.bm-encima .bm-barra { z-index: 1355; }
  /* Con el teclado abierto (escribiendo en un campo), la barra se aparta. */
  html.con-barra-app.bm-tecleando .bm-barra { translate: 0 110%; opacity: 0; pointer-events: none; }
  .bm-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; min-height: 50px; margin: 0; padding: 0 2px; border: 0; border-radius: 12px; background: none;
    font: inherit; font-size: .62rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; color: #6b7785;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color .18s ease;
  }
  .bm-tab:hover { color: var(--nf-navy); }
  .bm-tab:focus-visible { outline: 2px solid var(--nf-navy); outline-offset: -2px; }
  .bm-ico {
    position: relative; display: grid; place-items: center; width: 30px; height: 28px; border-radius: 10px;
    transition: background .2s ease, transform .2s ease;
  }
  .bm-ico svg { width: 22px; height: 22px; }
  .bm-tab:active .bm-ico { transform: scale(.9); }
  .bm-tab.on { color: var(--nf-navy); }
  .bm-tab.on .bm-ico { background: #e4eefb; transform: translateY(-1px); }
  .bm-txt { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* El globo cuelga del icono: así va a su esquina con la etiqueta debajo o al lado. */
  .bm-badge {
    position: absolute; top: -5px; inset-inline-start: calc(100% - 12px); min-width: 17px; padding: 1px 5px;
    border-radius: 999px; background: #e0382f; color: #fff; font-size: .58rem; font-weight: 800; text-align: center;
    box-shadow: 0 0 0 2px #fff;
  }
  .bm-badge[hidden], .bm-salud[hidden] { display: none; }
  /* La base de datos sin conexión (el punto rojo del menú «Conectores» de la cabecera). */
  .bm-salud { position: absolute; top: 0; inset-inline-end: 0; width: 9px; height: 9px; border-radius: 50%; background: #e0382f; box-shadow: 0 0 0 2px #fff; }
  /* «Más» lleva la cara del usuario: su foto o sus iniciales. */
  .bm-cara {
    display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
    background: linear-gradient(135deg, var(--nf-navy) 0%, var(--nf-navy-light) 100%); color: #fff;
    font-size: 10px; font-weight: 800; letter-spacing: .2px;
  }
  .bm-cara img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .bm-tab[data-bm="mas"].on .bm-ico { background: none; }
  .bm-tab[data-bm="mas"].on .bm-cara { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--nf-navy); }

  /* ── El chat: sin botón flotante (está en la barra), su panel ocupa la pantalla entre arriba y la barra ── */
  html.con-barra-app #hpc-fab { display: none; }
  html.con-barra-app #hpc-panel {
    position: fixed; inset-inline: 0; margin-inline: auto; width: min(560px, calc(100% - 16px)); height: auto;
    top: calc(env(safe-area-inset-top, 0px) + 8px); bottom: calc(var(--hp-barra-alto) + 8px);
    transform-origin: 50% 100%;
  }
  html.con-barra-app #hpc-toast { bottom: 0; }
  /* Sus pestañas (Mensajes, Tareas, Soporte) a lo ancho si caben y, en un móvil estrecho, deslizándose. */
  html.con-barra-app #hpc-tabs { overflow-x: auto; scrollbar-width: none; }
  html.con-barra-app #hpc-tabs::-webkit-scrollbar { display: none; }
  html.con-barra-app .hpc-tab { flex: 1 0 auto; padding-inline: 10px; }

  /* ── «Más»: el menú de la cabecera, como hoja que sale de la barra ──
     La hamburguesa no se ve: la abre la pestaña «Más». La cabecera pierde su backdrop-filter (no se nota: su fondo
     es opaco), que haría de ella el bloque contenedor del panel fijo y lo dejaría colgando de arriba. Los
     Conectores tampoco van aquí: tienen su pestaña. */
  html.con-barra-app .header.has-burger { -webkit-backdrop-filter: none; backdrop-filter: none; }
  html.con-barra-app .header.has-burger .header-burger,
  html.con-barra-app .header.has-burger .header-nav .conn-menu { display: none; }
  html.con-barra-app .header.has-burger .header-nav {
    position: fixed; top: auto; bottom: var(--hp-barra-alto); inset-inline: 0; margin-inline: auto; width: min(600px, 100%);
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - var(--hp-barra-alto) - env(safe-area-inset-top, 0px) - 16px);
    padding-block: 8px 12px; padding-inline: 12px;
    border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -18px 48px rgba(4, 18, 42, .45);
    animation: bm-hoja-sube .3s cubic-bezier(.2,.8,.25,1) both;
  }
  html.con-barra-app .header.has-burger .header-nav::before {
    content: ''; order: 0; flex: none; align-self: center; width: 40px; height: 4px; margin-block: 0 10px;
    border-radius: 999px; background: rgba(255,255,255,.3);
  }
  @keyframes bm-hoja-sube { from { transform: translateY(calc(100% + var(--hp-barra-alto))); } to { transform: none; } }
  /* Las tareas (js/chat.js) se abren desde ese menú: encima de la barra, no colgando de la cabecera. */
  html.con-barra-app .hpt-panel {
    top: auto !important; bottom: calc(var(--hp-barra-alto) + 8px);
    inset-inline: 0; margin-inline: auto; width: min(560px, calc(100% - 16px));
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - var(--hp-barra-alto) - env(safe-area-inset-top, 0px) - 24px);
  }

  /* ── Las hojas de Herramientas y Conectores ── */
  html.con-barra-app .bm-hoja-cont {
    display: block; position: fixed; inset: 0; z-index: 1310; pointer-events: none;
    visibility: hidden; transition: visibility 0s linear .34s;
  }
  html.con-barra-app .bm-hoja-cont.open { pointer-events: auto; visibility: visible; transition-delay: 0s; }
  .bm-fondo { position: absolute; inset: 0; background: rgba(8,20,35,.45); opacity: 0; transition: opacity .25s ease; }
  .bm-hoja-cont.open .bm-fondo { opacity: 1; }
  .bm-hoja {
    position: absolute; bottom: var(--hp-barra-alto); inset-inline: 0; margin-inline: auto; width: min(600px, 100%);
    display: flex; flex-direction: column;
    /* En un móvil alto la hoja no se come la pantalla entera: hasta el 80 %; en uno bajo, todo lo que haya. */
    max-height: calc(100vh - 100px);
    max-height: min(80dvh, calc(100dvh - var(--hp-barra-alto) - env(safe-area-inset-top, 0px) - 16px));
    background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -18px 48px rgba(9,14,24,.3); outline: none;
    transform: translateY(calc(100% + var(--hp-barra-alto))); transition: transform .34s cubic-bezier(.2,.8,.25,1);
  }
  .bm-hoja-cont.open .bm-hoja { transform: none; }
  .bm-asa { flex: none; width: 40px; height: 4px; margin-block: 8px 2px; margin-inline: auto; border-radius: 999px; background: #d5dde8; }
  .bm-hoja-cab { flex: none; display: flex; align-items: center; gap: 10px; padding-block: 6px 8px; padding-inline: 18px 10px; }
  .bm-hoja-t { flex: 1; min-width: 0; margin: 0; font-size: 1.02rem; font-weight: 800; color: var(--nf-navy); }
  .bm-cerrar {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: #eef2f7; color: #4a5a70; font: inherit; font-size: .95rem; cursor: pointer;
  }
  .bm-buscar {
    flex: none; display: flex; align-items: center; gap: 8px; margin-block: 0 6px; margin-inline: 14px;
    padding-inline: 12px; border: 1px solid var(--border); border-radius: 12px; background: #f6f8fb; color: var(--text-mute);
  }
  .bm-buscar:focus-within { border-color: var(--nf-navy-light); background: #fff; }
  .bm-buscar svg { flex: none; width: 18px; height: 18px; }
  .bm-buscar input {
    flex: 1; min-width: 0; height: 42px; border: 0; background: none; outline: none;
    font: inherit; font-size: 16px; color: var(--text);
  }
  .bm-hoja-cuerpo {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding-block: 2px 16px; padding-inline: 14px;
  }
  .bm-sec {
    margin-block: 14px 8px; margin-inline: 2px; font-size: .64rem; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--text-mute);
  }
  .bm-sec:first-child { margin-block-start: 6px; }
  .bm-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
  .bm-app {
    display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
    padding-block: 10px 9px; padding-inline: 4px; border: 1px solid var(--border); border-radius: 14px; background: #fff;
    color: var(--text); font-size: .7rem; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none;
    -webkit-tap-highlight-color: transparent; transition: transform .15s ease, border-color .15s ease;
  }
  .bm-app:hover { color: var(--text); border-color: #c9d6e6; }
  .bm-app:active { transform: scale(.96); }
  .bm-app.on { border-color: var(--nf-navy); background: #f4f8ff; }
  .bm-app-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; overflow: hidden; font-size: 22px; }
  .bm-app-ico img { width: 40px; height: 40px; display: block; }
  .bm-app-n { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .bm-vacio { margin: 0; padding-block: 28px; padding-inline: 12px; text-align: center; font-size: .86rem; color: var(--text-mute); }
  /* Conectores: las tarjetas del menú de la cabecera (js/conn-menu.js), a dos columnas o a las que quepan. */
  .bm-hoja .conn-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding-block-start: 4px; }
  .bm-hoja a.conn-card { color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
  .bm-hoja a.conn-card:active { transform: scale(.98); }
  .bm-hub {
    display: flex; align-items: center; justify-content: center; gap: 6px; margin-block-start: 12px;
    padding-block: 12px; padding-inline: 14px; border-radius: 12px; background: var(--nf-navy); color: #fff;
    font-size: .86rem; font-weight: 800; text-decoration: none;
  }
  .bm-hub:hover { color: #fff; background: var(--nf-navy-light); }

  /* Un mapa (Leaflet) pone sus capas en 400 y sus controles en 1000: aislado, se queda debajo de la barra al
     desplazarse en vez de pintarse encima. */
  html.con-barra-app .leaflet-container { isolation: isolate; }
}

/* Un móvil de lado, o uno muy bajo: la barra se aplana (icono y texto en línea) y sube menos. */
@media (max-width: 720px) and (max-height: 500px) {
  html.con-barra-app { --hp-barra-alto: calc(46px + env(safe-area-inset-bottom, 0px)); }
  html.con-barra-app .bm-barra { padding-block: 3px calc(3px + env(safe-area-inset-bottom, 0px)); }
  .bm-tab { flex-direction: row; gap: 6px; min-height: 40px; font-size: .7rem; }
  .bm-ico { width: 26px; height: 26px; }
  .bm-ico svg { width: 20px; height: 20px; }
}
/* Los móviles más estrechos (un plegable cerrado, 344 px): las etiquetas un punto más pequeñas, para que
   «Herramientas» quepa entera. */
@media (max-width: 360px) and (min-height: 501px) {
  .bm-tab { padding: 0; font-size: .58rem; letter-spacing: -.02em; }
}
/* Los «pasaporte» y los plegables abiertos (de 480 a 720 px de ancho): las etiquetas caben más grandes. */
@media (min-width: 480px) and (max-width: 720px) and (min-height: 501px) {
  .bm-tab { font-size: .68rem; }
  .bm-apps { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html.con-barra-app .bm-barra, html.con-barra-app .header.has-burger .header-nav { animation: none; }
  .bm-barra, .bm-hoja, .bm-fondo, .bm-ico, .bm-app, .bm-tab { transition: none; }
}
