/* ══════════════════════════════════════════════════════════════════════════════
   nisto-hub.css — Hub de Actividades (Conversaciones · Procedimientos · Seguimientos)

   Componentes REUTILIZABLES por las tres sub-vistas (SDD "Hub Actividades" §2-§10):
     .hub / .hub-subnav            shell con sub-navegación de 220px (§2)
     .filter-toolbar (.ft-*)       una fila, sin wrap, controles de 34px (§3)
     .hub-kpis                     4 tarjetas (§5; solo Conversaciones)
     .data-table (.dt-*)           tabla densa con acento lateral de 3px (§4)
     .hub-pag (.pg-*)              paginación (§4)
     .dt-state / .skel             vacío · carga (nis-shimmer) · error (§9)
     .wide-panel (.wp-*)           detalle al 70% con velo (§6)
     .sug-bar / .composer          respuesta sugerida + composer (§6.2)
     .hub-m*                       mobile 390: segmented de iconos, tarjetas y detalle (§8)

   Tailwind está PRE-COMPILADO: las utilidades nuevas no existen, por eso el hub vive acá.
   Los 9 tokens nuevos del SDD §11 están en nisto-tokens.css; abajo, alias LOCALES del hub
   (colores del handoff que no tienen token de marca propio).
   OJO: --live (coral) = "En vivo"; --needshelp-accent (ámbar) = fila escalada.
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
  --hub-line: #F0F0EE;          /* separadores internos (cabecera de tabla, paneles) */
  --hub-row-line: #F4F4F2;      /* borde inferior de fila */
  --hub-crumb-chev: #D2D3D5;    /* chevron del breadcrumb / punto separador */
  --hub-chip-on-bg: #FFF1EC;    /* chip destacado activo */
  --hub-chip-on-bd: #F0C9B6;
  --hub-chip-on-fg: #8A3413;
  --hub-warm-bg: #FFFDFB;       /* razón de escalamiento / barra de sugerencia */
  --hub-warm-bd: #F0D7BF;
  --hub-err-tile: #FDECEA;      /* tile del estado de error */
  --hub-draft-bd: var(--border-default);   /* composer con borrador (#D9DADD) */
  --hub-veil: rgba(16,16,18,.28);
}

@keyframes nis-shimmer { from { background-position: -420px 0; } to { background-position: 420px 0; } }
@keyframes nis-spin { to { transform: rotate(360deg); } }
@keyframes hub-push-in { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ── Shell ─────────────────────────────────────────────────────────────────── */
.hub { display: flex; height: 100%; min-height: 0; background: var(--surface-page); }
.hub-subnav {
  width: var(--subnav-w); flex: none; box-sizing: border-box; background: var(--surface-card);
  border-right: 1px solid var(--border-subtle); padding: 18px 12px;
  display: flex; flex-direction: column; overflow-y: auto;
}
.hub-sn-eyebrow {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--text-faint); padding: 0 8px 12px;
}
.hub-sn-item {
  width: 100%; border: none; font: inherit; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  margin-bottom: 3px; font-size: 14px; font-weight: 500; background: transparent; color: var(--text-body);
}
.hub-sn-item:hover { background: var(--surface-subtle); }
.hub-sn-item.on {
  color: var(--text-strong); font-weight: 600; background: var(--neutral-100);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.hub-sn-item:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 1px; }
