/* ═══════════════════════════════════════════════════════════
   Tablero (ADR 0055): una sola pantalla, sin desplazarse.
   Barra única (pestañas · filtros · acciones) y debajo las tarjetas repartidas en FILAS que se completan: cada fila suma el ancho disponible (las tarjetas se estiran, nunca queda un hueco) y las
   filas se reparten el alto de la pantalla en proporción a lo que necesita cada clase de tarjeta. Si no entra, se desplaza; en celular va una tarjeta por fila.
   Mismo lenguaje que la app de campo: neutros, blanco como acento, mono en etiquetas y cifras. Solo lo propio del tablero: lo demás (botones, diálogos) es de account.css.
   ═══════════════════════════════════════════════════════════ */
.tb-page, .tb-detail {
  --tb-data: #E6E8EC;                   /* datos: el blanco de la app (su único acento); el color queda para los estados */
  --tb-surface: #111111;                /* paneles de la app */
  --tb-line: rgba(255, 255, 255, .14);  /* borde de la app */
  --tb-mono: var(--font-mono);
}
.tb-page { position: relative; display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; padding: 12px 16px 14px; }

/* ── Barra única ── */
.tb-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.tb-tabs { display: flex; align-items: center; flex: 1 1 0; gap: 6px; min-width: 150px; overflow-x: auto; scrollbar-width: none; }
.tb-tabs::-webkit-scrollbar { display: none; }
.tb-tab { display: inline-flex; flex: none; align-items: center; gap: 8px; height: 30px; padding: 0 13px; color: var(--t2); font-family: var(--font-sans); font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--tb-surface); border: 1px solid var(--tb-line); border-radius: 999px; cursor: pointer; }
.tb-tab:hover { color: var(--t1); background: var(--s2); }
.tb-tab.active { color: #080808; background: #F2F2F2; border-color: #F2F2F2; }
.tb-tab.active .tb-tab-tools button { color: #55585f; }
.tb-tab.active .tb-tab-tools button:hover { color: #080808; }
.tb-tab-tools { display: inline-flex; gap: 2px; margin-left: 2px; }
.tb-tab-tools button { padding: 0 3px; color: var(--t3); background: none; border: 0; cursor: pointer; font-size: 12px; line-height: 1; }
.tb-tab-tools button:hover { color: var(--t1); }
.tb-tab-add { color: var(--t1); border-style: dashed; }
.tb-tabform { display: flex; align-items: center; gap: 8px; }
.tb-tabform input { max-width: 260px; }
.tb-bar-filters { display: flex; flex: none; align-items: center; gap: 6px 8px; }
.tb-chips { display: inline-flex; gap: 4px; }
.tb-chip { height: 28px; white-space: nowrap; padding: 0 11px; color: var(--t2); font-family: var(--tb-mono); font-size: 11.5px; font-weight: 600; background: var(--tb-surface); border: 1px solid var(--tb-line); border-radius: 999px; cursor: pointer; }
.tb-chip:hover { color: var(--t1); }
.tb-chip.on { color: #080808; background: #F2F2F2; border-color: #F2F2F2; }
/* Con el prefijo .tb-page para ganarle a `.account-v2 select` (que pone relleno de 10 px y cortaba el texto). */
.tb-page .tb-select { box-sizing: border-box; height: 30px; max-width: 180px; padding: 0 28px 0 12px; color: var(--t1); font-family: var(--font-sans); font-size: 12.5px; line-height: 1.2; background-color: var(--tb-surface); border: 1px solid var(--tb-line); border-radius: 999px; cursor: pointer; }
.tb-select:focus-visible, .tb-chip:focus-visible, .tb-tab:focus-visible { outline: 2px solid #F2F2F2; outline-offset: 2px; }
.tb-bar-actions { display: inline-flex; flex: none; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tb-notice { margin: 0; }

/* ── La pantalla es una grilla de 24 × 12 celdas que se reparten TODO el espacio disponible (sin bordes, en cualquier monitor); cada tarjeta ocupa siempre el mismo rectángulo de celdas. ── */
.tb-stage { position: relative; display: flex; flex: 1 1 0; align-items: center; justify-content: center; min-height: 0; }
.tb-board { position: relative; display: grid; flex: 1 1 auto; align-self: stretch; width: 100%; min-height: 0; }
.tb-free { border: 1px dashed rgba(255, 255, 255, .22); border-radius: 6px; background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(255, 255, 255, .04) 5px 6px); pointer-events: none; }
.tb-ghost { z-index: 20; border: 2px solid var(--lime); border-radius: 12px; background: rgba(132, 204, 22, .14); pointer-events: none; }
.tb-ghost.bad { border-color: var(--red); background: rgba(239, 68, 68, .16); }
.tb-card.outside { outline: 2px solid var(--red); outline-offset: -2px; }
/* Pantalla muy chica: las tarjetas van una debajo de otra y la página se desplaza (no se edita). */
.tb-stage.is-list { display: block; flex: none; width: 100%; overflow: visible; }
.tb-board.is-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.tb-board.is-list .tb-card { flex: none; width: 100%; }
.tb-card { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; container-type: inline-size; background: var(--tb-surface); border: 1px solid var(--tb-line); border-radius: 12px; }
.tb-card.off { opacity: .55; }
.tb-card.dragging { opacity: .35; }
.tb-board.editing .tb-card { cursor: grab; outline: 1px dashed var(--b); outline-offset: -1px; }
.tb-board.editing .tb-card:hover { outline-color: var(--primary); }
.tb-card-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--b); }
.tb-card-head h3 { margin: 0; overflow: hidden; color: var(--t2); font-family: var(--tb-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.tb-card-tools { display: inline-flex; flex: none; align-items: center; gap: 4px; }
.tb-card-tools button { padding: 3px 8px; color: var(--t2); background: var(--s2); border: 1px solid var(--b); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.tb-card-tools button:hover { color: var(--t1); border-color: var(--primary); }
.tb-card-tools button.on { color: var(--t1); background: var(--primary-g); border-color: var(--primary); }
.tb-card-tools button.danger:hover { color: var(--red); border-color: var(--red); }
.tb-card-body { position: relative; display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; padding: 8px 14px; color: var(--t3); font-size: 13px; text-align: center; }
.tb-fill { width: 100%; }
/* Gráficos y mapa: ocupan todo el espacio que les deja la tarjeta (el SVG se arma con ese alto). */
.tb-card.k-hbar .tb-fill, .tb-card.k-bar .tb-fill, .tb-card.k-line .tb-fill, .tb-card.k-stack .tb-fill, .tb-card.k-map .tb-fill { position: absolute; inset: 8px 10px 6px; width: auto; }
.tb-card.k-map .tb-fill { inset: 8px; }
.tb-skel { width: 100%; display: grid; gap: 8px; }
.tb-skel i { display: block; height: 10px; background: var(--s3); border-radius: 5px; }
.tb-skel i:nth-child(2) { width: 70%; }
.tb-skel i:nth-child(3) { width: 45%; }

/* ── Explicación (ⓘ) ── */
.tb-card-info { gap: 2px; }
.tb-page .tb-size { box-sizing: border-box; height: 26px; max-width: 76px; padding: 0 20px 0 8px; color: var(--t1); font-family: var(--tb-mono); font-size: 11px; background-color: var(--s2); border: 1px solid var(--b); border-radius: var(--radius-sm); cursor: pointer; }
.tb-card-tools button.tb-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; color: var(--t2); background: none; border: 0; border-radius: var(--radius-sm); }
.tb-card-tools button.tb-icon:hover { color: var(--t1); background: var(--s2); }
.tb-card-tools button.tb-icon.on { color: #080808; background: #F2F2F2; }
.tb-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-pop { position: absolute; top: 40px; z-index: 30; width: 320px; padding: 12px 14px; color: var(--t2); text-align: left; background: #1A1A1A; border: 1px solid var(--tb-line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); font-size: 12.5px; line-height: 1.5; }
.tb-pop b { color: var(--t1); font-family: var(--tb-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.tb-pop p { margin: 2px 0 10px; }
.tb-pop p:last-child { margin-bottom: 0; }

/* ── Detalle ── */
.tb-detail { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.tb-what { margin: 0 0 14px; color: var(--t1); font-size: 14px; line-height: 1.5; }
.tb-how { margin: 14px 0; color: var(--t2); font-size: 12.5px; line-height: 1.5; }
.tb-how b { color: var(--t1); font-weight: 600; }
.tb-table-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--tb-line); border-radius: 8px; }
.tb-table { width: 100%; border-collapse: collapse; font-family: var(--tb-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.tb-table th { position: sticky; top: 0; padding: 8px 12px; color: var(--t2); text-align: right; background: #1A1A1A; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.tb-table td { padding: 7px 12px; color: var(--t1); text-align: right; border-top: 1px solid var(--b); }
.tb-table th:first-of-type, .tb-table td:first-of-type { color: var(--t2); text-align: left; }
.tb-detail .tb-chart { position: relative; inset: auto; width: 100%; }

/* ── Indicadores: la cifra crece con la tarjeta ── */
/* La cifra, la variación y el detalle ocupan el espacio de la tarjeta: crecen con su ancho y su alto (container queries sobre el cuerpo). */
.tb-card.k-kpi .tb-card-body { container-type: size; padding: 6px 14px; }
.tb-card.k-kpi .tb-fill { height: 100%; }
.tb-kpi { display: grid; align-content: center; gap: 3cqh; justify-items: start; height: 100%; text-align: left; width: 100%; }
.tb-kpi-value { color: var(--t1); font-family: var(--tb-mono); font-size: clamp(28px, min(21cqw, 38cqh), 150px); font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tb-kpi-delta { display: inline-flex; align-items: center; padding: 0.3em 0.7em; border-radius: 999px; font-size: clamp(11.5px, min(5.4cqw, 9cqh), 24px); font-weight: 600; line-height: 1.3; }
.tb-kpi-delta.good { color: var(--lime); background: rgba(132, 204, 22, .12); }
.tb-kpi-delta.bad { color: var(--red); background: rgba(239, 68, 68, .12); }
.tb-kpi-delta.flat { color: var(--t2); background: var(--s2); font-weight: 500; }
.tb-kpi-detail { color: var(--t2); font-size: clamp(11.5px, min(5cqw, 8.5cqh), 22px); line-height: 1.35; }
.tb-kpi-big { height: auto; }
.tb-kpi-big .tb-kpi-value { font-size: 56px; }
.tb-kpi-big .tb-kpi-delta { font-size: 14px; }
.tb-kpi-big .tb-kpi-detail { font-size: 14px; }

/* ── Gráficos y mapa ── */
.tb-chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.tb-chart.is-map { z-index: 0; isolation: isolate; overflow: hidden; background: var(--s2); border-radius: 8px; }
.tb-chart .leaflet-container { font-family: var(--font-sans); background: var(--s2); }
.tbm-control { padding: 5px 9px; color: var(--t1); background: rgba(17, 17, 17, .92); border: 1px solid var(--tb-line); border-radius: 8px; font-size: 11.5px; line-height: 1.4; }
.tbm-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tbm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tbm-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.tbm-dash { display: inline-block; width: 16px; height: 0; border-top: 2px dashed; }
.tbm-heat { pointer-events: none; }
.tbm-control button { padding: 0; color: var(--t1); background: none; border: 0; font: inherit; cursor: pointer; }
.tb-chart svg { display: block; max-width: 100%; overflow: visible; }
.ch-grid { stroke: rgba(255, 255, 255, .08); stroke-width: 1; }
.ch-tick { fill: var(--t2); font-family: var(--tb-mono); font-size: 10.5px; }
.ch-label { fill: var(--t1); font-size: 12px; }
.ch-val { fill: var(--t1); font-family: var(--tb-mono); font-size: 11px; font-weight: 600; }
.ch-bar { fill: var(--tb-data); }
.ch-bar[style*="fill"]:hover { opacity: .8; }
.ch-bar:hover { fill: #FFFFFF; }
.ch-line { stroke: var(--tb-data); stroke-width: 2; }
.ch-area { fill: var(--tb-data); opacity: .10; }
.ch-dot { fill: var(--tb-data); }
.ch-s0 { fill: var(--lime); background: var(--lime); }
.ch-s1 { fill: var(--yellow); background: var(--yellow); }
.ch-s2 { fill: var(--red); background: var(--red); }
.ch-bar.ch-s0:hover, .ch-bar.ch-s1:hover, .ch-bar.ch-s2:hover { opacity: .8; }
.ch-hit { cursor: pointer; }
.ch-hit:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
g.ch-hit:hover .ch-bar { opacity: .8; }
.ch-hit-area { fill: transparent; }
.ch-hit-area:hover + .ch-bar, .ch-hit-area:hover + .ch-dot, .ch-hit-area:focus-visible + .ch-bar { fill: var(--primary); }
.ch-bar.ch-hit { cursor: pointer; }
.ch-m { stroke: var(--tb-surface); stroke-width: 2; }
.ch-m0 { fill: var(--cyan); background: var(--cyan); }
.ch-m1 { fill: var(--t1); background: var(--t1); }
.ch-m2 { fill: var(--yellow); background: var(--yellow); }
.ch-m3 { fill: var(--t3); background: var(--t3); }
.ch-total { fill: var(--t1); font-family: var(--tb-mono); font-size: 26px; font-weight: 700; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; color: var(--t2); font-size: 11px; }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }

.tb-empty { padding: 40px 20px; text-align: center; color: var(--t3); background: var(--tb-surface); border: 1px dashed var(--b); border-radius: var(--radius-md); }

/* ── Catálogo: panel flotante bajo la barra (no empuja las tarjetas) ── */
.tb-picker { position: absolute; top: 54px; right: 16px; z-index: 40; width: min(720px, calc(100% - 32px)); max-height: calc(100% - 70px); overflow-y: auto; padding: 14px 18px; background: #1A1A1A; border: 1px solid var(--tb-line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.tb-picker h3 { margin: 12px 0 8px; color: var(--t2); font-family: var(--tb-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.tb-picker h3:first-child { margin-top: 0; }
.tb-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.tb-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; color: var(--t1); font-family: var(--font-sans); font-size: 13px; font-weight: 600; text-align: left; background: var(--tb-surface); border: 1px solid var(--b); border-radius: var(--radius-sm); cursor: pointer; }
.tb-pick:hover:not(:disabled) { border-color: var(--primary); }
.tb-pick:disabled { color: var(--t3); cursor: not-allowed; opacity: .6; }
.tb-pick small { color: var(--t3); font-size: 11px; font-weight: 400; }

/* ── Tarjeta angosta (celular, o una chica en una pantalla chica): el título no se corta; se guarda lugar ocultando el ⓘ (el detalle trae la misma explicación) ── */
@container (max-width: 240px) {
  .tb-card-head { padding-left: 10px; }
  .tb-card-head h3 { font-size: 9.5px; letter-spacing: .06em; }
  .tb-card-tools button.tb-icon[title="Qué muestra"] { display: none; }
}

/* ── Tablet: dos columnas; las filas siguen repartiéndose el alto ── */
@media (max-width: 1099px) {
  .tb-bar-actions { margin-left: 0; }
}
/* ── Celular: una tarjeta por fila, con alto propio; la página se desplaza (no hay otra forma de que se lea) ── */
@media (max-width: 639px) {
  .tb-page { padding: 10px 10px 14px; }
  .tb-tabs, .tb-bar-filters, .tb-bar-actions { flex: 1 1 100%; }
  .tb-select { max-width: none; flex: 1; }
  .tb-pop { width: min(320px, calc(100vw - 32px)); }
}
@media (prefers-reduced-motion: reduce) {
  .tb-card-tools button, .tb-chip { transition: none; }
}
.tb-kpi-value.is-link { cursor: pointer; }
.tb-kpi-value.is-link:hover, .tb-kpi-value.is-link:focus-visible { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; outline: none; }
.tbm-report { margin-top: 8px; padding: 6px 12px; color: var(--t1); font: 600 12px/1.2 var(--font-sans); background: var(--s3); border: 1px solid var(--b); border-radius: var(--radius-sm); cursor: pointer; }
.tbm-report:hover { background: var(--s2); border-color: var(--t2); }
