/* Qualifier console layout. Colours, type, radii and components come from the Normstead design system (ds/). */
html, body { margin: 0; background: var(--bg-grouped); color: var(--label); font-family: var(--font-sans); }
a { color: var(--link); }
a:hover { color: var(--accent-hover); }
* { box-sizing: border-box; }

.q-shell { min-height: 100vh; display: flex; }
.q-side { flex: 0 0 var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--separator); min-height: 100vh; }
.q-side .ns-sidebar { border-right: 0; }
.q-side .ns-sidebar { position: sticky; top: 0; min-height: 100vh; }
.q-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.q-bar { display: flex; align-items: center; gap: var(--space-3); height: var(--nav-height); padding: 0 var(--space-6);
  background: var(--material-bar); -webkit-backdrop-filter: var(--material-blur); backdrop-filter: var(--material-blur);
  border-bottom: 1px solid var(--separator); position: sticky; top: 0; z-index: 5; }
.q-crumbs { flex: 1 1 auto; min-width: 0; color: var(--label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-crumbs .is-here { color: var(--label); }
.q-menu { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; background: transparent; border: 0;
  border-radius: var(--radius-sm); color: var(--label); cursor: pointer; }
.q-menu:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.q-content { width: 100%; max-width: var(--content-max); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6); }
.q-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); }
.q-head__text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.q-head h1 { margin: 0; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--label-secondary); }
.q-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.q-row { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: flex-start; }
.q-col-2 { flex: 2 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.q-col-1 { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.q-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-6); }
.q-scroll { overflow-x: auto; }
.q-muted { color: var(--label-secondary); }
.q-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.q-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.q-mono { font-family: var(--font-mono); }
.q-num { font-variant-numeric: tabular-nums; }
.q-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }

/* the process track */
.q-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(9, minmax(112px, 1fr)); gap: var(--space-2); min-width: 1000px; }
.q-step { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-3); border-top: 3px solid var(--separator); }
.q-step a, .q-step span.q-step__label { color: var(--label); text-decoration: none; }
.q-step a:hover .q-step__label { text-decoration: underline; }
.q-step__dot { width: 28px; height: 28px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; background: var(--fill); color: var(--label-secondary); }
.q-step--done { border-top-color: var(--accent); }
.q-step--done .q-step__dot { background: var(--accent-soft); color: var(--accent-on-soft); }
.q-step--warn { border-top-color: var(--warning-text); }
.q-step--warn .q-step__dot { background: var(--warning-soft); color: var(--warning-on-soft); }
.q-step--fail { border-top-color: var(--danger-text); }
.q-step--fail .q-step__dot { background: var(--danger-soft); color: var(--danger-on-soft); }
.q-step--next { border-top-color: var(--accent); }
.q-step--next .q-step__dot { background: var(--accent); color: var(--on-accent); }

/* the verdict panel: navy in both themes */
.q-verdict { background: var(--brand-navy); color: var(--on-brand-navy); border-radius: var(--radius-lg); padding: var(--space-6);
  display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; }
.q-verdict p { margin: 0; }
.q-verdict__facts { flex: 1 1 260px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }

/* progress */
.q-bar-track { height: 8px; border-radius: var(--radius-full); background: var(--fill); overflow: hidden; }
.q-bar-fill { height: 8px; border-radius: var(--radius-full); background: var(--accent); transition: width 250ms cubic-bezier(0.1, 0.9, 0.2, 1); }
.q-bar-fill.is-done { background: var(--success-text); }
.q-log { margin: 0; padding: var(--space-4); background: var(--fill); color: var(--label); border-radius: var(--radius-sm); overflow-x: auto;
  white-space: pre; max-height: 360px; overflow-y: auto; }

.q-caveats { list-style: none; margin: 0; padding: 0; }
.q-caveats li { display: flex; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--separator); }
.q-caveats li:last-child { border-bottom: 0; }
.q-caveats .data { flex: 0 0 120px; color: var(--label-secondary); }

.q-empty { padding: var(--space-8); text-align: center; color: var(--label-secondary); }
.q-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); }
.q-signin { width: 100%; max-width: 420px; }

/* phone and narrow windows: the sidebar becomes a drawer behind the menu button */
.q-drawer { display: none; }
@media (max-width: 760px) {
  .q-side { display: none; }
  .q-menu { display: inline-flex; }
  .q-bar { padding: 0 var(--space-3) 0 var(--space-4); }
  .q-content { padding: var(--space-4); gap: var(--space-4); }
  .q-hide-sm { display: none; }
  .q-drawer.is-open { display: block; position: fixed; inset: 0; z-index: 20; }
  .q-drawer__scrim { position: absolute; inset: 0; background: var(--scrim); }
  .q-drawer__panel { position: absolute; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); background: var(--surface); overflow-y: auto; box-shadow: var(--shadow-3); }
}
@media (prefers-reduced-motion: reduce) { .q-bar-fill { transition: none; } }