.hub-sn-ic { width: 17px; height: 17px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.hub-sn-ic svg { width: 17px; height: 17px; }
.hub-sn-l { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-sn-n { flex: none; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.hub-sn-item.on .hub-sn-n { color: var(--text-body); }
/* Línea discreta al pie de la sub-nav (Seguimientos): sin horario del workspace. */
.hub-biz-line { margin-top: auto; padding: 0 4px; font-size: 11px; color: var(--text-faint); line-height: 1.45; }

.hub-main { flex: 1; min-width: 0; overflow-y: auto; box-sizing: border-box; padding: 22px 26px 26px; }
.hub-crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-faint); margin-bottom: 14px; }
.hub-crumb svg { width: 13px; height: 13px; color: var(--hub-crumb-chev); }
.hub-crumb b { color: var(--text-body); font-weight: 600; }
.hub-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.hub-h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.9px; line-height: 1.1; color: var(--text-strong); }
.hub-sub { margin: 7px 0 0; font-size: 14px; color: var(--text-muted); line-height: 1.45; }
.hub-actions { display: flex; align-items: center; gap: 8px; flex: none; padding-top: 4px; }
.hub-btn {
  border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body);
  font: inherit; font-size: 13px; font-weight: 600; height: 36px; padding: 0 12px; border-radius: 9px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.hub-btn svg { width: 15px; height: 15px; }
.hub-btn:hover { background: var(--surface-subtle); }
.hub-btn-dark { border-color: var(--surface-dark); background: var(--surface-dark); color: var(--text-on-dark); }
.hub-btn-dark:hover { background: var(--surface-dark-raised); }

