/* S090-077c — Hub del cliente (Mis clientes → nombre): marco + Ficha + Chat.
   Contrato para las secciones (D Agenda, E Nutrición/Documentos, F Progreso):
   - Contenedor de contenido: cada `.mc-hub-pane` ya vive dentro de `.mc-hub-main`
     (scroll propio) con padding `var(--mc-hub-pad-y) var(--mc-hub-pad-x)`.
   - Ancho: `.mc-hub-pane` ocupa todo el ancho; para texto/formularios usar
     `.mc-hub-content` (max-width: var(--mc-hub-content-max), centrado).
   - Cabecera de sección: `.mc-hub-section-head` > `.mc-hub-section-title`
     (+ `.mc-hub-section-sub`) y `.mc-hub-section-actions` a la derecha.
   - Estados: `.mc-hub-skel` (+ --line / --title / --pill / --bubble),
     `.mc-hub-skel-block`, `.mc-hub-state` (.is-empty / .is-error).
   - Paneles: `.mc-hub-panel` (hairline + radius, sin sombra). */

#mc-client-hub-dialog {
  --mc-hub-pad-x: 24px;
  --mc-hub-pad-y: 20px;
  --mc-hub-content-max: 1120px;
  --mc-hub-nav-w: 212px;
  --mc-hub-gap: 16px;
  --mc-hub-radius: var(--radius-lg, 16px);
  --mc-hub-ease: var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  /* html usa `zoom` (densidad): vw/dvh no lo respetan; se dimensiona por inset. */
  --modal-w: 1480px;
  --modal-max-h: none;
  inset: 16px;
  margin: auto;
  width: auto;
  max-width: 1480px;
  min-width: 0;
  height: auto;
  max-height: none;
  border-radius: var(--mc-hub-radius);
  background: var(--sys-surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--elev-2), 0 32px 72px -28px rgba(0, 0, 0, 0.45);
  transition:
    opacity var(--dur-base, 240ms) var(--mc-hub-ease),
    transform var(--dur-base, 240ms) var(--mc-hub-ease),
    overlay var(--dur-fast, 160ms) allow-discrete,
    display var(--dur-fast, 160ms) allow-discrete;
}
#mc-client-hub-dialog::before {
  display: none;
}
@starting-style {
  #mc-client-hub-dialog[open] {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

/* ——— Cabecera ——— */
#mc-client-hub-dialog .mc-hub-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px 20px;
  padding: 18px var(--mc-hub-pad-x) 16px;
  background: var(--sys-surface);
  border-bottom: 1px solid var(--hairline);
}
#mc-client-hub-dialog .mc-hub-identity {
  align-items: flex-start;
  gap: 14px;
}
#mc-client-hub-dialog .mc-hub-identity .avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: color-mix(in srgb, var(--tenant-primary) 14%, var(--sys-surface));
  color: var(--tenant-primary);
  border: 1px solid color-mix(in srgb, var(--tenant-primary) 22%, transparent);
}
#mc-client-hub-dialog .mc-hub-identity-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.mc-hub-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#mc-client-hub-dialog .mc-hub-identity-text h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.2;
}
#mc-client-hub-dialog .mc-hub-identity-text > .hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.mc-hub-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--text);
  background: color-mix(in srgb, var(--sys-surface-2) 70%, transparent);
  border: 1px solid var(--hairline);
}
.mc-hub-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
}
.mc-hub-status.is-active::before { background: var(--sys-ok); }
.mc-hub-status.is-inactive::before,
.mc-hub-status.is-archived::before { background: var(--sys-warn); }
.mc-hub-status.is-deleted::before { background: var(--sys-err); }
.mc-hub-status[hidden] { display: none; }

.mc-hub-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-height: 26px;
}
.mc-hub-fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  max-width: 280px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--sys-surface-2) 60%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
}
.mc-hub-fact > span:not(.mc-hub-tag) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-hub-fact .nav-ico {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--muted);
}
.mc-hub-fact-sub {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.mc-hub-fact.is-muted { color: var(--muted); }
.mc-hub-fact.is-plan.is-active .nav-ico { color: var(--sys-ok); }
.mc-hub-fact.is-plan.is-soon .nav-ico { color: var(--sys-warn); }
.mc-hub-fact.is-plan.is-expired .nav-ico { color: var(--sys-err); }
.mc-hub-fact.is-btn {
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.mc-hub-fact.is-btn:hover {
  background: color-mix(in srgb, var(--tenant-primary) 7%, var(--sys-surface));
  border-color: color-mix(in srgb, var(--tenant-primary) 26%, var(--hairline));
}
.mc-hub-fact.is-btn:focus-visible {
  outline: 2px solid var(--tenant-primary);
  outline-offset: 2px;
}
.mc-hub-fact.is-tags {
  gap: 4px;
  padding-inline: 4px 8px;
}
.mc-hub-fact.is-tags.is-muted { padding-inline: 10px; }
.mc-hub-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--mc-tag, var(--tenant-primary)) 14%, transparent);
}
.mc-hub-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--mc-tag, var(--tenant-primary));
}

#mc-client-hub-dialog .mc-hub-header-actions {
  gap: 8px;
  align-self: start;
}
.mc-hub-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.mc-hub-act .nav-ico,
.mc-hub-close-x .nav-ico {
  width: 16px;
  height: 16px;
}
#mc-client-hub-dialog .mc-hub-more-btn,
#mc-client-hub-dialog .mc-hub-close-x {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}
#mc-client-hub-dialog .mc-hub-act:active,
#mc-client-hub-dialog .mc-hub-more-btn:active,
#mc-client-hub-dialog .mc-hub-close-x:active {
  transform: scale(0.97);
}
.mc-hub-more-wrap { position: relative; }
.mc-hub-menu,
.mc-hub-tagpop {
  position: absolute;
  z-index: 40;
  display: grid;
  padding: 6px;
  background: var(--sys-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius, 12px);
  box-shadow: var(--elev-2);
  transform-origin: top right;
  transition: opacity var(--dur-fast) var(--mc-hub-ease), transform var(--dur-fast) var(--mc-hub-ease);
}
@starting-style {
  .mc-hub-menu:not([hidden]),
  .mc-hub-tagpop:not([hidden]) {
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
  }
}
.mc-hub-menu[hidden],
.mc-hub-tagpop[hidden] { display: none; }
.mc-hub-menu {
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
}
.mc-hub-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
}
.mc-hub-menu button .nav-ico {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.mc-hub-menu button:hover,
.mc-hub-menu button:focus-visible {
  background: color-mix(in srgb, var(--sys-surface-2) 90%, transparent);
  outline: none;
}
.mc-hub-menu button.is-danger,
.mc-hub-menu button.is-danger .nav-ico { color: var(--sys-err); }
.mc-hub-menu-sep {
  height: 1px;
  margin: 4px 2px;
  border: 0;
  background: var(--hairline);
}
.mc-hub-tagpop {
  top: calc(100% - 8px);
  right: var(--mc-hub-pad-x);
  width: min(320px, calc(100vw - 32px));
  max-height: min(420px, 60dvh);
  overflow: auto;
  gap: 6px;
  padding: 12px;
}
.mc-hub-tagpop-title {
  margin: 0 0 2px;
  font-size: 0.84rem;
  font-weight: 650;
}
.mc-hub-tagpop-list {
  display: grid;
  gap: 2px;
}
.mc-hub-tagpop-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 6px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
}
.mc-hub-tagpop-opt:hover { background: color-mix(in srgb, var(--sys-surface-2) 90%, transparent); }
.mc-hub-tagpop-opt input { accent-color: var(--tenant-primary); width: 16px; height: 16px; }
.mc-hub-tagpop-hint { margin: 4px 0 0; font-size: 0.74rem; }

/* ——— Navegación ——— */
#mc-client-hub-dialog .mc-hub-shell {
  grid-template-columns: var(--mc-hub-nav-w) minmax(0, 1fr);
}
#mc-client-hub-dialog .mc-hub-tabs {
  gap: 2px;
  padding: 14px 10px;
  background: color-mix(in srgb, var(--sys-surface-2) 55%, var(--sys-surface));
  border-right: 1px solid var(--hairline);
}
#mc-client-hub-dialog .mc-hub-tab {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  color: var(--muted);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
#mc-client-hub-dialog .mc-hub-tab-sub { display: none; }
#mc-client-hub-dialog .mc-hub-tab-label {
  font-size: 0.875rem;
  font-weight: 550;
}
.mc-hub-tab-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
#mc-client-hub-dialog .mc-hub-tab:hover {
  background: color-mix(in srgb, var(--sys-text) 5%, transparent);
  color: var(--text);
}
#mc-client-hub-dialog .mc-hub-tab.is-active {
  background: color-mix(in srgb, var(--tenant-primary) 10%, var(--sys-surface));
  color: var(--text);
  border: 0;
}
#mc-client-hub-dialog .mc-hub-tab.is-active .mc-hub-tab-label { font-weight: 650; }
#mc-client-hub-dialog .mc-hub-tab.is-active .mc-hub-tab-ico { color: var(--tenant-primary); }
#mc-client-hub-dialog .mc-hub-tab:focus-visible {
  outline: 2px solid var(--tenant-primary);
  outline-offset: -2px;
}

