/* ==========================================================================
   Dicofar CRM · Estilos de vista: Clientes (.cl) y Ficha de cliente (.cf)
   Solo tokens de crm.css. Prefijos: .cl-* (lista) y .cf-* (ficha).
   La ficha usa container queries (container "cf") para pasar de 3 columnas a
   2 columnas o a pestañas según el ancho real del contenido (no del viewport),
   así funciona igual con la barra lateral expandida o contraída.
   ========================================================================== */

/* ============================== LISTA ================================== */
.cl-header .page-subtitle strong { color: var(--text); font-weight: var(--fw-semibold); }
.cl-sub-muted { color: var(--text-4); }
.cl-tabs { margin-bottom: var(--sp-4); }
.cl-tabs .tab { gap: 7px; }
.cl-fdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-4); }
.cl-fdot--tofu { background: var(--tofu); }
.cl-fdot--mofu { background: var(--mofu); }
.cl-fdot--bofu { background: var(--bofu); }
.cl-fdot--cliente { background: var(--won); }
.cl-fdot--perdido { background: var(--lost); }

.cl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.cl-searchrow { display: flex; gap: var(--sp-2); flex: 1 1 300px; max-width: 440px; min-width: 0; }
.cl-search { flex: 1 1 auto; }
.cl-search .input { padding-right: 8px; }
.cl-filters-btn { flex: none; }
.cl-filters-btn .count { margin-left: 2px; }
.cl-quickrow { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.cl-quickrow::-webkit-scrollbar { display: none; }
.cl-quick { flex-wrap: nowrap; }
.cl-scope { flex: none; }
.cl-scope .segmented__item > span { min-height: 28px; }
.cl-toolbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex: none; order: 2; }
.cl-quickrow { order: 3; flex-basis: 100%; }

.cl-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--sp-3); }
.cl-fchip { height: 26px; gap: 5px; padding-right: 6px; background: var(--brand-soft); color: var(--brand-text); }
.cl-fchip__k { color: var(--text-3); font-weight: var(--fw-regular); }
.cl-fchip .tag__remove { margin-right: 0; color: inherit; }
.cl-clear { margin-left: var(--sp-1); }
.cl-callout { margin-bottom: var(--sp-3); align-items: center; flex-wrap: wrap; }
.cl-callout > .btn { flex: none; }

.cl-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; min-height: 30px; margin-bottom: var(--sp-2); font-size: var(--fs-13); color: var(--text-3); }
.cl-summary strong { color: var(--text); font-weight: var(--fw-semibold); }
.cl-summary__sort { font-size: var(--fs-12); color: var(--text-4); }

