/* kwatch dashboard: the Issues table, its status switch, the live
   updates bar and the pager. Tokens come from app.css. One toolbar row
   (status, search, "Filters (N)"); the other filters, the quick views
   and the view buttons open from it. Under 1100px wide the Where
   column hides; under 900px the table becomes two-line cards, so the
   page never scrolls sideways. Over 900px wide the page is one screen
   high: the head and the small toolbar stay put and only the table
   scrolls, its heading on top (js/core.js KW.scrollBox). */

/* The toolbar is one row here; the table scrolls under it. */
.content.wide .filterbox { position: static; }
@media (min-width: 901px) {
  .main:has(> .content.wide) { height: 100vh; height: 100dvh; }
  .content.wide { position: relative; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding-bottom: var(--space-4); }
  .content.wide > * { flex-shrink: 0; }
  .content.wide > .tablewrap { flex: 0 1 auto; min-height: 10rem; overflow: auto; overscroll-behavior: contain; scroll-padding-top: 40px; }
  .content.wide > .livebar { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); margin: 0; }
  /* The pager sits at the screen's bottom edge: its menu opens upward. */
  .pager .dd-pop { top: auto; bottom: calc(100% + 6px); }
}

/* Status: one pressed choice of three, with counts. */
.stsw { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-chip); }
.stsw-b { display: inline-flex; align-items: center; gap: 6px; min-height: calc(var(--ctl) - 6px); padding: 0 14px; border: 0; border-radius: var(--radius-chip); background: transparent; color: var(--text); font-weight: 600; font-size: var(--t-small); }
.stsw-b:hover { background: var(--surface); }
.stsw-b[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.stsw-b[aria-pressed="true"] .fc-n { background: var(--bg); color: var(--text); }
.filters .f-sort, .f-dir { display: none; }
/* The namespace picker stays in the row; the other pickers open under
   "More filters" in one panel. */
.ftoggle { display: inline-flex; align-items: center; margin: 0 0 12px 8px; vertical-align: top; }
.fmore { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.content:not(.f-open) .fmore { display: none; }

/* New or changed issues waiting: at the bottom of the screen, so it
   never covers the table's heading. */
.livebar { position: sticky; bottom: 12px; z-index: var(--z-livebar); width: fit-content; margin-left: auto; margin-right: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 6px 6px 6px 16px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--text); color: var(--bg); font-weight: 600; font-size: var(--t-small); }
.livebar .btn { color: var(--bg); border-color: var(--bg); }
.livebar .btn:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.pagenote { margin-top: 10px; }

/* The table: fixed columns (colmenu.js gives them their widths), the
   title takes the room left and ends in "…". The heading stays on
   screen while the rows scroll; the frame scrolls sideways only when
   the columns can't fit. */
.tablewrap { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-card); overflow: clip; }
.tablewrap.scrollx { overflow-x: auto; }
.tablewrap.loading { opacity: .7; }
.itable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-small); table-layout: fixed; }
.itable.stale { opacity: .6; }
.itable th { text-align: left; font-size: var(--t-micro); font-weight: 600; color: var(--text-muted); background: var(--surface); padding-left: 8px; height: 40px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.it-sort { background: none; border: 0; padding: 0; color: inherit; font: inherit; line-height: 2rem; display: inline-block; white-space: nowrap; }
.it-sort:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.itable th[aria-sort] { color: var(--text); }
.itable th[aria-sort="ascending"] .it-sort::after { content: "↑"; margin-left: 4px; }
.itable th[aria-sort="descending"] .it-sort::after { content: "↓"; margin-left: 4px; }
.itable td { padding: 0 8px; height: 44px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); }
.itable tbody tr:last-child td { border-bottom: 0; }
.itable.compact td { height: 34px; }
.itable.compact .chip { padding-top: 0; padding-bottom: 0; }
.itable tbody tr { cursor: pointer; }
.itable tbody tr:hover td { background: var(--surface); }
.itable td:first-child { border-left: 4px solid transparent; padding-left: 8px; }
.itable th:first-child { padding-left: 12px; }
.it-row.sev-page td:first-child { border-left-color: var(--failing); }
.it-row.sev-notify td:first-child { border-left-color: var(--degraded); }
.it-row.sev-low td:first-child { border-left-color: var(--control-border); }
.it-row.sev-resolved td:first-child { border-left-color: var(--success); }
.it-link { font-weight: 600; color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; }
.it-link:hover { text-decoration: underline; }
.itable td.c-where .mono { font-size: var(--t-micro); }
.it-ns { display: none; }
.itable td.c-started, .itable td.c-last, .itable td.c-dur, .itable td.c-rep { font-variant-numeric: tabular-nums; }
.itable td.ok { color: var(--success); }
.itable .chip { font-size: var(--t-micro); }
.it-row.is-gone td { opacity: .7; text-decoration: line-through; text-decoration-color: var(--text-muted); }
/* Not only faded: a word says the row has left the list. */
.it-row.is-gone td.c-title::after { content: "Gone"; margin-left: 8px; font-size: var(--t-micro); font-weight: 600; text-decoration: none; display: inline-block; color: var(--text-muted); }
.it-row.is-updated td.c-title { box-shadow: inset 3px 0 0 var(--text); }
/* The row with the keyboard focus is marked as a whole. */
.itable tbody tr:focus-within td { background: var(--surface); box-shadow: inset 0 2px 0 var(--text), inset 0 -2px 0 var(--text); }
.itable tbody tr:focus-within .it-link:focus-visible { outline: none; text-decoration: underline; }
.itable td.c-title { white-space: normal; padding-top: 6px; padding-bottom: 6px; }
.itable td.c-title .it-link { white-space: normal; overflow-wrap: break-word; text-wrap: balance; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* What else is true of the issue sits under its title, so it never
   squeezes the title. */
.it-marks { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 2px; font-size: var(--t-micro); color: var(--text-muted); }
.it-marks > * { margin: 0 !important; flex: none; vertical-align: baseline !important; }
.it-marks .i-rep { padding: 0; background: none; color: var(--text-muted); font-weight: 500; }
.it-marks .i-left { padding: 0 6px; line-height: 1.3; }
.i-stopped { flex: none; font-size: var(--t-micro); line-height: 1.4; font-weight: 600; color: var(--text-muted); border: 1px solid var(--control-border); border-radius: var(--radius-chip); padding: 0 6px; white-space: nowrap; }
.i-why { font-size: var(--t-micro); line-height: 1.4; color: var(--text-muted); border: 1px dashed var(--line); border-radius: var(--radius-chip); padding: 0 6px; }
@media (max-width: 1100px) and (min-width: 901px) {
  .itable .c-where { display: none; }
  /* Where is gone: the namespace stays, a second line under the title. */
  .itable td.c-title .it-ns { display: block; margin-top: 2px; font-size: var(--t-micro); color: var(--text-muted); overflow-wrap: anywhere; }
  .shell { grid-template-columns: 11.5rem 1fr; }
  .content.wide { padding-left: var(--space-5); padding-right: var(--space-5); }
}

/* A refused search: the reason, in words, beside the filters. */
.badreq { margin-top: 12px; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; border: 1px solid var(--degraded); border-radius: var(--radius-card); background: var(--degraded-bg); color: var(--text); }
.badreq p { margin: 0; font-weight: 500; }
.badreq .btn { border-color: var(--text); }

/* Pager. */
.pager { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; font-size: var(--t-small); color: var(--text-muted); }
.pager-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pager .btn { min-width: var(--ctl); padding: 0 10px; white-space: nowrap; }
.pager .btn[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pager-gap { align-self: center; padding: 0 2px; }
.pager-range { font-variant-numeric: tabular-nums; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.pager-size .dd-btn { min-width: 72px; }

@media (max-width: 900px) {
  .filters .f-sort { display: block; flex: 0 1 auto; }
  .filters .f-sort .dd { display: block; }
  .f-dir:not([hidden]) { display: inline-flex; align-items: center; }
  .tablewrap { border: 0; overflow: visible; }
  .itable, .itable tbody { display: block; min-width: 0 !important; }
  .itable thead { display: none; }
  /* A card is two lines: the title, then where, how urgent, how long. */
  .itable tr { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 10px 12px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-card); margin-bottom: 8px; }
  .it-row.sev-page { border-left-color: var(--failing); }
  .it-row.sev-notify { border-left-color: var(--degraded); }
  .it-row.sev-resolved { border-left-color: var(--success); }
  .itable td { display: block; flex: none; height: auto; max-width: 100%; padding: 0; border: 0; white-space: normal; overflow: visible; text-overflow: clip; background: transparent !important; box-shadow: none !important; }
  .itable td:first-child { border: 0; }
  /* The title cell lets its parts join the card: the title takes its
     own line, its marks ("failed again", "12 objects", "Settled on its
     own") end the last line beside the level and the time, where there
     is room, so a card stays about four lines. */
  .itable td.c-title { display: contents; }
  .itable td.c-title .it-link { order: 0; flex: 1 0 100%; }
  .itable td.c-title .it-marks { display: contents; }
  .itable td.c-title .it-marks > *, .it-row.is-gone td.c-title::after { order: 6; }
  /* Where takes two lines at most; the whole of it is in the tooltip. */
  .itable td.c-where { order: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .itable td.c-sev { order: 2; }
  .itable td.c-status { order: 3; }
  .itable td.c-last { order: 4; }
  .itable td.c-ack, .itable td.c-started, .itable td.c-dur { order: 5; }
  .itable td.c-where span.mono { display: inline; }
  .itable td.c-where .c-where-obj::before { content: " · "; }
  /* The whole card is the title's link, so it is one big tap target. */
  .it-link::after { content: ""; position: absolute; inset: 0; }
  .itable td.c-last, .itable td.c-ack, .itable td.c-started, .itable td.c-dur { font-size: var(--t-micro); color: var(--text-muted); }
  /* Tighter chips and gaps keep the last line (level, status, time,
     marks) in one row even when the text draws a little wider. */
  .itable td.c-sev .chip, .itable td.c-status .chip { padding: 0 7px; }
  .itable td:empty, .itable td.none { display: none; }
  .itable tbody tr:hover td { background: transparent; }
  .itable tbody tr:focus-within { outline: 2px solid var(--text); outline-offset: 1px; }
}
@media (max-width: 700px) {
  .content:not(.f-open) .shint { display: none; }
  .tbar .stsw { display: flex; flex: 1 0 100%; }
  .tbar .filters { flex: 1 1 0; }
  .stsw-b { flex: 1; justify-content: center; padding: 0 8px; }
  .pager { flex-direction: column; align-items: stretch; }
  .pager-btns .btn { flex: 1 0 auto; }
}

.stsw-help { margin: 0 0 12px; max-width: var(--measure); }

/* Where: the namespace, then the object under it; it wraps after "/"
   and "." instead of being cut. */
.itable td.c-where .mono { display: block; white-space: normal; overflow-wrap: break-word; word-break: normal; }
.itable td.c-where { white-space: normal; padding-top: 6px; padding-bottom: 6px; }
/* The status switch is explained only where the choice is not obvious. */
.stsw:has(.stsw-b[data-status="active"][aria-pressed="true"]) ~ .stsw-help { display: none; }

/* Filters: an open state, and the namespace on the search row. */
.ftoggle[aria-expanded="true"] { background: var(--surface); border-color: var(--text); }

/* One toolbar row above the table: status, search, "Filters (N)" and
   the search tips ("?"); the filters in use sit in a slim row under it
   and the rest in the panel the button opens. */
.ihead { align-items: center; gap: 8px 24px; }
.ihead-t { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.ihead h1 { font-size: 1.5rem; }
.ihead .sub { margin: 0; }
.ihead > .updated { margin-top: 0; }
.content.wide .filterbox { margin-top: 12px; padding: 0; }
.tbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tbar .stsw, .tbar .ftoggle { margin: 0; }
.tbar .filters { flex: 1 1 14rem; min-width: 0; }
.tbar .filters .f-search { flex: 1 1 100%; }
.trow2 .ttools { margin: 0 0 0 auto; }
.shint { position: relative; margin: 0; }
.shint > summary { justify-content: center; width: 30px; height: 30px; min-height: 0; border: 1px solid var(--line); border-radius: 50%; font-weight: 600; color: var(--text-muted); }
.shint > summary::before { display: none; }
.shint > summary:hover { text-decoration: none; border-color: var(--text); }
.shint-pop { position: absolute; z-index: var(--z-popover); top: calc(100% + 6px); right: 0; width: min(24rem, calc(100vw - 32px)); padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-card) }
.shint-h { margin: 0 0 4px; font-weight: 600; color: var(--text); }
.trow2 { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.filterbox .factive { margin-top: 8px; }
.fmore .fpicks { flex: 1 1 100%; }
.trow2 .qvbox, .qvbox + .filterbox { margin-top: 0; }
.trow2 .qv { min-height: 30px; padding: 0 10px; font-size: var(--t-micro); }
.trow2 .qv-news { margin: 0; }
.content.wide .tablewrap { margin-top: 10px; }
@media (max-width: 900px) {
  /* Rows are cards here: columns and view options do nothing. */
  .trow2 .ttools { display: none; }
}

/* A settled issue's greyed level stays on one line, like any level. */
.chip.c-settled { white-space: nowrap; }
