/* Ekalix - the Query Store page (querystore.js, CONTRACT-V18 W5).

   Every colour is a theme variable from styles.css, so the six themes move this page with them.
   Every class is prefixed .qs- and scoped under the page (.qs-page) or its window (.qs-win), so
   nothing here can reach another page. Labels, chips and tabs never wrap: one line, and an
   ellipsis with the whole text in a tooltip only where free text (a statement) has to be cut. */

.qs-page { display: flex; flex-direction: column; gap: 0; min-width: 0; }

/* ---------- the bar: database, window, read again ---------- */
.qs-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px;
  margin: 0 0 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r-s); background: var(--surface-1);
}
.qs-grp { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap; }
.qs-lab {
  font-size: calc(var(--fs-micro) + .5px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
}
.qs-db {
  height: 28px; min-width: 180px; max-width: 300px; padding: 0 8px;
  border: 1px solid var(--border-2); border-radius: var(--r-s); background: var(--surface-2); color: var(--text);
  font-family: var(--font); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.qs-db:focus-visible, .qs-topn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qs-seg { flex: 0 0 auto; }
.qs-seg button { white-space: nowrap; }
.qs-seg button:disabled { opacity: .45; cursor: not-allowed; }
.qs-custom { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.qs-custom input[type="datetime-local"] {
  height: 28px; padding: 0 6px; border: 1px solid var(--border-2); border-radius: var(--r-s);
  background: var(--surface-2); color: var(--text); font-family: var(--mono); font-size: var(--fs-body); color-scheme: inherit;
}
.qs-to { font-size: 12px; color: var(--text-3); }
/* Custom: a row of its own under the bar, so the controls above never move. */
.qs-custrow {
  flex: 1 0 100%; order: 10; display: flex; align-items: center; gap: 10px; min-width: 0;
  margin-top: 1px; padding-top: 8px; border-top: 1px dashed var(--hairline); white-space: nowrap;
}
.qs-custrow .qs-hintline { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.qs-hintline { font-size: var(--fs-body); color: var(--text-3); white-space: nowrap; }
.qs-read {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-body); color: var(--text-3); font-family: var(--mono);
}
.qs-bar .btn .spinner { margin-right: 2px; }

/* ---------- the chosen database's Query Store, on one line ---------- */
.qs-facts {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px;
  margin: 0 0 12px; padding: 0 2px; font-size: 12px; color: var(--text-3);
}
.qs-fact { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.qs-fact > i { font-style: normal; font-size: var(--fs-micro); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.qs-fact > b { font-family: var(--mono); font-size: 12px; font-weight: 650; color: var(--text); }
.qs-fact > .dim { font-size: var(--fs-body); }
.qs-fact.t-warning > b { color: var(--warning); }
.qs-meter { display: inline-block; width: 58px; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.qs-meter > b { display: block; height: 100%; border-radius: 4px; background: var(--tone); }
.qs-pctv { font-family: var(--mono); font-size: var(--fs-body); font-weight: 650; color: var(--text-2); }
.qs-pctv.t-warning, .qs-pctv.t-serious, .qs-pctv.t-critical { color: var(--tone); }
.qs-facts .pill { flex: 0 0 auto; }

/* ---------- Query Store off in some databases: one line, the T-SQL behind a button ---------- */
.qs-off { margin: 0 0 10px; }
.qs-offline {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 7px 12px; border: 1px solid var(--info-bd); border-radius: var(--r-s); background: var(--info-bg);
  font-size: 12.5px; color: var(--text-2);
}
.qs-offi {
  flex: 0 0 auto; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: var(--info); color: var(--on-accent); font-size: calc(var(--fs-micro) + .5px); font-weight: 800; font-family: var(--mono);
}
.qs-offt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-offt b { color: var(--text); font-family: var(--mono); }
.qs-offbtn { flex: 0 0 auto; white-space: nowrap; }
.qs-offsql { margin-top: 8px; }
.qs-offsql pre.code { max-height: 220px; overflow: auto; }
.qs-hint { margin-top: 6px; font-size: var(--fs-body); color: var(--text-3); }

/* ---------- findings: the product's incident list ---------- */
.qs-findings { padding: 10px 12px 12px; }
.qs-findlist { display: grid; gap: 8px; padding: 10px 12px; }

/* ---------- tabs ---------- */
.qs-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.qs-tabs::-webkit-scrollbar { display: none; }
.qs-tabs .subtab { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.qs-count {
  display: inline-flex; align-items: center; gap: 4px; height: 17px; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-3); color: var(--text-2);
  font-family: var(--mono); font-size: calc(var(--fs-micro) + .5px); font-weight: 700; white-space: nowrap;
}
.qs-count.t-warning, .qs-count.t-critical, .qs-count.t-serious, .qs-count.t-info { border-color: var(--tone-bd); background: var(--tone-bg); color: var(--tone); }
.qs-count > span[aria-hidden] { font-size: calc(var(--fs-micro) - .5px); }

/* ---------- panels: one-line headers, controls on the right ---------- */
.qs-page .panel > .ph { flex-wrap: nowrap; }
.qs-page .panel > .ph .pcol { flex-wrap: nowrap; flex: 0 1 auto; min-width: 0; }
.qs-page .panel > .ph .pcol h2 { white-space: nowrap; }
.qs-page .panel > .ph .sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-pright { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap; }
.qs-topn {
  height: 26px; padding: 0 6px; border: 1px solid var(--border); border-radius: var(--r-s);
  background: var(--surface-2); color: var(--text-2); font-family: var(--font); font-size: var(--fs-body); cursor: pointer;
}
.qs-load { margin: 0; }
.qs-body { position: relative; transition: opacity .15s; }
.qs-body.qs-stale { opacity: .55; }
.qs-pad { padding: 12px 14px 2px; }
.qs-pad:empty { display: none; }
.qs-body > .ldr, .qs-body > .empty { padding-top: 34px; padding-bottom: 34px; }
.qs-body > .banner { margin: 12px 14px; }
.qs-tiles { margin-bottom: 10px; }
.qs-tiles .tile .f { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-note { margin: 0 0 10px; }
.qs-retry { margin-left: 8px; }

/* ---------- table cells ---------- */
.qs-flag { min-height: 16px; }
.qs-flag.none { display: inline-block; width: 16px; height: 16px; }
.qs-share { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-family: var(--mono); font-size: var(--fs-body); color: var(--text-2); }
.qs-share > i { display: inline-block; width: 52px; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.qs-share > i > b { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
tr.dt-row.t-critical .qs-share > i > b, tr.dt-row.t-serious .qs-share > i > b, tr.dt-row.t-warning .qs-share > i > b { background: var(--tone); }

/* The statement column takes what the others leave and cuts its text, instead of widening the table. */
.qs-page td.qs-qcol, .qs-win td.qs-qcol { width: 100%; max-width: 0; }
.qs-q {
  appearance: none; display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0; max-width: 100%;
  margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  overflow: hidden; white-space: nowrap;
}
.qs-q:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
/* The object's name keeps its width (up to most of the cell); the statement takes what is left. */
.qs-qo { flex: 0 0 auto; min-width: 0; max-width: 62%; overflow: hidden; text-overflow: ellipsis; font-weight: 650; color: var(--text); }
.qs-masked { height: 24px; padding: 0 9px; font-family: var(--font); font-size: var(--fs-small); cursor: help; }
.qs-qt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: var(--fs-body); color: var(--text-2); }
.qs-q:hover .qs-qt, .qs-q:hover .qs-qo { color: var(--accent); }
.qs-plans { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.qs-tag {
  display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 4px;
  border: 1px solid var(--tone-bd); background: var(--tone-bg); color: var(--tone);
  font-family: var(--font); font-size: calc(var(--fs-micro) + .5px); font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.qs-wait { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.qs-wait .dim { font-family: var(--mono); font-size: var(--fs-small); }
.qs-page td.qs-nextcol { max-width: 300px; }
.qs-next { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* ---------- an opened row: what to do, the statement, the buttons ---------- */
.qs-detail { display: grid; gap: 10px; }
.qs-advice { padding: 9px 12px; border: 1px solid var(--accent-bd); border-radius: var(--r-xs); background: var(--accent-bg); }
.qs-advice .k { margin-bottom: 3px; font-size: var(--fs-micro); font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.qs-advice p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text); }
.qs-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- T-SQL for a DBA: labelled as never run by Ekalix ---------- */
.qs-sql { border: 1px dashed var(--border-2); border-radius: var(--r-xs); background: var(--surface-2); }
.qs-sqlh { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 11px; border-bottom: 1px dashed var(--border); min-width: 0; }
.qs-sqll { flex: 0 0 auto; font-size: calc(var(--fs-micro) + .5px); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--warning); white-space: nowrap; }
.qs-sqln { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-body); color: var(--text-3); }
.qs-sql pre.code { margin: 0; border: 0; border-radius: 0 0 var(--r-xs) var(--r-xs); white-space: pre-wrap; word-break: break-word; }

/* ---------- waits over time: the stacked chart and its list ---------- */
.qs-waits { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: stretch; }
.qs-waitsoff { display: grid; gap: 8px; margin-bottom: 12px; }
/* The stack is drawn by perfcharts.js's DetailChart from running totals, lowest band painted last.
   Filled solid enough that each band shows its own colour; its own tooltip and legend would quote
   the running totals, so the list beside the chart takes their place with each category's value. */
.qs-stack .dc-area { opacity: .78; }
.qs-stack .dc-line { stroke-width: 1.2; }
.qs-stack .dc-tip, .qs-stack .dc-legend, .qs-stack .dc-sttable { display: none; }
.qs-waitsbig { grid-template-columns: minmax(0, 1fr) 320px; }
/* Full size, a chart has no frame of its own: room on the left for the value tag that rides the
   crosshair out past the axis, which would otherwise be cut by the window's edge. */
.qs-waitsbig .dc.big, .qs-bigchart .dc.big { padding-left: 30px; }
.qs-stack .dc-read > .dc-sw { display: none; }
.qs-stack .dc { height: auto; }
.qs-wlist {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--r-s); background: var(--surface-2);
}
.qs-wlh { display: flex; align-items: baseline; gap: 8px; padding: 0 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--hairline); font-size: var(--fs-body); color: var(--text-3); white-space: nowrap; }
.qs-wlh > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.qs-wlh > b { font-family: var(--mono); font-size: 13px; color: var(--text); }
.qs-wrow {
  appearance: none; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-rows: auto 5px; gap: 2px 8px; align-items: center;
  width: 100%; padding: 5px 4px; border: 1px solid transparent; border-radius: var(--r-xs); background: transparent;
  color: var(--text-2); font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.qs-wrow:hover { border-color: var(--border); background: var(--surface-3); }
.qs-wrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qs-wrow.off { color: var(--text-3); }
.qs-wrow.off .qs-wn { text-decoration: line-through; }
.qs-wrow.off .qs-sw { opacity: .3; }
.qs-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.qs-sw.none { background: var(--surface-3); border: 1px dashed var(--border-2); }
.qs-wn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-wv { font-family: var(--mono); font-size: var(--fs-body); font-weight: 650; color: var(--text); white-space: nowrap; }
.qs-wrow .qs-wb { grid-column: 2 / 4; }
.qs-wb { display: block; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.qs-wb > b { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.qs-wparts { display: grid; gap: 1px; margin: 6px 0 0; padding: 6px 4px 0 24px; border-top: 1px dashed var(--hairline); }
.qs-wph { margin-bottom: 2px; font-size: var(--fs-micro); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.qs-wpart { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-body); color: var(--text-3); min-width: 0; }
.qs-wpart .qs-wn { flex: 1 1 auto; }
.qs-wpart .qs-wv { font-weight: 600; color: var(--text-2); }
.qs-wlf { margin-top: auto; padding: 8px 2px 0; font-size: var(--fs-small); color: var(--text-3); }

/* ---------- one query, in its window ---------- */
.qs-win { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.qs-qpane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.qs-qpane > .inlinemsg { margin: 0; }
.qs-qkv { gap: 3px 18px; }
.qs-text pre.code { max-height: 168px; overflow: auto; white-space: pre-wrap; word-break: break-word; padding-right: 64px; }
.qs-sect { min-width: 0; }
.qs-secth { display: flex; align-items: baseline; gap: 10px; margin: 0 0 7px; white-space: nowrap; min-width: 0; }
.qs-secth > b { font-size: var(--fs-small); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-2); }
.qs-secth > .dim { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-body); }
.qs-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.qs-bigchart { display: flex; flex-direction: column; gap: 8px; }
.qs-bigbar { display: flex; align-items: center; gap: 8px; }
.qs-qcols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.qs-planid { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.qs-planid > b { font-family: var(--mono); color: var(--text); }
.qs-wbars { display: grid; gap: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--r-s); background: var(--surface-2); }
.qs-wbar { display: grid; grid-template-columns: minmax(80px, 130px) minmax(0, 1fr) 76px; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.qs-wbar .qs-wv { text-align: right; }

/* ---------- a plan, in the same window ---------- */
.qs-plan { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.qs-planbar { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.qs-planbar > b { font-size: 13px; color: var(--text); }
.qs-planbar > .dim { font-size: var(--fs-body); }

/* Narrow windows: the list goes under the chart, the three charts stack. */
@media (max-width: 1100px) {
  .qs-waits { grid-template-columns: minmax(0, 1fr); }
  .qs-charts { grid-template-columns: minmax(0, 1fr); }
  .qs-qcols { grid-template-columns: minmax(0, 1fr); }
}