/* ——— Contenedor de contenido ——— */
#mc-client-hub-dialog .mc-hub-main {
  padding: var(--mc-hub-pad-y) var(--mc-hub-pad-x) calc(var(--mc-hub-pad-y) + 8px);
  background: var(--sys-surface);
  scroll-padding-top: 16px;
}
#mc-client-hub-dialog .mc-hub-pane.is-active {
  animation: mc-hub-pane-in var(--dur-fast, 160ms) var(--mc-hub-ease);
}
@keyframes mc-hub-pane-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.mc-hub-content {
  width: 100%;
  max-width: var(--mc-hub-content-max);
  margin-inline: auto;
}
.mc-hub-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.mc-hub-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}
.mc-hub-section-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.mc-hub-section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mc-hub-panel {
  border: 1px solid var(--hairline);
  border-radius: var(--radius, 12px);
  background: var(--sys-surface);
  padding: 16px;
}

/* Skeleton / estados */
.mc-hub-skel {
  display: block;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--sys-text) 6%, transparent) 0%,
    color-mix(in srgb, var(--sys-text) 11%, transparent) 40%,
    color-mix(in srgb, var(--sys-text) 6%, transparent) 80%
  );
  background-size: 240% 100%;
  animation: mc-hub-shimmer 1.3s linear infinite;
}
.mc-hub-skel--title { width: 180px; height: 16px; margin-bottom: 14px; }
.mc-hub-skel--line { width: 100%; height: 12px; margin: 10px 0; }
.mc-hub-skel--line.is-short { width: 58%; }
.mc-hub-skel--pill { display: inline-block; width: 96px; height: 24px; border-radius: 999px; }
.mc-hub-skel--bubble { width: min(52%, 320px); height: 38px; border-radius: 14px; margin: 8px 0; }
.mc-hub-skel--bubble.is-mine { margin-left: auto; width: min(40%, 260px); }
.mc-hub-skel--bubble.is-short { width: min(30%, 180px); }
.mc-hub-skel-block { max-width: 720px; padding: 4px 0; }
@keyframes mc-hub-shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}
.mc-hub-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 20px;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius, 12px);
  color: var(--muted);
  list-style: none;
}
.mc-hub-state p { margin: 0; }
.mc-hub-state.is-error { border-style: solid; border-color: color-mix(in srgb, var(--sys-err) 35%, var(--hairline)); color: var(--text); }

/* ——— Ficha ——— */
#mc-client-hub-dialog .cf-head {
  align-items: flex-end;
  margin-bottom: 20px;
  gap: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
#mc-client-hub-dialog .cf-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 0;
  gap: 2px;
  min-width: 0;
}
#mc-client-hub-dialog .cf-tabs::-webkit-scrollbar { display: none; }
#mc-client-hub-dialog .cf-tab {
  white-space: nowrap;
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 550;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
#mc-client-hub-dialog .cf-tab:hover { color: var(--text); }
#mc-client-hub-dialog .cf-tab.is-active {
  color: var(--text);
  font-weight: 650;
  border-bottom-color: var(--tenant-primary);
}
#mc-client-hub-dialog .cf-tab:focus-visible {
  outline: 2px solid var(--tenant-primary);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}
.cf-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}
#mc-client-hub-dialog .cf-head-actions .cf-obs-btn.hidden { display: none; }
#mc-client-hub-dialog .cf-edit-fab {
  position: static;
  float: none;
  margin: 0;
  padding: 0 12px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  box-shadow: none;
  gap: 6px;
}
#mc-client-hub-dialog .cf-edit-fab:hover {
  filter: none;
  background: color-mix(in srgb, var(--sys-text) 5%, transparent);
}
#mc-client-hub-dialog .cf-edit-fab:active { transform: scale(0.97); }

/* ——— Ficha › General (S090-090a): perfil de cliente tipo CRM ———
   Sin repetir la identidad de la cabecera. Propiedades editables en línea (Attio),
   actividad de entreno 7/30 días + racha (Everfit/TrueCoach), rail sin tarjetas
   separado por hairline (Linear). Layout por container query del panel. */
#mc-client-hub-dialog .cf-pane { container: cfpane / inline-size; }
#mc-client-hub-dialog .cfg {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  max-width: var(--mc-hub-content-max, 1120px);
}
.cfg-main { container: cfmain / inline-size; display: grid; gap: 26px; min-width: 0; align-content: start; }
.cfg-rail { display: grid; min-width: 0; align-content: start; }
@container cfpane (min-width: 700px) {
  #mc-client-hub-dialog .cfg {
    grid-template-columns: minmax(0, 760px) 250px;
    justify-content: space-between;
    gap: 0 32px;
    align-items: start;
  }
  .cfg-rail { position: sticky; top: 0; padding-left: 24px; border-left: 1px solid var(--hairline); }
}
@container cfpane (min-width: 1000px) {
  #mc-client-hub-dialog .cfg { grid-template-columns: minmax(0, 760px) 290px; gap: 0 48px; }
}
@container cfpane (max-width: 699px) {
  .cfg-rail { border-top: 1px solid var(--hairline); }
  .cfg-rail-sec:first-child { padding-top: 16px; }
}

.cfg-main > section,
.cfg-rail-sec { animation: cfg-in 220ms var(--mc-hub-ease, ease-out) both; }
.cfg-main > section:nth-child(2) { animation-delay: 30ms; }
.cfg-main > section:nth-child(3) { animation-delay: 60ms; }
.cfg-main > section:nth-child(n + 4) { animation-delay: 90ms; }
.cfg-rail-sec:nth-child(n + 2) { animation-delay: 60ms; }
@keyframes cfg-in { from { opacity: 0; transform: translateY(4px); } }

.cfg-h {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
}

