/* kwatch dashboard: the issue page's tabs and what they hold. The tab
   bar (a select menu on phones), the sections, "Alert status", caused
   by / causing, at the same time, who it hits, the "New since your last
   visit" marks, change diffs, the containers' break snapshots, the
   mini timeline and the usage chart. Tokens come from app.css, so
   light, dark and high contrast follow it. */

/* Tabs: a row of plain words with their counts on one line. The open
   tab is in full ink with a 3px bar under it and a filled count; the
   others are muted and get a soft background on hover. */
.d-tabbar { margin-top: 24px; border-bottom: 1px solid var(--line); }
.d-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.d-tabs::-webkit-scrollbar { display: none; }
.d-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 0 14px; background: none; border: 0; border-radius: var(--radius-input) var(--radius-input) 0 0; color: var(--text-muted); font-weight: 600; font-size: var(--t-small); white-space: nowrap; }
.d-tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.d-tab:hover { color: var(--text); background: var(--surface); }
.d-tab:focus-visible { outline: var(--focus-width) solid var(--text); outline-offset: -4px; }
.d-tab[aria-selected="true"] { color: var(--text); }
.d-tab[aria-selected="true"]::after { background: var(--text); }
.d-badge { min-width: 1.5rem; padding: 0 7px; font-size: var(--t-micro); font-weight: 700; line-height: 1.5; text-align: center; border-radius: var(--radius-chip); background: var(--surface); color: var(--text-soft); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.d-tab[aria-selected="true"] .d-badge { background: var(--text); border-color: var(--text); color: var(--bg); }
.d-panel { padding-top: 4px; }
.d-panel:focus { outline: none; }
.d-panel:focus-visible { outline: var(--focus-width) solid var(--text); outline-offset: 2px; }
.tab-empty { margin: 18px 0; padding: 14px 16px; border-radius: var(--radius-card); background: var(--surface); color: var(--text-soft); max-width: var(--measure); }
.sec { padding: 16px 0 6px; border-bottom: 1px solid var(--line); }
.sec-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.sec > .fold-cap { margin: 0 0 8px; }
.sec > .fold-body { padding: 4px 0 12px; }
.d-panel > .d-alert { margin-top: 16px; }
.step-n { display: block; font-size: var(--t-micro); font-weight: 700; color: var(--text-muted); }
/* On a phone the tabs stay one row that scrolls sideways, right under the
   summary. */
@media (max-width: 700px) {
  .d-tabbar { margin-top: 16px; }
  .d-tabs { gap: 0; -webkit-overflow-scrolling: touch; }
  .d-tab { flex: none; padding: 0 10px; gap: 6px; }
  .d-tab::after { left: 6px; right: 6px; }
}
/* Tabs waiting off the right edge: a fade and an arrow say the bar
   scrolls. The bar sticks to the top of the window while a long tab
   scrolls, so another tab is always one click away. */
.d-tabbar { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--bg); }
.d-tabbar.more::after { content: "›"; position: absolute; right: 0; top: 0; bottom: 1px; width: 44px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; background: linear-gradient(to right, transparent, var(--bg) 65%); font-size: 1.6rem; font-weight: 700; color: var(--text); pointer-events: none; }

/* Summary card notes. */
.d-caused, .d-blast { font-size: var(--t-small); overflow-wrap: anywhere; max-width: var(--measure); }
.d-caused { padding: 6px 10px; border-radius: var(--radius-input); background: var(--degraded-bg); }
.d-looked { margin-top: 10px; font-size: var(--t-small); font-weight: 600; color: var(--resolved); cursor: help; }

/* What's going on with this alert. */
/* The summary is the one card of the page; what the tabs hold is flat,
   set apart by a line. */
.d-alert { margin-top: 12px; border-top: 1px solid var(--line); padding: 14px 0 16px; display: grid; gap: 8px; }
.d-alert .d-kicker { margin-bottom: 2px; }
.al-open p { font-weight: 600; overflow-wrap: anywhere; }
.al-open[title] { cursor: help; }
.al-bar { height: 8px; max-width: 420px; margin-top: 6px; border-radius: var(--radius-chip); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.al-fill { display: block; width: 0; height: 100%; background: var(--success); transition: width 900ms linear; }
.al-line { font-size: var(--t-small); color: var(--text-soft); overflow-wrap: anywhere; max-width: var(--measure); }
.al-line b { color: var(--text); }
.al-timing { font-size: var(--t-small); }
.al-t { cursor: help; white-space: nowrap; }
.al-t time { font-size: var(--t-micro); color: var(--text); }
.al-how { margin-top: 4px; font-size: var(--t-small); }
.al-how summary { cursor: pointer; color: var(--text-soft); text-decoration: underline; text-decoration-color: var(--line); min-height: 28px; display: inline-flex; align-items: center; }
.al-how > p { margin-top: 6px; max-width: var(--measure); }
.al-how .cmd { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .al-fill { transition: none; } }

/* New since your last visit. */
.c-new { color: var(--resolved); background: var(--resolved-bg); font-size: var(--t-micro); padding: 0 7px; margin-left: 8px; vertical-align: 1px; }
.tl .ev.is-new .tx-text { font-weight: 600; }
.cx-row.is-new, .in-warn.is-new { box-shadow: inset 3px 0 0 var(--resolved); padding-left: 10px; }

/* Before and after of a change. */
.cx-diff { margin-top: 6px; font-size: var(--t-micro); }
.cx-diff summary { cursor: pointer; color: var(--text-soft); min-height: 28px; display: inline-flex; align-items: center; }
.cx-fields { display: grid; grid-template-columns: minmax(0, 14em) minmax(0, 1fr); gap: 4px 12px; margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius-input); background: var(--surface); }
.cx-fields dt { overflow-wrap: anywhere; color: var(--text-muted); }
.cx-fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cx-old { color: var(--failing); text-decoration: line-through; }
.cx-new { color: var(--success); text-decoration: none; }
.cx-key { color: var(--text-soft); }

