:root {
  --bg: #06101c;
  --panel: rgba(15, 30, 48, 0.92);
  --panel-2: rgba(22, 41, 63, 0.88);
  --line: rgba(137, 164, 194, 0.28);
  --text: #f7fbff;
  --muted: #a9b7c8;
  --green: #69e254;
  --green-2: #1dbb55;
  --yellow: #ffd02c;
  --orange: #ff9d2e;
  --red: #ff3b3b;
  --blue: #39a7ff;
  --cyan: #56e1ff;

  --chart-pl1: #1FA6B8;
  --chart-pl2: #FF7A3D;
  --chart-pl3: #B8C7CC;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  /* Número de tarjetas visibles simultáneamente. Hoy son 3.
     En el futuro pueden existir más líneas sin cambiar esta densidad visual. */
  --visible-line-count: 3;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: clamp(16px, 0.52vw, 22px); }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(43, 119, 178, 0.22), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(33, 219, 135, 0.12), transparent 24%),
    linear-gradient(135deg, #020812 0%, #081422 46%, #050b13 100%);
}

/* ==============================
   Pantalla TV
   ============================== */
.dashboard-body {
  overflow: hidden;
}

.tv-shell {
  width: 100%;
  max-width: none;
  height: 100vh;
  margin: 0;
  padding: clamp(16px, 1.15vw, 28px) clamp(20px, 1.7vw, 48px) clamp(20px, 1.45vw, 36px);
  display: grid;
  grid-template-rows: auto 1fr 0.92fr;
  gap: 16px;
}

.tv-header {
  display: grid;
  grid-template-columns: clamp(90px, 8vw, 180px) minmax(0, 1fr) clamp(90px, 8vw, 180px);
  align-items: center;
  text-align: center;
}

.brand-pill, .refresh-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: clamp(8px, 0.55vw, 12px) clamp(12px, 0.85vw, 20px);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.13);
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: clamp(0.78rem, 0.72vw, 1.08rem);
}
.refresh-pill { justify-self: end; }

.tv-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3.7vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 4px 18px rgba(0,0,0,0.45);
}

.tv-header p {
  margin: 10px 0 0;
  font-size: clamp(1rem, 1.8vw, 2rem);
  color: rgba(247,251,255,0.82);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.line-grid {
  display: grid;
  grid-template-columns: repeat(var(--visible-line-count), minmax(0, 1fr));
  gap: clamp(14px, 1vw, 24px);
  min-height: 0;
}

.line-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(18,38,60,0.95), rgba(8,21,35,0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: clamp(18px, 1.25vw, 30px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 0.85vw, 18px);
  min-width: 0;
}
.line-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 30%);
  pointer-events: none;
}

.line-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.line-name {
  margin: 0;
  font-size: clamp(2rem, 3.3vw, 4.6rem);
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.line-name.working { color: var(--green); }
.line-name.stopped { color: var(--red); }
.line-name.lunch { color: var(--blue); }
.line-name.breakfast { color: var(--blue); }
.line-name.setup { color: var(--yellow); }
.line-name.no-plan { color: var(--muted); }

.status-line {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(0.82rem, 1.18vw, 1.32rem);
  font-weight: 800;
  max-width: min(100%, 460px);
  white-space: nowrap;
}
.status-line span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}
.status-dot.stopped { background: var(--red); box-shadow: 0 0 14px var(--red); }
.status-dot.lunch { background: var(--blue); box-shadow: 0 0 14px var(--blue); }
.status-dot.breakfast { background: var(--blue); box-shadow: 0 0 14px var(--blue); }
.status-dot.setup { background: var(--yellow); box-shadow: 0 0 14px var(--yellow); }
.status-dot.no-plan { background: var(--muted); box-shadow: none; }

.status-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
  color: #fff;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.35), transparent 30%), var(--green-2);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.status-icon.stopped { background-color: #d72d2d; }