/* Actividad */
.cfg-pulse { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 8px 0 0; }
@container cfmain (min-width: 500px) {
  .cfg-pulse { grid-template-columns: repeat(4, max-content); justify-content: start; gap: 0 40px; }
}
.cfg-pulse-i { min-width: 0; }
.cfg-pulse-i dt { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.cfg-pulse-i dd { margin: 3px 0 0; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.cfg-pulse-i b {
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.cfg-pulse-i dd span { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cfg-pulse.is-loading .cfg-pulse-i { width: 104px; }
.cfg-pulse-err { margin: 6px 0 0; font-size: 0.8125rem; color: var(--muted); }

/* Propiedades */
.cfg-props { margin: 0; display: grid; }
.cfg-prop {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 40px;
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 75%, transparent);
}
.cfg-prop:last-child { border-bottom: 0; }
.cfg-prop dt { font-size: 0.8125rem; color: var(--muted); line-height: 1.3; }
.cfg-prop dd { margin: 0; min-width: 0; }
.cfg-val {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% + 8px);
  min-height: 32px;
  margin: 0 0 0 -8px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.cfg-val span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cfg-val .nav-ico { width: 14px; height: 14px; flex: 0 0 14px; color: var(--muted); opacity: 0; transition: opacity 120ms ease; }
.cfg-val:hover { background: color-mix(in srgb, var(--sys-text, currentColor) 5%, transparent); }
.cfg-val:hover .nav-ico,
.cfg-val:focus-visible .nav-ico { opacity: 1; }
.cfg-val:focus-visible { outline: 2px solid var(--tenant-primary); outline-offset: -2px; }
.cfg-val:active { background: color-mix(in srgb, var(--sys-text, currentColor) 8%, transparent); }
.cfg-prop.is-empty .cfg-val span { color: var(--muted); }
.cfg-static { display: block; padding: 5px 0; font-size: 0.875rem; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cfg-prop.is-static.is-empty .cfg-static { color: var(--muted); }
.cfg-prop.is-saving { opacity: 0.55; pointer-events: none; }
.cfg-prop.is-saved .cfg-val { animation: cfg-saved 1s ease-out; }
@keyframes cfg-saved { from { background: color-mix(in srgb, var(--sys-ok) 18%, transparent); } }
@media (hover: none) {
  .cfg-val .nav-ico { opacity: 0.55; }
}

/* Edición en línea */
.cfg-edit { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.cfg-input {
  flex: 1 1 160px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--tenant-primary) 55%, var(--hairline));
  border-radius: 8px;
  background: var(--sys-surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-primary) 14%, transparent);
}
.cfg-input:focus { outline: none; }
textarea.cfg-input { flex-basis: 100%; height: auto; min-height: 64px; padding: 8px 10px; line-height: 1.45; resize: vertical; }
.cfg-unit { font-size: 0.8125rem; color: var(--muted); }
.cfg-edit .sm { min-height: 34px; }

/* Objetivo: una sola fila ancha, sin tarjeta */
.cfg-prop.is-goal { grid-template-columns: minmax(0, 1fr); border-bottom: 0; min-height: 0; }
.cfg-prop.is-goal .cfg-val { align-items: flex-start; font-size: 0.95rem; line-height: 1.5; padding-block: 6px; }
.cfg-prop.is-goal .cfg-val .nav-ico { margin-top: 4px; }
.cfg-prop.is-goal .cfg-edit { justify-content: flex-end; }
.cfg-prop.is-goal.is-empty .cfg-val span { font-size: 0.875rem; }

/* Rail */
.cfg-rail-sec { padding: 16px 0; border-bottom: 1px solid var(--hairline); min-width: 0; }
.cfg-rail-sec:first-child { padding-top: 0; }
.cfg-rail-sec:last-child { border-bottom: 0; }
.cfg-rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 8px; }
.cfg-rail-head .cfg-h { margin: 0; }
.cfg-link {
  appearance: none;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 6px;
  margin-right: -6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--tenant-primary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.cfg-link:hover { background: color-mix(in srgb, var(--tenant-primary) 10%, transparent); }
.cfg-link:focus-visible { outline: 2px solid var(--tenant-primary); outline-offset: 1px; }
.cfg-team { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cfg-team li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cfg-team-av {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--tenant-primary);
  background: color-mix(in srgb, var(--tenant-primary) 12%, var(--sys-surface));
}
.cfg-team li.is-empty .cfg-team-av { background: transparent; border: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent); }
.cfg-team-txt { display: grid; min-width: 0; line-height: 1.3; }
.cfg-team-txt b { font-size: 0.84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-team li.is-empty .cfg-team-txt b { font-weight: 500; color: var(--muted); }
.cfg-team-txt i { font-style: normal; font-size: 0.72rem; color: var(--muted); }
.cfg-plan-name { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.9rem; }
.cfg-plan-name b { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.cfg-fine { margin: 3px 0 0; font-size: 0.75rem; line-height: 1.4; color: var(--muted); }
.cfg-mini { margin: 12px 0 0; display: grid; gap: 6px; }
.cfg-mini div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.8rem; min-width: 0; }
.cfg-mini dt { flex: 0 0 auto; color: var(--muted); }
.cfg-mini dd { margin: 0; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; }
.cfg-mini .cfg-link { min-height: 22px; padding: 0 4px; margin: 0 -4px 0 2px; }
#cf-chat-usage { color: var(--muted); }
.cfg-rail .cf-pills { display: flex; flex-wrap: wrap; gap: 6px; }
#mc-client-hub-dialog .cf-pill {
  height: 24px;
  padding: 0 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--cf-pill, var(--tenant-primary)) 14%, transparent);
  border: 0;
  gap: 5px;
}
#mc-client-hub-dialog .cf-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--cf-pill, var(--tenant-primary));
}
@container cfmain (max-width: 420px) {
  .cfg-prop { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; }
}
@media (pointer: coarse) {
  .cfg-val { min-height: 44px; }
  .cfg-link { min-height: 44px; }
  .cfg-mini .cfg-link { min-height: 36px; }
  .cfg-input, .cfg-edit .sm { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .cfg-main > section, .cfg-rail-sec, .cfg-prop.is-saved .cfg-val { animation: none; }
  .cfg-val, .cfg-val .nav-ico, .cfg-link { transition: none; }
}

/* ——— Ficha › Historial (S090-090a): línea de tiempo + salud en rail ———
   Entrenos, medidas, notas, pagos, membresías y formularios (clic → respuestas). */
#mc-client-hub-dialog .cfh {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  max-width: var(--mc-hub-content-max, 1120px);
}
@container cfpane (min-width: 760px) {
  #mc-client-hub-dialog .cfh { grid-template-columns: minmax(0, 1fr) 270px; gap: 0 32px; align-items: start; }
  #mc-client-hub-dialog .cfh-rail { position: sticky; top: 0; padding-left: 24px; border-left: 1px solid var(--hairline); }
}
@container cfpane (max-width: 759px) {
  #mc-client-hub-dialog .cfh-rail { border-top: 1px solid var(--hairline); padding-top: 16px; }
}
.cfh-main { min-width: 0; }
.cfh-head { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cfh-head h4 { margin: 0 auto 0 0; font-size: 0.8125rem; font-weight: 650; }
.cfh-head .cfh-filters { order: 3; }
@container cfpane (max-width: 1099px) {
  .cfh-head::after { content: ""; order: 2; flex-basis: 100%; }
}
.cfh-filters {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--sys-text, currentColor) 5%, transparent);
}
.cfh-filters::-webkit-scrollbar { display: none; }
.cfh-filter {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  background: none;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.cfh-filter:hover { color: var(--text); }
.cfh-filter.is-active { background: var(--sys-surface); color: var(--text); box-shadow: 0 0 0 1px var(--hairline); }
.cfh-filter:focus-visible { outline: 2px solid var(--tenant-primary); outline-offset: 1px; }

.cfh-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.cfh-month { margin: 18px 0 4px 40px; font-size: 0.75rem; font-weight: 650; color: var(--muted); }
.cfh-month:first-child { margin-top: 0; }
.cfh-item {
  position: relative;
  animation: cfg-in 200ms var(--mc-hub-ease, ease-out) both;
  animation-delay: calc(var(--i, 0) * 18ms);
}
.cfh-item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--hairline);
}
.cfh-item:last-child::before { bottom: 50%; }
.cfh-hit {
  position: relative;
  display: flex;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 7px 8px 7px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
button.cfh-hit { cursor: pointer; transition: background-color 120ms ease; }
button.cfh-hit:hover { background: color-mix(in srgb, var(--sys-text, currentColor) 4%, transparent); }
button.cfh-hit:focus-visible { outline: 2px solid var(--tenant-primary); outline-offset: -2px; }
.cfh-dot {
  position: relative;
  z-index: 1;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--sys-surface);
  color: var(--muted);
}
.cfh-dot .nav-ico { width: 14px; height: 14px; }
.cfh-dot--train,
.cfh-dot--note { color: var(--tenant-primary); border-color: color-mix(in srgb, var(--tenant-primary) 30%, var(--hairline)); }
.cfh-dot--plan { color: var(--sys-ok); border-color: color-mix(in srgb, var(--sys-ok) 32%, var(--hairline)); }
.cfh-item.is-muted .cfh-dot { opacity: 0.7; }
.cfh-item.is-muted .cfh-title { font-weight: 550; color: var(--muted); }
.cfh-body { min-width: 0; flex: 1; padding-top: 3px; }
.cfh-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cfh-title { font-size: 0.875rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cfh-date { flex: 0 0 auto; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfh-sub { margin: 1px 0 0; font-size: 0.75rem; color: var(--muted); }
.cfh-text { margin: 4px 0 0; font-size: 0.8125rem; line-height: 1.45; color: color-mix(in srgb, var(--text) 82%, var(--muted)); overflow-wrap: anywhere; }
.cfh-skel { display: grid; gap: 12px; padding: 8px 0 8px 40px; }
.cfh-empty { display: grid; justify-items: start; gap: 8px; padding: 18px 0; color: var(--muted); }
.cfh-empty p { margin: 0; font-size: 0.84rem; line-height: 1.45; max-width: 52ch; }
.cfh-empty .nav-ico { width: 18px; height: 18px; }

#mc-client-hub-dialog .cfh-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-width: 0; max-width: none; }
#mc-client-hub-dialog .cfh-rail .cf-hist-card {
  padding: 0 0 16px;
  margin: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
#mc-client-hub-dialog .cfh-rail .cf-hist-card:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.cfh-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 4px; }
#mc-client-hub-dialog .cfh-card-head h4 { margin: 0; font-size: 0.8125rem; font-weight: 650; }
#mc-client-hub-dialog .cfh-rail .cf-hist-dl { margin: 0; }
#mc-client-hub-dialog .cfh-rail .cf-kv {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 12px;
  padding: 5px 0;
  border: 0;
}
#mc-client-hub-dialog .cfh-rail .cf-kv dt { flex: 0 1 auto; font-size: 0.78rem; color: var(--muted); }
#mc-client-hub-dialog .cfh-rail .cf-kv dd { flex: 1 0 auto; margin: 0; max-width: 100%; font-size: 0.82rem; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
#mc-client-hub-dialog .cfh-rail .cf-kv dd.is-empty { color: var(--muted); }
#mc-client-hub-dialog .cfh-rail .cf-pills { justify-content: flex-end; }
#mc-client-hub-dialog .cf-obs-btn { display: inline-flex; }
@media (pointer: coarse) {
  .cfh-filter { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .cfh-item { animation: none; }
  .cfh-filter, button.cfh-hit { transition: none; }
}

/* ——— Ficha › Formularios / Plan y productos / Negocio (S090-090a) ———
   Tablas de ancho fijo que caben en el panel (sin scroll horizontal) y pasan a
   filas-tarjeta por container query. */
#mc-client-hub-dialog .cf-forms,
#mc-client-hub-dialog .cf-neg { max-width: var(--mc-hub-content-max, 1120px); min-height: 0; gap: 14px; }

#mc-client-hub-dialog .cf-neg-toolbar,
#mc-client-hub-dialog .cf-forms-toolbar { gap: 8px; margin: 0; }
#mc-client-hub-dialog .cf-forms-search,
#mc-client-hub-dialog .cf-neg-search {
  padding: 0 12px;
  min-height: 38px;
  height: 38px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--sys-surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
#mc-client-hub-dialog .cf-forms-search:focus-within,
#mc-client-hub-dialog .cf-neg-search:focus-within {
  border-color: color-mix(in srgb, var(--tenant-primary) 55%, var(--hairline));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-primary) 14%, transparent);
}
#mc-client-hub-dialog .cf-forms-filter-btn,
#mc-client-hub-dialog .cf-neg-filter-btn,
#mc-client-hub-dialog .cf-forms-assign-btn,
#mc-client-hub-dialog .cf-neg-create { height: 38px; border-radius: 10px; }