/* Caused by, also causing, at the same time. */
.rel-list { list-style: none; margin: 8px 0 0; padding: 0; }
.rel-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.rel-row:first-child { border-top: 0; }
.rel-row[title] { cursor: help; }
.rel-body { min-width: 0; overflow-wrap: anywhere; }
.rel-row .chip { flex: none; font-size: var(--t-micro); }

/* Containers: at first break, when it got worse, now. */
.snap-sw { flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.snap-sw .tz-b, .snap-sw .tz-b:first-of-type, .snap-sw .tz-b:last-of-type { border-radius: var(--radius-chip); border-left: 1px solid var(--line); }
.snap-sw .tz-b[aria-pressed="true"] { border-color: var(--text); }

/* States strip: the states transitions add, and alert level marks. */
.seg-settling { background: var(--control-border); }
.seg-flapping { background: var(--degraded); }
.mt-svg { display: block; width: 100%; overflow: visible; }
.mt-bg { fill: var(--surface); }
.mt-band { cursor: help; }
.mt-band.seg-failing { fill: var(--failing); }
.mt-band.seg-flapping { fill: var(--degraded); }
.mt-band.seg-recovering { fill: var(--resolved); }
.mt-band.seg-settling { fill: var(--control-border); }
.mt-band.seg-quiet { fill: var(--control-border); opacity: .45; }
.mt-chg, .mt-tier { cursor: help; }
.mt-chg { fill: var(--text); }
.mt-chg.is-cause { fill: var(--failing); }
.mt-chg-l, .is-cause-l { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 2; }
.mt-tier { fill: var(--resolved); }
.mt-tier-l { stroke: var(--resolved); stroke-width: 1; stroke-dasharray: 1 3; }
.mt-key-chg, .mt-key-tier { white-space: nowrap; }

/* Memory or CPU over the last day. */
.uc { padding: 10px 0; border-top: 1px solid var(--line); }
.uc:first-child { border-top: 0; }
.uc-fig { margin: 6px 0 0; max-width: 520px; }
.uc-svg { display: block; width: 100%; height: 96px; background: var(--surface); border-radius: var(--radius-chip); }
.uc-col { fill: var(--resolved); }
.uc-col.hot { fill: var(--failing); }
.uc-limit { stroke: var(--failing); stroke-width: 1.5; stroke-dasharray: 5 4; }
.uc-base { stroke: var(--line); stroke-width: 1; }
.uc-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-variant-numeric: tabular-nums; font-size: var(--t-micro); color: var(--text-muted); }
.uc-key { display: inline-flex; align-items: center; gap: 6px; }
.uc-dash { width: 18px; border-top: 2px dashed var(--failing); }
.uc-sum { margin-top: 6px; font-size: var(--t-small); max-width: var(--measure); }

@media (max-width: 600px) {
  .d-alert { padding: 14px 0; }
  .cx-fields { grid-template-columns: 1fr; gap: 0 0; }
  .cx-fields dd { margin-bottom: 6px; }
}

/* Alert status: the pager's lines and the "can't see it" note. Issues
   moved into or out of this one. */
.al-extra { display: grid; gap: 4px; margin-top: 8px; }
.d-moved { display: grid; gap: 2px; margin-top: 10px; font-size: var(--t-small); overflow-wrap: anywhere; max-width: var(--measure); }
.d-short { margin-top: 16px; }

/* Objects listed in one issue (paging.js): the objects a removed
   controller left behind, and the Overview's old problems. One line
   each on a wide screen: kind · namespace/name, then what is wrong. */
.lo-list { list-style: none; margin: 8px 0 0; padding: 0; }
.lo-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: var(--t-small); }
.lo-row:first-child { border-top: 0; }
.lo-name { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.lo-what { flex: 1 1 14rem; min-width: 0; color: var(--text-soft); }
.lo-age { flex: none; color: var(--text-muted); font-size: var(--t-micro); }
.lo-all { margin-top: 8px; }
.lo-line { margin: 4px 0 0; font-size: var(--t-small); color: var(--text-soft); }
/* Beside the alert level: why kwatch lowered, capped or held it. */
.ds-lvl { margin: 6px 0 0; font-size: var(--t-small); color: var(--text-soft); overflow-wrap: anywhere; }

/* "Show every time": a stamp never breaks inside. */
.tl-stamp { white-space: nowrap; }

/* An update drawn in place (js/incupdate.js): what changed gets a short
   highlight (a bar on its left, as an updated row of the Issues table,
   and a soft background that fades), and the header says "Updated just
   now" for a few seconds. While an update waits for the reader, one
   quiet line says so. */
.kw-changed { box-shadow: inset 3px 0 0 var(--text); background: var(--surface); }
@media (prefers-reduced-motion: no-preference) {
  .kw-changed { animation: kw-changed 2.6s ease-out forwards; }
  @keyframes kw-changed { 0%, 40% { background: var(--surface); } 100% { background: transparent; box-shadow: inset 3px 0 0 transparent; } }
}
.d-upd { margin-left: auto; font-size: var(--t-micro); color: var(--text-muted); white-space: nowrap; }
.d-upd:not([hidden]) + .d-acts { margin-left: 0; }
.d-wait { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-input); font-size: var(--t-small); color: var(--text-soft); }
.d-wait .link { font-size: var(--t-small); font-weight: 600; }
