/* Nuronteq skin for the Django admin, on the shared tokens in brand/ui-tokens.css (loaded first).
   Every Django variable maps to one --nq-* token once, in a single :root block. That block is unlayered and loaded
   after dark_mode.css, so it wins in every theme, including "light" on a dark OS (Django's own
   html[data-theme="light"] reset lives in base.css, which nq-admin/django-layer.css moves into a low cascade layer).
   ":root[data-theme]" (0,2,0) outranks dark_mode.css's html[data-theme="dark"] (0,1,1) when dark is picked by hand. */

:root, :root[data-theme] {
  --primary: var(--nq-hover); /* module captions, selector headers */
  --primary-fg: var(--nq-fg);
  --secondary: var(--nq-pill);
  --accent: var(--nq-accent-fg); /* teal stays with the brand and live indicators (section 3) */

  --body-fg: var(--nq-fg);
  --body-bg: var(--nq-bg);
  --body-quiet-color: var(--nq-muted);
  --body-medium-color: var(--nq-muted);
  --body-loud-color: var(--nq-fg);

  --header-color: var(--nq-muted);
  --header-branding-color: var(--nq-fg);
  --header-bg: var(--nq-side);
  --header-link-color: var(--nq-fg);

  --breadcrumbs-fg: var(--nq-muted);
  --breadcrumbs-link-fg: var(--nq-accent-fg);
  --breadcrumbs-bg: var(--nq-bg);

  --link-fg: var(--nq-accent-fg);
  --link-hover-color: var(--nq-accent-hover);
  --link-selected-fg: var(--nq-accent-fg);

  --hairline-color: var(--nq-line);
  --border-color: var(--nq-control);

  --error-fg: var(--nq-crit);
  --message-success-bg: var(--nq-ok-bg);
  --message-warning-bg: var(--nq-warn-bg);
  --message-error-bg: var(--nq-crit-bg);

  --darkened-bg: var(--nq-hover);
  --selected-bg: var(--nq-hover);
  --selected-row: var(--nq-pill);

  --button-fg: #fff;
  --button-bg: var(--nq-btn);
  --button-hover-bg: var(--nq-btn-hover);
  --default-button-bg: var(--nq-btn-default);
  --default-button-hover-bg: var(--nq-btn-default-hover);
  --close-button-bg: var(--nq-btn);
  --close-button-hover-bg: var(--nq-btn-hover);
  --delete-button-bg: var(--nq-btn-danger);
  --delete-button-hover-bg: var(--nq-btn-danger-hover);

  --font-family-primary: var(--nq-font-text);
  --font-family-monospace: var(--nq-font-label);
}

/* IBM Plex Sans everywhere (Carbon productive type); Space Grotesk is for the wordmark only (it lives in the shell). */
body { font-size: var(--nq-text-body); letter-spacing: var(--nq-tracking-body); }
#site-name {
  font-family: var(--nq-font-text);
  font-weight: 600;
}
#content h1 { font-family: var(--nq-font-text); font-size: var(--nq-text-page-title); font-weight: 400; line-height: 2.25rem; letter-spacing: 0; } /* heading-04 */

#site-name a { display: inline-flex; align-items: center; gap: 10px; }
#site-name a:link, #site-name a:visited { color: var(--header-branding-color); }
#site-name img { flex: none; }
#header { border-bottom: 1px solid var(--nq-line); }

/* Sentence-case, semibold headers everywhere: no uppercase captions, table heads, filters or buttons.
   The "body" prefix outranks changelists.css and forms.css, which load after this file on their own pages. */
body .module h2, body .module caption, body .inline-group h2, body #changelist-filter h2 {
  font-family: var(--nq-font-text);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: normal;
  text-transform: none;
}
.module h2, .module caption, .inline-group h2 { background: var(--primary); color: var(--primary-fg); }
body thead th, body .object-tools a:link, body .object-tools a:visited, body .submit-row input.default, #user-tools, h5 {
  letter-spacing: normal;
  text-transform: none;
}
thead th { font-weight: 600; }

/* Shape and depth (sections 4.7, 4.8). */
body .module { border-radius: var(--nq-radius-xl); overflow: hidden; }
body #changelist .module, body .inline-group .module { border-radius: 0; overflow: visible; }
body fieldset.module { background: var(--nq-surface); border: 1px solid var(--nq-line); box-shadow: var(--nq-shadow-xs); }
body .button, body input[type="submit"], body input[type="button"], body .submit-row input, body a.button,
body .object-tools a:link, body .object-tools a:visited, body .submit-row a.deletelink {
  border-radius: var(--nq-radius-md);
  transition: background-color var(--nq-duration-fast) var(--nq-ease);
}
body input[type="text"], body input[type="password"], body input[type="email"], body input[type="url"],
body input[type="number"], body input[type="tel"], body input[type="search"], body textarea, body select,
body .vTextField {
  border-radius: var(--nq-radius-md);
  background-color: var(--nq-surface);
}
body .messagelist li { border-radius: var(--nq-radius-lg); }
body .selector-chosen, body .selector-available { border-radius: var(--nq-radius-lg); }

/* Tables (sections 5.4, 9.4): tabular numerals, right-aligned numbers, a header that stays in view.
   nq-admin.js marks numeric columns with .nq-num. */
