/* kwatch dashboard: the issue page. The summary card (what's wrong,
   why, proof, what to do, who was told, the state stepper), then what
   the tabs show: logs, what changed, seen before, who was told,
   "Containers" (table, restarts, usage now) and affected objects.
   Tokens come from app.css, so light, dark and high contrast follow. */

/* The summary card. Its header: the level and state chips with the
   copy buttons on one row, the whole title (wrapped, never cut), one
   line of where and since when, and the plain sentence of what is
   wrong. */
.ds { padding: 18px 22px 16px; }
.ds-head { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }
/* On the issue page the card holds only its header; the questions
   (.ds-body) and Who was alerted? (.ds-alerted) sit in the Summary and
   Alerts tabs, without the card's padding. The drawer keeps them in. */
.d-sum > .ds-head:last-child { padding-bottom: 0; }
.ds.ds-body { padding: 0; }
.d-panel > .ds-body > .ds-grid > .ds-row:first-child, .d-panel > .ds-alerted > .ds-row:first-child { border-top: 0; }
.d-panel > .ds-alerted { margin: 6px 0 0; }
.d-panel > .ds-body > .ds-notes { margin-top: 14px; }
.ds-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ds-top .chips { margin-top: 0; align-items: center; }
.ds-top .d-acts { display: inline-flex; gap: 8px; margin-left: auto; }
.ds-top .btn { min-height: 32px; padding: 0 12px; font-size: var(--t-micro); }
.ds-head .ds-lvl { margin: -2px 0 0; }
.ds h1 { margin: 2px 0 0; font-size: clamp(1.25rem, 1.1rem + 0.9vw, 1.75rem); line-height: 1.25; letter-spacing: -0.02em; max-width: 60ch; overflow-wrap: anywhere; text-wrap: pretty; }
.ds-where { display: flex; flex-wrap: wrap; align-items: baseline; list-style: none; margin: 0; padding: 0; font-size: var(--t-small); color: var(--text-soft); overflow-wrap: anywhere; }
.ds-where li { min-width: 0; }
.ds-where li:not(:last-child)::after { content: "\00b7"; padding: 0 8px; color: var(--text-muted); }
.ds-where .mono { font-size: var(--t-small); color: var(--text); }
.ds-where .ds-impact { color: var(--text); font-weight: 600; }
.ds-lead { margin: 2px 0 0; max-width: 75ch; overflow-wrap: anywhere; font-size: 1.0625rem; line-height: 1.45; color: var(--text); }
.ds-state.s-open, .ds-state.s-flapping { font-weight: 700; }
.ds-stage { margin: 0; }
.ds-stage:not(:has(> :not([hidden]))) { display: none; }
.ds-stage .al-open { margin-top: 8px; }
.ds-stage .al-open p { font-size: var(--t-small); font-weight: 400; color: var(--text-soft); }
/* Notes: one muted line under the stepper; each note one line, its
   full text in its tooltip. Caused by and can't see stay in full ink. */