/* Tabla */
.cl-results { container-type: inline-size; container-name: clres; }
.cl-tablewrap { overflow-x: auto; }
.cl-table td { white-space: nowrap; }
.cl-table th, .cl-table td { padding-left: 8px; padding-right: 8px; }
.cl-table th:first-child, .cl-table td:first-child { padding-left: var(--sp-4); }
.cl-table th:last-child, .cl-table td:last-child { padding-right: var(--sp-2); }
.cl-table th .th-sort { min-height: 28px; }
.cl-table .th-sort.is-sorted { color: var(--text); }
.cl-table .th-sort.is-sorted .icon { opacity: 1; color: var(--brand-text); }
.cl-table th.num .th-sort { flex-direction: row-reverse; }
.cl-td-company { min-width: 200px; max-width: 240px; white-space: normal; }
.cl-company { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cl-company__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cl-company__name { color: var(--text); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: var(--radius-sm); }
.cl-company__name:hover { color: var(--link); text-decoration: none; }
.cl-company__sub { font-size: var(--fs-12); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-score { display: inline-flex; align-items: center; gap: 8px; }
.cl-score__bar { width: 36px; height: 4px; flex: none; }
.cl-score .num { min-width: 20px; color: var(--text-2); font-size: var(--fs-12); }
.cl-last { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.cl-last.is-stale { color: var(--danger-text); font-weight: var(--fw-medium); }
.cl-due { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.cl-due .icon { color: var(--text-4); }
.cl-due--overdue { color: var(--danger-text); font-weight: var(--fw-medium); }
.cl-due--overdue .icon, .cl-due--today .icon, .cl-due--none .icon { color: currentColor; }
.cl-due--today { color: var(--warning-text); font-weight: var(--fw-medium); }
.cl-due--none { color: var(--warning-text); font-size: var(--fs-12); }
.cl-due__more { margin-left: 2px; font-size: 11px; color: var(--text-4); font-weight: var(--fw-regular); }
.cl-origin { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; color: var(--text-2); }
.cl-table .col-actions .btn { opacity: .55; }
.cl-table tbody tr:hover .col-actions .btn, .cl-table .col-actions .btn:focus-visible, .cl-table .col-actions .btn[aria-expanded="true"] { opacity: 1; }
.cl-table tbody tr:focus-within { background: var(--hover); }
.cl-table tbody tr.is-selected:focus-within { background: var(--selected); }
.cl-table tr.is-new td { animation: cl-flash 2.4s var(--ease) 1; }
@keyframes cl-flash { 0%, 35% { background: var(--brand-soft); } 100% { background: transparent; } }
@container clres (max-width: 1260px) { .cl-col-origin { display: none; } }
@container clres (max-width: 1200px) { .cl-col-owner .person__name { display: none; } }
@container clres (max-width: 1040px) { .cl-col-temp { display: none; } }
/* 1280 px (contenedor ≈ 968 px): empresa un poco más angosta y celdas más compactas para que entren las acciones. */
@container clres (max-width: 1010px) {
  .cl-td-company { min-width: 180px; max-width: 200px; }
  .cl-table th:not(:first-child):not(:last-child), .cl-table td:not(:first-child):not(:last-child) { padding-left: 6px; padding-right: 6px; }
}
@container clres (max-width: 940px) { .cl-col-score { display: none; } }

.cl-more { display: flex; justify-content: center; margin-top: var(--sp-4); }
.cl-more:empty { display: none; }
.cl-hint { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-12); color: var(--text-4); }

/* Barra de acciones masivas */
.cl-bulk {
  position: sticky; bottom: calc(var(--sp-4) + var(--safe-bottom)); z-index: var(--z-sticky); margin: var(--sp-4) auto 0; width: max-content; max-width: 100%;
  display: flex; align-items: center; gap: var(--sp-2); padding: 6px 6px 6px var(--sp-4); border-radius: var(--radius);
  background: var(--navy); color: #fff; box-shadow: var(--shadow-3); font-size: var(--fs-13); animation: cl-bulk-in var(--dur-2) var(--ease-out);
}
[data-theme="dark"] .cl-bulk { background: #1f2b45; border: 1px solid rgba(255, 255, 255, .08); }
@keyframes cl-bulk-in { from { opacity: 0; transform: translateY(8px); } }
.cl-bulk__count { white-space: nowrap; padding-right: var(--sp-2); }
.cl-bulk__count strong { color: #fff; }
.cl-bulk__actions { display: flex; gap: 2px; flex-wrap: wrap; }
.cl-bulk .btn--ghost { color: #dfe5f2; }
.cl-bulk .btn--ghost:hover, .cl-bulk .btn--ghost[aria-expanded="true"] { background: rgba(255, 255, 255, .1); color: #fff; }
.cl-bulk .btn:focus-visible { box-shadow: 0 0 0 2px var(--teal); }
.cl-bulk .cl-bulk__danger { color: #ffb8b8; }
.cl-bulk .cl-bulk__danger:hover { background: rgba(255, 120, 120, .16); color: #fff; }
body.cl-bulk-on .toasts:not(.toasts--top) { bottom: calc(var(--sp-5) + var(--safe-bottom) + 60px); }

/* Tarjetas (móvil) */
.cl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--sp-2) var(--sp-3); }
.cl-summary__cards { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; margin-left: auto; }
.cl-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.cl-card:focus-within { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.cl-card.is-selected { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: var(--selected); }
.cl-card.is-new { animation: cl-flash-card 2.4s var(--ease) 1; }
@keyframes cl-flash-card { 0%, 35% { box-shadow: 0 0 0 2px var(--brand); } 100% { box-shadow: var(--shadow-1); } }
.cl-card__top { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.cl-card__title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.cl-card__link { color: var(--text); font-size: var(--fs-16); line-height: 22px; font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.cl-card__link:hover { text-decoration: none; }
.cl-card__link:focus-visible { outline: none; }
.cl-card__sub { font-size: var(--fs-13); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-card__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cl-card__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-13); color: var(--text-2); }
.cl-card__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px var(--sp-3); font-size: var(--fs-12); }
.cl-card__actions { position: relative; z-index: 1; display: flex; gap: var(--sp-2); }
.cl-card__actions .btn { flex: 1 1 0; }
.cl-card__check { position: relative; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; margin: -8px -10px -8px 0; flex: none; cursor: pointer; }
.cl-card__check input { width: 20px; height: 20px; }
.cl-card.is-selecting { cursor: pointer; }
.cl-card.is-selecting .cl-card__link { pointer-events: none; }
.cl-card.is-selecting .cl-card__link::after { display: none; }

/* Panel de filtros */
.cl-filters { display: flex; flex-direction: column; gap: var(--sp-5); }
.cl-fsec__title { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--text); margin-bottom: var(--sp-2); }
.cl-fopt { display: flex; width: 100%; align-items: flex-start; gap: var(--sp-2); padding: 5px 0; min-height: 32px; }
.cl-fopt input { margin-top: 2px; }
.cl-fopt__label { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 2px 8px; flex-wrap: wrap; }
.cl-fopt__label .field__hint { flex-basis: 100%; }
.cl-fopt__n { margin-left: auto; font-size: var(--fs-12); color: var(--text-4); font-variant-numeric: tabular-nums; flex: none; }
.cl-fgroup + .cl-fgroup { margin-top: var(--sp-2); }
.cl-fgroup__title { display: flex; align-items: center; gap: 6px; margin: 2px 0; font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-3); }
.cl-temps { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.cl-tempopt { position: relative; display: inline-flex; }
.cl-tempopt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cl-tempopt > span {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-full); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: var(--fs-13); font-weight: var(--fw-medium); cursor: pointer;
}
.cl-tempopt > span .cl-fopt__n { margin-left: 2px; }
.cl-tempopt input:checked + span { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: var(--brand-text); }
.cl-tempopt input:focus-visible + span { box-shadow: var(--focus-ring); }
.cl-tags-list.is-collapsed .is-extra { display: none; }
.cl-tags-list.is-collapsed.is-searching .is-extra:not([hidden]) { display: block; }

/* Importación */
.cl-drop {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-6) var(--sp-4); text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); transition: border-color var(--dur-1), background var(--dur-1);
}
.cl-drop.is-over { border-color: var(--brand); background: var(--brand-soft); }
.cl-drop__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text-3); }
.cl-drop__title { font-weight: var(--fw-semibold); }
.cl-drop__hint { max-width: 440px; font-size: var(--fs-12); color: var(--text-3); }
.cl-drop__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-1); }
.cl-paste > summary { display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; color: var(--link); font-size: var(--fs-13); font-weight: var(--fw-medium); border-radius: var(--radius-sm); }
.cl-map { max-height: 300px; box-shadow: none; }
.cl-map__sample { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.cl-map .select--sm { min-width: 170px; }
.cl-import__summary { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-import__summary .badge { height: auto; min-height: 22px; padding-block: 3px; white-space: normal; line-height: 1.3; }
.cl-views-list .list-item { padding-inline: 0; }

@media (max-width: 767px) {
  .cl-header .page-header__actions .cl-new { flex: 1 1 auto; }
  .cl-header .page-header__actions .cl-io { flex: none; width: 44px; }
  .cl-tabs { margin-inline: calc(var(--sp-4) * -1); padding-inline: var(--sp-4); }
  .cl-toolbar { gap: var(--sp-2); }
  .cl-searchrow { flex: 1 1 100%; max-width: none; }
  .cl-filters-btn { width: 44px; padding: 0; }
  .cl-quickrow { flex: 1 1 100%; margin: 0 calc(var(--sp-4) * -1); padding: 2px var(--sp-4); }
  .cl-scope .segmented__item > span { min-height: 34px; }
  .cl-summary { margin-bottom: var(--sp-3); }
  .cl-bulk {
    position: fixed; left: var(--sp-3); right: var(--sp-3); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-2)); width: auto; margin: 0;
    padding: 6px 6px 6px var(--sp-3); flex-wrap: wrap; z-index: calc(var(--z-tabbar) - 1);
  }
  /* Dos filas a propósito: cantidad + cerrar arriba, acciones repartidas abajo
     (en una sola fila la X caía sola a una segunda línea). */
  .cl-bulk { row-gap: 2px; }
  .cl-bulk__count { flex: 1 1 auto; }
  .cl-bulk > .btn { order: 1; }
  .cl-bulk__actions { order: 2; flex: 1 1 100%; flex-wrap: nowrap; justify-content: space-between; }
  .cl-bulk__actions .btn span { display: none; }
  .cl-bulk__actions .btn, .cl-bulk > .btn { --btn-h: 44px; width: 44px; padding: 0; }
  .cl.has-bulk { padding-bottom: 128px; }
  body.cl-bulk-on .toasts:not(.toasts--top) { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 118px); }
  .cl-fopt { min-height: 44px; align-items: center; }
  .cl-fopt input { margin-top: 0; }
  .cl-tempopt > span { height: 40px; }
  .cl-map .select--sm { min-width: 150px; height: 40px; }
}