/* ── filter-toolbar (§3): UNA fila, sin wrap; todo mide 34px ──────────────── */
.filter-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; min-width: 0; flex-wrap: nowrap; }
.ft-chip {
  flex: none; white-space: nowrap; border: 1px solid var(--border-subtle); background: var(--surface-card);
  color: var(--text-body); font: inherit; font-size: 13px; font-weight: 600; height: 34px; padding: 0 12px;
  border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.ft-chip.on { background: var(--hub-chip-on-bg); border-color: var(--hub-chip-on-bd); color: var(--hub-chip-on-fg); }
.ft-chip .ft-n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ft-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ft-dot.help { background: var(--needshelp-accent); }
.ft-dot.live { background: var(--live); animation: nis-pulse 1.6s infinite; }
.ft-sep { width: 1px; height: 22px; background: var(--border-subtle); margin: 0 2px; flex: none; }
.ft-dd { position: relative; flex: none; }
.ft-btn {
  flex: none; white-space: nowrap; border: 1px solid var(--border-subtle); background: var(--surface-card);
  color: var(--text-body); font: inherit; font-size: 13px; font-weight: 500; height: 34px; padding: 0 11px;
  border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; max-width: 190px;
}
.ft-btn > svg:first-child, .ft-btn .ft-ic svg { width: 14px; height: 14px; flex: none; }
.ft-btn .ft-ic { display: inline-flex; flex: none; }
.ft-btn .ft-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ft-btn .ft-chev { width: 13px; height: 13px; color: var(--text-faint); flex: none; }
.ft-btn.on { border-color: var(--border-default); color: var(--text-strong); font-weight: 600; }
.ft-btn:hover, .ft-icon:hover { background: var(--surface-subtle); }
.ft-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 190px; max-height: 320px; overflow-y: auto;
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 12px;
  box-shadow: 0 18px 44px -20px rgba(16,16,18,.45); padding: 6px; animation: nis-rise .16s ease both;
}
.ft-pop.right { left: auto; right: 0; }
.ft-pop-h { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); padding: 7px 9px 6px; }
.ft-opt {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: none; background: transparent;
  border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-body); text-align: left; cursor: pointer;
  white-space: nowrap;
}
.ft-opt:hover { background: var(--neutral-100); }
.ft-opt.on { color: var(--text-strong); font-weight: 600; }
.ft-opt .ft-check { width: 14px; height: 14px; margin-left: auto; flex: none; }
.ft-opt .ft-box {
  width: 16px; height: 16px; border-radius: 5px; border: 1.6px solid var(--border-default); flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-on-dark);
}
.ft-opt .ft-box.on { background: var(--surface-dark); border-color: var(--surface-dark); }
.ft-opt .ft-box svg { width: 11px; height: 11px; }
.ft-opt[disabled] { opacity: .5; cursor: default; }
/* Periodo › «Personalizado»: Desde/Hasta dentro del mismo popover (o bajo los chips en mobile). */
.ft-pop.ft-pop-range { min-width: 280px; max-height: none; }
.ft-range { border-top: 1px solid var(--border-subtle); margin-top: 5px; padding: 10px 6px 4px; }
.hub-mchips .ft-range { flex: 1 1 100%; border-top: none; margin-top: 0; padding: 4px 0 0; }
.ft-range-row { display: flex; gap: 8px; }
.ft-range-f {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-faint);
}
.ft-range-f input {
  font-family: var(--font-body); font-size: 12.5px; color: var(--text-strong); background: var(--surface-card);
  border: 1px solid var(--border-default); border-radius: 8px; padding: 7px 8px; width: 100%; box-sizing: border-box; min-width: 0;
}
.ft-range-f input:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 1px; }
.ft-range-err { margin: 8px 2px 0; font-size: 12px; line-height: 1.4; color: var(--danger-fg); white-space: normal; }
.ft-range-apply {
  width: 100%; margin-top: 9px; border: none; border-radius: 8px; padding: 9px; cursor: pointer;
  background: var(--surface-dark); color: var(--text-on-dark); font: inherit; font-size: 12.5px; font-weight: 600;
}
.ft-range-apply:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 2px; }
.ft-search {
  flex: 1 1 auto; min-width: 132px; max-width: 232px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-subtle); background: var(--surface-card); height: 34px; padding: 0 11px;
  border-radius: 9px; box-sizing: border-box;
}
.ft-search svg { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.ft-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: inherit; font-size: 13px; color: var(--text-accent); }
.ft-icon {
  flex: none; border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  position: relative;
}
.ft-icon svg { width: 15px; height: 15px; }
.ft-icon .ft-badge {
  position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; border-radius: 8px; padding: 0 4px; box-sizing: border-box;
  background: var(--surface-dark); color: var(--text-on-dark); font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.ft-spacer { flex: 1 1 0; min-width: 0; }

/* ── KPIs (§5) ─────────────────────────────────────────────────────────────── */
.hub-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.hub-kpi { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 13px; padding: 14px 15px; min-width: 0; }
.hub-kpi-l { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-kpi-row { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; min-width: 0; }
.hub-kpi-v { font-size: 25px; font-weight: 700; letter-spacing: -0.7px; font-variant-numeric: tabular-nums; color: var(--text-strong); line-height: 1.15; }
.hub-kpi-v.live { color: var(--coral-700); }
.hub-kpi-v.help { color: var(--warning-fg); }
.hub-kpi-d { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-faint); white-space: nowrap; }
.hub-kpi-d.up { color: var(--success-fg); }
.hub-kpi-d.down { color: var(--danger-fg); }
.hub-kpi-d.help { color: var(--warning-fg); }
/* Contra qué compara el delta (title = rango exacto de la ventana previa). */
.hub-kpi-vs { margin-top: 3px; font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }

/* ── data-table (§4) ───────────────────────────────────────────────────────── */
.data-table { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 13px; overflow: hidden; }
.dt-head, .dt-row { display: grid; align-items: center; gap: 14px; }
.data-table.g12 .dt-head, .data-table.g12 .dt-row { gap: 12px; }
.dt-head {
  padding: 11px 16px 11px 19px; border-bottom: 1px solid var(--hub-line); background: var(--surface-subtle);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint);
}
.dt-head > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Columnas ajustables (nisto-colgrid.js): la manija de ancho vive en el gap, FUERA de la celda del
   encabezado → la celda no recorta; el rótulo (.nc-lbl) es quien trunca con elipsis. */
