/* Dashboard styles, part 4 of 8: small screens, alert colours, the streams table.
 * The parts load in this order, and a later rule wins over an earlier one. */

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-height: 920px) {
  .sidebar-top { height: 50px; }
  .nav { gap: 1px; }
  .nav a { padding: 6px 10px; }
  .nav a[aria-current="page"]::before { top: 6px; bottom: 6px; }
  .nav-group { padding: 10px 10px 2px; }
  .sidebar-foot { padding-top: 8px; gap: 6px; }
}
@media (max-width: 900px) {
  /* auto top row: on a short page the extra height goes to the content, not the menu bar. */
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-top { height: 52px; }
  .sidebar-foot { margin-left: auto; border-top: 0; padding-top: 0; order: 2; }
  .nav { order: 3; flex: 1 0 100%; flex-direction: row; overflow-x: auto; overflow-y: visible; scrollbar-width: none; margin: 0; padding: 0 0 6px; }
  .nav a { padding: 7px 11px; white-space: nowrap; }
  /* In the one-row menu a heading becomes a thin divider between the sections. */
  /* (.nav .nav-group: the shell polish further down sets .nav-group's font size again.) */
  .nav .nav-group { flex: none; align-self: center; width: 1px; height: 18px; padding: 0; margin: 0 6px; overflow: hidden; background: var(--border-strong); font-size: 0; }
  .nav .nav-group:first-child { display: none; }
  .nav a[aria-current="page"]::before { display: none; }
  .page { padding: 16px 14px 56px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field { grid-template-columns: minmax(0, 1fr) auto; }
  .field .name { grid-column: 1 / -1; }
  .kpi .value { font-size: 22px; }
  #health-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* GS-02/09/12: a KPI coloured by the alert thresholds. */
.kpi.warn { background: var(--warn-soft); border-color: var(--warn-border); }
.kpi.warn .label, .kpi.warn .sub { color: var(--warn); }
.kpi.bad { background: var(--danger-soft); border-color: var(--danger-border); }
.kpi.bad .label, .kpi.bad .sub { color: var(--danger); }
.kpi.bad .meter > span { background: var(--danger); }
.kpi.warn .meter > span { background: #f59e0b; }

/* Resolved alerts stay listed for 10 minutes, faded (GS-02). */
.attn li.resolved { opacity: 0.55; }
.attn li.attn-divider { padding: 6px 16px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); background: var(--surface-2); }

/* The Overview nav entry carries the open-alert count; red once one is critical. */
.nav a .count.alerts, .nav a[aria-current="page"] .count.alerts { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.nav a .count.alerts.crit, .nav a[aria-current="page"] .count.alerts.crit { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.lvl-pill.info { background: #38bdf8; }

/* GS-07: the streams table — status, health, expandable rows. */
.data th.center, .data td.center { text-align: center; }
.health-cell { display: inline-flex; align-items: center; gap: 6px; }
.expander { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; flex: none; }
.expander:hover { color: var(--text); border-color: var(--border-strong); }
.expander .icon { width: 14px; height: 14px; }
.expander-spacer { width: 24px; flex: none; }
.data tbody tr.open td { background: var(--surface-2); border-bottom-color: transparent; }
.data tr.expand-row > td { background: var(--surface-2); padding: 4px 14px 16px; }
.row-details { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; }
.row-details h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 8px 0 6px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.mini th { text-align: left; font-weight: 600; color: var(--muted); padding: 3px 6px 3px 0; border-bottom: 1px solid var(--border); }
table.mini td { padding: 4px 6px 4px 0; border-bottom: 1px solid var(--border); }
table.mini th.right, table.mini td.right { text-align: right; }
table.mini tr.warn-row td { color: var(--warn); font-weight: 600; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; font-size: 13px; }
.data tbody tr.gone td { color: var(--muted); }
.warn-text { color: var(--warn); font-weight: 600; }
@media (max-width: 900px) { .row-details { grid-template-columns: minmax(0, 1fr); } }