/* =============================== FICHA ================================= */
.cf { container-type: inline-size; container-name: cf; }
.cf-page { padding-top: var(--sp-5); }
@media (min-width: 1280px) { .cf-page { padding-inline: var(--sp-6); } }

/* Encabezado */
.cf-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-4) var(--sp-6); margin-bottom: var(--sp-4); }
.cf-head__id { display: flex; gap: var(--sp-4); min-width: 0; flex: 1 1 420px; }
.cf-head__id > .avatar { font-size: 20px; }
.cf-head__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf-head__titlerow { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
.cf-title { overflow-wrap: anywhere; }
.cf-head__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-13); color: var(--text-3); }
.cf-head__meta span { display: inline-flex; align-items: center; gap: 4px; }
.cf-head__meta a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.cf-head__meta a:hover { color: var(--link); }
.cf-head__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cf-scorebadge strong { color: var(--text); }
.cf-head__side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-3); flex: 0 1 auto; min-width: 0; }
.cf-owner { display: flex; align-items: center; gap: var(--sp-2); }
.cf-owner__label { font-size: var(--fs-12); color: var(--text-3); }
.cf-owner__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 6px; max-width: 260px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1);
  font-size: var(--fs-13); font-weight: var(--fw-medium); color: var(--text); transition: background var(--dur-1);
}
.cf-owner__btn:hover { background: var(--hover); }
.cf-owner__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cf-owner__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-owner__btn > .icon { color: var(--text-3); }
.cf-head__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* Buyer journey */
.cf-path { padding: var(--sp-4) var(--sp-4) 0; margin-bottom: var(--sp-4); overflow: hidden; }
.cf-path__head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.cf-sec-title { font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.cf-path__meta { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 2px; font-size: var(--fs-13); color: var(--text-3); }
.cf-path__meta strong { color: var(--text); font-weight: var(--fw-semibold); }
.cf-path__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-lostbox { margin-bottom: var(--sp-3); }
.cf-path__scroll { overflow-x: auto; margin: 0 calc(var(--sp-4) * -1); padding: 4px var(--sp-4) var(--sp-4); scrollbar-width: thin; overscroll-behavior-x: contain; }
.cf-path__groups { display: flex; gap: 10px; width: 100%; min-width: max-content; }
.cf-pg { --pg: var(--text-4); --pg-text: var(--text-3); --pg-soft: var(--surface-3); --pg-strong: var(--text-3);
  display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: max-content; }
.cf-pg--tofu { --pg: var(--tofu); --pg-text: var(--tofu-text); --pg-soft: var(--tofu-soft); --pg-strong: var(--tofu-text); }
.cf-pg--mofu { --pg: var(--mofu); --pg-text: var(--mofu-text); --pg-soft: var(--mofu-soft); --pg-strong: var(--mofu-text); }
.cf-pg--bofu { --pg: var(--bofu); --pg-text: var(--bofu-text); --pg-soft: var(--bofu-soft); --pg-strong: var(--bofu-text); }
.cf-pg--cliente { --pg: var(--won); --pg-text: var(--won-text); --pg-soft: var(--won-soft); --pg-strong: var(--won-text); }
[data-theme="dark"] .cf-pg { --pg-strong: var(--pg); }
.cf-pg__label { display: flex; align-items: baseline; gap: 2px; padding-bottom: 5px; border-bottom: 2px solid var(--pg); font-family: var(--mono); font-size: 11px; font-weight: var(--fw-medium); letter-spacing: .05em; color: var(--pg-text); white-space: nowrap; }
.cf-pg__name { font-family: var(--font); font-size: var(--fs-12); letter-spacing: 0; font-weight: var(--fw-regular); color: var(--text-3); }
.cf-pg__steps { display: flex; }
.cf-step-li { display: flex; flex: 1 1 0; min-width: max-content; }
.cf-step-li + .cf-step-li { margin-left: -6px; }
.cf-step-li:focus-within { position: relative; z-index: 1; outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.cf-step {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 4px; height: 34px; padding: 0 16px 0 20px;
  font-size: var(--fs-13); font-weight: var(--fw-medium); white-space: nowrap; background: var(--surface-3); color: var(--text-3);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.cf-step-li:first-child .cf-step { padding-left: 12px; border-radius: 4px 0 0 4px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.cf-pg:last-child .cf-step-li:only-child .cf-step { padding: 0 14px; border-radius: 4px; clip-path: none; }
.cf-step:focus-visible { outline: none; }
.cf-step.is-done { background: var(--pg-soft); color: var(--pg-text); }
.cf-step.is-current { background: var(--pg-strong); color: #fff; font-weight: var(--fw-semibold); }
[data-theme="dark"] .cf-step.is-current { color: #0b1120; }
.cf-step.is-future:hover, .cf-step.is-done:hover { background: color-mix(in srgb, var(--pg) 22%, var(--surface)); color: var(--pg-text); }
.cf-step.is-lostat { background: var(--lost-soft); color: var(--lost-text); box-shadow: inset 0 0 0 1px var(--lost); }

.cf-keys { border-top: 1px solid var(--border); margin: 0 calc(var(--sp-4) * -1); }
.cf-keys__bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 var(--sp-3); min-height: 44px; padding: 0 var(--sp-4) 0 var(--sp-2); }
.cf-keys__toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 var(--sp-2); border-radius: var(--radius); font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--text); }
.cf-keys__toggle:hover { background: var(--hover); }
.cf-keys__chev { color: var(--text-3); transform: rotate(-90deg); transition: transform var(--dur-2) var(--ease); }
.cf-keys.is-open .cf-keys__chev { transform: none; }
.cf-keys__count { padding: 1px 8px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-3); font-size: var(--fs-12); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.cf-keys__count.is-done { background: var(--success-soft); color: var(--success-text); }
.cf-keys__time { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--text-3); padding: 6px 0; }
.cf-keys__time strong { color: var(--text); font-weight: var(--fw-semibold); }
.cf-keys__body { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--sp-3) var(--sp-6); padding: var(--sp-1) var(--sp-4) var(--sp-4); }
.cf-keys__guide { padding-left: var(--sp-3); border-left: 3px solid var(--brand); font-size: var(--fs-13); line-height: 1.55; color: var(--text-2); align-self: start; }
.cf-keys__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 2px var(--sp-5); }
.cf-keys__list .checkbox { padding: 5px 0; font-size: var(--fs-13); }
.cf-keys__list .checkbox input:checked + span { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.cf-move { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cf-move > .icon { color: var(--text-4); }

/* Pestañas (modo angosto) y grilla */
.cf-tabs.tabs { display: none; margin-bottom: var(--sp-4); position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 6; background: var(--bg); }
.cf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.cf-col { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
@container cf (min-width: 1140px) {
  .cf-grid { grid-template-columns: 300px minmax(0, 1fr) 300px; }
  .cf-col--left { grid-column: 1; grid-row: 1; }
  .cf-col--center { grid-column: 2; grid-row: 1; }
  .cf-col--right { grid-column: 3; grid-row: 1; }
}
@container cf (min-width: 800px) and (max-width: 1139.98px) {
  .cf-grid { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto 1fr; }
  .cf-col--center { grid-column: 1; grid-row: 1 / span 2; }
  .cf-col--right { grid-column: 2; grid-row: 1; }
  .cf-col--left { grid-column: 2; grid-row: 2; }
}
@container cf (max-width: 799.98px) {
  .cf-tabs.tabs { display: flex; }
  .cf-grid[data-active="actividad"] .cf-col:not(.cf-col--center),
  .cf-grid[data-active="datos"] .cf-col:not(.cf-col--left),
  .cf-grid[data-active="tareas"] .cf-col:not(.cf-col--right) { display: none; }
  .cf-keys__body { grid-template-columns: minmax(0, 1fr); }
  .cf-comp__grid { grid-template-columns: minmax(0, 1fr); }
  .cf-head__side { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; width: 100%; }
  .cf-head__actions { justify-content: flex-start; }
}

/* Tarjetas de la ficha */
.cf-card .card__header, .cf-tl .card__header { min-height: 48px; padding: 10px var(--sp-4); }
.cf-card .card__title .count, .cf-tl .card__title .count { font-weight: var(--fw-medium); }
.cf-card .card__title > .icon, .cf-tl .card__title > .icon { color: var(--text-3); }
.cf-card__empty { padding: var(--sp-3) var(--sp-4) var(--sp-4); font-size: var(--fs-13); color: var(--text-3); }

/* Datos editables en línea */
.cf-fields { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0 var(--sp-4) var(--sp-4); }
.cf-fgroup { margin: var(--sp-4) 0 var(--sp-1); font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); }
.cf-fgroup:first-child { margin-top: var(--sp-3); }
.cf-f { position: relative; display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: start; gap: 8px; min-height: 32px; }
.cf-f__label { padding-top: 6px; font-size: var(--fs-13); line-height: 20px; color: var(--text-3); }
.cf-f__value { min-width: 0; }
.cf-f__btn {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; width: calc(100% + 8px); min-height: 32px; margin-left: -8px; padding: 6px 8px;
  border-radius: var(--radius-sm); text-align: left; font-size: var(--fs-13); line-height: 20px; color: var(--text); overflow-wrap: anywhere; transition: background var(--dur-1);
}
.cf-f__btn:hover { background: var(--hover); }
.cf-f__text { flex: 1 1 auto; min-width: 0; }
.cf-f__btn:focus-visible { outline-offset: 0; }
.cf-f__btn .badge { margin-top: -1px; }
.cf-f__pen { flex: none; margin-top: 3px; color: var(--text-4); opacity: 0; transition: opacity var(--dur-1); }
.cf-f__btn:hover .cf-f__pen, .cf-f__btn:focus-visible .cf-f__pen { opacity: 1; }
.cf-f__ph { color: var(--text-4); }
.cf-f--wide { grid-template-columns: minmax(0, 1fr); gap: 0; }
.cf-f--wide .cf-f__label { padding-top: 4px; }
.cf-f__label.sr-only { padding: 0; }
.cf-f__static { padding: 6px 0; font-size: var(--fs-13); line-height: 20px; }
.cf-f__input { margin: 1px 0; }
.cf-f__help { margin-top: 4px; font-size: 11px; color: var(--text-4); }
.cf-f .field__error { margin-top: 4px; }
.cf-f.is-editing .cf-f__label { color: var(--text); }
.cf-f.is-saved .cf-f__btn { animation: cf-saved 1.6s var(--ease) 1; }
.cf-f.is-saved::after { content: "Guardado"; position: absolute; right: 0; top: -2px; font-size: 11px; font-weight: var(--fw-medium); color: var(--success-text); }
@keyframes cf-saved { 0%, 40% { background: var(--success-soft); } 100% { background: transparent; } }
.cf-f__value--link { display: flex; align-items: center; gap: 2px; min-height: 32px; }
.cf-f__link { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-13); }
.cf-f__note { display: block; margin-top: 2px; font-size: var(--fs-12); color: var(--text-4); }
.cf-tagsrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cf-tagedit { display: block; }
.cf-tag:hover { background: var(--active); color: var(--text); text-decoration: none; }
.cf-consent { font-size: var(--fs-13); }
.cf-f--bare { display: block; }

/* Contactos */
.cf-contacts { display: flex; flex-direction: column; }
.cf-contact { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-2) var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.cf-contact:first-child { border-top: 0; }
.cf-contact__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cf-contact__top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cf-contact__name { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--text); }
.cf-contact__role { font-size: var(--fs-12); color: var(--text-3); }
.cf-contact__links { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 4px; }
.cf-contact__link { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; max-width: 100%; font-size: var(--fs-12); color: var(--link); border-radius: var(--radius-sm); }
.cf-contact__link:first-child { flex-basis: 100%; }
.cf-contact__link .icon { flex: none; }
.cf-contact__wa { color: var(--success-text); }
.cf-contact__menu { flex: none; }