.dt-head > span.nc-hc { overflow: visible; }
.dt-head .nc-lbl { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-row {
  padding: 12px 16px; border-bottom: 1px solid var(--hub-row-line); cursor: pointer;
  border-left: var(--row-accent-w) solid transparent; min-height: 46px; box-sizing: border-box;
  transition: background var(--dur-fast) ease;
}
.dt-row:last-child { border-bottom: none; }
.dt-row:hover { background: var(--surface-subtle); }
.dt-row:focus-visible { outline: 2px solid var(--text-strong); outline-offset: -2px; }
.dt-row.sel { background: var(--surface-subtle); }
.dt-row.acc-live { border-left-color: var(--live); }
.dt-row.acc-help { border-left-color: var(--needshelp-accent); }
.dt-row.acc-err { border-left-color: var(--danger-fg); }
.dt-cell { min-width: 0; }
.dt-cell, .dt-main, .dt-sub, .dt-mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-main { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-accent); line-height: 1.25; }
.dt-main.m500 { font-size: 13px; font-weight: 500; }
.dt-sub { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 1px; line-height: 1.3; }
.dt-sub.sans { font-family: var(--font-body); font-size: 11.5px; }
.dt-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-body); font-variant-numeric: tabular-nums; }
.dt-mono.faint { color: var(--text-faint); }
.dt-ch { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; }
.dt-ch > span:last-child { font-size: 12.5px; color: var(--text-body); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-tile { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ch-tile svg { width: 12px; height: 12px; }
.ch-tile.lg { width: 26px; height: 26px; border-radius: 7px; }
.ch-tile.lg svg { width: 14px; height: 14px; }

/* Pill de estado (tabla, header del panel, tarjetas mobile) */
.st-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 9px;
  border-radius: 99px; white-space: nowrap; background: var(--neutral-100); color: var(--text-muted);
}
.st-pill.st-live { background: var(--coral-50); color: var(--coral-700); }
.st-pill.st-help { background: var(--warning-bg); color: var(--warning-fg); }
.st-pill.st-ok { background: var(--neutral-100); color: var(--text-body); }
.st-pill.st-good { background: var(--success-bg); color: var(--success-fg); }
.st-pill.st-fail { background: var(--danger-bg); color: var(--danger-fg); }
.st-pill.st-wait { background: var(--warning-bg); color: var(--warning-fg); }
.st-pill .st-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); flex: none; animation: nis-pulse 1.6s infinite; }

/* ── Paginación ────────────────────────────────────────────────────────────── */
.hub-pag { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-bottom: 4px; min-width: 0; }
.pg-pages { display: flex; align-items: center; gap: 3px; flex: none; }
.pg-btn {
  border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body);
  min-width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font: inherit; font-family: var(--font-mono);
  font-size: 12px; font-weight: 600; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
}
.pg-btn svg { width: 14px; height: 14px; }
.pg-btn.on { background: var(--surface-dark); border-color: var(--surface-dark); color: var(--text-on-dark); }
.pg-btn[disabled] { color: var(--text-faint); cursor: default; }
.pg-gap { color: var(--text-faint); padding: 0 4px; font-family: var(--font-mono); font-size: 12px; }
.pg-size { position: relative; flex: none; }
.pg-size > button {
  border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body); font: inherit;
  font-size: 12.5px; font-weight: 500; height: 30px; padding: 0 10px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.pg-size > button svg { width: 12px; height: 12px; color: var(--text-faint); }