.ds-notes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin-top: 12px; font-size: var(--t-micro); color: var(--text-muted); }
.ds-dyn:not([hidden]), .ds-notes .d-moved:not([hidden]) { display: contents; }
.ds-dyn { list-style: none; margin: 0; padding: 0; }
.ds .ds-notes > *, .ds-notes .ds-note, .ds-notes .d-moved > p { margin: 0; padding: 0; max-width: 100%; min-width: 0; background: none; border-radius: 0; font-size: inherit; font-weight: 400; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.ds-notes a { color: inherit; }
.ds-notes .d-caused, .ds-notes .n-warn { order: -1; }
.ds-notes b { font-weight: 600; }
.ds-note-ico { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ds .ds-notes > .d-caused, .ds-notes .ds-note.n-warn { color: var(--text); font-weight: 600; }
.ds-notes .d-caused .ds-note-ico, .ds-note.n-warn .ds-note-ico { color: var(--degraded); }
.ds-note.n-ok .ds-note-ico { color: var(--success); }
.ds-notes .d-looked .ds-note-ico { color: var(--resolved); }
.ds-grid { margin: 14px 0 0; }
.ds-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ds-row dt { font-size: var(--t-micro); font-weight: 600; color: var(--text-muted); padding-top: 2px; }
.ds-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ds-what { font-size: 1.0625rem; font-weight: 600; }
.ds-unknown { font-weight: 600; }
.ds-sub { margin-top: 2px; font-size: var(--t-small); color: var(--text-soft); }
.ds-meter { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; cursor: help; }
.mt-bars { display: inline-flex; gap: 3px; }
.mt { width: 18px; height: 8px; border: 1.5px solid var(--control-border); border-radius: var(--radius-chip); }
.mt.on { background: var(--text); border-color: var(--text); }
.m-high .mt.on { background: var(--success); border-color: var(--success); }
.m-possible .mt.on { background: var(--degraded); border-color: var(--degraded); }
.mt-t { font-size: var(--t-micro); font-weight: 600; }
.ds-proof { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ds-pf { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
.ds-ico { width: 16px; height: 16px; margin-top: 3px; fill: none; stroke: var(--text-soft); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ds-kind { display: inline-block; margin-right: 8px; padding: 0 6px; font-size: var(--t-micro); font-weight: 600; color: var(--text-soft); border: 1px solid var(--line); border-radius: var(--radius-chip); }
.ds-n { margin-left: 8px; font-size: var(--t-micro); font-weight: 700; padding: 0 7px; border-radius: var(--radius-chip); background: var(--degraded-bg); color: var(--degraded); white-space: nowrap; }
.ds-at { margin-left: 8px; font-size: var(--t-micro); color: var(--text-muted); white-space: nowrap; }
.ds-raw { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; }
.ds-raw-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: zoom-in; padding: 4px 8px; font-size: var(--t-micro); line-height: 1.55; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-input); }
/* On a phone the proof line wraps, so the one real error line is read in full. */
@media (max-width: 700px) {
  .ds-raw-t { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 12em; overflow: auto; cursor: text; }
}
.ds-raw-t.is-open { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 12em; overflow: auto; cursor: text; }
.ds-r-next .cmd { margin-top: 6px; }
.ds-steps-b { display: inline-block; margin-top: 6px; font-size: var(--t-small); text-align: left; }
.ds-told { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.ds-tc { display: inline-flex; align-items: baseline; gap: 6px; }
.ds-tc-i { width: 1.1em; text-align: center; font-weight: 700; }
.ds-tc-s { color: var(--text-soft); font-size: var(--t-small); }
.t-ok .ds-tc-i { color: var(--success); }
.t-bad .ds-tc-i, .t-bad .ds-tc-s, .t-open .ds-tc-i { color: var(--failing); }
.t-bad .ds-tc-s { font-weight: 600; }
.t-wait .ds-tc-i { color: var(--degraded); }
.ds-more { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: var(--t-small); }
.ds-more-h { color: var(--text-muted); }
:root[data-contrast="more"] .ds-raw-t { border: 1px solid currentColor; }

/* Containers: restarts as a bar against the most restarted one. */
.rs { display: inline-flex; align-items: center; gap: 8px; }
.rs .viz-meter { width: 56px; height: 6px; }


/* One-line times. */
.d-nowrap { white-space: nowrap; }

/* Logs: one set of controls. */
.lg-ctl { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.lg-ctl label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.lg-ctl .dd { flex: 1 1 auto; }
.lg-ctl .dd-btn { min-height: 36px; }
.lg-ctl [data-log-n] { margin: 0; }

/* What changed just before. */
.cx-fixed { margin: 4px 0 10px; }
.cx-list { list-style: none; margin: 4px 0 0; padding: 0; }
.cx-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cx-row:first-child { border-top: 0; }
.cx-when { align-self: start; font-size: var(--t-micro); font-weight: 600; text-align: center; padding: 2px 8px; border-radius: var(--radius-chip); cursor: help; }
.cx-before { color: var(--degraded); background: var(--degraded-bg); }
.cx-during { color: var(--resolved); background: var(--resolved-bg); }
.cx-line { overflow-wrap: anywhere; }
.cx-line .mono { font-size: var(--t-small); }
.cx-line .chip { margin-left: 8px; vertical-align: 1px; }
.cx-meta { display: block; margin-top: 2px; font-size: var(--t-micro); color: var(--text-muted); overflow-wrap: anywhere; }

/* Seen before. */
.seen-list { margin: 8px 0 0; padding-left: 18px; }
.seen-list li { padding: 2px 0; }
.seen-list .mono { font-size: var(--t-small); }
.seen-prev { margin-top: 10px; }

/* Who was told. */
.told-list { list-style: none; margin: 4px 0 0; padding: 0; }
.told-row { display: grid; grid-template-columns: 8em minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.told-row:first-child { border-top: 0; }
.told-row time { font-size: var(--t-micro); color: var(--text-muted); padding-top: 2px; }
.told-body p { overflow-wrap: anywhere; }
.told-body .ch-msg { margin-top: 6px; }
.told-body [title] { cursor: help; }

/* Changed just before it recovered: plain rows, no Before/During tag. */
.cx-plain { display: block; }

/* What we sent: the exact text, wrapped. */
.sent-h { margin-top: 12px; }
.sent-h:first-child { margin-top: 0; }
.sent-text { margin: 4px 0 0; padding: 10px 12px; font-family: var(--font-mono); font-size: var(--t-micro); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-input); }

/* Hidden for safety: where kwatch hid a secret in text. */
.hid-tag { display: inline-block; margin: 0 2px; padding: 0 5px; font-family: var(--font-body); font-size: var(--t-micro); line-height: 1.5; border: 1px dashed currentColor; border-radius: var(--radius-chip); cursor: help; }
:root[data-contrast="more"] .hid-tag { border-style: solid; border-width: 2px; }

/* Tables: containers and affected objects. */
.kt-wrap { overflow-x: auto; }
.kt { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.kt th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: var(--t-micro); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.kt th[title] { cursor: help; }
.kt td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kt .mono { font-size: var(--t-micro); }
.kt-name, .kt-img { overflow-wrap: anywhere; }
.x-num { font-variant-numeric: tabular-nums; }
.x-bad { color: var(--failing); }
.x-warn { color: var(--degraded); font-weight: 600; }
.ao-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: help; }
.ao-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--control-border); }
.ao-dot.s-failing { background: var(--failing); }
.ao-dot.s-cause { background: var(--degraded); }
.ao-dot.s-recovered { background: var(--success); }
.ao-dot.s-gone { background: transparent; border: 1.5px dashed var(--control-border); }
.ao-cmds { display: flex; flex-wrap: wrap; gap: 6px; }
.ao-cmds .btn { min-height: 32px; padding: 0 10px; font-size: var(--t-micro); white-space: nowrap; }
[data-affected] + [data-related]:not(:empty) { margin-top: 16px; }

.ao-main { display: block; font-size: var(--t-micro); color: var(--text-muted); }

/* Containers: the table, then usage now, then the chart. */
.ct-part:not(:empty) { margin-top: 18px; }
.ct-part > .fold-h { cursor: default; }
.ct-part > .fold-h + .use, .ct-part > .fold-h + .uc { border-top: 0; }

/* Usage now: used against the limit (or request). */
.use { padding: 10px 0; border-top: 1px solid var(--line); }
.use:first-child { border-top: 0; }
.use-name { font-size: var(--t-micro); color: var(--text-muted); overflow-wrap: anywhere; }
.use-row { margin-top: 6px; }
.use-bar { height: 8px; max-width: 420px; margin-top: 4px; border-radius: var(--radius-chip); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.use-fill { display: block; width: 0; height: 100%; background: var(--resolved); }
.use-fill.warm { background: var(--degraded); }
.use-fill.hot { background: var(--failing); }

/* States strip above the step-by-step list. */
.strip { margin: 4px 0 18px; }
.strip-h { font-size: var(--t-micro); font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.seg-failing { background: var(--failing); }
.seg-recovering { background: var(--resolved); }
.seg-quiet { background: var(--control-border); opacity: .45; }
.strip-ends { display: flex; justify-content: space-between; margin-top: 4px; font-variant-numeric: tabular-nums; font-size: var(--t-micro); color: var(--text-muted); }
.strip-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: var(--t-micro); color: var(--text-muted); }
.strip-key > span { display: inline-flex; align-items: center; gap: 6px; }
.seg-dot { width: 10px; height: 10px; border-radius: var(--radius-chip); }

/* Narrow screens: table rows become labelled stacks. */
@media (max-width: 600px) {
  .kt-stack thead { display: none; }
  .kt-stack, .kt-stack tbody, .kt-stack tr { display: block; width: 100%; }
  .kt-stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .kt-stack td { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 8px; padding: 2px 0; border: 0; }
  .kt-stack td::before { content: attr(data-label); color: var(--text-muted); font-size: var(--t-micro); font-weight: 400; }
  .cx-row, .told-row { grid-template-columns: 1fr; gap: 4px; }
  .ds { padding: 14px 16px; }
  .ds-row { grid-template-columns: 1fr; gap: 2px; }
  .cx-when { justify-self: start; }
}

/* The release linked to the issue (js/release.js): a row of the summary. */
.rl-who, .rl-when, .rl-verdict, .rl-line { margin: 0; }
.rl-who { font-size: var(--t-small); font-weight: 600; }
.rl-when, .rl-line { margin-top: 4px; font-size: var(--t-small); color: var(--text-soft); }
.rl-verdict { margin-top: 8px; font-size: var(--t-small); }
.rl-h { margin: 12px 0 4px; font-size: var(--t-micro); font-weight: 600; color: var(--text-muted); }
.rl-list { margin: 0; padding: 0 0 0 18px; font-size: var(--t-small); }
.rl-log { margin-top: 6px; max-height: 8rem; }
.rl-lead { margin: 0; font-size: var(--t-small); font-weight: 600; }
.rl-repo { font-size: var(--t-micro); }
.detail { max-width: none; }

/* The questions: each answer one short block, prose capped for reading. */
.ds-row dd p, .ds-row dd ol { max-width: 75ch; }
.ds-row dt { font-size: var(--t-small); color: var(--text-soft); font-weight: 700; }
.ds-why-t { font-size: 1.0625rem; font-weight: 600; }
.ds-rel { margin-top: 6px; font-size: var(--t-small); color: var(--text-soft); cursor: help; }
.ds-cap { margin-top: 10px; font-size: var(--t-small); color: var(--text-soft); }
.ds-cap b { color: var(--text); }
.ds-key { margin-top: 8px; font-size: var(--t-small); font-weight: 600; }
.ds-todo { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; }
.ds-todo li::marker { font-weight: 700; color: var(--text-soft); }
.ds-todo .cmd { margin-top: 6px; }
.ds-next-t { font-weight: 600; }
.ds-alert { margin: 0 0 4px; font-size: var(--t-small); }
.ds-alert b { font-weight: 700; }
.ds-alert.t-bad { color: var(--failing); font-weight: 600; }
.ds-runbook { margin-top: 8px; font-size: var(--t-small); }

/* Details: has this happened before, anywhere else, reference. */
.seen-h { font-weight: 600; max-width: 75ch; }
.seen-fix { margin: 8px 0; max-width: 75ch; font-weight: 600; }
.seen-strip { max-width: 560px; margin: 4px 0 10px; }
.viz-dot.is-fix { background: var(--success); }
.seen-x { font-weight: 700; color: var(--text-soft); }
.seen-all { margin-top: 8px; }
.kt-more { margin-top: 8px; }
.ao-bar { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tl-about { list-style: none; padding: 0 0 8px; color: var(--text-soft); }
.in-body { min-width: 0; }
.in-body .rd-line { margin-top: 2px; color: var(--text-soft); }
.facts dd .btn { margin-left: 10px; }
.mono { overflow-wrap: break-word; }