#content table { font-variant-numeric: tabular-nums; }
#changelist table tbody td, #changelist table tbody th { font-size: var(--nq-text-table); }
#content table .nq-num { text-align: right; }
#changelist table thead th.nq-num .text { text-align: right; }
#changelist table tbody tr { transition: background-color var(--nq-duration-fast) var(--nq-ease); }
#changelist table tbody tr:hover { background: var(--nq-hover); }
#changelist table tbody tr.selected { background: var(--selected-row); }
@media (min-width: 64rem) {
  /* The results box scrolls on its own so its header row can stick; a page-level sticky header is impossible
     because Django wraps the table in an overflow-x container. */
  #changelist .results {
    max-height: calc(100dvh - 14rem);
    overflow: auto;
    overscroll-behavior: contain;
  }
  #changelist .results table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--nq-surface);
    box-shadow: inset 0 -1px 0 var(--nq-line);
  }
}

/* Codes such as order numbers and SKUs (IBM Plex Mono only here). */
.nq-code { font-family: var(--nq-font-label); font-size: 0.9em; letter-spacing: 0; }

.login .submit-row input { background: var(--default-button-bg); }
.login .submit-row input:hover { background: var(--default-button-hover-bg); }
body.login { background: var(--nq-bg); }
.login #container {
  background: var(--nq-surface);
  border: 1px solid var(--nq-line);
  border-radius: var(--nq-radius-xl);
  box-shadow: var(--nq-shadow-md);
  overflow: hidden;
}

/* Carbon data table (docs/carbon.md; admin/nq/table_toolbar.html, change_list_results.html, pagination.html).
   Row height comes from --nq-row-pad: 32 px rows on desk screens, 48 px on touch, or the person's own choice
   (User.table_density -> body.nq-density-*). Cells use body-compact-01 (14/18), so a row is 18 px + 2 x pad. */
body.nq { --nq-row-pad: 7px; --nq-row-h: 32px; }
@media (pointer: coarse) { body.nq { --nq-row-pad: 15px; --nq-row-h: 48px; } }
body.nq.nq-density-xs { --nq-row-pad: 3px; --nq-row-h: 24px; }
body.nq.nq-density-sm { --nq-row-pad: 7px; --nq-row-h: 32px; }
body.nq.nq-density-md { --nq-row-pad: 11px; --nq-row-h: 40px; }
body.nq.nq-density-lg { --nq-row-pad: 15px; --nq-row-h: 48px; }

body.nq #changelist { display: block; background: none; }
body.nq #changelist .changelist-form-container { display: block; }
body.nq #changelist .results { background: var(--nq-surface); border: 0; }

/* Toolbar: a 48 px row on the layer colour; search grows, tools are 48 px squares. */
body.nq .nq-table-head { position: relative; margin: 0; background: var(--nq-surface); }
body.nq .nq-table-toolbar { display: flex; align-items: stretch; min-height: 48px; }
body.nq .nq-table-toolbar-fill { flex: 1; }
body.nq .nq-table-search { position: relative; display: flex; flex: 1 1 16rem; min-width: 0; margin: 0; }
body.nq .nq-table-search-icon { position: absolute; left: 16px; top: 16px; color: var(--nq-muted); pointer-events: none; }
body.nq .nq-table-search input[type="search"] {
  width: 100%; height: 48px; margin: 0; padding: 0 16px 0 48px; border: 0; border-bottom: 1px solid var(--nq-control);
  border-radius: 0; background: var(--nq-surface); color: var(--nq-fg); font: inherit; letter-spacing: var(--nq-tracking-body);
}
body.nq .nq-table-search input[type="search"]::placeholder { color: var(--nq-muted); }
body.nq .nq-table-search input[type="search"]:focus { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-table-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; height: 48px;
  margin: 0; padding: 0 16px; border: 0; background: transparent; color: var(--nq-fg); font: inherit;
  font-size: var(--nq-text-body); cursor: pointer; white-space: nowrap; text-decoration: none; list-style: none;
}
body.nq summary.nq-table-tool { padding: 0; }
body.nq summary.nq-table-tool::-webkit-details-marker { display: none; }
body.nq .nq-table-tool:hover { background: var(--nq-hover); color: var(--nq-fg); text-decoration: none; }
body.nq .nq-table-tool:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-table-settings { position: relative; }
body.nq .nq-table-settings[open] > summary { background: var(--nq-pill); }
body.nq .nq-table-menu {
  position: absolute; z-index: 20; top: 48px; right: 0; min-width: 16rem; margin: 0; padding: 8px 0;
  background: var(--nq-surface); box-shadow: var(--nq-shadow-overlay);
}
body.nq .nq-table-menu-title { margin: 0; padding: 4px 16px 8px; color: var(--nq-muted); font-size: 0.75rem; letter-spacing: var(--nq-tracking-label); }
body.nq .nq-table-menu-item {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px;
  margin: 0; padding: 0 16px; border: 0; border-radius: 0; background: transparent; color: var(--nq-fg); font: inherit;
  text-align: left; cursor: pointer;
}
body.nq .nq-table-menu-item:hover { background: var(--nq-hover); }
body.nq .nq-table-menu-item[aria-pressed="true"] { background: var(--nq-pill); font-weight: 600; box-shadow: inset 3px 0 0 var(--nq-accent); }
body.nq .nq-table-menu-hint { color: var(--nq-muted); font-size: 0.75rem; font-weight: 400; }