.pg-size .ft-pop { top: auto; bottom: calc(100% + 6px); min-width: 130px; }
.pg-range { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.pg-upd { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.pg-upd svg { width: 13px; height: 13px; }

/* ── Estados vacío / carga / error (§9): mismo marco de tabla ─────────────── */
.dt-state { padding: 46px 24px; text-align: center; }
.dt-state-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-page); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; color: var(--text-faint); }
.dt-state-ic svg { width: 19px; height: 19px; }
.dt-state-ic.err { background: var(--hub-err-tile); color: var(--danger-fg); }
.dt-state-t { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; color: var(--text-strong); }
.dt-state-s { margin: 6px auto 14px; max-width: 280px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.dt-state-btns { display: inline-flex; gap: 8px; }
.dt-state-btn {
  border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body); font: inherit;
  font-size: 12.5px; font-weight: 600; height: 32px; padding: 0 13px; border-radius: 8px; cursor: pointer;
}
.dt-state-btn.dark { background: var(--surface-dark); border-color: var(--surface-dark); color: var(--text-on-dark); }
.dt-state-id { margin-top: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.dt-skel-row { display: grid; align-items: center; gap: 14px; padding: 16px 16px 16px 19px; border-bottom: 1px solid var(--hub-row-line); min-height: 46px; box-sizing: border-box; }
.skel {
  height: 10px; border-radius: 99px;
  background: linear-gradient(90deg, var(--neutral-100), var(--neutral-200) 40%, var(--neutral-100) 80%);
  background-size: 840px 100%; animation: nis-shimmer 1.3s linear infinite;
}
.dt-loading-foot { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; font-size: 12.5px; color: var(--text-faint); }
.hub-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--neutral-200); border-top-color: var(--text-muted); animation: nis-spin .8s linear infinite; flex: none; }
@media (prefers-reduced-motion: reduce) { .skel, .hub-spin { animation: none; } }

/* ── wide-panel (§6): 70% + velo ───────────────────────────────────────────── */
.wp-root { position: fixed; inset: 0; z-index: 60; }
.wp-veil { position: absolute; inset: 0; background: var(--hub-veil); animation: nis-fade .2s ease both; }
.wide-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel-wide-w); background: var(--surface-card);
  display: flex; flex-direction: column; box-shadow: -24px 0 70px -28px rgba(16,16,18,.42);
  animation: nis-slide .2s ease both; outline: none;
}
.wp-head { flex: none; padding: 18px 22px 14px; border-bottom: 1px solid var(--hub-line); }
.wp-head-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wp-title-wrap { flex: 0 1 auto; min-width: 0; }
.wp-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-strong); }
.wp-esc { display: inline-flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 12px; color: var(--hub-chip-on-fg); font-weight: 500; }
.wp-esc i, .wp-esc .wp-esc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: nis-pulse 1.6s infinite; flex: none; }
.wp-spacer { flex: 1; }
.wp-ibtn {
  flex: none; border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.wp-ibtn svg { width: 15px; height: 15px; }
.wp-ibtn:hover { background: var(--surface-subtle); }
.wp-ibtn[disabled] { opacity: .45; cursor: default; }
.wp-ibtn.strong { color: var(--text-strong); }
.wp-ibtn.done { background: var(--success-bg); border-color: var(--success-bg); color: var(--success-fg); }
.wp-ibtn:focus-visible, .wp-tbtn:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 1px; }
.wp-nav { flex: none; display: flex; gap: 2px; }
.wp-nav .wp-ibtn:first-child { border-radius: 8px 0 0 8px; }
.wp-nav .wp-ibtn:last-child { border-radius: 0 8px 8px 0; }
.wp-tbtn {
  flex: none; border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body); font: inherit;
  font-size: 12.5px; font-weight: 600; height: 32px; padding: 0 11px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.wp-tbtn svg { width: 14px; height: 14px; }
