/* Salud del lote: one state per lot, one card per device, the week's incidents. */
.health-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-ink-500);
}
[data-state="ok"] > .health-dot,
[data-state="ok"] > .health-device-head > .health-dot { background: var(--color-moss); }
[data-state="warn"] > .health-dot,
[data-state="warn"] > .health-device-head > .health-dot,
[data-state="unwatched"] > .health-device-head > .health-dot { background: var(--color-warn); }
[data-state="down"] > .health-dot,
[data-state="down"] > .health-device-head > .health-dot,
[data-state="silent"] > .health-device-head > .health-dot { background: var(--color-danger); }

.health-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0 28px;
  padding: 16px 18px;
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: var(--color-paper);
}
.health-banner .health-dot { width: 12px; height: 12px; margin-top: 6px; }
.health-banner strong { display: block; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.health-banner p { margin: 2px 0 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.health-banner[data-state="down"] { border-color: color-mix(in srgb, var(--color-danger) 45%, transparent); }
.health-banner[data-state="warn"] { border-color: color-mix(in srgb, var(--color-warn) 55%, transparent); }

.health-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 10px;
}
.health-section-head h2 { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); }

.health-link {
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--color-accent);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
}
.health-link:hover { text-decoration: underline; }
.health-link:disabled { opacity: 0.5; cursor: default; }

.health-devices,
.health-incidents {
  display: grid;
  gap: 10px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}
.health-devices { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.health-device,
.health-incident {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--color-line);
  border-radius: 12px;
  background: var(--color-paper);
}
.health-device[data-state="down"],
.health-device[data-state="silent"] { border-color: color-mix(in srgb, var(--color-danger) 45%, transparent); }

.health-device-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.health-device-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-semibold);
}

.health-chip {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-fill-strong);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.health-chip[data-state="warn"],
.health-chip[data-state="unwatched"] { background: var(--color-sand-weak); color: var(--color-warn-ink); }
.health-chip[data-state="down"],
.health-chip[data-state="silent"] { background: color-mix(in srgb, var(--color-danger) 14%, transparent); color: var(--color-danger); }

.health-meta {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.health-hint {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--color-fill);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.health-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
.health-ack {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.health-actions .health-ack { margin: 0; }

.health-incident[data-open="true"] { border-color: color-mix(in srgb, var(--color-danger) 45%, transparent); }
.health-incident-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}
.health-incident-time { color: var(--color-text-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.health-incident .health-meta { margin-left: 0; }

.health-dialog {
  position: fixed;
  inset: 0;
  width: min(420px, calc(100vw - 32px));
  height: fit-content;
  margin: auto;
  padding: 22px;
  border: 1px solid var(--color-line);
  border-radius: 16px;
  background: var(--color-paper);
  box-shadow: var(--shadow-dash);
}
.health-dialog::backdrop { background: rgba(18, 36, 28, 0.35); }
.health-dialog h2 { margin: 0 0 8px; font-size: var(--text-lg); }
.health-field { display: grid; gap: 6px; margin-top: 14px; }
.health-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 20px;
}
.health-forget { margin-right: auto; color: var(--color-danger); white-space: nowrap; }

/* The lot's dot next to its name: the list, the sidebar caption, the phone strip. */
[data-health]::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
[data-health="warn"]::after { background: var(--color-warn); }
[data-health="down"]::after { background: var(--color-danger); }
[data-health="ok"]::after,
[data-health="none"]::after,
[data-health=""]::after { display: none; }

@media (max-width: 760px) {
  .health-devices { grid-template-columns: 1fr; }
  .health-banner { margin-bottom: 22px; }
  .health-dialog { padding: 18px; }
}