/* Filters: a dropdown per list filter inside the toolbar (nq-admin.js names the active choice). */
body.nq #changelist-filter.nq-table-filters {
  position: static; order: 0; display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: stretch; gap: 0; width: auto;
  margin: 0; padding: 0; border: 0; background: none; overflow: visible;
}
body.nq #changelist-filter details { position: relative; margin: 0; border: 0; }
body.nq #changelist-filter details > summary {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; margin: 0; padding: 0 16px; border: 0;
  border-radius: 0; background: transparent; color: var(--nq-fg); font-size: var(--nq-text-body); font-weight: 400;
  cursor: pointer; white-space: nowrap; list-style: none;
}
body.nq #changelist-filter details > summary:hover { background: var(--nq-hover); }
body.nq #changelist-filter details > summary:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq #changelist-filter details > summary::before { content: none; }
body.nq #changelist-filter details > summary::after { content: "\25BE"; color: var(--nq-muted); }
body.nq #changelist-filter details[open] > summary { background: var(--nq-pill); }
body.nq #changelist-filter details[data-nq-active] > summary { font-weight: 600; box-shadow: inset 0 -3px 0 var(--nq-accent); }
body.nq #changelist-filter details > ul {
  position: absolute; z-index: 20; top: 48px; left: 0; min-width: 14rem; max-height: 20rem; overflow: auto;
  margin: 0; padding: 8px 0; border: 0; border-radius: 0; background: var(--nq-surface); box-shadow: var(--nq-shadow-overlay);
}
body.nq #changelist-filter li { margin: 0; padding: 0; list-style: none; }
body.nq #changelist-filter li a { display: flex; align-items: center; min-height: 32px; padding: 6px 16px; border-radius: 0; color: var(--nq-fg); }
body.nq #changelist-filter li a:hover { background: var(--nq-hover); color: var(--nq-fg); text-decoration: none; }
body.nq #changelist-filter li.selected a { background: var(--nq-pill); color: var(--nq-pill-fg); font-weight: 600; }
body.nq #changelist-filter li.selected { border: 0; padding: 0; }

body.nq #changelist-filter .nq-table-tool-text { display: inline-flex; align-items: center; padding: 0 16px; color: var(--nq-accent-fg); }

/* Date drill-down (Django's date_hierarchy) as a row of the table head. */
body.nq #changelist .toplinks { margin: 0; padding: 8px 16px; border-top: 1px solid var(--nq-line); background: var(--nq-surface); font-size: var(--nq-text-body); }
body.nq #changelist .toplinks li { margin-right: 16px; }

/* Active filters as Carbon dismissible tags, under the toolbar. */
body.nq .nq-filter-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 8px 16px; list-style: none; border-top: 1px solid var(--nq-line); }
body.nq .nq-filter-tags li { margin: 0; padding: 0; list-style: none; }
body.nq .nq-filter-tag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 0 0 8px;
  border-radius: var(--nq-radius-pill); background: var(--nq-info-bg); color: var(--nq-info);
  font-size: 0.75rem; letter-spacing: var(--nq-tracking-label);
}
body.nq .nq-filter-tag a { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: inherit; }
body.nq .nq-filter-tag a:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
body.nq .nq-filter-tag a:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-filter-clear { font-size: 0.875rem; color: var(--nq-accent-fg); }

