/* /system/monitoring — three tabs (Matt 2026-08-24)
   ══════════════════════════════════════════════════════════════════════════
   "I cannot even begin to use the page as it is."  Fair: I had stacked the
   lifecycle strip, the pending-suggestions table and the down-sites table on
   top of the existing board, producing one never-ending scroll where the thing
   you came for was below three things you did not.

   Three panels instead:
     1. Overview     the board that was always here — hero cards, KPIs, hosts.
     2. Sites down   what is broken right now, with the reason.
     3. Check these  billing/inventory mismatches awaiting a human decision.

   CSS :target only — CSP forbids inline JS. Same mechanism as .aq-tabs on
   /alerts, including its hard-won lesson:
   ⚠ :has() on the CONTAINER, never a sibling combinator. The tab anchors live
     INSIDE .mon-tabs, so `#mt-down:target ~ .mon-panel-down` can never match —
     the panels are siblings of .mon-tabs, not of the <a>.
   ⚠ And per Matt on the first alerts attempt — "1980's attempt at GUI? that
     looks like CRAP" — contrast, not boxes: ONE rule under the strip, a brand
     underline on the selected tab, no frame round the strip or the panel. */

.mon-tabs {
  display: flex; align-items: flex-end; gap: var(--space-1); flex-wrap: wrap;
  margin: 0 0 var(--space-4); padding: 0;
  border: 0; border-bottom: 2px solid var(--border-strong); border-radius: 0;
  background: none;
}
.mon-tab {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 10px 4px; margin: 0 var(--space-4) -2px 0;
  border: 0; border-bottom: 3px solid transparent;
  background: none; text-decoration: none; border-radius: 0;
  color: var(--text-mute); font-weight: 600; font-size: var(--fs-md);
}
.mon-tab:hover { color: var(--text); }
.mon-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* count pill */
.mon-tab-c {
  font-size: var(--fs-xs); font-weight: 700; padding: 1px 8px; border-radius: 99px;
  background: var(--bg-soft); color: var(--text-mute); font-variant-numeric: tabular-nums;
}
.mon-tab-down .mon-tab-c  { background: var(--red-bg);    color: var(--red); }
.mon-tab-check .mon-tab-c { background: var(--yellow-bg); color: var(--yellow-deep); }

/* Selected tab = :target on the anchor's own id. */
.mon-tab:target { color: var(--text); border-bottom-color: var(--brand); }

