/* kwatch dashboard: the plain-words layer. The issue summary ("What's
   happening"), folded sections, the Overview headline, the color legend
   and the notifications switch. Tokens come from app.css. */

/* Issue summary: the one card to read first. */
.d-sum { border: 1px solid var(--line); border-radius: var(--radius-card); padding: 20px 22px; background: var(--bg); }
.d-sum .chips { margin-top: 10px; }
.d-sum h1 { font-size: var(--t-h1); margin-top: 10px; overflow-wrap: anywhere; }
.d-facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 14px 0 0; font-size: var(--t-small); }
.d-facts div { display: flex; gap: 8px; min-width: 0; }
.d-facts dt { color: var(--text-muted); }
.d-facts dd { margin: 0; overflow-wrap: anywhere; }
.d-facts .mono { font-size: var(--t-small); }
.d-first { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.d-first h2 { margin-bottom: 6px; }
.d-first p { max-width: var(--measure); }
.d-cause { max-width: var(--measure); }

/* Folded sections: a plain heading, closed until asked for. */
.fold { border-bottom: 1px solid var(--line); }
.d-sum + .fold { margin-top: 18px; border-top: 1px solid var(--line); }
.fold > summary { display: flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 6px 0; cursor: pointer; font-weight: 600; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); flex: none; margin: 0 4px 0 2px; }
.fold[open] > summary::before { transform: rotate(45deg); }
.fold > summary:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.fold-body { padding: 4px 0 20px; }
.fold-h { margin-bottom: 4px; width: fit-content; }
/* One muted line under a section heading; the heading keeps its tooltip too. */
.fold-cap { color: var(--text-muted); font-size: var(--t-micro); margin: 0 0 6px 21px; }
.fold-h + .fold-cap { margin: 0 0 8px; }
.fold-n { color: var(--text-muted); font-weight: 400; }
.fold .tl { margin-top: 4px; }
.fold .logs { margin-top: 0; }
@media print { .fold > .fold-body { display: block; } }

/* Help: "?" beside the logo opens what the colors mean. */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.side-top .brand { margin-bottom: 0; }
.legend { position: relative; }
.legend > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1.5px solid var(--control-border); border-radius: 50%; font-weight: 700; font-size: var(--t-small); color: var(--text-muted); cursor: pointer; }
.legend > summary::-webkit-details-marker { display: none; }
.legend > summary:hover, .legend[open] > summary { background: var(--surface); border-color: var(--text); }
.legend-pop { position: fixed; z-index: var(--z-legend); top: 70px; left: 16px; width: min(20rem, calc(100vw - 32px)); max-height: calc(100vh - 86px); overflow-y: auto; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-card); font-size: var(--t-small); color: var(--text); }
.legend-h { font-weight: 700; margin-bottom: 8px; }
.legend ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.legend li { line-height: 1.45; }
.legend li b { font-weight: 600; }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.legend p { color: var(--text-muted); }
.dot.quiet { border: 1.5px dashed var(--control-border); }
.legend .legend-sub { font-weight: 600; color: var(--text); margin: 8px 0 6px; }

/* Notifications switch in the sidebar. */

/* Under 700px the sidebar's settings fold behind one button. */
.who-b { display: none; }

@media (max-width: 700px) {
  .side-top { margin: 0 6px 0 0; flex: 1; }
  .who-b { display: inline-flex; align-items: center; min-height: var(--ctl); margin-left: auto; }
  .side:not(.who-open) .who { display: none; }
  /* Under its button: the popover hangs from the logo row, not a fixed offset. */
  .side-top { position: relative; }
  .side-top .legend { position: static; }
  .legend-pop { position: absolute; top: calc(100% + 8px); left: 0; max-height: calc(100vh - 120px); }
  .d-sum { padding: 16px; }
  .cmd code { white-space: pre-wrap; overflow-wrap: anywhere; }
}

/* Quick views above a list, and what is new since the last visit. */
.qvbox { margin-top: 18px; }
.qv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qv { min-height: var(--ctl); padding: 0 12px; border-radius: var(--radius-chip); border: 1.5px solid var(--line); background: transparent; color: var(--text); font-size: var(--t-small); font-weight: 500; }
.qv:hover { border-color: var(--text); background: var(--surface); }
.qv[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.qv-news { margin-top: 8px; font-size: var(--t-small); color: var(--text-muted); }
.qv-news span { color: var(--text); font-weight: 600; cursor: help; }
.qvbox + .filterbox { margin-top: 8px; }
.c-title .c-seen-new, .c-title .c-seen-changed { margin-left: 6px; font-size: var(--t-micro); padding: 0 6px; }
.c-seen-new { color: var(--resolved); background: var(--resolved-bg); }
.c-seen-changed { color: var(--degraded); background: var(--degraded-bg); }
.also .chip { margin: 0 0 0 6px; font-size: var(--t-micro); padding: 0 6px; }
.legend-keys { margin-top: 12px; }
/* A phone has no keyboard: the keys are left out of the help. */
@media (max-width: 700px), (pointer: coarse) {
  .legend-h.legend-keys, .legend ul.legend-keys-list { display: none; }
}
.legend kbd { display: inline-block; min-width: 22px; padding: 0 6px; margin-right: 4px; border: 1px solid var(--line); border-radius: var(--radius-chip); font-family: var(--font-body); font-weight: 600; font-size: var(--t-micro); line-height: 1.25rem; text-align: center; color: var(--text); }

/* Can't reach kwatch: a bar over the top of every page (js/refresh.js),
   pinned in a zero-height box so showing it never moves the page.
   What is shown stays, dimmed a little, with a muted freshness line. */
.offline-pin { position: sticky; top: 0; z-index: var(--z-offline); height: 0; }
.offline { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 16px 8px var(--space-6); background: var(--degraded-bg); color: var(--text); border-bottom: 1px solid var(--degraded); font-size: var(--t-small); font-weight: 500; }
.offline .btn { min-height: var(--ctl); border-color: var(--text); }
html.kw-stale .updated { opacity: .6; }
html.kw-stale .live, .updated.stale .live { color: var(--text-muted); }
html.kw-stale .live::before, .updated.stale .live::before { background: var(--text-muted); animation: none; }
html.kw-stale .ov-tile, html.kw-stale .ov-first, html.kw-stale .pgrid, html.kw-stale .act-list, html.kw-stale .itable, html.kw-stale .detail { opacity: .8; }
/* On a phone the bar would cover the page heading: it takes its own
   room above the page instead. */
@media (max-width: 700px) {
  .offline-pin { height: auto; }
  .offline { position: relative; padding-left: var(--space-4); }
}
.provbar { margin: 0 0 var(--space-4); padding: 10px 14px; background: var(--failing-bg); border: 1px solid var(--line); border-radius: var(--radius-chip); color: var(--text); font-size: var(--t-small, 0.875rem); }
.provbar p { margin: 0; }
.provbar p + p { margin-top: 6px; }
.provbar .prov-word { font-weight: 600; color: var(--failing); margin-right: 6px; }
.provbar .prov-fix { color: var(--text-muted); }
.provbar { overflow-wrap: anywhere; }