/* Batch action bar: covers the toolbar while rows are selected. Django's own action row stays for no-JS. */
body.nq #changelist.nq-batch-ready .actions { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
body.nq .nq-batch-bar {
  position: absolute; inset: 0 0 auto 0; z-index: 15; display: flex; align-items: stretch; height: 48px;
  background: var(--nq-accent); color: #ffffff;
}
body.nq .nq-batch-bar[hidden] { display: none; }
body.nq .nq-batch-count { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0 16px; font-size: var(--nq-text-body); }
body.nq .nq-batch-actions { display: flex; align-items: stretch; overflow-x: auto; }
body.nq .nq-batch-btn {
  display: inline-flex; align-items: center; height: 48px; margin: 0; padding: 0 16px; border: 0; border-radius: 0;
  background: transparent; color: #ffffff; font: inherit; font-size: var(--nq-text-body); white-space: nowrap; cursor: pointer;
}
body.nq .nq-batch-btn:hover { background: #0050e6; }
body.nq .nq-batch-btn:focus-visible { outline: 2px solid #ffffff; outline-offset: -4px; }
body.nq .nq-batch-cancel { position: relative; }
body.nq .nq-batch-cancel::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 1px; background: rgb(255 255 255 / 0.5); }
body.nq .nq-batch-btn[hidden] { display: none; }

/* The table: Carbon header ($layer-accent), 1 px row rules, row height by density, square checkboxes. */
body.nq #result_list { width: 100%; border-collapse: collapse; background: var(--nq-surface); }
body.nq #changelist #result_list thead th {
  height: var(--nq-row-h); padding: 0; border: 0; background: var(--nq-pill); color: var(--nq-fg);
  font-size: var(--nq-text-body); font-weight: 600; letter-spacing: var(--nq-tracking-body); vertical-align: middle;
  white-space: nowrap;
}
body.nq #changelist #result_list thead th .text { padding: 0; }
body.nq #changelist #result_list thead th .text > span,
body.nq #changelist #result_list thead th .text > a { display: flex; align-items: center; min-height: var(--nq-row-h); padding: 0 16px; }
body.nq #result_list thead th .nq-sort { gap: 8px; color: var(--nq-fg); text-decoration: none; }
body.nq #result_list thead th .nq-sort:hover { background: var(--nq-pill-hover); color: var(--nq-fg); }
body.nq #result_list thead th .nq-sort:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq #result_list thead th .nq-sort-icon { display: inline-flex; color: var(--nq-fg); opacity: 0; transition: opacity var(--nq-duration-fast) var(--nq-ease); }
body.nq #result_list thead th .nq-sort:hover .nq-sort-icon,
body.nq #result_list thead th .nq-sort:focus-visible .nq-sort-icon,
body.nq #result_list thead th[aria-sort] .nq-sort-icon,
body.nq #result_list thead th.sorted .nq-sort-icon { opacity: 1; }
body.nq #result_list thead th .nq-sort-priority { font-size: 0.75rem; font-weight: 400; color: var(--nq-muted); }
body.nq #result_list thead th .text { display: flex; align-items: stretch; }
body.nq #result_list thead th .nq-sort-remove { display: inline-flex !important; align-items: center; padding: 0 8px !important; min-height: var(--nq-row-h); color: var(--nq-muted); }
body.nq #result_list thead th .nq-sort-remove:hover { color: var(--nq-fg); background: var(--nq-hover); }
body.nq #result_list thead th.nq-num .text { justify-content: flex-end; }
body.nq #result_list thead th.sorted { background: var(--nq-pill); }
body.nq #result_list thead th.action-checkbox-column { width: 48px; padding: 0 0 0 16px; }
body.nq #changelist #result_list tbody td,
body.nq #changelist #result_list tbody th {
  padding: var(--nq-row-pad) 16px; border: 0; border-bottom: 1px solid var(--nq-line); vertical-align: middle;
  font-size: var(--nq-text-body); line-height: 18px; letter-spacing: var(--nq-tracking-body);
}
body.nq #changelist #result_list tbody td.action-checkbox { width: 48px; padding-right: 0; }
body.nq #result_list tbody th { white-space: nowrap; } /* the record's number never wraps */
/* Rows sit on $layer-01 without zebra stripes (Django's base.css stripes even rows on the page colour). */
body.nq #result_list tbody tr { background: var(--nq-surface); }
body.nq #result_list tbody tr:hover { background: var(--nq-hover); }
body.nq #result_list tbody tr.selected { background: var(--nq-pill); }
body.nq #result_list tbody tr.selected:hover { background: var(--nq-pill-hover); }
/* Links in a selected row: text colour plus underline (Blue 40 is 3.6:1 on g100's selected-hover grey). */
body.nq #result_list tbody tr.selected a:not(.nq-btn):not(.nq-btn-icon) { color: var(--nq-fg); text-decoration: underline; text-underline-offset: 3px; }
body.nq #result_list input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--nq-fg); vertical-align: middle; }
body.nq #result_list tbody td .nq-chip, body.nq #result_list tbody td .nq-status { vertical-align: middle; }

/* Pagination: 48 px bar under the table. */
body.nq .nq-pagination {
  display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; min-height: 48px; margin: 0;
  padding: 0 0 0 16px; border-top: 1px solid var(--nq-line); background: var(--nq-surface); font-size: var(--nq-text-body);
}
body.nq .nq-pagination-range { display: flex; align-items: center; flex: 1 1 auto; margin: 0; color: var(--nq-fg); }
body.nq .nq-pagination-all { display: flex; align-items: center; padding: 0 16px; }
body.nq .nq-pagination input[name="_save"] { align-self: center; margin: 0 16px; }
body.nq .nq-pagination-pages { display: flex; align-items: stretch; border-left: 1px solid var(--nq-line); }
body.nq .nq-pagination-pages select {
  height: 48px; margin: 0; padding: 0 8px 0 16px; border: 0; border-radius: 0; background: transparent; color: var(--nq-fg); font: inherit;
}
body.nq .nq-pagination-pages select:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-pagination-of { display: flex; align-items: center; padding: 0 16px 0 4px; color: var(--nq-muted); white-space: nowrap; }
body.nq .nq-pagination.nq-js .nq-pagination-go { display: none; }
body.nq .nq-pagination-go { align-self: center; margin-right: 8px; }
body.nq .nq-pagination-step {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; border-left: 1px solid var(--nq-line); color: var(--nq-fg);
}
body.nq a.nq-pagination-step:hover { background: var(--nq-hover); color: var(--nq-fg); }
body.nq a.nq-pagination-step:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-pagination-step[aria-disabled="true"] { color: var(--nq-faint); cursor: not-allowed; }
@media (max-width: 40rem) {
  /* Phones: search on its own row, then the filter buttons and the row-height menu flow on together. */
  body.nq .nq-table-toolbar { flex-wrap: wrap; }
  body.nq .nq-table-search { flex-basis: 100%; }
  body.nq #changelist-filter.nq-table-filters { display: contents; }
  body.nq .nq-pagination-range { flex-basis: 100%; min-height: 48px; }
  body.nq .nq-pagination-pages { border-left: 0; }
}