.q-note { white-space: normal; }
.q-note summary { cursor: pointer; color: var(--label-secondary); }
.q-note summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.q-scroll .ns-table { min-width: 640px; }
.ns-tf__hint, .ns-tf__error, .data, .ns-row__value, .ns-row__sub { overflow-wrap: anywhere; }
.q-content > * { min-width: 0; }
.q-scroll, .q-step { position: relative; }

/* v20.1: sections, agent tabs and the form controls the design system has no component for (same look as its text field) */
.q-section { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.q-section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.q-section__head h2 { margin: 0; }
.q-section__lead { margin: calc(-1 * var(--space-2)) 0 0; max-width: 820px; }
.q-tabs { display: flex; gap: var(--space-1); overflow-x: auto; border-bottom: 1px solid var(--separator); scrollbar-width: thin; }
.q-tab { flex: 0 0 auto; padding: var(--space-2) var(--space-3); color: var(--label-secondary); text-decoration: none; font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.q-tab:hover { color: var(--label); background: var(--fill); }
.q-tab.is-active { color: var(--label); border-bottom-color: var(--accent); }
.q-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.q-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.q-field__label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--label); }
.q-field__hint { font-size: 12px; line-height: 16px; color: var(--label-secondary); overflow-wrap: anywhere; }
.q-select, .q-textarea, .q-input { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--label); background: var(--bg); border: 0;
  box-shadow: inset 0 0 0 1px var(--border-control), inset 0 -1px 0 0 var(--border-control-strong); border-radius: var(--radius-sm); }
.q-select { height: var(--control-md); padding: 0 32px 0 var(--space-3); min-width: 140px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--label-secondary) 50%), linear-gradient(135deg, var(--label-secondary) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.q-input { height: var(--control-sm); padding: 0 var(--space-2); min-width: 160px; font-size: 13px; }
.q-textarea { padding: var(--space-2) var(--space-3); line-height: 1.5; resize: vertical; min-height: 64px; }
.q-textarea.code { font-family: var(--font-mono); font-size: 13px; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.q-select:focus-visible, .q-textarea:focus-visible, .q-input:focus-visible, .q-file:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.q-select:disabled { opacity: 0.5; }
.ns-table .q-select { height: var(--control-sm); font-size: 13px; min-width: 110px; }
.q-file { font: inherit; font-size: 14px; color: var(--label-secondary); max-width: 100%; }
.q-file::file-selector-button { font: inherit; font-size: 14px; font-weight: 500; margin-right: var(--space-3); height: var(--control-sm); padding: 0 var(--space-3);
  color: var(--label); background: transparent; border: 1px solid var(--border-control-strong); border-radius: var(--radius-sm); cursor: pointer; }
.q-radios { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.q-radio { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border-radius: var(--radius-md); cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--separator); }
.q-radio:hover { background: var(--fill); }
.q-radio.is-on { box-shadow: inset 0 0 0 2px var(--accent); }
.q-radio input { margin: 3px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.q-radio__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.q-radios:disabled .q-radio { cursor: default; opacity: 0.7; }
.q-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4) var(--space-6); }
.q-form__row { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.q-kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--space-2) var(--space-6); margin: 0; }
.q-kv dt, .q-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.q-checks { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.q-checks li { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) 0; border-bottom: 1px solid var(--separator); }
.q-checks li:last-child { border-bottom: 0; }
.q-checks li > :first-child { flex: 0 0 auto; }
.q-checks__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.q-diagram { overflow: auto; max-height: 560px; background: #fff; border-radius: var(--radius-sm); padding: var(--space-2); }
.q-diagram img { display: block; max-width: none; }
.q-spark { display: block; background: var(--bg); border-radius: 4px; }
.q-skip { position: absolute; left: -9999px; top: 0; z-index: 30; padding: var(--space-2) var(--space-3); background: var(--accent); color: var(--on-accent); }
.q-skip:focus { left: var(--space-2); top: var(--space-2); }
.q-content:focus { outline: none; }
@media (max-width: 760px) { .q-kv { grid-template-columns: 1fr; gap: 2px var(--space-4); } .q-kv dd { margin-bottom: var(--space-2); } }

/* v20.3: the brand with the product under the lockup; lists boxed like cards; sortable tables in one type style */
.q-brand { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.q-brand__product { font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; color: var(--label-secondary); padding-left: 2px; }
.q-brand--lg .q-brand__product { font-size: 15px; line-height: 20px; }
.q-boxlist .ns-card__body { padding: var(--space-2) 0 0; }
.q-list-flat .ns-list__group { box-shadow: none; border-radius: 0; background: transparent; }
.q-boxlist__foot { margin: 0; padding: var(--space-2) var(--space-4) var(--space-4); }
.q-num { font-variant-numeric: tabular-nums; }
.q-nowrap { white-space: nowrap; }
.q-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.q-sort--right { flex-direction: row; }
.q-sort:hover { color: var(--label); }
.q-sort:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }
.q-sort__mark { font-size: 10px; color: var(--label-tertiary); }
.q-sort.is-on .q-sort__mark { color: var(--accent-text, var(--accent)); }
/* a main column with a fixed-width side column (the agents page): the table gets the room */
.q-row--side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-6); }
.q-row--side > * { min-width: 0; }
@media (max-width: 1100px) { .q-row--side { grid-template-columns: minmax(0, 1fr); } }
.q-table .ns-table th { white-space: nowrap; }
.q-table .ns-table th, .q-table .ns-table td { padding-left: 12px; padding-right: 12px; }
@media (max-width: 1400px) { .q-row--side { grid-template-columns: minmax(0, 1fr) 300px; } }
/* one type style inside tables: values set in the data (mono) style elsewhere read as body text here, with even digits */
.q-table td .data, .q-table td .code, .q-table td .ns-mono { font-family: var(--font-sans); font-size: inherit; line-height: inherit; font-weight: inherit; }
.q-table td { font-variant-numeric: tabular-nums; }
/* v20.7: deployment targets on the Release tab */
.q-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3) var(--space-6); }
.q-wrap { overflow-wrap: anywhere; word-break: break-all; }
/* v20.9: try-out */
.q-finding { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--separator); border-radius: var(--radius-md, 8px); }
.q-quote { margin: 0; padding: var(--space-1) var(--space-3); border-left: 3px solid var(--separator); color: var(--label-secondary, var(--label)); font-style: italic; overflow-wrap: anywhere; }
.q-verdicts { display: flex; flex-direction: column; gap: var(--space-2); }
.q-row-inline { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
.q-row-inline > :first-child { flex: 1 1 260px; }
/* v20.10: the labelling page */
.q-label-shell { min-height: 100vh; background: var(--background, var(--bg)); }
.q-label-shell .q-bar { display: flex; align-items: center; padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--separator); }
.q-label-main { max-width: 880px; margin: 0 auto; padding: var(--space-6) var(--space-4) 64px; display: block; }
.q-itemtext { font-size: 16px; line-height: 1.55; white-space: pre-wrap; user-select: text; }
.q-ctx { color: var(--label-secondary, var(--label)); }
.q-cat { border: 1px solid var(--separator); border-radius: 8px; padding: var(--space-3); }
.q-cat.is-on { border-color: var(--accent); }
.q-cat__head { display: flex; gap: var(--space-3); align-items: flex-start; cursor: pointer; }
.q-cat__extra { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); padding-left: 28px; }
.q-sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-2); }
.q-set { border: 1px dashed var(--separator); border-radius: 8px; padding: var(--space-2) var(--space-3); }

