/* QA Studio (qa-studio.js): Overview, a status board of MAYA's automated checks, then UI/UX (site checks) and MCP health check. */
#qa-panel .qa-tabs { display: flex; flex-wrap: wrap; gap: 24px; margin: 0 0 18px; border-bottom: 1px solid var(--border-strong); }
#qa-panel .qa-tab { margin-bottom: -1px; padding: 9px 0 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; transition: color .15s var(--ease), border-color .15s var(--ease); }
#qa-panel .qa-tab:hover { color: var(--ink); }
#qa-panel .qa-tab.active { border-bottom-color: var(--accent); color: var(--accent); }
#qa-panel .qa-tab:focus-visible { outline-offset: -2px; border-radius: 4px; }

/* The board: one card per check, its latest result in the middle and its next step at its foot. */
.qa-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; align-items: stretch; }
.qa-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px 18px; }
.qa-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qa-card h2 { margin: 0; font-family: var(--brand-font); font-size: var(--font-lg); font-weight: 600; color: var(--ink); }
.qa-card-about { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.qa-card-body { flex: 1; display: grid; align-content: start; gap: 8px; min-width: 0; padding: 10px 0 2px; border-top: 1px solid var(--border-subtle); }
.qa-card-subject { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-card-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.qa-card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.qa-facts { display: grid; gap: 4px; margin: 0; }
.qa-fact { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; font-size: 12.5px; }
.qa-fact dt { color: var(--muted); }
.qa-fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.qa-tally { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.qa-tally li { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.qa-place-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.qa-place-list li { display: grid; gap: 1px; min-width: 0; }
.qa-place-list .btn-link { justify-self: start; font-size: 13px; }
.qa-place-note { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.qa-empty { margin: 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-muted); font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.qa-aside { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }
.qa-aside .btn-link { font-size: 12.5px; }

/* UI/UX: site checks */
.qa-form, .qa-history, .qa-audit, .qa-connector { padding: 16px 18px; margin-bottom: 14px; }
.qa-form h2, .qa-history h2, .qa-audit h2, .qa-connector h2 { display: flex; align-items: center; gap: 2px; margin: 0 0 6px; font-family: var(--brand-font); font-size: var(--font-lg); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.qa-form > .muted { margin: 0; font-size: 12.5px; line-height: 1.55; }
/* The fields wrap onto more rows rather than past the card: a select as wide as its longest test name shrinks to its column. */
.qa-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; margin: 12px 0; }
.qa-form-grid label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 0; }
.qa-form-grid input, .qa-form-grid select { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; min-height: var(--control-height); padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font: inherit; font-size: 13px; font-weight: 400; color: var(--text); }
.qa-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.qa-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.qa-toolbar .muted { margin: 0; font-size: 12.5px; }
.qa-history-list { margin: 6px -18px -16px; padding: 0; list-style: none; border-top: 1px solid var(--border-subtle); }
.qa-history-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 18px; border: 0; border-bottom: 1px solid var(--border-subtle); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: background-color .12s var(--ease); }
.qa-history-list li:last-child .qa-history-row { border-bottom: 0; border-radius: 0 0 12px 12px; }
.qa-history-row:hover { background: var(--bg); }
.qa-history-row:focus-visible { outline-offset: -2px; }
.qa-history-main { display: grid; gap: 1px; min-width: 0; }
.qa-history-main strong { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-history-main small, .qa-history-when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.qa-score { font-variant-numeric: tabular-nums; }
.qa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.qa-table th, .qa-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; overflow-wrap: anywhere; }
.qa-audit-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qa-audit-head h2 { margin: 0; }
.qa-audit > .muted { margin: 6px 0 4px; font-size: 12.5px; }
.qa-page { border-top: 1px solid var(--border); padding: 8px 0; }
.qa-page summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.qa-issues { margin: 6px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.qa-severity { display: inline-block; min-width: 54px; font-weight: 600; }
.qa-high .qa-severity, .qa-issue.qa-high strong { color: var(--fail); }
.qa-medium .qa-severity { color: var(--warn-ink); }
.qa-low .qa-severity { color: var(--muted); }
.qa-ok strong { color: var(--pass); }
.qa-samples { display: block; overflow-wrap: anywhere; }
/* Pictures of the first elements an issue is about, each framed in red on its page. */
.qa-pictures { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 8px; }
.qa-picture { margin: 0; width: 200px; max-width: 100%; }
.qa-picture a { display: block; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); }
.qa-picture a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qa-picture img { display: block; width: 100%; height: 120px; object-fit: contain; background: var(--surface-sunken); }
.qa-picture figcaption { margin-top: 4px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MCP health check: connectors */
.qa-connectors { display: grid; gap: 12px; }
.qa-connector .qa-audit-head h2 { margin: 0; }
.qa-connector-url { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-connector .qa-actions { margin: 0 0 0 auto; }
.qa-check-line { margin: 10px 0 4px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) {
  .qa-history-row { grid-template-columns: 64px minmax(0, 1fr); }
  .qa-history-when { display: none; }
  .qa-connector .qa-actions { margin-left: 0; }
}

/* Before a check starts: the sign-in test signs in to another site (it may go on), or cannot sign a check in at all. */
.qa-notice:empty { display: none; }
.qa-notice-warning, .qa-notice-problem { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.55; overflow-wrap: anywhere; }
.qa-notice-warning { border: 1px solid var(--warn-border); border-left: 3px solid var(--warn); background: var(--warn-wash); color: var(--warn-ink); }
.qa-notice-warning strong { font-weight: 600; }
.qa-notice-warning .btn-link { font-size: 12.5px; }
.qa-notice-problem { border: 1px solid var(--fail-border); border-left: 3px solid var(--fail); background: var(--fail-soft); color: var(--fail-ink); }

/* Why a check could not finish, on the board, in Earlier checks and in the result. */
.qa-reason { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--fail-ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.qa-history-main small.qa-history-reason { color: var(--fail-ink); overflow: hidden; text-overflow: ellipsis; }
.qa-failure { display: grid; gap: 10px; margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--fail-border); border-left: 3px solid var(--fail); border-radius: 8px; background: var(--fail-wash); }
.qa-failure-reason { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.55; color: var(--fail-ink); overflow-wrap: anywhere; }
.qa-failure-detail summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.qa-failure-detail pre { max-height: 220px; margin: 8px 0 0; padding: 10px 12px; overflow: auto; border-radius: 6px; background: var(--surface); border: 1px solid var(--fail-border); font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.qa-failure-screen { margin: 0; }
.qa-failure-screen img { display: block; max-width: min(100%, 560px); height: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.qa-failure-screen figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* The live screen of a running check: what it is doing, how far it has got, its browser and the pages checked so far. */
.qa-live-phase { margin: 8px 0 6px; font-size: 13.5px; font-weight: 600; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.qa-live .qa-notice-warning { margin: 0 0 8px; }
.qa-progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-active); }
.qa-progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s var(--ease); }
.qa-progress-label { margin: 6px 0 12px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qa-live-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 16px; align-items: start; }
.qa-live-screen { --qa-live-height: max(220px, calc(100vh - 290px)); display: grid; gap: 6px; margin: 0; min-width: 0; }
/* The picture keeps its shape and stays within the window's height, so the words above it stay in view. */
.qa-live-waiting { display: grid; place-items: center; aspect-ratio: 1366 / 800; max-height: var(--qa-live-height); margin: 0; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-muted); font-size: 12.5px; color: var(--muted); text-align: center; }
.qa-live-picture { display: block; width: auto; max-width: 100%; height: auto; max-height: var(--qa-live-height); border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-xs); }
.qa-live-url { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-live-found { min-width: 0; }
.qa-live-found h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.qa-live-pages { display: grid; gap: 6px; max-height: 360px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.qa-live-pages li { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.qa-live-page { display: grid; gap: 1px; min-width: 0; }
.qa-live-page strong { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-live-page small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-live-none { margin: 0; font-size: 12.5px; }
@media (max-width: 900px) {
  .qa-live-grid { grid-template-columns: minmax(0, 1fr); }
}