/* Score */
.cf-score__big { display: inline-flex; align-items: baseline; gap: 2px; font-size: var(--fs-13); }
.cf-score__big strong { font-size: var(--fs-20); font-weight: var(--fw-semibold); }
.cf-score--high strong { color: var(--success-text); }
.cf-score--mid strong { color: var(--brand-text); }
.cf-score--low strong { color: var(--text-2); }
.cf-score__bar { margin-bottom: var(--sp-3); }
.cf-score__bar.cf-score--high { --c: var(--success); }
.cf-score__bar.cf-score--mid { --c: var(--brand); }
.cf-score__bar.cf-score--low { --c: var(--text-4); }
.cf-score__intro { margin-bottom: var(--sp-3); font-size: var(--fs-12); color: var(--text-3); line-height: 1.5; }
.cf-signals { display: flex; flex-direction: column; gap: 6px; }
.cf-signal { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-13); line-height: 1.45; color: var(--text-2); }
.cf-signal .icon { flex: none; margin-top: 3px; stroke-width: 2.4; }
.cf-signal.is-good .icon { color: var(--success-text); }
.cf-signal.is-bad .icon { color: var(--danger-text); }
.cf-signal.is-neutral .icon { color: var(--text-4); }

/* Composer */
.cf-composer { overflow: visible; }
.cf-comp__tabs { display: flex; gap: 2px; padding: 4px var(--sp-2) 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.cf-comp__tabs::-webkit-scrollbar { display: none; }
.cf-comp__tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; flex: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: var(--fs-13); font-weight: var(--fw-medium); color: var(--text-3); white-space: nowrap;
}
.cf-comp__tab:hover { color: var(--text); }
.cf-comp__tab[aria-selected="true"] { color: var(--text); }
.cf-comp__tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--brand); }
.cf-comp__tab[aria-selected="true"] .icon { color: var(--brand-text); }
.cf-comp__tab:focus-visible { outline-offset: -2px; }
.cf-cpane { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.cf-comp__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.cf-comp__grid .field .input { margin-top: var(--sp-2); }
.cf-comp__grid .field .select + .input { margin-top: var(--sp-2); }
.cf-comp__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
.cf-comp__hint { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: var(--fs-12); color: var(--text-3); }
.cf-comp__btns { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-left: auto; }
.cf-comp__foot > .btn--primary { margin-left: auto; }
.cf-note { min-height: 80px; }
.cf-mention-wrap { position: relative; }
.cf-mention {
  position: absolute; left: 8px; top: calc(100% + 4px); z-index: 30; width: min(320px, calc(100% - 16px));
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3);
}
.cf-mention .menu__item { white-space: normal; }
.cf-mention-tag { padding: 0 2px; border-radius: 3px; background: var(--brand-soft); color: var(--brand-text); font-weight: var(--fw-medium); }
.cf-callrow { display: flex; gap: var(--sp-2); }
.cf-callrow .select { flex: 1 1 auto; min-width: 0; }
.cf-callrow .btn { flex: none; }
.cf-follow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.cf-follow__when { display: flex; gap: var(--sp-2); }
.cf-follow__when input[type="date"] { width: 156px; }
.cf-follow__when input[type="time"] { width: 108px; }
.cf-dt { display: flex; gap: var(--sp-2); }
.cf-dt input[type="date"] { flex: 1 1 58%; }
.cf-dt input[type="time"] { flex: 1 1 42%; }
.cf-who { min-width: 0; margin: 0; padding: 0; border: 0; }
.cf-who__list { display: flex; flex-wrap: wrap; gap: 6px var(--sp-4); margin-top: 6px; }
.cf-who__list .checkbox { font-size: var(--fs-13); }
.cf-wa-meta { display: flex; justify-content: space-between; gap: var(--sp-2); font-family: var(--mono); }