/* Resumen: misma fila de cifras que «Actividad» del General */
.cff-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 20px; font-size: 0.8125rem; color: var(--muted); }
.cff-summary[hidden] { display: none; }
.cff-stat b { font-size: 1.05rem; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; margin-right: 4px; }
.cff-stat.is-pend b { color: color-mix(in srgb, var(--sys-warn) 80%, var(--text)); }
.cff-bar, .cfp-meter-bar { display: block; flex: 1 1 120px; min-width: 90px; max-width: 220px; height: 4px; align-self: center; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.cff-bar i, .cfp-meter-bar i {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  border-radius: inherit;
  background: var(--sys-ok);
  transform-origin: left;
  animation: cff-grow 500ms var(--mc-hub-ease, ease-out) both;
}
@keyframes cff-grow { from { transform: scaleX(0); } }
.cfn-summary[hidden] { display: none; }
.cfn-summary .cfg-pulse-i.is-warn b { color: color-mix(in srgb, var(--sys-warn) 80%, var(--text)); }
#mc-client-hub-dialog .cf-neg .cfn-summary { margin: 0 0 4px; }

/* Tablas */
#mc-client-hub-dialog .cf-neg-table-wrap,
#mc-client-hub-dialog .cf-forms-table-wrap {
  overflow: visible !important;
  max-height: none !important;
  padding-inline-end: 0 !important;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--sys-surface);
  box-shadow: none;
}
#mc-client-hub-dialog .cf-pane .usuarios-pagination[hidden] { display: none !important; }
#mc-client-hub-dialog .cf-neg-table,
#mc-client-hub-dialog .cf-forms-table,
#mc-client-hub-dialog .cf-plan-tx { border-collapse: collapse; width: 100%; min-width: 0; }
#mc-client-hub-dialog .cf-neg-table,
#mc-client-hub-dialog .cf-forms-table { table-layout: fixed; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-check { width: 40px; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-nombre { width: auto; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-estado { width: 128px; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-envio { width: 108px; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-resp { width: 112px; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-actions { width: 168px; }
#mc-client-hub-dialog .cf-forms-table .cf-forms-col-del { width: 48px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(1) { width: 96px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(3) { width: 112px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(4) { width: 112px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(5) { width: 88px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(6) { width: 112px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(7) { width: 108px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(8) { width: 88px; }
#mc-client-hub-dialog .cf-neg-table th:nth-child(9) { width: 52px; }
@container cfpane (max-width: 959px) {
  #mc-client-hub-dialog .cf-neg-table th:nth-child(5),
  #mc-client-hub-dialog .cf-neg-table td:nth-child(5),
  #mc-client-hub-dialog .cf-neg-table th:nth-child(8),
  #mc-client-hub-dialog .cf-neg-table td:nth-child(8) { width: 0; padding: 0 !important; font-size: 0; visibility: hidden; }
}
.cfn-summary.cfg-pulse { margin: 0; }
@container cfpane (min-width: 500px) {
  .cfn-summary.cfg-pulse { grid-template-columns: repeat(4, max-content); justify-content: start; gap: 0 40px; }
}
#mc-client-hub-dialog .cf-neg-table thead th,
#mc-client-hub-dialog .cf-forms-table thead th,
#mc-client-hub-dialog .cf-plan-tx thead th {
  position: static;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#mc-client-hub-dialog .cf-neg-table tbody td,
#mc-client-hub-dialog .cf-forms-table tbody td,
#mc-client-hub-dialog .cf-plan-tx tbody td {
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  font-size: 0.84rem;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
#mc-client-hub-dialog .cf-neg-table td,
#mc-client-hub-dialog .cf-forms-table td.cf-forms-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
#mc-client-hub-dialog .cf-neg-table td.cf-neg-prod { white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
#mc-client-hub-dialog .cf-neg-table td.cf-neg-actions-col,
#mc-client-hub-dialog .cf-forms-table td.usuarios-roster-actions-col { overflow: visible; }
#mc-client-hub-dialog .cf-neg-table tbody tr:last-child td,
#mc-client-hub-dialog .cf-forms-table tbody tr:last-child td,
#mc-client-hub-dialog .cf-plan-tx tbody tr:last-child td { border-bottom: 0; }
#mc-client-hub-dialog .cf-neg-table tbody tr,
#mc-client-hub-dialog .cf-forms-table tbody tr { transition: background-color 120ms ease; }
#mc-client-hub-dialog .cf-neg-table tbody tr:hover,
#mc-client-hub-dialog .cf-forms-table tbody tr:hover { background: color-mix(in srgb, var(--sys-text, currentColor) 3%, transparent); }
#mc-client-hub-dialog .cf-neg-table .num,
#mc-client-hub-dialog .cf-plan-tx .num { font-variant-numeric: tabular-nums; text-align: right; }
#mc-client-hub-dialog .cf-neg-empty,
#mc-client-hub-dialog .cf-forms-empty { padding: 32px 16px; text-align: center; color: var(--muted); white-space: normal; }
#mc-client-hub-dialog .cf-forms-empty { display: grid; justify-items: center; gap: 4px; }
#mc-client-hub-dialog .cf-forms-empty h4 { color: var(--text); }
#mc-client-hub-dialog .cf-forms-empty p { margin-inline: auto; max-width: 52ch; }

/* Formularios: nombre → respuestas; plantilla en icono */
#mc-client-hub-dialog .cf-forms-table .cf-forms-name {
  display: block;
  max-width: 100%;
  padding: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms ease;
}
#mc-client-hub-dialog .cf-forms-table button.cf-forms-name:hover { color: var(--tenant-primary); }
#mc-client-hub-dialog .cf-forms-table .cf-forms-name.is-static { cursor: default; }
#mc-client-hub-dialog .cf-forms-rec { margin-top: 1px; font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mc-client-hub-dialog .cf-forms-table td.usuarios-roster-actions-col { text-align: right; white-space: nowrap; }
#mc-client-hub-dialog .cf-forms-view { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 0.78rem; }
#mc-client-hub-dialog .cf-forms-icon,
#mc-client-hub-dialog .cf-forms-del {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  padding: 0;
  vertical-align: middle;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
