/* Dashboard: jerarquía operativa, altura natural y adaptación al ancho real.
   Mantiene las claves y tamaños del editor de layout. */
.dashboard-shell { container-type:inline-size; min-width:0; }
.dashboard-shell [data-layout-key="stat-cards"],
.dashboard-shell .dash-estadisticas { container-type:inline-size; }
.dashboard-shell .dash-bloques { grid-template-columns:repeat(12,minmax(0,1fr)); align-items:start; gap:var(--resumen-espacio); }
.dashboard-shell .dash-bloques > [data-layout-key] > .card,
.dashboard-shell #riesgo-container > .card { height:auto; margin:0; }
.dashboard-shell [data-layout-key="atencion"],
.dashboard-shell .dash-bloques > [data-layout-key="atencion"]:has(.op-pendientes-card) { display:flex; flex-direction:column; gap:var(--resumen-espacio); }
.dashboard-shell [data-layout-key="atencion"]:not(:has(.op-pendientes-card)):not(:has(.aviso)):not(:has(#banner-recordatorios > *)):not(:has(#banner-renovacion > *)) { display:none; }
.dashboard-shell .dash-atencion:not(:has(.aviso)):not(:has(#banner-recordatorios > *)):not(:has(#banner-renovacion > *)) { display:none; }
.dashboard-shell .dash-filas,.dashboard-shell .aten-lista { flex:0 1 auto; gap:0; }
.dashboard-shell .dash-filas > * { flex:0 1 auto; }
.dashboard-shell .dash-filas > .dash-row-item--vert { display:block; }
html[data-arte] .dashboard-shell .card:hover { transform:none; }
.dashboard-shell .section-header { flex-wrap:wrap; align-items:center; gap:10px; }
.dashboard-shell .section-title { font-size:15px; line-height:1.4; letter-spacing:-.2px; }
.dashboard-shell .resumen-cifras--dashboard { grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); }
.dashboard-shell .resumen-cifras--estadisticas { grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); margin-bottom:20px; }
.dashboard-shell .dash-row-item {
  min-width:0; padding:11px 8px; border:0; border-top:1px solid var(--border);
  border-radius:8px; background:transparent; gap:10px;
}
.dashboard-shell .dash-row-item:first-child { border-top:0; }
.dashboard-shell .dash-row-item:hover { background:var(--surface2); border-color:var(--border); }
.dashboard-shell .dash-paciente { flex:1; min-width:0; overflow-wrap:anywhere; }
.dashboard-shell .dash-paciente-nombre { display:flex; flex-wrap:wrap; align-items:center; gap:5px; font-size:14px; font-weight:600; }
.dashboard-shell .turno-meta { flex:0 0 auto; text-align:right; font-variant-numeric:tabular-nums; }
.dashboard-shell .turno-meta > div:first-child { font-size:14px !important; }
.dashboard-shell .dash-row-item:focus-visible,
.dashboard-shell [role="button"]:focus-visible,
.dashboard-shell button:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }
.dash-aclaracion { font-size:12px; color:var(--text-muted); line-height:1.6; margin:-4px 0 14px; }
.dashboard-shell .actividad-grid { grid-template-columns:minmax(0,1fr); gap:0; }
.dashboard-shell .dash-consultorio { padding:9px 0; border-top:1px solid var(--border); animation:fadeSlideIn var(--mov-entrada,500ms) both; transition:background .3s; }
.dashboard-shell .dash-consultorio:first-child { border-top:0; }
.dashboard-shell .actividad-grid > div { min-width:0; overflow-wrap:anywhere; }
.dashboard-shell .actividad-grid > div > div:first-child { flex-wrap:wrap; gap:6px; }
.dashboard-shell .aviso { min-width:0; flex-wrap:wrap; }
.dashboard-shell .aviso-cuerpo { flex:1 1 140px; min-width:0; overflow-wrap:anywhere; }
.dashboard-shell .aviso-cabecera { flex-wrap:wrap; gap:10px; }
.dashboard-shell .dash-est-cab { gap:12px; }
.dashboard-shell .dash-est-cab > .section-title { display:flex; align-items:center; gap:6px; flex:0 0 auto; }
.dashboard-shell .dash-est-periodos { flex-wrap:wrap; }
.dashboard-shell canvas { max-width:100%; }
.dashboard-shell [data-layout-key="banner-primeros-pasos"]:has(#primeros-pasos:empty) { display:none; }
/* Fallback por viewport; las consultas de contenedor también contemplan
   sidebar anclado, paneles laterales y ventanas con poco ancho útil. */
@media(max-width:767px) {
  .dashboard-shell .dash-bloques > [data-layout-key] { grid-column:span 12; }
}
@container(max-width:700px) {
  .dashboard-shell .dash-bloques > [data-layout-key] { grid-column:span 12; }
  .dashboard-shell .two-col { grid-template-columns:minmax(0,1fr); }
}
@media(max-width:420px) {
  .dashboard-shell .dash-row-item > .turno-meta { margin-left:auto; }
  .dashboard-shell .dash-bloques { gap:var(--resumen-espacio); }
}
@media(pointer:coarse) {
  .dashboard-shell [role="button"],.dashboard-shell .dash-plegar { min-height:var(--alto-boton,36px); }
}
@media(prefers-reduced-motion:reduce) {
  .dashboard-shell * { animation:none !important; transition:none !important; }
}

/* Jerarquía por alineación y tipografía; sin franjas laterales decorativas. */
.dashboard-shell .section-header { margin-bottom:12px !important; }
.dashboard-shell .dash-filas > .dash-row-item:has(.dash-paciente) {
  display:grid; grid-template-columns:32px minmax(0,1fr) auto; align-items:center;
}
.dashboard-shell .dash-row-item:has(.dash-paciente) > :first-child {
  width:32px; height:32px; flex-shrink:0;
}
.dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta { max-width:9rem; }
.dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta > * { overflow-wrap:anywhere; }
.dashboard-shell .dash-horas { display:flex; flex-wrap:wrap; gap:4px; }
.dashboard-shell .dash-hora { padding:3px 6px; border:1px solid var(--border); border-radius:5px; font-size:12px; font-variant-numeric:tabular-nums; color:var(--text); }
.dashboard-shell .dash-horas-mas { font-size:12px; color:var(--text-muted); align-self:center; }
@container(max-width:380px) {
  .dashboard-shell .dash-filas > .dash-row-item:has(.dash-paciente) { grid-template-columns:32px minmax(0,1fr); gap:6px 10px; }
  .dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta { grid-column:2; display:flex; flex-wrap:wrap; gap:8px; margin-left:0; max-width:none; text-align:left; }
}

/* Alturas independientes: no estirar tarjetas ni dejar filas artificiales.
   Sin ResizeObserver queda la grilla CSS habitual como respaldo. */
.dashboard-shell .dash-bloques.dash-distribucion {
  grid-auto-rows:1px; row-gap:0; grid-auto-flow:row;
}
/* Neutralizar la antigua fila móvil de hora+fecha; la hora nunca se parte. */
.dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta {
  display:flex; flex-direction:column; align-items:flex-end; gap:3px;
  width:auto; border-top:0; padding-top:0; margin-top:0;
}
.dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta > :first-child {
  white-space:nowrap; overflow-wrap:normal; word-break:normal; flex-shrink:0;
}
.dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta > :last-child { min-width:0; line-height:1.4; }
@container(max-width:520px) {
  .dashboard-shell .dash-filas > .dash-row-item:has(.dash-paciente) { grid-template-columns:32px minmax(0,1fr); }
  .dashboard-shell .dash-row-item:has(.dash-paciente) .turno-meta {
    grid-column:2; flex-direction:row; flex-wrap:wrap; align-items:baseline;
    gap:4px 10px; max-width:none; margin-left:0; text-align:left;
  }
}
.dashboard-shell .dash-distribucion > [data-layout-key] {
  align-self:start; min-height:0;
}

/* Variación contra el mismo tramo del mes anterior. El texto va en el gris de
   apoyo, que ya pasa AA en los dos temas; el color va SOLO en la flecha, que
   es un gráfico y acompaña al signo — el signo es lo que dice si subió o bajó.
   Pintar la cifra de verde pedía medir --green sobre cada tarjeta y tema, y
   ya se midió una vez en 3,31:1. */
.dashboard-shell .stat-variacion { margin-top:8px; font-size:12px; line-height:1.5; color:var(--text-muted); overflow-wrap:anywhere; }
.dashboard-shell .stat-variacion strong { font-weight:700; color:var(--ink); }
.dashboard-shell .stat-flecha--sube { color:var(--green); }
.dashboard-shell .stat-flecha--baja { color:var(--rose); }

/* Igual que el resumen de Hoy, las cantidades aprovechan el ancho disponible.
   Los importes conservan una fila completa cuando el panel se angosta. */
@container(max-width:700px) {
  .dashboard-shell .resumen-cifras--dashboard { grid-template-columns:repeat(auto-fit,minmax(100px,1fr)); }
  .dashboard-shell .resumen-cifra--moneda { grid-column:1 / -1; }
}

/* «Lo que recuperó el centro» (js/recuperado.js). Tres secciones separadas
   por un filete horizontal: los turnos que entraron solos (la cifra grande y
   una fila por camino), lo que avisó la paciente y la oferta de huecos (una
   tira de tres cifras). Cada fila lleva la cantidad en su propia columna, así
   los números quedan alineados y el rótulo no se parte. Las aclaraciones van
   juntas al pie. Las notas son div y no p: la regla de párrafos de tarjeta
   las ponía en 15px, más grandes que los datos. Sin cajas ni filetes
   laterales: el bloque ya es una tarjeta. */
.dashboard-shell .recu-cab { margin-bottom:4px; flex-wrap:wrap; row-gap:10px; }
.dashboard-shell .recu-cuerpo { display:flex; flex-direction:column; }
.dashboard-shell .recu-seccion { display:flex; flex-direction:column; gap:8px; padding:14px 0; }
.dashboard-shell .recu-seccion + .recu-seccion { border-top:1px solid var(--border); }
.dashboard-shell .recu-seccion:first-child { padding-top:6px; }
.dashboard-shell .recu-seccion .bloque-tit { margin:0; }
.dashboard-shell .recu-lead { display:flex; align-items:baseline; gap:8px; margin:0; font-size:14px !important; font-weight:600 !important; color:var(--ink); }
.dashboard-shell .recu-cifra { font-size:28px; font-weight:800; line-height:1; color:var(--ink); font-variant-numeric:tabular-nums; }
.dashboard-shell .recu-lista { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.dashboard-shell .recu-lista > li.recu-fila { display:grid; grid-template-columns:32px minmax(0,1fr); column-gap:10px; align-items:baseline; margin:0; padding:0; font-size:13px !important; }
.dashboard-shell .recu-n { font-size:17px; font-weight:800; line-height:1.2; color:var(--ink); text-align:right; font-variant-numeric:tabular-nums; }
.dashboard-shell .recu-que { font-size:14px; font-weight:600; color:var(--ink); line-height:1.4; }
.dashboard-shell .recu-valor { font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; margin-left:6px; }
.dashboard-shell .recu-sub { font-size:12px; line-height:1.45; color:var(--apoyo, var(--text-muted)); }
.dashboard-shell .recu-tira { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; }
.dashboard-shell .recu-celda-n { font-size:20px; font-weight:800; line-height:1.2; color:var(--ink); font-variant-numeric:tabular-nums; }
.dashboard-shell .recu-tasa { font-size:12px; font-weight:600; color:var(--apoyo, var(--text-muted)); }
.dashboard-shell .recu-celda-rot { font-size:12px; line-height:1.35; color:var(--apoyo, var(--text-muted)); }
.dashboard-shell .recu-nota { font-size:12px; line-height:1.45; color:var(--apoyo, var(--text-muted)); padding:6px 0; }
.dashboard-shell .recu-pie { font-size:12px; line-height:1.5; color:var(--apoyo, var(--text-muted)); padding-top:12px; border-top:1px solid var(--border); }