body.nq-queue #result_list th.field-case_number,
body.nq-queue #result_list td.field-record,
body.nq-queue #result_list td.field-state,
body.nq-queue #result_list td.field-severity_chip { white-space: nowrap; }
body.nq-queue #result_list td.field-what { min-width: 16rem; line-height: 1.45; }
body.nq-queue #result_list .nq-cell-sub { display: block; margin-top: 4px; color: var(--nq-muted); font-size: var(--nq-text-meta); line-height: 1rem; font-variant-numeric: tabular-nums; }
body.nq-queue #result_list td.field-row_actions { width: 48px; padding: 4px 8px 0; text-align: right; }
body.nq-queue #result_list th.column-row_actions { padding-left: 8px; padding-right: 8px; }
body.nq-queue #result_list td.field-row_actions .nq-btn-icon { width: 32px; min-height: 32px; }
body.nq-queue #result_list td.field-row_actions .nq-row-menu-panel { top: 36px; }
body.nq-queue #result_list tbody tr { cursor: pointer; }
body.nq-queue #result_list td.field-what { font-variant-numeric: normal; } /* codes keep proportional figures */
/* Phones: each case is a card (severity, number and menu; what happened; then state, age, owner, record, site). */
@media (max-width: 40rem) {
  body.nq.nq-queue #changelist #result_list thead, body.nq.nq-queue #changelist #result_list td.action-checkbox { display: none; }
  body.nq.nq-queue #changelist #result_list tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 4px;
    border-bottom: 1px solid var(--nq-line);
  }
  body.nq.nq-queue #changelist #result_list tbody td, body.nq.nq-queue #changelist #result_list tbody th {
    display: block; padding: 0; border: 0; min-width: 0; text-align: left; background: none;
  }
  body.nq.nq-queue #changelist #result_list td.field-severity_chip { order: 1; }
  body.nq.nq-queue #changelist #result_list th.field-case_number { order: 2; }
  body.nq.nq-queue #changelist #result_list td.field-row_actions { order: 3; margin-left: auto; width: auto; padding: 0; }
  body.nq.nq-queue #changelist #result_list td.field-what { order: 4; flex: 1 0 100%; min-width: 0; }
  body.nq.nq-queue #changelist #result_list td.field-state { order: 5; }
  body.nq.nq-queue #changelist #result_list td.field-owner { order: 7; }
  body.nq.nq-queue #changelist #result_list td.field-record { order: 8; }
  body.nq.nq-queue .nq-tab-save { margin-left: 0; }
}

/* Recent activity (UI Phase 2, workstream D): one row per activity, the whole row a link when it names one record. */
body .nq-activity {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 8px;
  border-radius: var(--nq-radius-md);
  color: var(--nq-fg);
  text-decoration: none;
  transition: background-color var(--nq-duration-fast) var(--nq-ease);
}
body a.nq-activity:hover {
  background: var(--nq-hover);
  color: var(--nq-fg);
  text-decoration: none;
}
body a.nq-activity:focus-visible {
  outline: 2px solid var(--nq-focus);
  outline-offset: 2px;
}

/* Accessibility (UI Phase 2, workstream H; docs/accessibility.md).
   Links inside running text are underlined, not told apart by colour alone (WCAG 1.4.1): the breadcrumb trail and
   Django's "Today | calendar" shortcuts beside date fields. */
body .breadcrumbs a,
body .datetimeshortcuts a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* The "|" between those shortcuts is text too: muted (4.5:1), not the faint placeholder grey. */
body .datetimeshortcuts {
  color: var(--nq-muted);
}
/* Filter choices are at least 24 px tall (WCAG 2.5.8 target size); Django's are 20 px. The Carbon toolbar gives
   them 32 px (see "Carbon data table" above). */

/* ---- Carbon PR 4: progress indicator, line tabs, side panel (docs/carbon.md) ------------------------------------ */

/* Progress indicator (admin/nq/progress.html): a 2 px rule over each step, Blue for steps done and the step the record
   is at, then 16 px icons and 14/18 labels. Steps run across from 42rem and stack on phones. */
body.nq .nq-progress-indicator { display: flex; margin: 16px 0 0; padding: 0; list-style: none; overflow-x: auto; }
body.nq .nq-progress-step {
  --nq-step-line: var(--nq-line-strong);
  display: flex; align-items: flex-start; gap: 8px; flex: 1 1 0; min-width: 8rem; margin: 0; padding: 8px 16px 4px 0;
  border-top: 2px solid var(--nq-step-line); color: var(--nq-fg); font-size: var(--nq-text-body); line-height: 1.125rem;
  letter-spacing: var(--nq-tracking-body); list-style: none;
}
body.nq .nq-progress-step[data-state="complete"], body.nq .nq-progress-step[data-state="current"] { --nq-step-line: var(--nq-accent); }
body.nq .nq-progress-step[data-state="warning"] { --nq-step-line: var(--nq-warn); }
body.nq .nq-progress-step[data-state="error"] { --nq-step-line: var(--nq-crit); }
body.nq .nq-progress-step[aria-current="step"] { font-weight: 600; }
body.nq .nq-progress-icon { display: inline-flex; flex: none; margin-top: 1px; color: var(--nq-accent-fg); }
body.nq .nq-progress-step[data-state="incomplete"] .nq-progress-icon { color: var(--nq-muted); }
body.nq .nq-progress-step[data-state="warning"] .nq-progress-icon { color: var(--nq-warn); }
body.nq .nq-progress-step[data-state="error"] .nq-progress-icon { color: var(--nq-crit); }
body.nq .nq-progress-note { display: block; margin-top: 2px; color: var(--nq-muted); font-size: var(--nq-text-meta); font-weight: 400; line-height: 1rem; }
@media (max-width: 41.99rem) {
  body.nq .nq-progress-indicator { flex-direction: column; overflow: visible; }
  body.nq .nq-progress-step { min-width: 0; padding: 6px 0 6px 12px; border-top: 0; border-left: 2px solid var(--nq-step-line); }
}

/* Line tabs: 40 px tabs on a 1 px rule; the selected tab has a 2 px Blue underline and semibold text. Used for record
   tabs (data-nq-tabset) and, as links, for the exception queue's saved views. */