#mc-client-hub-dialog .cf-forms-icon .nav-ico,
#mc-client-hub-dialog .cf-forms-del .nav-ico { width: 16px; height: 16px; stroke: currentColor; }
#mc-client-hub-dialog .cf-forms-icon:hover { color: var(--text); background: color-mix(in srgb, var(--sys-text, currentColor) 7%, transparent); }
#mc-client-hub-dialog .cf-forms-del:hover { filter: none; color: var(--sys-err); background: color-mix(in srgb, var(--sys-err) 10%, transparent); }
#mc-client-hub-dialog .cf-forms-icon:focus-visible,
#mc-client-hub-dialog .cf-forms-del:focus-visible { outline: 2px solid var(--tenant-primary); outline-offset: 1px; }
#mc-client-hub-dialog .cf-forms-del-head { text-align: center; }

#mc-client-hub-dialog .cf-forms-pill,
#mc-client-hub-dialog .cf-neg-pill,
#mc-client-hub-dialog .cf-plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 22px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#mc-client-hub-dialog .cf-forms-pill::before,
#mc-client-hub-dialog .cf-neg-pill::before,
#mc-client-hub-dialog .cf-plan-pill::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
#mc-client-hub-dialog .cf-forms-pill.is-pendiente,
#mc-client-hub-dialog .cf-neg-pill.is-pendiente,
#mc-client-hub-dialog .cf-plan-pill.is-soon { color: color-mix(in srgb, var(--sys-warn) 72%, var(--text)); background: color-mix(in srgb, var(--sys-warn) 14%, transparent); }
#mc-client-hub-dialog .cf-forms-pill.is-completado,
#mc-client-hub-dialog .cf-neg-pill.is-pagado,
#mc-client-hub-dialog .cf-plan-pill.is-active { color: color-mix(in srgb, var(--sys-ok) 72%, var(--text)); background: color-mix(in srgb, var(--sys-ok) 14%, transparent); }
#mc-client-hub-dialog .cf-neg-pill.is-fallido,
#mc-client-hub-dialog .cf-neg-pill.is-revertido,
#mc-client-hub-dialog .cf-plan-pill.is-expired { color: color-mix(in srgb, var(--sys-err) 78%, var(--text)); background: color-mix(in srgb, var(--sys-err) 12%, transparent); }
#mc-client-hub-dialog .cf-plan-pill.is-none { color: var(--muted); background: color-mix(in srgb, var(--sys-text, currentColor) 7%, transparent); }
#mc-client-hub-dialog .cf-neg-kebab {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease;
}
#mc-client-hub-dialog .cf-neg-kebab:hover { background: color-mix(in srgb, var(--sys-text, currentColor) 7%, transparent); color: var(--text); }
.cf-neg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cf-neg-foot .hint { margin: 0; font-size: 0.78rem; }
.cf-neg-foot .hint:empty { display: none; }

/* Plan y productos */
#mc-client-hub-dialog .cf-plan { max-width: var(--mc-hub-content-max, 1120px); gap: 0; }
.cfp { container: cfplan / inline-size; display: grid; gap: 24px; }
.cfp > * { animation: cfg-in 220ms var(--mc-hub-ease, ease-out) both; }
.cfp > :nth-child(2) { animation-delay: 40ms; }
.cfp > :nth-child(n + 3) { animation-delay: 80ms; }
.cfp-cur { min-width: 0; padding-bottom: 20px; border-bottom: 1px solid var(--hairline); }
.cfp-cur-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.cfp-cur-id { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
.cfp-name { margin: 0; font-size: 1.125rem; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; }
.cfp-cur-top .is-danger { color: var(--sys-err); flex: 0 0 auto; }
.cfp-end { margin: 4px 0 0; font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; max-width: 64ch; }
.cfp-cur .cfp-meter-bar { max-width: 320px; margin-top: 10px; }
.cfp-cur.is-soon .cfp-meter-bar i { background: var(--sys-warn); }
.cfp-cur.is-expired .cfp-meter-bar i { background: var(--sys-err); }
.cfp-facts { display: flex; flex-wrap: wrap; gap: 10px 40px; margin: 16px 0 0; }
.cfp-facts div { display: grid; gap: 2px; min-width: 0; }
.cfp-facts dt { font-size: 0.75rem; color: var(--muted); }
.cfp-facts dd { margin: 0; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; gap: 5px; flex-wrap: wrap; }
.cfp-facts-svc dd span { height: 22px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 6px; font-size: 0.74rem; font-weight: 550; background: color-mix(in srgb, var(--sys-text, currentColor) 7%, transparent); }
.cfp-note { margin: 0; font-size: 0.84rem; line-height: 1.5; color: var(--muted); max-width: 64ch; }
.cfp-sec { min-width: 0; }
.cfp-sec .cfg-h { margin-bottom: 8px; }
.cfp-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@container cfplan (min-width: 720px) {
  .cfp-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#mc-client-hub-dialog .cfp .cf-block {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--sys-surface);
  box-shadow: none;
}
#mc-client-hub-dialog .cfp .cf-block h4 { margin: 0 0 4px; font-size: 0.875rem; font-weight: 650; }
#mc-client-hub-dialog .cfp .cf-block > .hint { margin: 0 0 12px; font-size: 0.8rem; line-height: 1.45; }
#mc-client-hub-dialog .cfp .cf-plan-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 4px; }
#mc-client-hub-dialog .cfp .cf-plan-form .field:first-child { grid-column: 1 / -1; }
#mc-client-hub-dialog .cfp .cf-plan-form .btn-primary { grid-column: 1 / -1; height: 40px; border-radius: 10px; }
#mc-client-hub-dialog .cfp .cf-plan-form select,
#mc-client-hub-dialog .cfp .cf-plan-form input { height: 38px; line-height: normal; border-radius: 10px; }
.cfp .cf-field-lbl { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
#mc-client-hub-dialog .cf-plan-tx { margin: 0; }
#mc-client-hub-dialog .cfp .usuarios-roster-wrap { border: 1px solid var(--hairline); border-radius: 12px; background: none; overflow-x: auto; padding-inline-end: 0 !important; }
.cf-plan-history { gap: 0; }
#mc-client-hub-dialog .cf-plan-history li { padding: 10px 0; }
#mc-client-hub-dialog .cf-plan-history li:last-child { border-bottom: 0; }

/* Tablas → filas-tarjeta cuando el panel es estrecho */
@container cfpane (max-width: 639px) {
  #mc-client-hub-dialog .cf-forms-toolbar,
  #mc-client-hub-dialog .cf-neg-toolbar { flex-wrap: wrap; }
  #mc-client-hub-dialog .cf-forms-search,
  #mc-client-hub-dialog .cf-neg-search { flex-basis: 100%; }
  #mc-client-hub-dialog .cf-forms-assign-btn,
  #mc-client-hub-dialog .cf-neg-create { margin-left: auto; }
  #mc-client-hub-dialog .cf-forms-table-wrap,
  #mc-client-hub-dialog .cf-neg-table-wrap { border: 0; background: none; }
  #mc-client-hub-dialog .cf-forms-table,
  #mc-client-hub-dialog .cf-neg-table { display: block; }
  #mc-client-hub-dialog .cf-forms-table colgroup,
  #mc-client-hub-dialog .cf-forms-table thead,
  #mc-client-hub-dialog .cf-neg-table thead { display: none; }
  #mc-client-hub-dialog .cf-forms-table tbody,
  #mc-client-hub-dialog .cf-neg-table tbody { display: grid; gap: 8px; }
  #mc-client-hub-dialog .cf-forms-table tbody tr,
  #mc-client-hub-dialog .cf-neg-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    padding: 12px 14px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--sys-surface);
  }
  #mc-client-hub-dialog .cf-forms-table tbody td,
  #mc-client-hub-dialog .cf-neg-table tbody td { display: grid !important; gap: 2px; padding: 0; border: 0; font-size: 0.84rem; min-width: 0; white-space: normal; }
  #mc-client-hub-dialog .cf-forms-table tbody td[data-label]::before,
  #mc-client-hub-dialog .cf-neg-table tbody td[data-label]::before { content: attr(data-label); font-size: 0.7rem; color: var(--muted); }
  #mc-client-hub-dialog .cf-forms-table tbody td:first-child { display: none !important; }
  #mc-client-hub-dialog .cf-forms-table tbody td[data-label="Nombre"],
  #mc-client-hub-dialog .cf-neg-table tbody td.cf-neg-prod { grid-column: 1 / -1; }
  #mc-client-hub-dialog .cf-forms-table tbody td[data-label="Nombre"]::before { display: none; }
  #mc-client-hub-dialog .cf-forms-table tbody td.usuarios-roster-actions-col { display: flex !important; align-items: center; gap: 4px; text-align: left; }
  #mc-client-hub-dialog .cf-forms-table tbody td.cf-forms-del-head { display: flex !important; justify-content: flex-end; align-items: center; }
  #mc-client-hub-dialog .cf-neg-table tbody td.num { text-align: left; }
  #mc-client-hub-dialog .cf-neg-table tbody td.cf-neg-actions-col { grid-column: 1 / -1; justify-items: end; }
  #mc-client-hub-dialog .cf-neg-empty-row td,
  #mc-client-hub-dialog .cf-forms-table tbody tr:only-child td[colspan] { display: block !important; grid-column: 1 / -1; }
  #mc-client-hub-dialog .cf-neg-table tbody tr.cf-neg-empty-row,
  #mc-client-hub-dialog .cf-forms-table tbody tr:only-child:has(td[colspan]) { display: block; }
  #mc-client-hub-dialog .cfp .cf-plan-form { grid-template-columns: minmax(0, 1fr); }
  .cfp-cur-top { align-items: flex-start; }
}
@media (pointer: coarse) {
  #mc-client-hub-dialog .cf-forms-view,
  #mc-client-hub-dialog .cf-forms-icon,
  #mc-client-hub-dialog .cf-forms-del,
  #mc-client-hub-dialog .cf-neg-kebab { min-height: 44px; min-width: 44px; }
  #mc-client-hub-dialog .cf-forms-filter-btn,
  #mc-client-hub-dialog .cf-neg-filter-btn,
  #mc-client-hub-dialog .cf-forms-assign-btn,
  #mc-client-hub-dialog .cf-neg-create { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .cfp > *, .cff-bar i, .cfp-meter-bar i { animation: none; }
  #mc-client-hub-dialog .cf-neg-table tbody tr, #mc-client-hub-dialog .cf-forms-table tbody tr,
  #mc-client-hub-dialog .cf-forms-icon, #mc-client-hub-dialog .cf-forms-del, #mc-client-hub-dialog .cf-neg-kebab { transition: none; }
}

/* ——— Chat (armonía con el chat de la app) ——— */
#mc-client-hub-dialog .mc-hub-pane[data-mc-hub-pane="chat"].is-active {
  margin: calc(-1 * var(--mc-hub-pad-y)) calc(-1 * var(--mc-hub-pad-x)) calc(-1 * (var(--mc-hub-pad-y) + 8px));
  min-height: 0;
  animation: none;
}
#mc-client-hub-dialog .mc-hub-chat {
  border-top: 0;
  background: color-mix(in srgb, var(--sys-surface-2) 55%, var(--sys-surface));
}
#mc-client-hub-dialog .mc-hub-chat-msg-list {
  gap: 2px;
  padding: 16px max(16px, calc((100% - 860px) / 2));
}
.mc-hub-chat-item { margin: 0; }
.mc-hub-chat-item.is-run-start { margin-top: 10px !important; }
.mc-hub-chat-msg-list .chat-msg-row { display: flex; }
.mc-hub-chat-msg-list .chat-avatar { display: none; }
#mc-client-hub-dialog .mc-hub-chat-msg-list .chat-bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: min(72%, 520px);
  padding: 7px 10px 5px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--sys-surface);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.06);
}
#mc-client-hub-dialog .mc-hub-chat-msg-list .chat-bubble.is-mine {
  margin-left: auto;
  border-color: transparent;
  background: color-mix(in srgb, var(--tenant-primary) 15%, var(--sys-surface));
}
.mc-hub-chat-item.is-run-start:not(.is-mine) .chat-bubble { border-top-left-radius: 4px; }
.mc-hub-chat-item.is-run-start.is-mine .chat-bubble { border-top-right-radius: 4px; }
#mc-client-hub-dialog .mc-hub-chat-msg-list .chat-bubble-body {
  font-size: 0.875rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}
