/* ════════════════════════════════════════════════════════════════════════════
   20-eventalerts.css — the recurring event-alert screen (static/js/event-alerts.js).
   ----------------------------------------------------------------------------
   Loaded AFTER 13-widgets.css so it can sit inside a #settings-view .st-section
   and inherit that page's panel rhythm. Load order IS the cascade (see
   CLAUDE.md); do not renumber.

   Colour is REINFORCEMENT ONLY. Every state on this surface is also a word —
   "ARMED" / "not armed", "Not delivering" / "Delivering" — because the six-class
   verdict ramp collapses to ΔE 3.92 under deuteranopia in the dark theme. The
   armed rail below is a 2px bar plus an uppercase mono word; desaturate a
   screenshot and the row still reads. Nothing here encodes state in hue alone.

   Every colour comes from tokens.css, which flips on :root[data-theme="light"],
   so both themes are covered without a second block. Rounded elements use inset
   box-shadow rings rather than 1px borders: a 1px rounded border renders as a
   bowtie artifact in headless screenshots (see CLAUDE.md gotchas).
   ════════════════════════════════════════════════════════════════════════ */

.ea {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* ── R1: the verdict. The single most important element; nothing competes. ── */
.ea-verdict {
  margin: 0;
  padding: 0.6875rem 0.875rem 0.6875rem calc(0.8125rem + 3px);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-radius: 3px;
}
.ea-verdict.is-bad  { background: color-mix(in srgb, var(--red) 7%, var(--bg-tertiary)); }
.ea-vw {
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text-bright);
}
.ea-verdict.is-bad .ea-vw { color: var(--red); }
.ea-verdict.is-ok  .ea-vw { color: var(--accent); }

/* ── the evidence strip: inline, never a tooltip ──────────────────────────── */
.ea-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg-intel);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.ea-s {
  display: flex;
  align-items: baseline;
  gap: 0.4375rem;
  padding: 0.1875rem 0;
  min-width: 0;
}
.ea-s-k {
  flex: none;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing:normal;
  text-transform:none;
  color: var(--text-muted);
}
.ea-s-v {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
/* The bad state is a WORD in the value ("never run here"); the colour only
   makes it findable, so a greyscale reader loses nothing. */
.ea-s.is-bad .ea-s-v { color: var(--red); }
/* The channel line links up to the Notifications section (2026-10-10) rather
   than repeating each channel's state. Plain text, no underline; hover and
   focus are colour only. */
.ea-s-go {
  flex: none;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.ea-s-go:hover, .ea-s-go:focus-visible { outline: none; color: var(--text-primary); }

/* ── panels ───────────────────────────────────────────────────────────────── */
.ea-panel {
  padding: 0.75rem 0.875rem 0.625rem;
  background: var(--bg-secondary);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.ea-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-subtle);
}
.ea-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.ea-note {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: right;
}

/* R2: absence is one line, not an empty state. No art, no centred hero. */
.ea-none {
  margin: 0.375rem 0;
  color: var(--text-muted);
}

/* ── armed rows ───────────────────────────────────────────────────────────── */
.ea-list, .ea-tlist { list-style: none; margin: 0; padding: 0; }

/* FIVE columns for five children — [state][symbol][type][what][button]. A
   four-column track wrapped the button onto its own line under the state
   chip, which read as a second row of the table. */
.ea-row {
  display: grid;
  grid-template-columns: 5rem 4.5rem minmax(6rem, 11rem) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 0.75rem;
  padding: 0.375rem 0;
  text-align: left;
}
.ea-row + .ea-row { box-shadow: inset 0 1px 0 var(--border-subtle); }

.ea-sym {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.ea-type { color: var(--text-primary); }
.ea-what {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* THE state word. Uppercase bold for ARMED, lowercase muted for the off
   state: two cues besides hue, and no edge line. */
.ea-state {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  padding-left: 0.5625rem;
  white-space: nowrap;
}
.ea-state.is-on {
  font-weight: 700;
  text-transform:none;
  color: var(--accent);
}
.ea-state.is-off {
  color: var(--text-xmuted);
}

/* ── the per-type arming rows ─────────────────────────────────────────────── */
.ea-trow {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) minmax(0, 1.15fr) auto;
  align-items: baseline;
  gap: 0.125rem 0.75rem;
  padding: 0.4375rem 0;
}
.ea-trow + .ea-trow { box-shadow: inset 0 1px 0 var(--border-subtle); }
.ea-tmain { display: flex; flex-direction: column; gap: 0.0625rem; min-width: 0; }
.ea-tmain .ea-what { white-space: normal; }
.ea-tcount { display: flex; flex-direction: column; gap: 0.0625rem; min-width: 0; }

/* No proportion without its n and its interval, physically attached. This is
   the element that carries them; it is never a tooltip and never truncated. */
.ea-rate {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.ea-rate-2 { color: var(--text-muted); }

/* The pairing caveat spans the whole row: it is about the row, not a column. */
.ea-pair {
  grid-column: 2 / -1;
  margin-top: 0.1875rem;
  padding: 0.3125rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--amber) 8%, var(--bg-tertiary));
  border-radius: 2px;
}
.ea-pair b { color: var(--text-primary); font-weight: 650; }

/* ── controls ─────────────────────────────────────────────────────────────── */
.ea-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.375rem 0 0.5rem;
}
.ea-lab {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing:normal;
  text-transform:none;
  color: var(--text-muted);
}
.ea-in {
  width: 7.5rem;
  padding: 0.3125rem 0.5rem;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-transform:none;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 0;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--border-default);
}
.ea-in:focus-visible {
  outline: none;
  box-shadow:inset 0 0 0 1px var(--accent);
}
.ea-err { color: var(--red); }

.ea-btn {
  padding: 0.25rem 0.625rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 0;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--border-default);
  cursor: pointer;
  white-space: nowrap;
}
.ea-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-bright); }
.ea-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ea-btn:focus-visible {
  outline: none;
  box-shadow:inset 0 0 0 1px var(--accent);
}
.ea-arm { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-glow); }
.ea-off { color: var(--text-secondary); }

.ea-more {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding-top: 0.5rem;
}
.ea-more-n {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* ── R3: the one expander per panel ───────────────────────────────────────── */
.ea-x {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.5rem;
  padding: 0.1875rem 0;
  font: inherit;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.ea-x:hover { color: var(--text-secondary); }
.ea-x:focus-visible { outline: none; color: var(--accent); text-decoration: underline; }
.ea-x-c {
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform 0.12s ease;
}
.ea-x[aria-expanded="true"] .ea-x-c { transform: rotate(90deg); }
.ea-x-b { padding: 0.25rem 0 0.125rem; }
.ea-x-list {
  margin: 0;
  padding-left: 1.0625rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.ea-x-list li { margin: 0.1875rem 0; }

/* ── the provenance foot line ─────────────────────────────────────────────── */
.ea-foot {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--text-xmuted);
}

/* ── narrow: the grids become stacks rather than truncating a caveat ───────── */
@media (max-width: 60rem) {
  .ea-row  { grid-template-columns: 5rem 4.5rem minmax(0, 1fr); }
  .ea-row .ea-what { grid-column: 3; }
  .ea-row .ea-btn { grid-column: 3; justify-self: start; margin-top: 0.25rem; }
  .ea-trow { grid-template-columns: 5rem minmax(0, 1fr); }
  .ea-tcount { grid-column: 2; }
  .ea-trow .ea-btn { grid-column: 2; justify-self: start; margin-top: 0.25rem; }
  .ea-what { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .ea-x-c { transition: none; }
}