.wp-meta { display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: 12.5px; color: var(--text-muted); min-width: 0; }
.wp-meta > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-meta svg { width: 13px; height: 13px; color: var(--text-faint); flex: none; }
.wp-meta .wp-mono { font-family: var(--font-mono); }
.wp-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--hub-crumb-chev); flex: none; }
.wp-body { flex: 1; min-height: 0; display: flex; }
.wp-thread { flex: 1; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--hub-line); }
.wp-thread-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.wp-ctx { width: 312px; flex: none; overflow-y: auto; padding: 16px 18px; background: var(--surface-subtle); box-sizing: border-box; }
.wp-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.wp-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 13px; margin-top: 11px; }
.wp-card:first-of-type { margin-top: 0; }
.wp-card-l { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.wp-card p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-accent); white-space: pre-wrap; overflow-wrap: break-word; }
.wp-card p.muted { color: var(--text-faint); }
.wp-card.warm { background: var(--hub-warm-bg); border-color: var(--hub-warm-bd); }
.wp-card.warm .wp-card-l { color: var(--warning-fg); }
.wp-contact { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wp-av { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-dark); color: var(--text-on-dark); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; flex: none; }
.wp-contact-n { font-size: 14px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-contact-p { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-foot { flex: none; border-top: 1px solid var(--hub-line); padding: 12px 20px 16px; background: var(--surface-subtle); }
.wp-note { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }
.wp-note svg { width: 12px; height: 12px; flex: none; }
.wp-resolved { display: flex; align-items: center; gap: 9px; background: var(--success-bg); border-radius: 11px; padding: 9px 12px; font-size: 12.5px; font-weight: 600; color: var(--success-fg); margin-bottom: 10px; }
.wp-resolved svg { width: 15px; height: 15px; }
.wp-loading { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-faint); font-size: 13px; }
.wp-jump {
  position: sticky; bottom: 0; align-self: flex-end; width: 36px; height: 36px; border-radius: 50%; flex: none;
  border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body); cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(16,16,18,.28); display: flex; align-items: center; justify-content: center; margin-top: -36px;
}
.wp-jump svg { width: 16px; height: 16px; }