/* Línea de tiempo */
.cf-tl__filters { padding: var(--sp-3) var(--sp-4) 0; }
.cf-tl__body { padding: var(--sp-1) var(--sp-4) var(--sp-4); }
.cf-day__label { padding: var(--sp-4) 0 var(--sp-2); font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--text-3); }
.cf-day__label::first-letter { text-transform: uppercase; }
.cf-events { display: flex; flex-direction: column; }
.cf-ev { position: relative; display: flex; gap: var(--sp-3); padding-bottom: var(--sp-4); }
.cf-ev::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 1px; background: var(--border); }
.cf-ev:last-child { padding-bottom: 0; }
.cf-ev:last-child::before { display: none; }
.cf-ev__icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-3); box-shadow: 0 0 0 3px var(--surface); }
.cf-ev__icon .icon { width: 14px; height: 14px; }
.cf-ev--nota .cf-ev__icon { background: var(--amber-bg); color: var(--amber-fg); }
.cf-ev--email .cf-ev__icon { background: var(--blue-bg); color: var(--blue-fg); }
.cf-ev--whatsapp .cf-ev__icon { background: var(--green-bg); color: var(--green-fg); }
.cf-ev--llamada .cf-ev__icon { background: var(--teal-bg); color: var(--teal-fg); }
.cf-ev--reunion .cf-ev__icon { background: var(--purple-bg); color: var(--purple-fg); }
.cf-ev--formulario .cf-ev__icon { background: var(--brand-soft); color: var(--brand-text); }
.cf-ev--tarea .cf-ev__icon { background: var(--success-soft); color: var(--success-text); }
.cf-ev--f-tofu .cf-ev__icon { background: var(--tofu-soft); color: var(--tofu-text); }
.cf-ev--f-mofu .cf-ev__icon { background: var(--mofu-soft); color: var(--mofu-text); }
.cf-ev--f-bofu .cf-ev__icon { background: var(--bofu-soft); color: var(--bofu-text); }
.cf-ev--f-cliente .cf-ev__icon { background: var(--won-soft); color: var(--won-text); }
.cf-ev--f-perdido .cf-ev__icon { background: var(--lost-soft); color: var(--lost-text); }
.cf-ev__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding-top: 4px; }
.cf-ev__main > * { max-width: 100%; }
.cf-ev__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cf-ev__title { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--text); overflow-wrap: anywhere; }
.cf-ev__to { font-size: var(--fs-12); color: var(--text-3); overflow-wrap: anywhere; }
.cf-ev__text { font-size: var(--fs-13); line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
.cf-ev__text.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cf-ev__note { padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warning); color: var(--text); }
.cf-ev__bubble { max-width: min(100%, 520px); }
.cf-ev__bubble .cf-ev__text { padding: 8px 12px; border-radius: 12px 12px 12px 3px; background: var(--green-bg); color: var(--text); }
.cf-ev__quote { margin: 0; padding: 6px 12px; border-left: 3px solid var(--border-strong); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); }
.cf-ev__details { width: 100%; }
.cf-ev__details > summary { display: inline-flex; align-items: center; min-height: 28px; cursor: pointer; font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--link); border-radius: var(--radius-sm); }
.cf-ev__dl { margin: 6px 0 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: var(--fs-12); }
.cf-ev__stage { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cf-ev__stage > .icon { color: var(--text-4); }
.cf-ev__small { font-size: var(--fs-12); line-height: 1.5; color: var(--text-3); overflow-wrap: anywhere; }
.cf-ev__foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--fs-12); color: var(--text-4); }
.cf-ev__who { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); }
.cf-ev__who--auto .icon { color: var(--text-4); }
.cf-ev__more { height: auto; font-size: var(--fs-12); }
.cf-ev--sistema .cf-ev__title { font-weight: var(--fw-regular); color: var(--text-3); }
.cf-ev.is-new .cf-ev__icon { animation: cf-new-ring 2.4s var(--ease) 1; }
@keyframes cf-new-ring { 0%, 40% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px color-mix(in srgb, var(--brand) 45%, transparent); } 100% { box-shadow: 0 0 0 3px var(--surface); } }
.cf-file { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-13); }
.cf-file > .icon { color: var(--text-3); }
.cf-file__name { font-weight: var(--fw-medium); max-width: 260px; }