.status-icon.lunch { background-color: #2178d7; }
.status-icon.breakfast { background-color: #2178d7; }
.status-icon.setup { background-color: #d7aa21; }
.status-icon.no-plan { background-color: #687484; }

.big-progress {
  position: relative;
  z-index: 1;
  padding: 16px 0 4px;
  border-top: 1px solid rgba(255,255,255,0.14);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.progress-title {
  color: var(--muted);
  font-size: clamp(0.75rem, 0.95vw, 1.05rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.progress-main-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.progress-main-row.single-kpi-row {
  justify-content: flex-start;
}
.progress-main-row.single-kpi-row .efficiency-number {
  margin-right: auto;
}
.day-count {
  font-size: clamp(1.7rem, 2.7vw, 3.3rem);
  font-weight: 900;
}
.percent-badge {
  min-width: 104px;
  padding: 8px 16px;
  text-align: center;
  border-radius: 16px;
  font-size: clamp(1.35rem, 2.1vw, 2.5rem);
  font-weight: 950;
  color: #07101a;
  background: var(--yellow);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.12), 0 8px 18px rgba(0,0,0,0.28);
}
.percent-badge.good { background: linear-gradient(180deg, #8fff5e, #38c852); }
.percent-badge.warn { background: linear-gradient(180deg, #ffe056, #ffc20a); }
.percent-badge.bad { background: linear-gradient(180deg, #ff6464, #e33434); color: #fff; }

.progress-bar {
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 10px;
  background: rgba(255,255,255,0.13);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.38);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--yellow);
  transition: width .35s ease;
}
.progress-fill.good { background: linear-gradient(90deg, #6fe353, #42cc72); }
.progress-fill.warn { background: linear-gradient(90deg, #ffd02c, #ffb322); }
.progress-fill.bad { background: linear-gradient(90deg, #ff3b3b, #ff6767); }

.model-profit-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 16px;
}
.info-block label {
  display: block;
  color: var(--muted);
  font-size: clamp(0.85rem, 1vw, 1.1rem);
  font-weight: 800;
  margin-bottom: 4px;
}
.info-block strong {
  display: block;
  font-size: clamp(1.2rem, 1.7vw, 2rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profit-box {
  display: flex;
  align-items: center;
  gap: 12px;
}
.profit-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  background: linear-gradient(180deg, rgba(111,227,83,0.95), rgba(29,171,84,0.95));
}
.profit-value { font-size: clamp(1.25rem, 1.7vw, 2.05rem); font-weight: 950; }

.current-goal {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
  font-size: clamp(0.9rem, 1vw, 1.15rem);
}
.current-goal strong { color: var(--text); font-size: 1.15em; }

.sequence {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 118px;
}
.sequence-title {
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: 0.86rem;
  text-transform: uppercase;
}
.sequence-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: clamp(0.85rem, 0.95vw, 1.08rem);
}
.sequence-row .seq-model {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sequence-row .seq-qty { color: var(--muted); }
.sequence-row.current { color: var(--yellow); }
.sequence-row.completed { color: var(--green); }
.sequence-row.pending { color: rgba(247,251,255,0.75); }

.reason-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 59, 59, 0.16);
  border: 1px solid rgba(255,59,59,0.22);
  color: #ff7070;
  font-size: clamp(1.05rem, 1.45vw, 1.8rem);
  font-weight: 950;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reason-footer.lunch { background: rgba(57,167,255,0.16); border-color: rgba(57,167,255,0.24); color: #76c5ff; }
.reason-footer.breakfast { background: rgba(57,167,255,0.16); border-color: rgba(57,167,255,0.24); color: #76c5ff; }
.reason-footer.setup { background: rgba(255,208,44,0.14); border-color: rgba(255,208,44,0.22); color: #ffdc66; }
.reason-footer.working { background: rgba(105,226,84,0.10); border-color: rgba(105,226,84,0.20); color: var(--green); }

.chart-card {
  min-height: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(18,38,60,0.92), rgba(9,20,34,0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px 24px 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.chart-header { text-align: center; }
.chart-header h2 { margin: 0; font-size: clamp(1.2rem, 1.8vw, 2.1rem); }
.chart-header p { margin: 4px 0 0; color: var(--muted); font-weight: 700; font-size: clamp(.85rem, .9vw, 1.2rem); }
.weekly-chart { width: 100%; height: 100%; min-height: 220px; }
.weekly-chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-legend { display: flex; justify-content: center; gap: clamp(24px, 2.3vw, 52px); font-weight: 900; color: rgba(255,255,255,0.88); font-size: clamp(.9rem, 1vw, 1.25rem); }
.legend-line { display: inline-block; width: clamp(38px, 2.5vw, 64px); height: clamp(4px, .28vw, 7px); border-radius: 99px; margin-right: clamp(7px, .55vw, 12px); vertical-align: middle; }
.legend-line.pl1 { background: var(--chart-pl1); }
.legend-line.pl2 { background: var(--chart-pl2); }
.legend-line.pl3 { background: var(--chart-pl3); }

/* Responsive vertical para laptops/ventanas con menor altura útil.
   Mantiene 3 líneas visibles, compacta el contenido y evita que Modelo actual
   / Último registro queden recortados. Las pantallas con más altura conservan
   el layout grande. */
@media (max-height: 1100px) {
  .dashboard-body { overflow: auto; }
  .tv-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto;
    padding: 16px 32px 24px;
    gap: 12px;
  }
  .tv-header h1 { font-size: clamp(2rem, 3.1vw, 3.8rem); }
  .tv-header p { font-size: clamp(1rem, 1.4vw, 1.6rem); }
  .line-card { padding: 14px 18px 12px; gap: 7px; }
  .line-name { font-size: clamp(2rem, 3vw, 3.6rem); }
  .status-line { margin-top: 5px; }
  .status-icon { width: 46px; height: 46px; font-size: 27px; }
  .big-progress { padding: 8px 0 2px; }
  .progress-title { margin-bottom: 5px; }
  .progress-bar { height: 15px; margin: 8px 0 5px; }
  .sequence { min-height: auto; padding: 9px 12px; gap: 5px; }
  .reason-footer { padding: 10px 12px; }
  /* Se conserva la altura V23 para Vista 2. Vista 1 la sobreescribe
     según la altura útil del viewport en las reglas siguientes. */
  .weekly-chart { height: 190px; min-height: 190px; }
  .chart-card { padding: 14px 22px 10px; }
}

/* Vista 1: en laptop/1080p el gráfico aprovecha el espacio vertical disponible
   sin fijar una división rígida al 50% de la pantalla. */
@media (min-height: 901px) and (max-height: 1100px) {
  .chart-card:not(.summary-chart-card) .weekly-chart {
    height: clamp(250px, 25.5vh, 280px);
    min-height: clamp(250px, 25.5vh, 280px);
  }
}

/* Vista 1: en alturas realmente limitadas se prioriza que tarjetas + gráfico
   sigan cabiendo sin obligar al usuario a cambiar el zoom del navegador. */
@media (max-height: 900px) {
  .chart-card:not(.summary-chart-card) .weekly-chart {
    height: clamp(190px, 25vh, 220px);
    min-height: clamp(190px, 25vh, 220px);
  }
}

@media (max-width: 1100px) {
  .line-grid { grid-template-columns: minmax(0, 1fr); }
  .tv-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    grid-template-rows: auto auto auto;
    padding-inline: clamp(14px, 3vw, 28px);
  }
  .dashboard-body { overflow: auto; }
  .tv-header { grid-template-columns: minmax(72px, auto) minmax(0, 1fr) minmax(72px, auto); gap: 10px; }
  .brand-pill, .refresh-pill { padding: 8px 12px; }
  .chart-legend { gap: clamp(16px, 5vw, 36px); flex-wrap: wrap; }
}

/* ==============================
   V9 - Eficiencia por horas estándar automática
   ============================== */
.efficiency-number {
  font-size: clamp(2.6rem, 5vw, 6rem);
  font-weight: 950;
  line-height: .95;
  letter-spacing: .02em;
}
.efficiency-detail-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
  padding-top: 2px;
}
.efficiency-detail-grid .info-block strong {
  font-size: clamp(1.35rem, 2vw, 2.55rem);
}
.efficiency-detail-grid .info-block label {
  font-size: clamp(.78rem, 1vw, 1rem);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.efficiency-detail-grid .model-block {
  grid-column: 1 / -1;
}
.efficiency-detail-grid .model-block strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.12;
  font-size: clamp(1.05rem, 1.45vw, 1.85rem);
  word-break: break-word;
}

.last-motor-line {
  margin-top: 8px;
  font-size: clamp(.82rem, .95vw, 1.05rem);
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .02em;
}
.labor-row { grid-template-columns: 1fr .75fr 1.5fr .8fr; }
.schedule-row { grid-template-columns: repeat(7, 1fr); margin-top: 16px; }
.formula-card {
  margin-top: 22px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.055);
  padding: 18px 20px;
}
.formula-card h3 { margin: 0 0 10px; font-size: 1.25rem; }
.formula-card p { margin: 7px 0; color: rgba(247,251,255,.82); font-weight: 700; }
.formula-card .muted-note { color: var(--muted); }

@media (max-height: 1100px) {
  .efficiency-number { font-size: clamp(2.4rem, 4.2vw, 5rem); }
  .efficiency-detail-grid { gap: 5px 16px; }
  .last-motor-line { margin-top: 4px; }
}

@media (max-width: 1100px) {
}

/* ==============================
   V14 - Vista 2: eficiencia histórica
   ============================== */
.line-grid.summary-mode {
  grid-template-columns: 1fr;
  justify-items: center;
}

.chart-card.summary-chart-card,
.line-grid.summary-mode .summary-chart-card {
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

.summary-chart-card {
  min-height: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(18,38,60,0.92), rgba(9,20,34,0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px 24px 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.summary-left-header {
  text-align: center;
}

.summary-left-header h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2.25rem);
}

.summary-left-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
  font-size: clamp(.95rem, 1.1vw, 1.25rem);
}

.summary-chart {
  width: 100%;
  height: 100%;
  min-height: 260px;
}

.summary-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.summary-legend {
  margin-top: 2px;
}

@media (max-height: 1100px) {
  .summary-chart { height: 280px; min-height: 280px; }
  .summary-chart-card { padding: 16px 22px 10px; }
}

/* V18 - alerta visual de inactividad preservada de V17. */
.line-card.inactivity-warning {
  border-color: rgba(255, 208, 44, 0.9);
  background: linear-gradient(180deg, rgba(88, 69, 9, 0.96), rgba(47, 36, 7, 0.97));
  box-shadow: 0 0 0 2px rgba(255, 208, 44, 0.22), var(--shadow);
}

.line-card.inactivity-critical {
  border-color: rgba(255, 59, 59, 0.95);
  background: linear-gradient(180deg, rgba(91, 20, 24, 0.97), rgba(48, 9, 13, 0.98));
  box-shadow: 0 0 0 2px rgba(255, 59, 59, 0.24), var(--shadow);
}

/* V25 - Displays panorámicos con viewport lógico bajo (p. ej. Android Box).
   El dispositivo puede sacar 1080p por HDMI pero Chrome reportar ~979x494 CSS px.
   En este caso se conserva la densidad de TV (3 líneas simultáneas) y se compacta
   verticalmente el contenido. Tablets 4:3 / verticales no entran en esta regla. */
@media (max-width: 1100px) and (max-height: 650px) and (min-aspect-ratio: 16/10) {
  .dashboard-body { overflow: hidden; }

  .tv-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    padding: 7px 14px 9px;
    gap: 6px;
    grid-template-rows: auto minmax(0, 1.08fr) minmax(0, 0.92fr);
  }

  .tv-header {
    grid-template-columns: 66px minmax(0, 1fr) 66px;
    gap: 6px;
  }
  .tv-header h1 {
    font-size: clamp(1.55rem, 4.2vw, 2.25rem);
    line-height: .95;
    letter-spacing: .025em;
  }
  .tv-header p {
    margin-top: 3px;
    font-size: clamp(.72rem, 2.15vw, 1rem);
    line-height: 1.05;
  }
  .brand-pill,
  .refresh-pill {
    padding: 4px 7px;
    font-size: .62rem;
    letter-spacing: .05em;
  }

  /* Vista 1: 3 líneas en una sola fila aunque el viewport CSS sea < 1100 px. */
  .line-grid:not(.summary-mode) {
    grid-template-columns: repeat(var(--visible-line-count), minmax(0, 1fr));
    gap: 7px;
    min-height: 0;
  }

  .line-grid:not(.summary-mode) .line-card {
    min-height: 0;
    padding: 7px 9px 6px;
    gap: 2px;
    border-radius: 14px;
  }
  .line-grid:not(.summary-mode) .line-top { gap: 6px; }
  .line-grid:not(.summary-mode) .line-name {
    font-size: clamp(1.45rem, 4.1vw, 2rem);
    line-height: .88;
  }
  .line-grid:not(.summary-mode) .status-line {
    gap: 5px;
    margin-top: 3px;
    font-size: .66rem;
  }
  .line-grid:not(.summary-mode) .status-dot {
    width: 8px;
    height: 8px;
  }
  .line-grid:not(.summary-mode) .status-icon {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  .line-grid:not(.summary-mode) .big-progress {
    padding: 3px 0 1px;
  }
  .line-grid:not(.summary-mode) .progress-title {
    margin-bottom: 2px;
    font-size: .60rem;
    letter-spacing: .08em;
  }
  .line-grid:not(.summary-mode) .efficiency-number {
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    line-height: .9;
  }
  .line-grid:not(.summary-mode) .progress-bar {
    height: 8px;
    margin: 3px 0 2px;
  }

  .line-grid:not(.summary-mode) .efficiency-detail-grid {
    gap: 1px 8px;
    padding-top: 0;
  }
  .line-grid:not(.summary-mode) .efficiency-detail-grid .info-block label {
    margin-bottom: 1px;
    font-size: .56rem;
    letter-spacing: .045em;
  }
  .line-grid:not(.summary-mode) .efficiency-detail-grid .info-block strong {
    font-size: .96rem;
    line-height: 1;
  }
  .line-grid:not(.summary-mode) .efficiency-detail-grid .model-block strong {
    font-size: clamp(.67rem, 1.85vw, .84rem);
    line-height: 1.02;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  .line-grid:not(.summary-mode) .last-motor-line {
    margin-top: 1px;
    font-size: .58rem;
    line-height: 1.05;
  }

  /* Vista 1: gráfico flexible dentro del espacio restante. */
  .chart-card:not(.summary-chart-card) {
    min-height: 0;
    padding: 5px 9px 3px;
    border-radius: 14px;
  }
  .chart-card:not(.summary-chart-card) .chart-header h2 {
    font-size: .92rem;
    line-height: 1;
  }
  .chart-card:not(.summary-chart-card) .chart-header p {
    margin-top: 2px;
    font-size: .58rem;
    line-height: 1;
  }
  .chart-card:not(.summary-chart-card) .weekly-chart {
    height: 100%;
    min-height: 0;
  }
  .chart-card:not(.summary-chart-card) .chart-legend {
    gap: 18px;
    font-size: .68rem;
    line-height: 1;
  }
  .chart-card:not(.summary-chart-card) .legend-line {
    width: 26px;
    height: 3px;
    margin-right: 5px;
  }

  /* Vista 2: conserva las dos gráficas, pero las hace caber en el viewport bajo
     en lugar de heredar el mínimo de 280 px pensado para laptops/TV normales. */
  .line-grid.summary-mode {
    min-height: 0;
    grid-template-columns: 1fr;
  }
  .summary-chart-card,
  .chart-card.summary-chart-card {
    min-height: 0;
    padding: 5px 9px 3px;
    border-radius: 14px;
  }
  .summary-left-header h2,
  .chart-card.summary-chart-card .chart-header h2 {
    font-size: .92rem;
    line-height: 1;
  }
  .summary-left-header p,
  .chart-card.summary-chart-card .chart-header p {
    margin-top: 2px;
    font-size: .58rem;
    line-height: 1;
  }
  .summary-chart,
  .chart-card.summary-chart-card .weekly-chart {
    height: 100%;
    min-height: 0;
  }
  .summary-legend,
  .chart-card.summary-chart-card .chart-legend {
    gap: 18px;
    font-size: .68rem;
    line-height: 1;
  }
}