/* Respuesta sugerida (§6.2): barra colapsable → "Usar" */
.sug-bar { border: 1px solid var(--hub-chip-on-bd); background: var(--hub-warm-bg); border-radius: 11px; margin-bottom: 10px; overflow: hidden; }
.sug-head { width: 100%; display: flex; align-items: center; gap: 9px; border: none; background: transparent; font: inherit; text-align: left; cursor: pointer; padding: 9px 12px; }
.sug-tile { width: 21px; height: 21px; border-radius: 6px; flex: none; background: var(--live); color: var(--text-on-dark); display: inline-flex; align-items: center; justify-content: center; }
.sug-tile svg { width: 12px; height: 12px; }
.sug-l { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--warning-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-chev { flex: none; display: inline-flex; color: var(--warning-fg); transition: transform .16s ease; }
.sug-chev svg { width: 15px; height: 15px; }
.sug-bar.open .sug-chev { transform: rotate(180deg); }
.sug-body { padding: 0 12px 12px; animation: nis-rise .16s ease both; }
.sug-body p { margin: 0 0 10px; font-size: 13px; line-height: 1.55; color: var(--text-accent); white-space: pre-wrap; overflow-wrap: break-word; }
.sug-use { border: none; background: var(--surface-dark); color: var(--text-on-dark); font: inherit; font-size: 12.5px; font-weight: 600; height: 32px; padding: 0 14px; border-radius: 8px; cursor: pointer; }
.composer { display: flex; align-items: flex-end; gap: 9px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 9px 11px; }
.composer.has { border-color: var(--hub-draft-bd); }
.composer textarea { flex: 1; min-width: 0; border: none; outline: none; resize: none; background: transparent; font: inherit; font-size: 13.5px; line-height: 1.5; color: var(--text-accent); padding: 0; overflow-y: hidden; }
.composer-send { flex: none; border: none; background: var(--surface-dark); color: var(--text-on-dark); width: 32px; height: 32px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.composer-send svg { width: 15px; height: 15px; }
.composer-send[disabled] { opacity: .5; cursor: default; }

/* Tabs Conversación / Contexto y CTA: SOLO mobile (en escritorio caben las dos columnas) */
.wp-mtabs, .wp-back, .wp-cta, .wp-mbug { display: none; }

/* ── Mobile 390 (§8) ───────────────────────────────────────────────────────── */
.hub-mhead { background: var(--surface-card); border-bottom: 1px solid var(--border-subtle); padding: 14px 16px 0; }
.hub-mtitle { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-strong); }
.hub-msub { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; line-height: 1.4; }
.hub-mseg { display: flex; gap: 3px; background: var(--neutral-100); border-radius: 10px; padding: 3px; margin: 12px 0; }
.hub-mseg button { flex: 1; height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.hub-mseg button svg { width: 18px; height: 18px; }
.hub-mseg button.on { background: var(--surface-card); color: var(--text-strong); box-shadow: 0 1px 3px rgba(16,16,18,.12); }
.hub-mrow { display: flex; gap: 8px; padding-bottom: 12px; }
.hub-mrow .ft-search { max-width: none; flex: 1; }
.hub-mfbtn { flex: none; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-subtle); background: var(--surface-card); border-radius: 9px; height: 34px; padding: 0 11px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-body); cursor: pointer; }
.hub-mfbtn svg { width: 14px; height: 14px; }
.hub-mfbtn .ft-n { font-family: var(--font-mono); color: var(--warning-fg); }
.hub-mchips { display: flex; gap: 7px; padding: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
.hub-mchips::-webkit-scrollbar { display: none; }
.hub-mlist { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.hub-mcard {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer; box-sizing: border-box;
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-left: 3px solid transparent;
  border-radius: 12px; padding: 12px 13px; color: var(--text-accent);
}
.hub-mcard.acc-live { border-left-color: var(--live); }
.hub-mcard.acc-help { border-left-color: var(--needshelp-accent); }
.hub-mcard.acc-err { border-left-color: var(--danger-fg); }
.hub-mcard-top { display: flex; align-items: center; gap: 9px; }
.hub-mcard-t { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-mcard .st-pill { font-size: 11.5px; padding: 3px 8px; }
.hub-mcard-mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-mcard-b { font-size: 13px; color: var(--text-body); margin-top: 7px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-mcard-f { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--hub-row-line); font-size: 11.5px; color: var(--text-faint); }
.hub-mcard-f .wp-mono { font-family: var(--font-mono); }
.hub-mmore { display: block; margin: 0 12px 16px; width: calc(100% - 24px); height: 44px; border: 1px solid var(--border-subtle); background: var(--surface-card); border-radius: 11px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-body); cursor: pointer; }

@media (max-width: 768px) {
  .hub { display: block; height: auto; }
  .hub-subnav { display: none; }
  .hub-main { padding: 0; overflow: visible; }
  .hub-m-hide { display: none !important; }
  .hub-mcard { min-height: 44px; }

  /* Detalle a pantalla completa: el header hace de barra de navegación */
  .wp-veil { display: none; }
  .wide-panel { width: 100%; left: 0; background: var(--surface-page); animation: hub-push-in .24s cubic-bezier(.22,.61,.36,1) both; }
  .wp-head { background: var(--surface-card); padding: 12px 14px; border-bottom-color: var(--border-subtle); }
  .wp-back { display: inline-flex; border-radius: 9px; }
  .wp-mbug { display: inline-flex; color: var(--live); border-radius: 9px; }
  .wp-head .wp-ibtn { width: 40px; height: 40px; border-radius: 9px; }
  .wp-desk-only { display: none !important; }
  .wp-mav { display: inline-flex !important; width: 32px; height: 32px; font-size: 12px; }
  .wp-title { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
  .wp-esc { font-size: 11.5px; }
  .wp-meta { display: none; }
  .wp-mtabs { display: flex; gap: 4px; margin-top: 13px; background: var(--neutral-100); border-radius: 11px; padding: 4px; }
  .wp-mtabs button { flex: 1; border: none; font: inherit; padding: 8px; min-height: 36px; border-radius: 8px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; background: transparent; color: var(--text-muted); }
  .wp-mtabs button svg { width: 15px; height: 15px; }
  .wp-mtabs button.on { background: var(--surface-card); color: var(--text-strong); box-shadow: 0 1px 3px rgba(16,16,18,.14); }
  .wp-body { display: block; flex: 1; min-height: 0; overflow: hidden; position: relative; }
  .wp-thread { border-right: none; height: 100%; }
  .wp-thread-scroll { padding: 14px; }
  .wp-ctx { width: auto; height: 100%; padding: 14px; }
  .wide-panel[data-mtab="conversacion"] .wp-ctx { display: none; }
  .wide-panel[data-mtab="contexto"] .wp-thread { display: none; }
  .wide-panel[data-mtab="contexto"] .wp-foot { display: none; }
  .wp-foot { background: var(--surface-card); padding: 10px 14px 14px; }
  .composer textarea { font-size: 13px; }
  .composer-send { width: 36px; height: 36px; }
  .wp-cta { display: block; flex: none; background: var(--surface-card); border-top: 1px solid var(--hub-line); padding: 10px 14px 14px; }
  .wide-panel[data-mtab="conversacion"] .wp-cta { display: none; }
  .wp-cta button { width: 100%; height: 46px; border: none; font: inherit; border-radius: 12px; background: var(--surface-dark); color: var(--text-on-dark); display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 14px; font-weight: 600; cursor: pointer; }
  .wp-cta button svg { width: 16px; height: 16px; }
  .sug-head { min-height: 40px; }
  .sug-use { height: 40px; }
}
.wp-mav { display: none !important; }
@media (max-width: 768px) { .wp-mav { display: inline-flex !important; } }

/* ── Hilo de chat compartido (partials/_chat_thread.html · SDD §7) ─────────────
   Lo usan Actividades, Calidad, Bugs y Oportunidades: lead a la izquierda en blanco;
   agente, operador y sistema a la derecha sobre --neutral-100. */
.thr-row { display: flex; gap: 8px; align-items: flex-start; animation: nis-rise .2s ease both; }
.thr-out { justify-content: flex-end; }
.thr-col { max-width: 80%; min-width: 0; }
.thr-col-out { max-width: 82%; display: flex; flex-direction: column; align-items: stretch; }
.thr-av { width: 26px; height: 26px; border-radius: 50%; flex: none; margin-top: 2px; display: flex; align-items: center; justify-content: center; }
.thr-av-lead { background: var(--neutral-100); border: 1px solid var(--border-subtle); color: var(--text-muted); box-sizing: border-box; }
.thr-av-op { background: var(--surface-dark); color: var(--text-on-dark); font-size: 10px; font-weight: 600; }
.thr-av-blob { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.thr-ch { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.thr-col-out .thr-ch { justify-content: flex-end; }
.thr-ch-tile { width: 15px; height: 15px; border-radius: 4px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.thr-ch-tile svg { width: 9px; height: 9px; }
.thr-ch > span:last-child { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-faint); }
.thr-bub { padding: 10px 13px; font-size: 13.5px; line-height: 1.5; color: var(--text-accent); overflow-wrap: break-word; word-break: break-word; }
.thr-bub.txt { white-space: pre-wrap; }
.thr-bub-in { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 14px 14px 14px 4px; box-shadow: 0 1px 2px rgba(16,16,18,.05); }
.thr-bub-out { background: var(--neutral-100); border-radius: 14px 14px 4px 14px; }
.thr-bub-result { background: var(--success-bg); color: var(--success-fg); }
.thr-bub > div { white-space: pre-wrap; }
.thr-foot { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-top: 4px; }
.thr-foot-out { text-align: right; }
@media (max-width: 768px) {
  .thr-av, .thr-av-blob { width: 22px; height: 22px; }
  .thr-av-op { font-size: 9px; }
  .thr-bub { font-size: 13px; padding: 9px 12px; }
  .thr-foot { font-size: 9.5px; }
}
