/* kwatch dashboard: the Overview (js/status.js), the small charts every
   page shares (js/viz.js), the card grid of the Overview and kwatch
   pages, the kwatch page (js/kwatchpage.js) and what kwatch watches
   (js/ovcoverage.js). Colors are the tokens of app.css, so light, dark
   and high contrast follow by themselves. */

/* Chart colors: each class names what a mark means. */
:root { --s-page: var(--failing); --s-notify: var(--degraded); --s-low: var(--control-border);
  --s-ok: var(--success); --s-open: var(--text-muted); --s-done: var(--line); }
.s-page { --c: var(--s-page); } .s-notify { --c: var(--s-notify); } .s-low { --c: var(--s-low); }
.s-ok { --c: var(--s-ok); } .s-open { --c: var(--s-open); } .s-done { --c: var(--s-done); }
.s-quiet { --c: transparent; }
/* "s-done", the rest of a count that is no alert level, is striped so
   it never reads as Low's solid grey, in any theme. */
.viz-seg.s-done, .viz-sw.s-done { background: repeating-linear-gradient(135deg, var(--text-muted) 0 2px, transparent 2px 5px); }

/* ---- Overview ---- */
.ov-notes { display: grid; gap: 8px; margin-top: 16px; }
.ov-note { margin-top: 0; }
.ov-note p { margin-top: 2px; }
.ov-note .viz-meter { margin: 8px 0 4px; max-width: 28rem; }
.n-failing { background: var(--failing-bg); } .n-failing b { color: var(--failing); }
.ov-tile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 20px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-card); }
.ov-tile.bad { background: var(--failing-bg); }
.ov-status.bad { border-color: var(--failing); }
.ov-status.warn { background: var(--degraded-bg); border-color: var(--degraded); }
.ov-tile > .ov-say { flex: 1 1 16rem; }
.ov-says { min-width: 0; flex: 1 1 12rem; }
/* How far the first read is, under a "starting" verdict. */
.ov-start { flex: 1 1 100%; margin: 0; }
.viz-meter.ov-start { max-width: 28rem; margin: 6px 0 2px; }
.ov-tile > .ov-start { padding-left: 38px; }
.ov-tile > .viz-meter.ov-start { padding-left: 0; margin-left: 38px; }
@media (max-width: 700px) { .ov-tile > .ov-start { padding-left: 0; } .ov-tile > .viz-meter.ov-start { margin-left: 0; } }
.ov-sub { margin: 2px 0 0; font-size: var(--t-small); color: var(--text-muted); }
.ov-lvl { color: inherit; text-decoration: none; white-space: nowrap; }
.ov-lvl:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.ov-mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--control-border); color: var(--bg); }
.ov-tile.ok .ov-mark { background: var(--success); }
.ov-tile.warn .ov-mark { background: var(--degraded); }
.ov-tile.bad .ov-mark { background: var(--failing); }
.ov-mark .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.ov-say { font-size: clamp(1.25rem, 1.4vw + 0.9rem, 1.75rem); letter-spacing: -0.02em; overflow-wrap: anywhere; }
/* How the week went: below what is wrong now, set apart by a line. */
.ov-week { margin-top: 32px; padding-top: 4px; border-top: 1px solid var(--line); }
/* The week in four numbers, then the cards; the rest folds under "More". */
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 12px; margin: 4px 0 0; }
.ov-stat { min-width: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-card); }
.ov-stat dt { font-size: var(--t-micro); color: var(--text-muted); }
.ov-stat dd { margin: 0; }
.ov-stat-n { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ov-stat-sub { font-size: var(--t-micro); color: var(--text-muted); }
.ov-settled { margin: 14px 0 0; font-size: var(--t-body); }
.ov-settled b { font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .ov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .ov-stat { padding: 10px 12px; } }
/* The issues to look at first beside the bad releases and changes on a
   wide screen (3:2), one under the other below 1100px. */
.ov-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: stretch; margin-top: 20px; }
.ov-main { min-width: 0; display: flex; flex-direction: column; }
.ov-main > .ov-act { flex: 1 0 auto; }
@media (min-width: 1100px) {
  .ov-pair:has(> .ov-rel:not([hidden])) { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
/* What to act on is in cards like the rest of the page: the title is
   the card header (V.head), the rows run edge to edge under it. */
.pcard .ov-h2 { font-size: var(--t-body); font-weight: 700; color: var(--text); margin: 0; }
.pcard .ov-look, .pcard .ov-rel-list { border: 0; border-radius: 0; margin: 0 -20px; border-top: 1px solid var(--line); }
.pcard .ov-rel-list > li { padding: 12px 20px; }
.pcard .ov-row { padding: 12px 20px; }
.pcard > .ov-olds { margin-top: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.ov-calm { margin-top: 0; }
/* The short line that ends a card whose list is all there is: it sits
   at the card's bottom, like a card footer. */
.ov-first { flex: 1 0 auto; display: flex; flex-direction: column; }
.ov-end { margin: auto 0 0; padding-top: 12px; text-align: center; font-size: var(--t-small); color: var(--text-muted); }
/* A trend against last week: the arrow and the words, then the colour
   (more alerts is worse). */
.ov-trend.up { color: var(--failing); }
.ov-trend.down { color: var(--success); }
.ov-arrow { font-size: .85em; }
.ov-pat { margin-top: 32px; }
.ov-h2 { font-family: var(--font-body); font-size: var(--t-small); font-weight: 600; line-height: 1.3; color: var(--text-muted); letter-spacing: 0; margin: 28px 0 8px; }
.ov-rel-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.ov-rel-list > li { padding: 10px 16px; font-size: var(--t-small); }
.ov-rel-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; }
.ov-rel-name { font-weight: 600; overflow-wrap: anywhere; }
.ov-rel-list > li + li { border-top: 1px solid var(--line); }
.ov-rel-v { font-weight: 600; color: var(--failing); }
.ov-rel-at { margin-top: 2px; color: var(--text-muted); overflow-wrap: anywhere; }
.ov-look { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.ov-look > li + li { border-top: 1px solid var(--line); }
.ov-rule { margin: -4px 0 8px; font-size: var(--t-micro); color: var(--text-muted); }
.ov-row { display: grid; grid-template-columns: minmax(0, 1fr) 11rem; gap: 6px 16px; align-items: start; padding: 12px 16px; min-height: var(--hit); color: var(--text); text-decoration: none; }
.ov-row:hover { background: var(--surface); }
.ov-row:hover .ov-title { text-decoration: underline; }
.ov-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ov-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.ov-gist { font-size: var(--t-small); color: var(--text-soft); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ov-chips .chip + .chip { margin-left: 0; }
.ov-what { display: flex; flex-direction: column; min-width: 0; }
.ov-title { font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ov-where { font-size: var(--t-micro); color: var(--text-muted); margin-top: 2px; }
.ov-dtext { font-size: var(--t-micro); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ov-more, .ov-calm { margin-top: 12px; }

/* ---- shared charts ---- */
.viz-track { display: block; height: 10px; border-radius: var(--radius-chip); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.viz-fill { display: flex; height: 100%; gap: 2px; }
.viz-seg { display: block; min-width: 4px; height: 100%; background: var(--c); }
a.viz-seg:hover { opacity: .8; }
.viz-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: var(--t-small); }
.viz-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; min-height: 28px; }
a.viz-key:hover span:not(.viz-sw) { text-decoration: underline; }
.viz-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.viz-sw.s-quiet { border: 1.5px dashed var(--control-border); }
.viz-kn { font-variant-numeric: tabular-nums; }
.viz-meter { display: block; height: 10px; border-radius: var(--radius-chip); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.viz-mfill { display: block; height: 100%; background: var(--text-muted); border-radius: var(--radius-chip); }
.viz-meter.ok .viz-mfill { background: var(--success); }
.viz-meter.warn .viz-mfill { background: var(--degraded); }
.viz-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.viz-rtop { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin-bottom: 4px; }
.viz-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.viz-name.mono { font-size: var(--t-small); }
.viz-val { font-size: var(--t-micro); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.viz-cols { display: block; width: 100%; height: 150px; overflow: visible; }
.viz-cols .viz-axis { stroke: var(--line); }
.viz-cols .viz-hit { fill: transparent; }
.viz-cols .viz-day:hover .viz-hit { fill: var(--surface); }
.viz-cols .viz-open { fill: var(--s-open); }
.viz-cols .viz-paged { fill: var(--s-page); }
.viz-cols .viz-res { fill: var(--s-ok); }
.viz-cols text { font-family: var(--font-body); font-size: 12px; fill: var(--text-muted); }
.viz-cols .viz-cnum { fill: var(--text); font-variant-numeric: tabular-nums; }
.viz-tl { margin-top: 8px; }
.viz-tltrack { position: relative; height: 22px; border-bottom: 2px solid var(--line); margin: 0 7px; }
.viz-dot { position: absolute; bottom: -8px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--control-border); border: 2px solid var(--bg); cursor: help; }
.viz-dot.bad { background: var(--failing); }
.viz-tlends { display: flex; justify-content: space-between; margin-top: 10px; font-size: var(--t-micro); color: var(--text-muted); }
.viz-gauge { width: 9rem; height: auto; flex: none; }
.viz-gtrack, .viz-gfill { fill: none; stroke-width: 12; stroke-linecap: round; }
.viz-gtrack { stroke: var(--surface); }
.viz-gfill { stroke: var(--success); } .viz-gfill.warn { stroke: var(--degraded); } .viz-gfill.bad { stroke: var(--failing); }
.viz-gtext { font-family: var(--font-body); font-size: 18px; font-weight: 700; fill: var(--text); }

/* ---- page cards (Overview, kwatch) ---- */
/* One grid: two equal columns, one 16px gap everywhere, cards in a row
   stretched to the same height; a lone card spans the row. */
.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: stretch; }
.ov-h2 + .pgrid { margin-top: 0; }
.pcard { border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px 20px; min-width: 0; display: flex; flex-direction: column; }
.pcard > * { min-width: 0; }
.pcard-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 4px; }
.pcard-act { flex: none; font-size: var(--t-small); }
.pcard-top .pcard-h { margin: 0; }
/* The footer of a card ("+2 more namespaces") sits at its bottom. */
.pcard > .pcard-more { margin-top: auto; padding-top: 12px; }
.pcard.pwide { grid-column: 1 / -1; }
/* A lone card, or the odd last one, fills the row instead of leaving a hole. */
.pgrid > .pcard:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pcard-h { font-family: var(--font-body); font-size: var(--t-body); font-weight: 700; letter-spacing: 0; margin: 0 0 4px; }
.pcard-note { font-size: var(--t-small); color: var(--text-muted); margin: 0 0 14px; }
.pcard-more { margin-top: 12px; font-size: var(--t-small); }
.pempty { color: var(--text-muted); margin: 4px 0 0; }

/* ---- kwatch page ---- */
.kp-facts { grid-template-columns: 8.5rem 1fr; }
/* A mono value (Version) sits on the label's baseline at its size. */
.kp-facts { align-items: baseline; }
.kp-facts dd.mono { font-size: var(--t-small); }
.kp-sub { font-family: var(--font-body); font-size: var(--t-small); font-weight: 600; letter-spacing: 0; color: var(--text-muted); margin: 16px 0 0; }
.kp-gauge { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.kp-gtext, .kp-big { font-size: 1.125rem; font-weight: 600; }
.kp-mline { font-weight: 600; margin-bottom: 6px; }
.kp-stats { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.kp-stats li { padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-chip); font-size: var(--t-small); }
.kp-stats li.bad { border-color: var(--failing); color: var(--failing); }
.kp-stats li.warn { border-color: var(--degraded); color: var(--degraded); }
.kp-ns { margin-top: 10px; font-size: var(--t-small); }
.kp-chans { list-style: none; margin: 0; padding: 0; }
.kp-ch { padding: 14px 0; border-top: 1px solid var(--line); }
.kp-ch:first-child { border-top: 0; padding-top: 4px; }
.kp-chtop { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 8px; }
.kp-counts { margin-top: 6px; font-size: var(--t-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.nav-dot { width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--degraded); box-shadow: 0 0 0 2px var(--degraded-bg); }

/* ---- what kwatch watches ---- */
.cov-lead { margin: 0 0 12px; }
.cov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cov-part { min-width: 0; }
.cov-h { font-family: var(--font-body); font-weight: 600; font-size: var(--t-small); letter-spacing: 0; color: var(--text-muted); margin: 0 0 4px; }
.cov-part p { margin: 0; }
.cov-sub { margin-top: 8px !important; font-size: var(--t-small); color: var(--text-muted); }
.cov-gaps { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: var(--t-small); overflow-wrap: anywhere; }
.cov-more { font-family: var(--font-body); color: var(--text-muted); }
.cov-rbac { margin-top: 16px; }
.cov-yaml { position: relative; margin-top: 8px; }
.cov-yaml pre { margin: 0; padding: 10px 12px; padding-right: 3rem; overflow-x: auto; font-size: var(--t-micro); line-height: 1.5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-input); }
.cov-yaml .copy-ico { position: absolute; top: 6px; right: 6px; background: var(--surface); }

/* High contrast: marks get an outline so they stand apart from the track. */
:root[data-contrast="more"] .viz-seg, :root[data-contrast="more"] .viz-mfill { box-shadow: inset 0 0 0 1px var(--text); }
:root[data-contrast="more"] .viz-track, :root[data-contrast="more"] .viz-meter { box-shadow: inset 0 0 0 1px var(--control-border); }
:root[data-contrast="more"] { --s-done: var(--control-border); }
@media (pointer: coarse) {
  .viz-key, .viz-name, .ov-more a, .ov-calm a, .pcard-more a { display: inline-flex; align-items: center; min-height: 44px; }
  .viz-dot { width: 20px; height: 20px; margin-left: -10px; bottom: -11px; }
}
@media (max-width: 900px) {
  .ov-row { grid-template-columns: minmax(0, 1fr); }
  .ov-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 4px 10px; }
  .ov-chips { justify-content: flex-start; }
}
@media (max-width: 700px) {
  .pgrid, .cov-grid { grid-template-columns: minmax(0, 1fr); }
  .pcard { padding: 16px; }
  .ov-tile { padding: 14px 16px; }
  .ov-row { padding: 12px 14px; }
  .kp-facts { grid-template-columns: 7rem 1fr; }
}
.ov-ack { width: fit-content; }
@media (max-width: 700px) { .viz-cols text { font-size: 14px; } }
/* Resources on the kwatch page: memory, CPU and disk side by side,
   each a gauge against its limit (js/kwatchpage.js). */
.kp-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 16px; margin-top: 8px; }
.kp-res-part { min-width: 0; }
.kp-res-part .viz-gauge { width: 7.5rem; }
.kp-res-h { font-family: var(--font-body); font-size: var(--t-small); font-weight: 700; letter-spacing: 0; margin: 4px 0 2px; }
.kp-res-t { font-size: var(--t-small); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kp-res-x { margin-top: 2px; font-size: var(--t-micro); color: var(--text-muted); overflow-wrap: anywhere; }

/* Paging held while nodes come and go; old problems not shown. */
.ov-hold { margin: 4px 0 0; font-size: var(--t-small); color: var(--text-soft); }
.ov-hold-at { white-space: nowrap; }
.ov-olds { margin-top: 12px; font-size: var(--t-small); color: var(--text-muted); }
.ov-old-h { margin: 0 0 4px; }
.ov-old .lo-list { max-width: var(--max-app); }