body.nq .nq-tablist, body.nq .nq-tabs {
  display: flex; flex-wrap: nowrap; align-items: stretch; gap: 0; margin: 0; padding: 0; overflow-x: auto;
  border-bottom: 1px solid var(--nq-line-strong); scrollbar-width: thin;
}
body.nq .nq-tabs { margin-bottom: 16px; }
body.nq .nq-tab-button, body.nq .nq-tab, body.nq .nq-ui a.nq-tab:link, body.nq .nq-ui a.nq-tab:visited {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0 0 -1px; padding: 0 16px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--nq-muted);
  font: inherit; font-size: var(--nq-text-body); font-weight: 400; letter-spacing: var(--nq-tracking-body);
  white-space: nowrap; cursor: pointer; text-decoration: none; box-shadow: none;
}
body.nq .nq-tab-button:hover, body.nq .nq-tab:hover, body.nq .nq-ui a.nq-tab:hover {
  background: transparent; color: var(--nq-fg); border-bottom-color: var(--nq-control);
}
body.nq .nq-tab-button[aria-selected="true"], body.nq .nq-ui a.nq-tab[aria-current="page"] {
  background: transparent; color: var(--nq-fg); font-weight: 600; border-bottom-color: var(--nq-accent); box-shadow: none;
}
body.nq .nq-tab-button:focus-visible, body.nq .nq-tab:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-tab-count { color: var(--nq-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
body.nq .nq-tab-save { margin-left: auto; color: var(--nq-accent-fg); }
body.nq .nq-tabset .nq-tabpanel.nq-card { margin-top: 0; border-top: 0; }
body.nq .nq-tabset > .nq-tabpanel:not(.nq-card) { padding-top: 16px; }
body.nq .nq-tabpanel-title, body.nq .nq-tabpanel .inline-heading {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Side panel (exception queue): 30rem on the right under the header. From 82rem it sits beside the list, which
   narrows to make room; below that it floats over the list with Carbon's overlay shadow. */
body.nq .nq-side-panel {
  position: fixed; z-index: 35; top: var(--nq-shell-h); right: 0; bottom: 0; display: flex; flex-direction: column;
  width: min(30rem, 100vw); border-left: 1px solid var(--nq-line); background: var(--nq-surface); color: var(--nq-fg);
  box-shadow: var(--nq-shadow-overlay);
}
body.nq .nq-side-panel[hidden] { display: none; }
body.nq .nq-side-panel-inner { display: flex; flex: 1; flex-direction: column; min-height: 0; transition: opacity var(--nq-duration-fast) var(--nq-ease); }
body.nq .nq-side-panel[aria-busy="true"] .nq-side-panel-inner { opacity: 0.6; }
body.nq .nq-panel-head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 8px 16px 24px; border-bottom: 1px solid var(--nq-line); }
body.nq .nq-panel-kind { margin: 0; color: var(--nq-muted); font-size: var(--nq-text-meta); letter-spacing: var(--nq-tracking-label); }
body.nq .nq-panel-title { margin: 4px 0 0; color: var(--nq-fg); font-size: 1.25rem; font-weight: 400; line-height: 1.75rem; }
body.nq .nq-panel-title:focus:not(:focus-visible) { outline: none; }
body.nq .nq-panel-title:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: 2px; }
body.nq .nq-panel-body { flex: 1; min-height: 0; padding: 16px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
body.nq .nq-panel-state { margin: 0; }
body.nq .nq-panel-section { margin-top: 24px; }
body.nq .nq-panel-section-title { margin: 0; color: var(--nq-fg); font-size: var(--nq-text-body); font-weight: 600; }
body.nq .nq-side-panel .nq-fields { grid-template-columns: minmax(0, 1fr); }
body.nq .nq-side-panel .nq-progress-step { min-width: 6rem; }
body.nq .nq-side-panel .nq-timeline { margin: 8px 0 0; padding: 0; }
body.nq .nq-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--nq-line); }
body.nq .nq-panel-error { margin: 0; padding: 24px; }
body.nq .nq-btn-ghost, body.nq .nq-ui a.nq-btn-ghost:link, body.nq .nq-ui a.nq-btn-ghost:visited {
  border-color: transparent; background: transparent; color: var(--nq-accent-fg);
}
body.nq .nq-btn-ghost:hover { background: var(--nq-hover); color: var(--nq-accent-hover); }
body.nq .nq-panel-head .nq-btn-ghost { color: var(--nq-fg); }
body.nq-queue #result_list tbody tr.nq-row-current > * { background: var(--nq-pill); }
body.nq-queue #result_list tbody tr.nq-row-current > :first-child { box-shadow: inset 3px 0 0 var(--nq-accent); }
/* With the panel open the list keeps severity, case and what happened; the panel shows the state, owner, age and record. */
@media (min-width: 40.01rem) {
  body.nq-queue.nq-panel-open #result_list :is(.column-state, .field-state, .column-owner, .field-owner,
    .column-record, .field-record, .column-row_actions, .field-row_actions) { display: none; }
  body.nq-queue.nq-panel-open #result_list td.field-what { min-width: 0; }
}
@media (min-width: 82rem) {
  body.nq.nq-panel-open #content { margin-right: 30rem; }
  body.nq .nq-side-panel { box-shadow: none; }
}
@media (max-width: 63.99rem) {
  body.nq .nq-side-panel { bottom: calc(3.5rem + 1px + env(safe-area-inset-bottom)); } /* above the phone's bottom bar */
}
@media (prefers-reduced-motion: reduce) {
  body.nq .nq-side-panel-inner { transition: none; }
}