/* guided intake (v20.12) */
.q-linkbtn { background: none; border: 0; padding: 0; color: var(--accent, inherit); text-decoration: underline; cursor: pointer; font: inherit; }
.q-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.q-chip { border: 1px solid var(--separator, #8884); background: var(--fill, transparent); color: inherit; border-radius: var(--radius-full, 999px); padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.q-chip:hover, .q-chip:focus-visible { border-color: var(--accent, currentColor); }

/* activity (v20.13) */
.q-copy { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--separator, #8884); border-radius: var(--radius-sm, 6px); padding: 3px 10px; color: inherit; cursor: pointer; font: inherit; }
.q-copy:hover, .q-copy:focus-visible { border-color: var(--accent, currentColor); }
.q-busy { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.q-indeterminate { width: 35%; animation: q-slide 1.4s ease-in-out infinite; }
@keyframes q-slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.q-bar-fill.is-approx { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 8px, transparent 8px 16px); }
.q-progress-note { white-space: normal; }
@media (prefers-reduced-motion: reduce) { .q-indeterminate { animation: none; width: 100%; opacity: .5; } }

/* guided process (v20.13) */
.q-tab.is-locked { color: var(--label-tertiary, #8a8a8f); opacity: .55; cursor: not-allowed; }
.q-tab.is-locked::after { content: ' 🔒'; font-size: 11px; }
.q-todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.q-todo__item { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.q-todo__dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); flex: 0 0 auto; position: relative; top: 1px; }
.q-todo__item.is-soft .q-todo__dot { border-color: var(--label-tertiary, #999); }
.q-todo__text { flex: 1 1 260px; }
.q-todo__go { white-space: nowrap; font-weight: 600; }

/* v20.16: quieter pages. Folded sections and popup rows (Q.Section fold / popup) */
.q-fold { gap: var(--space-3); border-top: 1px solid var(--separator); padding-top: var(--space-3); }
.q-fold__head { display: flex; align-items: center; gap: var(--space-2); width: 100%; background: none; border: 0; padding: var(--space-1) 0; cursor: pointer; text-align: left; color: inherit; font: inherit; }
.q-fold__head:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
.q-fold__summary { margin-left: auto; text-align: right; }
.q-poprow { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--separator); border-radius: 12px; background: var(--surface, transparent); }
.q-poprow__text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 320px; min-width: 0; }
.q-table-lite { width: 100%; border-collapse: collapse; }
.q-table-lite td, .q-table-lite th { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--separator); vertical-align: top; }
.q-table-lite tr:last-child td { border-bottom: 0; }
.ns-dialog.ns-dialog--lg { max-width: 860px; max-height: 88vh; overflow: auto; }
.q-poprow__text p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-steps--dev { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); min-width: 0; }