#mc-client-hub-dialog .mc-hub-chat-msg-list .chat-bubble-meta {
  order: 2;
  justify-content: flex-end;
  gap: 4px;
  margin: 2px 0 0 auto;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding-left: 24px;
}
.mc-hub-chat-msg-list .chat-bubble-meta > span:not(.chat-read-receipt) { display: none; }
.mc-hub-chat-msg-list .chat-read-receipt { color: var(--muted); letter-spacing: -0.12em; }
.mc-hub-chat-msg-list .chat-read-receipt.is-read { color: var(--tenant-primary); }
#mc-client-hub-dialog .mc-hub-chat-msg-list .chat-msg-menu-btn {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 28px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sys-surface) 85%, transparent);
  color: var(--muted);
}
.mc-hub-chat-msg-list .chat-msg-menu {
  top: auto;
  bottom: calc(100% + 4px);
  right: 0;
  background: var(--sys-surface);
  border-color: var(--hairline);
  border-radius: var(--radius-sm, 8px);
  box-shadow: var(--elev-2);
}
.mc-hub-chat-msg-list .chat-msg-menu button { min-height: 34px; }
.mc-hub-chat-msg-list .chat-msg-menu button.danger { color: var(--sys-err); }
.mc-hub-chat-msg-list .chat-reply-quote {
  border-left: 0 !important;
  margin: 0 0 5px !important;
  padding: 5px 8px !important;
  border-radius: 8px;
  background: color-mix(in srgb, var(--sys-text) 6%, transparent);
  font-size: 0.8rem !important;
  opacity: 1 !important;
}
.mc-hub-chat-msg-list .chat-reply-quote strong {
  color: var(--tenant-primary);
  font-weight: 650;
}
.mc-hub-chat-msg-list .chat-media-bubble img,
.mc-hub-chat-msg-list .chat-media-bubble video {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  margin-top: 4px;
}
.mc-hub-chat-msg-list .chat-media-bubble > span,
.mc-hub-chat-msg-list .chat-audio-bubble > span:first-child {
  font-size: 0.76rem;
  color: var(--muted);
}
.mc-hub-chat-msg-list .chat-audio-bubble audio { width: min(260px, 100%); height: 36px; margin-top: 4px; }
.mc-hub-chat-msg-list .chat-file-bubble a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--sys-text) 5%, transparent);
  color: var(--text);
  text-decoration: none;
  font-weight: 550;
}
.mc-hub-chat-day {
  display: flex;
  justify-content: center;
  margin: 14px 0 4px !important;
  position: sticky;
  top: 0;
  z-index: 1;
}
.mc-hub-chat-day span {
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sys-surface) 92%, transparent);
  border: 1px solid var(--hairline);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.mc-hub-chat-empty {
  margin: auto !important;
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 320px;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
}
.mc-hub-chat-empty .nav-ico {
  width: 28px;
  height: 28px;
  color: var(--tenant-primary);
  margin-bottom: 4px;
}
.mc-hub-chat-empty strong { color: var(--text); font-size: 0.92rem; }
.mc-hub-chat-skel { display: block; padding: 8px 0; }
.mc-hub-chat-reply {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px;
  padding: 8px 8px 8px 12px;
  border-radius: 10px 10px 0 0;
  background: color-mix(in srgb, var(--tenant-primary) 8%, var(--sys-surface));
  border: 1px solid var(--hairline);
  border-bottom: 0;
}
.mc-hub-chat-reply[hidden] { display: none; }
.mc-hub-chat-reply-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.8rem;
}
.mc-hub-chat-reply-text strong { color: var(--tenant-primary); font-weight: 650; }
.mc-hub-chat-reply-text span {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-hub-chat-reply .nav-ico { width: 16px; height: 16px; }
#mc-client-hub-dialog .mc-hub-chat-composer.chat-composer--rich {
  border-top: 1px solid var(--hairline);
  background: var(--sys-surface);
}
#mc-client-hub-dialog .mc-hub-chat-composer textarea {
  border-radius: 20px;
}