/* ---- Carbon PR 5: field anatomy and notifications (docs/carbon.md, "Fields", "Notifications") ------------------- */

/* Fields: label above (12/16, secondary), the field on $field-02 with a 1 px $border-strong underline and no other
   border, 40 px tall, helper text and then the error message under it. Focus is a 2 px inset ring; an invalid field
   has a 2 px $support-error ring and a warning icon inside its right edge, next to words that say what is wrong. */
body.nq form .aligned.nq-form label, body.nq .nq-form .flex-container > label {
  display: block; float: none; width: auto; min-width: 0; margin: 0 0 8px; padding: 0;
  color: var(--nq-muted); font-size: var(--nq-text-meta); font-weight: 400; line-height: 1rem; letter-spacing: var(--nq-tracking-label);
}
body.nq .nq-form label.required { font-weight: 400; }
/* Optional fields say so; required ones say nothing (most fields are required). Read-only and checkbox labels don't. */
body.nq .nq-form .flex-container:has(> input:not([type="checkbox"]):not([type="hidden"]), > select, > textarea, > .related-widget-wrapper, > p.datetime, > p.date)
  > label:not(.required)::after { content: " (optional)"; display: inline; }
body.nq .nq-form .form-row { padding: 16px; border-bottom: 0; }
body.nq .nq-form .form-row .flex-container:not(.checkbox-row) { flex-direction: column; align-items: stretch; }
body.nq .nq-form .form-multiline { flex-direction: row; flex-wrap: wrap; gap: 16px 32px; }
body.nq form .aligned.nq-form div.help, body.nq form .aligned.nq-form p.help, body.nq form .aligned.nq-form ul.errorlist {
  margin: 4px 0 0; padding: 0;
}
body.nq .nq-form div.help, body.nq .nq-form p.help {
  color: var(--nq-muted); font-size: var(--nq-text-meta); line-height: 1rem; letter-spacing: var(--nq-tracking-label);
}
body.nq .nq-form .checkbox-row + div.help { margin-left: 24px; }
body.nq .nq-form .readonly, body.nq form .aligned.nq-form label + div.readonly {
  padding: 0; margin: 0; color: var(--nq-fg); font-size: var(--nq-text-body); line-height: 1.125rem; overflow-wrap: anywhere;
}
/* Date and time (Django's split widget): "Date" field, its shortcuts, then "Time" and its field, on one wrapping row. */
body.nq .nq-form p.datetime { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0; color: var(--nq-muted); font-size: var(--nq-text-meta); font-weight: 400; }
body.nq .nq-form p.datetime br { display: none; }
body.nq form .aligned.nq-form p.datetime label { display: inline; margin: 0; font-weight: 400; }
body.nq form .aligned.nq-form p.datetime label::after { content: none; }

body.nq input[type="text"], body.nq input[type="password"], body.nq input[type="email"], body.nq input[type="url"],
body.nq input[type="number"], body.nq input[type="tel"], body.nq input[type="date"], body.nq input[type="datetime-local"],
body.nq textarea, body.nq select, body.nq .vTextField, body.nq .nq-field {
  min-height: 40px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--nq-field-line); border-radius: 0;
  background-color: var(--nq-field); color: var(--nq-fg); font: inherit; font-size: var(--nq-text-body);
  letter-spacing: var(--nq-tracking-body); box-shadow: none;
  transition: background-color var(--nq-duration-fast) var(--nq-ease), outline-color var(--nq-duration-fast) var(--nq-ease);
}
body.nq .nq-form :is(input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="number"],
  input[type="tel"], select, .vTextField) { width: 100%; max-width: 32rem; }
body.nq .nq-form input:is(.vDateField, .vTimeField) { width: 10rem; max-width: 10rem; }
body.nq :is(input, textarea, select, .nq-field) { box-sizing: border-box; }
body.nq .nq-form textarea, body.nq textarea.nq-field { width: 100%; max-width: 48rem; padding: 11px 16px; line-height: 1.125rem; }
body.nq select[multiple] { padding: 8px 16px; }
body.nq :is(input, textarea, select, .nq-field)::placeholder { color: var(--nq-field-placeholder); opacity: 1; }
body.nq :is(input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="number"],
  input[type="tel"], textarea, select, .nq-field):hover:not(:disabled):not([readonly]) { background-color: var(--nq-field-hover); }
body.nq :is(input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="number"],
  input[type="tel"], input[type="search"], textarea, select, .nq-field):focus {
  outline: 2px solid var(--nq-focus); outline-offset: -2px; border-bottom-color: transparent;
}
body.nq :is(input, textarea, select, .nq-field):disabled {
  color: var(--nq-faint); border-bottom-color: transparent; cursor: not-allowed;
}
body.nq :is(input, textarea, select, .nq-field)[aria-invalid="true"] {
  outline: 2px solid var(--nq-support-error); outline-offset: -2px; border-bottom-color: transparent;
  padding-right: 40px; background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  background-image: var(--nq-glyph-invalid);
}
body.nq :is(input, textarea, select, .nq-field)[aria-invalid="true"]:focus { outline-color: var(--nq-focus); }
/* After the shared invalid rule, at a higher specificity: the glyph sits left of the select's own chevron. */
body.nq :is(select, select.nq-field)[aria-invalid="true"] { background-position: right 36px center; padding-right: 60px; }
body.nq ul.errorlist { margin: 4px 0 0; padding: 0; background: none; list-style: none; }
body.nq ul.errorlist li, body.nq .form-row.errors ul.errorlist li {
  margin: 0; padding: 0; border: 0; background: none; color: var(--nq-crit);
  font-size: var(--nq-text-meta); line-height: 1rem; letter-spacing: var(--nq-tracking-label);
}
body.nq .form-row.errors { background: none; border: 0; }
body.nq ul.errorlist.nonfield, body.nq ul.errorlist.nonform { margin: 0 0 16px; }