/* Panels. Default (no hash) = Overview, which is what the page is for. */
.mon-panel { display: none; }
.mon-panel-overview { display: block; }
.mon-root:has(#mt-down:target)  .mon-panel,
.mon-root:has(#mt-check:target) .mon-panel { display: none; }
.mon-root:has(#mt-down:target)  .mon-panel-down  { display: block; }
.mon-root:has(#mt-check:target) .mon-panel-check { display: block; }

/* Keep Overview underlined only while it IS the selection. */
.mon-tab-overview { border-bottom-color: var(--brand); color: var(--text); }
.mon-root:has(#mt-down:target)  .mon-tab-overview,
.mon-root:has(#mt-check:target) .mon-tab-overview {
  border-bottom-color: transparent; color: var(--text-mute);
}

/* Shared table styling for the two data panels. */
.mon-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 34rem; }
.mon-table th {
  text-align: left; font-weight: 600; color: var(--text-mute);
  font-size: var(--fs-xs); padding: 4px 8px 8px 0; white-space: nowrap;
}
.mon-table td { padding: 10px 8px 10px 0; border-top: 1px solid var(--border); vertical-align: top; }
.mon-table tr:first-child td { border-top: 0; }
.mon-scroll { overflow-x: auto; }
.mon-age { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mon-age-long { font-weight: 700; color: var(--red-deep); }
.mon-sub { color: var(--text-mute); font-size: var(--fs-xs); }

/* Reason colours — semantic, separate from the brand accent. */
.mon-r-suspended { color: var(--purple); }
.mon-r-5xx, .mon-r-dns, .mon-r-refused, .mon-r-network { color: var(--red); }
.mon-r-4xx, .mon-r-tls, .mon-r-timeout { color: var(--yellow-deep); }
.mon-r-other, .mon-r-unknown { color: var(--text-mute); }

.mon-empty {
  padding: var(--space-5); text-align: center; color: var(--text-mute);
  border: 1px dashed var(--border); border-radius: 12px;
}
.mon-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.mon-chip {
  font-size: var(--fs-xs); padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-mute);
}
.mon-chip strong { color: var(--text); }

.mon-h { margin: 0; font-size: var(--fs-lg); color: var(--text); }
.mon-panel-down .mon-h { color: var(--red-deep); }
.mon-name { font-weight: 600; color: inherit; text-decoration: none; }
.mon-name:hover { text-decoration: underline; }

/* Per-row park control + the parked (below-the-fold) table. */
.mon-actcol { width: 1%; white-space: nowrap; text-align: right; }
.mon-act { display: inline-flex; gap: 6px; align-items: center; }
.mon-act select {
  font-size: var(--fs-xs); padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
}
.mon-parked { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.mon-h-quiet { color: var(--text-mute); font-size: var(--fs-md); }
.mon-parked .mon-table td { color: var(--text-mute); }
.mon-parked .mon-name { color: var(--text-mute); }
.mon-badge {
  display: inline-block; font-size: var(--fs-xs); font-weight: 600;
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border);
}
.mon-b-suspended_billing { color: var(--purple); border-color: var(--purple); }
.mon-b-maintenance       { color: var(--yellow-deep); border-color: var(--yellow); }
.mon-b-not_monitored,
.mon-b-retired           { color: var(--text-mute); }

/* ── Detail: the standing monitoring decision, on the page you land on ──────
   Matt 2026-08-24: "I can Mute, but where can I SUSPEND monitoring on that
   site?"  Mute is a timed alert hold; this is whether we monitor it at all. */
.mon-status-bar {
  margin: var(--space-4) 0 var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev);
}
.mon-status-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: 0; }
.mon-status-form label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-mute); }
.mon-status-form select,
.mon-status-form input[type="text"] {
  font-size: var(--fs-sm); padding: 5px 8px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.mon-status-form input[type="text"] { flex: 1; min-width: 12rem; }
.mon-status-now { margin: var(--space-3) 0 0; font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.55; }
.mon-status-now strong { color: var(--text); }
.mon-status-note { color: var(--text-faint); }
.mon-status-links { margin: var(--space-2) 0 0; font-size: var(--fs-xs); }
.mon-status-links a { color: var(--brand); }

/* ── Drill-down modal ──────────────────────────────────────────────────────
   Native <dialog>: focus trap, Esc-to-close and inertness come from the
   platform rather than from JS we would have to get right. */
#mon-modal {
  width: min(56rem, 94vw); max-height: 88vh; padding: 0;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text);
}
#mon-modal::backdrop { background: rgb(0 0 0 / 0.45); }
.mon-modal-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg); border-radius: 14px 14px 0 0;
}
.mon-modal-title { font-weight: 600; font-size: var(--fs-md); margin: 0; flex: 1; }
.mon-modal-close {
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-mute);
  border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: var(--fs-md); line-height: 1.4;
}
.mon-modal-close:hover { color: var(--text); }
.mon-modal-body { padding: var(--space-4); overflow-y: auto; max-height: calc(88vh - 3.5rem); }
.mon-modal-body > div { max-width: none !important; }

/* Search: hide non-matching rows and any category left with no matches. */
.mon-row.mon-hide { display: none !important; }
details.mon-hide { display: none !important; }
.mon-search-note { font-size: var(--fs-xs); color: var(--text-mute); margin: 0 0 var(--space-3); }