/* ——— Tablet / celular ——— */
@media (max-width: 1100px) {
  #mc-client-hub-dialog {
    --mc-hub-nav-w: 64px;
  }
  #mc-client-hub-dialog .mc-hub-tab {
    justify-content: center;
    padding: 0;
  }
  #mc-client-hub-dialog .mc-hub-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  #mc-client-hub-dialog .mc-hub-tab-ico { width: 20px; height: 20px; }
}
@media (max-width: 820px) {
  #mc-client-hub-dialog {
    --mc-hub-pad-x: 16px;
    --mc-hub-pad-y: 16px;
    inset: 0;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  @starting-style {
    #mc-client-hub-dialog[open] {
      opacity: 0;
      transform: translateY(24px);
    }
  }
  #mc-client-hub-dialog .mc-hub-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: calc(12px + env(safe-area-inset-top, 0px)) var(--mc-hub-pad-x) 12px;
    gap: 10px;
  }
  #mc-client-hub-dialog .mc-hub-identity .avatar {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
  #mc-client-hub-dialog .mc-hub-identity-text h3 {
    font-size: 1.08rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .mc-hub-title-row { flex-wrap: wrap; row-gap: 4px; }
  .mc-hub-facts {
    grid-column: 1 / -1;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--mc-hub-pad-x));
    padding-inline: var(--mc-hub-pad-x);
  }
  .mc-hub-facts::-webkit-scrollbar { display: none; }
  .mc-hub-act span { display: none; }
  #mc-client-hub-dialog .mc-hub-act {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }
  #mc-client-hub-dialog .mc-hub-more-btn,
  #mc-client-hub-dialog .mc-hub-close-x {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
  #mc-client-hub-dialog .mc-hub-header-actions { gap: 4px; }
  #mc-client-hub-dialog .mc-hub-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  #mc-client-hub-dialog .mc-hub-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 6px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    background: var(--sys-surface);
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  #mc-client-hub-dialog .mc-hub-tabs::-webkit-scrollbar { display: none; }
  #mc-client-hub-dialog .mc-hub-tab {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
    gap: 8px;
    border-radius: 999px;
    scroll-snap-align: center;
  }
  #mc-client-hub-dialog .mc-hub-tab-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }
  #mc-client-hub-dialog .mc-hub-tab-ico { width: 18px; height: 18px; }
  .mc-hub-tagpop { right: 8px; left: 8px; width: auto; }
  .mc-hub-menu { min-width: 240px; }
  .mc-hub-menu button { min-height: 44px; }
  #mc-client-hub-dialog .cf-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  #mc-client-hub-dialog .cf-tabs,
  #mc-client-hub-dialog .cf-head-actions { width: 100%; max-width: 100%; }
  .cf-head-actions { justify-content: flex-end; flex-wrap: wrap; }
  #mc-client-hub-dialog .mc-hub-facts { padding-block: 8px; margin-block: -8px; }
  #mc-client-hub-dialog .mc-hub-fact.is-btn { position: relative; }
  #mc-client-hub-dialog .mc-hub-fact.is-btn::after {
    content: "";
    position: absolute;
    inset: -8px 0;
  }
  #mc-client-hub-dialog .cf-head-actions .ghost,
  #mc-client-hub-dialog .cf-gen-link { min-height: 44px; }
  #mc-client-hub-dialog .cf-tab { min-height: 44px; }
  #mc-client-hub-dialog .mc-hub-chat-msg-list { padding: 12px; }
  #mc-client-hub-dialog .mc-hub-chat-msg-list .chat-bubble { max-width: 84%; }
  #mc-client-hub-dialog .mc-hub-chat-composer.chat-composer--rich {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}
/* ——— S091-091c: responsive por contenedor (cabecera, rail, sub-pestañas, filtros) ———
   Cada barra es su propio contenedor: el dialog no lo es porque aloja popovers `position: fixed`. */
#mc-client-hub-dialog .mc-hub-header {
  container: mchubhead / inline-size;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 2px;
}
#mc-client-hub-dialog .mc-hub-identity { grid-column: 1 / 3; min-width: 0; }
#mc-client-hub-dialog .mc-hub-header-actions { grid-column: 3; }
#mc-client-hub-dialog .mc-hub-facts { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; }
#mc-client-hub-dialog .cf-head { container: cfhead / inline-size; }
@container mchubhead (max-width: 640px) {
  #mc-client-hub-dialog .mc-hub-identity,
  #mc-client-hub-dialog .mc-hub-identity-text { display: contents; }
  #mc-client-hub-dialog .mc-hub-identity .avatar { grid-column: 1; grid-row: 1; align-self: center; width: 44px; height: 44px; }
  #mc-client-hub-dialog .mc-hub-title-row { grid-column: 2; grid-row: 1; align-self: center; gap: 4px 8px; }
  #mc-client-hub-dialog .mc-hub-identity-text h3 { font-size: 1.05rem; line-height: 1.25; text-wrap: balance; }
  /* El email sigue en ⋯ → Copiar email y en Ficha › General. */
  #mc-client-hub-dialog .mc-hub-identity-text > .hint { display: none; }
  #mc-client-hub-dialog .mc-hub-header-actions { grid-column: 3; grid-row: 1; align-self: center; gap: 2px; }
  #mc-client-hub-dialog .mc-hub-act,
  #mc-client-hub-dialog .mc-hub-more-btn,
  #mc-client-hub-dialog .mc-hub-close-x { width: 40px; min-width: 40px; height: 40px; }
  #mc-client-hub-dialog .mc-hub-facts {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-wrap: wrap;
    overflow: visible;
    margin: 10px 0 0;
    padding: 0;
    gap: 6px;
  }
  #mc-client-hub-dialog .mc-hub-fact { min-height: 30px; max-width: 100%; min-width: 0; padding-inline: 9px; }
  #mc-client-hub-dialog .mc-hub-fact.is-plan { max-width: min(100%, 210px); }
  #mc-client-hub-dialog .mc-hub-fact.is-btn::after { inset: -5px 0; }
}
@media (max-width: 820px) {
  #mc-client-hub-dialog .mc-hub-tabs { container: mchubtabs / inline-size; }
}
/* Sin sitio para 6 etiquetas: iconos iguales y la pestaña activa con su nombre (sin scroll lateral). */
@container mchubtabs (max-width: 699px) {
  #mc-client-hub-dialog .mc-hub-tab { flex: 1 1 0; min-width: 40px; padding: 0 6px; justify-content: center; scroll-snap-align: none; }
  #mc-client-hub-dialog .mc-hub-tab:not(.is-active) .mc-hub-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  #mc-client-hub-dialog .mc-hub-tab.is-active { flex: 0 0 auto; padding: 0 14px; }
  #mc-client-hub-dialog .mc-hub-tab-ico { width: 20px; height: 20px; flex-basis: 20px; }
}
/* Sub-pestañas de Ficha: segmento que envuelve en 2 filas antes que cortarse. */
@container cfhead (max-width: 520px) {
  #mc-client-hub-dialog .cf-tabs {
    flex-wrap: wrap;
    overflow: visible;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--sys-text) 5%, transparent);
  }
  #mc-client-hub-dialog .cf-tab {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
  }
  #mc-client-hub-dialog .cf-tab.is-active {
    background: var(--sys-surface);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--hairline), 0 1px 2px color-mix(in srgb, var(--sys-text) 8%, transparent);
  }
  #mc-client-hub-dialog .cf-head { border-bottom: 0; margin-bottom: 14px; }
}
/* Filtros de Historial: rejilla 3×2 en vez de scroll lateral. */
@container cfpane (max-width: 520px) {
  #mc-client-hub-dialog .cfh-head .cfh-filters { display: flex; flex: 1 1 100%; flex-wrap: wrap; overflow: visible; }
  #mc-client-hub-dialog .cfh-filters > .cfh-filter { flex: 1 1 calc(33.333% - 2px); min-height: 36px; padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  #mc-client-hub-dialog,
  .mc-hub-menu,
  .mc-hub-tagpop { transition-property: opacity; }
  @starting-style {
    #mc-client-hub-dialog[open] { transform: none; }
  }
  #mc-client-hub-dialog .mc-hub-pane.is-active { animation: none; }
  .mc-hub-skel { animation: none; }
}

#mc-client-hub-dialog input:not([type=checkbox]):not([type=radio])::placeholder { font-weight: 400; color: var(--muted); opacity: 1; }
#mc-client-hub-dialog :is(.cf-forms-table, .cf-neg-table) { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
#mc-client-hub-dialog :is(.cf-forms-table, .cf-neg-table) :is(thead, thead tr, thead th) { background-color: transparent; }

/* ── Hub › Fisioterapia: #tab-recuperacion montado dentro del hub ── */
#mc-client-hub-dialog #tab-recuperacion.is-hub-embedded {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  overflow: visible;
  animation: none;
}
#mc-client-hub-dialog #tab-recuperacion.is-hub-embedded #recovery-client-picker,
#mc-client-hub-dialog #tab-recuperacion.is-hub-embedded #recovery-caseload-alerts,
#mc-client-hub-dialog #tab-recuperacion.is-hub-embedded #recovery-library-pane,
#mc-client-hub-dialog #tab-recuperacion.is-hub-embedded #recovery-lib-fab-wrap {
  display: none !important;
}
#mc-client-hub-dialog #tab-recuperacion.is-hub-embedded .physio-contextbar {
  padding-top: 0;
}