/* Notifications: Carbon low-contrast inline notifications. A 3 px support-colour edge and an icon, then the words on the
   status tint in text colour. Django's messages, its "Please correct the errors below" note and the licence banners. */
/* On the content grid: the same 16/32 px gutter as the breadcrumbs and #content, not under the side nav's edge. */
body.nq .messagelist { margin: 16px 16px 0; padding: 0; }
@media (min-width: 64rem) { body.nq .messagelist { margin: 16px 32px 0; } }
body.nq .messagelist li:last-child { margin-bottom: 0; }
body.nq .messagelist li, body.nq p.errornote {
  position: relative; display: block; margin: 0 0 8px; padding: 15px 16px 15px 48px; border: 0;
  border-left: 3px solid var(--nq-support-info); border-radius: 0; background: var(--nq-info-bg); color: var(--nq-fg);
  font-size: var(--nq-text-body); line-height: 1.125rem; letter-spacing: var(--nq-tracking-body); box-shadow: none;
  --nq-note-icon: var(--nq-glyph-info); --nq-note-colour: var(--nq-support-info);
}
/* The icon is a mask filled with the theme's support colour, so it follows g10 and g100. */
body.nq .messagelist li::before, body.nq p.errornote::before {
  content: ""; position: absolute; left: 13px; top: 15px; width: 18px; height: 18px;
  background-color: var(--nq-note-colour); -webkit-mask: var(--nq-note-icon) center / contain no-repeat;
  mask: var(--nq-note-icon) center / contain no-repeat;
}
body.nq .messagelist li.success {
  border-left-color: var(--nq-support-success); background: var(--nq-ok-bg);
  --nq-note-icon: var(--nq-glyph-success); --nq-note-colour: var(--nq-support-success);
}
body.nq .messagelist li.warning {
  border-left-color: var(--nq-support-warning); background: var(--nq-warn-bg);
  --nq-note-icon: var(--nq-glyph-warning-alt); --nq-note-colour: var(--nq-warn);
}
body.nq .messagelist li.error, body.nq p.errornote {
  border-left-color: var(--nq-support-error); background: var(--nq-crit-bg);
  --nq-note-icon: var(--nq-glyph-error); --nq-note-colour: var(--nq-support-error);
}
body.nq p.errornote { font-weight: 600; }
body.nq .messagelist li a { color: var(--nq-accent-fg); text-decoration: underline; }

/* Inline edit (Carbon PR 5, docs/carbon.md "Inline edit"): the value with a pencil that shows on row hover and on focus
   (always on touch screens); editing swaps in a 32 px field with Save and Cancel icon buttons in the same cell. */
body.nq .nq-inline { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
/* In a number column the pencil sits left of the value, so the figures stay aligned with the column's right edge. */
body.nq .nq-num .nq-inline { flex-direction: row-reverse; justify-content: flex-start; }
body.nq .nq-inline-trigger {
  display: inline-grid; place-items: center; width: 32px; height: 32px; margin: -8px 0; padding: 0; border: 0;
  border-radius: 0; background: transparent; color: var(--nq-muted); cursor: pointer; opacity: 0;
}
body.nq tr:hover .nq-inline-trigger, body.nq .nq-inline-trigger:focus-visible, body.nq .nq-inline-trigger[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { body.nq .nq-inline-trigger { opacity: 1; } }
body.nq .nq-inline-trigger:hover { background: var(--nq-hover); color: var(--nq-fg); }
body.nq .nq-inline-trigger:focus-visible { outline: 2px solid var(--nq-focus); outline-offset: -2px; }
body.nq .nq-inline-editing > .nq-inline-value, body.nq .nq-inline-editing > .nq-inline-trigger { display: none; }
body.nq .nq-inline-form { display: inline-flex; align-items: center; gap: 0; margin: -4px 0; }
body.nq .nq-inline-form[hidden] { display: none; }
body.nq .nq-inline-form[aria-busy="true"] { opacity: .6; }
body.nq .nq-inline .nq-inline-input { min-height: 32px; height: 32px; width: 7rem; padding: 0 8px; text-align: inherit; font-variant-numeric: tabular-nums; }
body.nq .nq-inline select.nq-inline-input { width: 10rem; text-align: left; padding-right: 32px; }
body.nq #result_list td:has(.nq-inline-editing) { min-width: 15rem; }
body.nq .nq-inline-unit { padding: 0 8px; color: var(--nq-muted); font-size: var(--nq-text-meta); }
body.nq .nq-inline-form .nq-btn-icon { width: 32px; height: 32px; min-height: 32px; padding: 0; }

/* Freshness line beside a live list's title (exception queue): "Updated 14:05 SAST · Refresh". */
body.nq .nq-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
body.nq .nq-updated { margin: 0; color: var(--nq-muted); font-size: var(--nq-text-meta); line-height: 1rem; font-variant-numeric: tabular-nums; }
/* A link in a line of text is underlined (1.4.1): in g100 the blue and the grey are too close to tell apart by colour. */
body.nq .nq-updated a { color: var(--nq-accent-fg); text-decoration: underline; text-underline-offset: 2px; }
body.nq .nq-inline { vertical-align: middle; }