/* Columna derecha */
.cf-next { padding: var(--sp-1) var(--sp-4) var(--sp-3); }
.cf-next__btn { font-size: var(--fs-14); }
.cf-tasks { display: flex; flex-direction: column; }
.cf-task { display: flex; align-items: flex-start; gap: 4px; padding: 6px var(--sp-4) 8px 8px; border-top: 1px solid var(--border); transition: opacity var(--dur-2); }
.cf-tasks .cf-task:first-child { border-top: 0; }
.cf-task.is-overdue { background: color-mix(in srgb, var(--danger-soft) 60%, transparent); box-shadow: inset 3px 0 0 var(--danger); }
.cf-task.is-completing, .cf-task.is-reopening { opacity: .45; }
.cf-task__check { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--text-4); transition: color var(--dur-1), background var(--dur-1); }
.cf-task__check .icon { width: 18px; height: 18px; }
.cf-task__check:hover { color: var(--success-text); background: var(--success-soft); }
.cf-task.is-done .cf-task__check { color: var(--success-text); }
.cf-task__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 8px; }
.cf-task__title { text-align: left; font-size: var(--fs-13); font-weight: var(--fw-medium); line-height: 1.4; color: var(--text); overflow-wrap: anywhere; border-radius: var(--radius-sm); }
.cf-task__title:hover { color: var(--link); }
.cf-task.is-done .cf-task__title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.cf-task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; font-size: var(--fs-12); color: var(--text-3); }
.cf-task__type, .cf-task__who { display: inline-flex; align-items: center; gap: 4px; }
.cf-task__due--overdue { color: var(--danger-text); font-weight: var(--fw-semibold); }
.cf-task__due--today { color: var(--warning-text); font-weight: var(--fw-semibold); }
.cf-task__due--upcoming { color: var(--text-2); }
.cf-task__auto { padding: 0 4px; border: 1px solid var(--border-strong); border-radius: 3px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.cf-tasks__done { padding: var(--sp-1) var(--sp-2) var(--sp-2); border-top: 1px solid var(--border); }
.cf-tasks__done .cf-tasks { margin: 0 calc(var(--sp-2) * -1) calc(var(--sp-2) * -1); }
.cf-tasks__toggle .icon { transition: transform var(--dur-2) var(--ease); transform: rotate(-90deg); }
.cf-tasks__toggle[aria-expanded="true"] .icon { transform: none; }

.cf-forms li + li { border-top: 1px solid var(--border); }
.cf-form { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-4); color: inherit; }
.cf-form:hover { background: var(--hover); text-decoration: none; }
.cf-form__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cf-form__title { font-size: var(--fs-13); font-weight: var(--fw-medium); color: var(--text); }
.cf-form__meta { font-size: var(--fs-12); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-form__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cf-sla { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.cf-sla.is-late { color: var(--danger-text); font-weight: var(--fw-semibold); }

.cf-files { padding: var(--sp-1) var(--sp-4) var(--sp-4); }
.cf-filelist { display: flex; flex-direction: column; margin-bottom: var(--sp-2); }
.cf-fileitem { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.cf-fileitem__icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--radius); background: var(--surface-3); color: var(--text-3); }
.cf-fileitem__main { display: flex; flex-direction: column; min-width: 0; }
.cf-fileitem__name { font-size: var(--fs-13); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-fileitem__meta { font-size: var(--fs-12); color: var(--text-3); overflow-wrap: anywhere; }
.cf-drophint { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 6px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; font-size: var(--fs-12); color: var(--text-3); }
.cf-drophint__limits { flex-basis: 100%; color: var(--text-4); }
.cf-card[data-sec="files"].is-over .cf-drophint { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.cf-card.is-busy { opacity: .6; pointer-events: none; }

.cf-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cf-metric { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.cf-metric:nth-child(odd) { border-right: 1px solid var(--border); }
.cf-metric:nth-last-child(-n + 2) { border-bottom: 0; }
.cf-metric__label { font-size: var(--fs-12); color: var(--text-3); }
.cf-metric__value { font-size: 18px; line-height: 26px; font-weight: var(--fw-semibold); color: var(--text); }
.cf-metric__sub { font-size: var(--fs-12); color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-firstresp { display: flex; align-items: flex-start; gap: 6px; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-12); line-height: 1.45; color: var(--text-2); }
.cf-firstresp .icon { flex: none; margin-top: 1px; }
.cf-firstresp.is-ok .icon { color: var(--success-text); }
.cf-firstresp.is-late .icon { color: var(--warning-text); }

/* Barra de acciones fija (móvil) */
.cf-actionbar { display: none; }

@media (hover: none) {
  .cf-f__pen { opacity: .55; }
  .cl-table .col-actions .btn { opacity: 1; }
}

@media (max-width: 767px) {
  .cf-page { padding-top: var(--sp-4); padding-bottom: calc(var(--sp-8) + 72px); }
  .cf-head { gap: var(--sp-3); margin-bottom: var(--sp-3); }
  .cf-head__id { flex-basis: 100%; gap: var(--sp-3); }
  .cf-head__id > .avatar { --av-size: 44px; font-size: 16px; }
  .cf-title { font-size: var(--fs-20); line-height: 26px; }
  .cf-head__meta { font-size: var(--fs-12); gap: 2px 10px; }
  .cf-head__actions .btn:not([data-act="more"]) { display: none; }
  .cf-head__actions .btn[data-act="more"] { width: 44px; height: 44px; }
  .cf-owner__btn { height: 44px; }
  .cf-path { padding-top: var(--sp-3); }
  .cf-path__actions { width: 100%; }
  .cf-path__actions .btn { flex: 1 1 auto; }
  .cf-step { height: 44px; }
  .cf-keys__time { padding-left: var(--sp-2); }
  .cf-tabs.tabs { margin-inline: calc(var(--sp-4) * -1); padding-inline: var(--sp-4); }
  .cf-tabs .tab { flex: 1 1 0; justify-content: center; }
  .cf-f { grid-template-columns: minmax(96px, 36%) minmax(0, 1fr); min-height: 44px; }
  .cf-f--wide { grid-template-columns: minmax(0, 1fr); }
  .cf-f__btn { min-height: 44px; padding-block: 12px; }
  .cf-f__label { padding-top: 12px; }
  .cf-f--wide .cf-f__label { padding-top: 8px; }
  .cf-f__value--link { min-height: 44px; }
  .cf-f__value--link .btn { width: 44px; height: 44px; }
  .cf-contact__link { min-height: 40px; font-size: var(--fs-13); }
  .cf-contact__menu { width: 44px; height: 44px; }
  .cf-comp__tab { height: 44px; }
  .cf-follow__when { width: 100%; }
  .cf-follow__when input { flex: 1 1 0; width: auto !important; }
  .cf-task__check { width: 44px; height: 44px; }
  .cf-task__main { padding-top: 11px; }
  .cf-task__title { min-height: 24px; }
  .cf-form { min-height: 56px; }
  .cf-ev__details > summary { min-height: 40px; }
  .cf-actionbar {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; position: fixed; left: 0; right: 0; z-index: calc(var(--z-tabbar) - 1);
    bottom: calc(var(--tabbar-h) + var(--safe-bottom)); padding: 6px calc(8px + var(--safe-right)) 6px calc(8px + var(--safe-left));
    background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--border); box-shadow: 0 -4px 14px rgba(14, 26, 51, .06);
    backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  }
  .cf-actionbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-2);
  }
  .cf-actionbar button .icon { width: 20px; height: 20px; color: var(--brand-text); }
  .cf-actionbar button:active { background: var(--active); }
  .cf-actionbar button:focus-visible { outline-offset: -2px; }
  body.cf-active .toasts:not(.toasts--top) { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 76px); }
}