/* ── Hub › Vista general + Progreso › Hábitos / Cardio ── */
#mc-client-hub-dialog .mc-hub-asg {
  --asg-ok: var(--sys-ok, #22c55e);
  --asg-warn: var(--sys-warn, #f59e0b);
  --asg-err: var(--sys-err, #ef4444);
  --asg-info: #60a5fa;
  --asg-muted: var(--muted);
  container: mcasg / inline-size;
}
#mc-client-hub-dialog .mc-hub-asg-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
#mc-client-hub-dialog .mc-hub-asg-top-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
#mc-client-hub-dialog .mc-hub-asg-title {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
#mc-client-hub-dialog .mc-hub-asg-lede { margin: 0; max-width: 62ch; }

#mc-client-hub-dialog .mc-hub-asg-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
#mc-client-hub-dialog .mc-hub-asg-stat {
  min-width: 0;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}
#mc-client-hub-dialog .mc-hub-asg-stat dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
#mc-client-hub-dialog .mc-hub-asg-stat dd {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
#mc-client-hub-dialog .mc-hub-asg-stat p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#mc-client-hub-dialog .mc-hub-asg-stat.is-ok dd { color: var(--asg-ok); }
#mc-client-hub-dialog .mc-hub-asg-stat.is-warn dd { color: var(--asg-warn); }
#mc-client-hub-dialog .mc-hub-asg-stat.is-err dd { color: var(--asg-err); }

#mc-client-hub-dialog .mc-hub-asg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  align-items: stretch;
}
#mc-client-hub-dialog .mc-hub-asg-grid.is-wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  align-items: start;
}
#mc-client-hub-dialog .mc-hub-asg-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 248px;
  padding: 14px 16px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, background-color 160ms ease;
}
#mc-client-hub-dialog .mc-hub-asg-card:hover {
  border-color: color-mix(in srgb, var(--text) 18%, var(--hairline));
  background: color-mix(in srgb, var(--text) 2%, var(--surface));
}
#mc-client-hub-dialog .mc-hub-asg-sec { min-height: 0; }
#mc-client-hub-dialog .mc-hub-asg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
#mc-client-hub-dialog .mc-hub-asg-head h4 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}
#mc-client-hub-dialog .mc-hub-asg-ico {
  --tone: var(--primary);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
}
#mc-client-hub-dialog .mc-hub-asg-ico .nav-ico { width: 16px; height: 16px; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="programa"] { --tone: color-mix(in srgb, var(--primary) 55%, #f4b740); }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="ok"] { --tone: var(--asg-ok); }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="cardio"] { --tone: #e0703a; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="nutri"] { --tone: #3d9a5c; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="wellness"] { --tone: #8b6fe0; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="fisio"] { --tone: #2f8fb3; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="form"] { --tone: #c9a227; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="doc"] { --tone: #7a8aa0; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="video"] { --tone: #d0508a; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="evo"] { --tone: #2fb3a0; }
#mc-client-hub-dialog .mc-hub-asg-ico[data-tone="logro"] { --tone: #e8b64c; }

#mc-client-hub-dialog .mc-hub-asg-chip {
  --chip: var(--asg-muted);
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 50%;
  padding: 2px 9px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--chip);
  background: color-mix(in srgb, var(--chip) 14%, transparent);
}
#mc-client-hub-dialog .mc-hub-asg-chip::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
#mc-client-hub-dialog .mc-hub-asg-chip.is-muted { color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); }
#mc-client-hub-dialog .mc-hub-asg-chip.is-count::before { display: none; }
#mc-client-hub-dialog .mc-hub-asg-chip.is-ok { --chip: var(--asg-ok); }
#mc-client-hub-dialog .mc-hub-asg-chip.is-warn { --chip: var(--asg-warn); }
#mc-client-hub-dialog .mc-hub-asg-chip.is-err { --chip: var(--asg-err); }
#mc-client-hub-dialog .mc-hub-asg-chip.is-info { --chip: var(--asg-info); }

#mc-client-hub-dialog .mc-hub-asg-kpi {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
#mc-client-hub-dialog .mc-hub-asg-kpi strong {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
#mc-client-hub-dialog .mc-hub-asg-kpi span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--muted);
}
#mc-client-hub-dialog .mc-hub-asg-bar {
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
#mc-client-hub-dialog .mc-hub-asg-bar i {
  display: block;
  width: var(--pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transform-origin: left;
  animation: mc-hub-asg-bar 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes mc-hub-asg-bar { from { transform: scaleX(0); } to { transform: none; } }
#mc-client-hub-dialog .mc-hub-asg-sub {
  margin: 8px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--muted);
}
#mc-client-hub-dialog .mc-hub-asg-body { flex: 1 1 auto; margin-top: 8px; min-width: 0; }
#mc-client-hub-dialog .mc-hub-asg-empty {
  margin: 6px 0;
  font-size: 13px;
  color: var(--muted);
}
#mc-client-hub-dialog .mc-hub-asg-empty.is-err { color: var(--asg-err); }
#mc-client-hub-dialog .mc-hub-asg-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
#mc-client-hub-dialog .mc-hub-asg-row {
  --row: var(--asg-muted);
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
#mc-client-hub-dialog .mc-hub-asg-row:last-child { border-bottom: 0; }
#mc-client-hub-dialog .mc-hub-asg-row.is-ok { --row: var(--asg-ok); }
#mc-client-hub-dialog .mc-hub-asg-row.is-warn { --row: var(--asg-warn); }
#mc-client-hub-dialog .mc-hub-asg-row.is-err { --row: var(--asg-err); }
#mc-client-hub-dialog .mc-hub-asg-row.is-info { --row: var(--asg-info); }
#mc-client-hub-dialog .mc-hub-asg-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--row) 80%, transparent);
}
#mc-client-hub-dialog .mc-hub-asg-row.is-muted .mc-hub-asg-dot { background: color-mix(in srgb, var(--muted) 45%, transparent); }
#mc-client-hub-dialog .mc-hub-asg-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
#mc-client-hub-dialog .mc-hub-asg-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
#mc-client-hub-dialog .mc-hub-asg-state {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--row);
}
#mc-client-hub-dialog .mc-hub-asg-state.is-muted { color: var(--muted); font-weight: 500; }
#mc-client-hub-dialog .mc-hub-asg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}
#mc-client-hub-dialog .mc-hub-asg-foot:empty { display: none; }
#mc-client-hub-dialog .mc-hub-asg-act { display: inline-flex; align-items: center; gap: 6px; }
#mc-client-hub-dialog .mc-hub-asg-act .nav-ico { width: 14px; height: 14px; }
#mc-client-hub-dialog .mc-hub-asg-lib,
#mc-client-hub-dialog .mc-hub-asg-add { margin-left: auto; }
#mc-client-hub-dialog .mc-hub-asg-lib + .mc-hub-asg-add { margin-left: 0; }
#mc-client-hub-dialog .mc-hub-asg-add { width: 30px; padding-inline: 0; justify-content: center; }
#mc-client-hub-dialog .mc-hub-asg-card.is-empty .mc-hub-asg-body { display: grid; align-content: center; }

@container mcasg (max-width: 760px) {
  #mc-client-hub-dialog .mc-hub-asg-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container mcasg (max-width: 520px) {
  #mc-client-hub-dialog .mc-hub-asg-top { flex-direction: column; }
  #mc-client-hub-dialog .mc-hub-asg-top-acts { justify-content: flex-start; }
  #mc-client-hub-dialog .mc-hub-asg-card { min-height: 0; }
  #mc-client-hub-dialog .mc-hub-asg-row { grid-template-columns: 8px minmax(0, 1fr) auto; row-gap: 0; padding: 4px 0; }
  #mc-client-hub-dialog .mc-hub-asg-meta { grid-column: 2; grid-row: 2; }
  #mc-client-hub-dialog .mc-hub-asg-state { grid-column: 3; grid-row: 1 / span 2; }
  #mc-client-hub-dialog .mc-hub-asg-lib { width: 30px; padding-inline: 0; justify-content: center; }
  #mc-client-hub-dialog .mc-hub-asg-lib span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #mc-client-hub-dialog .mc-hub-asg-bar i { animation: none; }
  #mc-client-hub-dialog .mc-hub-asg-card { transition: none; }
}
