/* Robust stage 10 — the styles of core/ux.js, shared by both dashboards (their own tokens: light and dark follow). */

/* a message that stays (an error) has its own × */
.toast.stay { display: flex; align-items: flex-start; gap: 10px; max-width: min(520px, calc(100vw - 40px)); }
.toast-x { border: 0; background: none; color: inherit; font: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; margin-left: auto; }
.toast-x:hover, .toast-x:focus-visible { outline: 2px solid currentColor; border-radius: 4px; }

/* a page that could not load */
.ux-err { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; border: 1px solid var(--crit, #d03b3b); border-left-width: 5px; margin-bottom: 12px; }
.ux-err > div { flex: 1; min-width: 200px; }

/* the "View only" ribbon (Top management) */
.ux-ribbon { background: #e8f1ff; color: #1849a9; border: 1px solid #b2ccff; border-radius: 10px; padding: 8px 14px; margin-bottom: 12px; font-size: 13.5px; }

/* a question asked in the page (in place of the browser's prompt), and the idle warning */
.ux-ask { position: fixed; inset: 0; z-index: 4000; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ux-ask-box { background: var(--card, #fff); color: var(--ink, #0b0b0b); border-radius: 14px; width: 100%; max-width: 460px; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); margin: 0; }
.ux-ask-box h2 { font-size: 18px; margin: 0 0 8px; }
.ux-ask-text { white-space: pre-line; margin: 0 0 12px; color: var(--ink-2, #52514e); }
.ux-ask-l { display: block; font-weight: 600; margin: 8px 0 4px; }
.ux-ask-box input, .ux-ask-box textarea { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--axis, #c3c2b7); border-radius: 8px; background: var(--card, #fff); color: var(--ink, #0b0b0b); }
.ux-ask-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* required fields: the star, the field that is missing, the words beside it */
.req { color: var(--crit, #d03b3b); font-weight: 700; }
.ux-bad, .ux-bad:focus { outline: 2px solid var(--crit, #d03b3b) !important; outline-offset: 1px; border-color: var(--crit, #d03b3b) !important; }
.ux-msg { display: block; color: var(--crit, #d03b3b); font-size: 13px; font-weight: 600; margin: 4px 0 0; }
.ux-msg[hidden] { display: none; }

/* tables: a heading sorts its column */
table.ux-sort thead th { cursor: pointer; user-select: none; white-space: nowrap; }
table.ux-sort thead th:hover { text-decoration: underline; }
table.ux-sort thead th[aria-sort="ascending"]::after { content: ' ▲'; font-size: 10px; }
table.ux-sort thead th[aria-sort="descending"]::after { content: ' ▼'; font-size: 10px; }
table.ux-sort thead th:focus-visible { outline: 2px solid var(--amber-d, #c77f00); outline-offset: -2px; }

/* keyboard: the row or tile that opens something shows where the focus is */
tr.click:focus-visible td { background: var(--page, #f4f6f9); box-shadow: inset 0 2px 0 var(--amber-d, #c77f00), inset 0 -2px 0 var(--amber-d, #c77f00); }
tr.click:focus-visible { outline: none; }
.tile[data-go]:focus-visible, .tile.click:focus-visible, .hist .item[data-uid]:focus-visible { outline: 3px solid var(--amber-d, #c77f00); outline-offset: 1px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ux-ribbon { background: #102a56; color: #9ec5ff; border-color: #1d4487; }
}
:root[data-theme="dark"] .ux-ribbon { background: #102a56; color: #9ec5ff; border-color: #1d4487; }

/* ---------------------------------------------------------------- robust stage 12A */

/* words for a screen reader only (a label that the eye does not need) */
.ux-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* where the keyboard is: every button, link, tab and field shows a ring (the mouse does not draw it) */
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible, [role="button"]:focus-visible,
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible, textarea:focus-visible { outline: 2px solid var(--amber-d, #c77f00); outline-offset: 2px; }
.ux-skip { position: absolute; left: 8px; top: -60px; z-index: 5000; background: var(--card, #fff); color: var(--ink, #0b0b0b); border: 2px solid var(--amber-d, #c77f00); border-radius: 8px; padding: 8px 14px; font-weight: 600; text-decoration: none; }
.ux-skip:focus { top: 8px; }

/* the table component (UX.table): one bar above a list — search, "Showing X–Y of N", pages, download */
.ux-tbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; }
.ux-tbar[hidden], .ux-tbar [hidden] { display: none; }
.ux-tfind { flex: 1 1 200px; max-width: 340px; margin: 0; }
.ux-tfind input { width: 100%; font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--axis, #c3c2b7); border-radius: 8px; background: var(--card, #fff); color: var(--ink, #0b0b0b); }
.ux-tinfo { color: var(--ink-2, #52514e); font-size: 13px; }
.ux-tpager { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2, #52514e); }
.ux-tcsv { margin-left: auto; }
tr[hidden] { display: none; }

/* column priority: the columns folded on a narrow screen (a class on the table per column), the "+" of a line, the folded part */
table.ux-h-1 > * > tr:not(.ux-more) > :nth-child(1),
table.ux-h-2 > * > tr:not(.ux-more) > :nth-child(2),
table.ux-h-3 > * > tr:not(.ux-more) > :nth-child(3),
table.ux-h-4 > * > tr:not(.ux-more) > :nth-child(4),
table.ux-h-5 > * > tr:not(.ux-more) > :nth-child(5),
table.ux-h-6 > * > tr:not(.ux-more) > :nth-child(6),
table.ux-h-7 > * > tr:not(.ux-more) > :nth-child(7),
table.ux-h-8 > * > tr:not(.ux-more) > :nth-child(8),
table.ux-h-9 > * > tr:not(.ux-more) > :nth-child(9),
table.ux-h-10 > * > tr:not(.ux-more) > :nth-child(10),
table.ux-h-11 > * > tr:not(.ux-more) > :nth-child(11),
table.ux-h-12 > * > tr:not(.ux-more) > :nth-child(12),
table.ux-h-13 > * > tr:not(.ux-more) > :nth-child(13),
table.ux-h-14 > * > tr:not(.ux-more) > :nth-child(14),
table.ux-h-15 > * > tr:not(.ux-more) > :nth-child(15),
table.ux-h-16 > * > tr:not(.ux-more) > :nth-child(16),
table.ux-h-17 > * > tr:not(.ux-more) > :nth-child(17),
table.ux-h-18 > * > tr:not(.ux-more) > :nth-child(18),
table.ux-h-19 > * > tr:not(.ux-more) > :nth-child(19),
table.ux-h-20 > * > tr:not(.ux-more) > :nth-child(20),
table.ux-h-21 > * > tr:not(.ux-more) > :nth-child(21),
table.ux-h-22 > * > tr:not(.ux-more) > :nth-child(22),
table.ux-h-23 > * > tr:not(.ux-more) > :nth-child(23),
table.ux-h-24 > * > tr:not(.ux-more) > :nth-child(24) { display: none; }
.ux-fold-c { display: none; width: 1%; padding-left: 2px; padding-right: 2px; text-align: right; }
table.ux-folded .ux-fold-c { display: table-cell; }
.ux-fold-b { min-width: 30px; min-height: 30px; border: 1px solid var(--axis, #c3c2b7); border-radius: 8px; background: var(--card, #fff); color: var(--ink, #0b0b0b); font: inherit; font-weight: 700; font-size: 16px; line-height: 1; cursor: pointer; }
.ux-fold-b:hover { background: var(--page, #f4f6f9); }
table.ux-tight th, table.ux-tight td, table.ux-tight .nowrap, table.ux-tight .nw { white-space: normal; overflow-wrap: break-word; padding-left: 5px; padding-right: 5px; }
table.ux-tight td b, table.ux-tight td code { overflow-wrap: anywhere; }
tr.ux-more > td { background: var(--page, #f4f6f9); padding: 8px 10px 10px; }
.ux-more-l { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 16px; }
.ux-more-l > div { min-width: 0; }
.ux-more-l dt { font-size: 12px; font-weight: 600; color: var(--ink-2, #52514e); margin: 0; }
.ux-more-l dd { margin: 0; overflow-wrap: anywhere; }
@media (pointer: coarse) { .ux-fold-b { min-width: 40px; min-height: 40px; } .ux-tbar .btn.small { padding: 8px 12px; } }
@media print { .ux-tbar, .ux-fold-c { display: none !important; } tr[hidden] { display: table-row; } }

/* contrast (the audit of stage 12A): a tag coloured by what it stands for (a finding, a category of officer) keeps its colour as a bar
   and writes its words in the page's ink — a pale pink or a dark blue on the tag's grey could not be read, least of all in the dark */
.tag[style*="color"] { -webkit-text-fill-color: var(--ink-2, #52514e); border-left: 4px solid currentColor; padding-left: 6px; }
.tag.who[style*="color"] { border: 1px solid currentColor; border-left-width: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) tr.hl td { background: #3d2a0a; } :root:not([data-theme="light"]) .tag.blue { color: #b2ddff; background: #102a56; } :root:not([data-theme="light"]) .tag.amber { color: #fec84b; background: #3d2a0a; } :root:not([data-theme="light"]) .demo-hint, .verdict.warn { background: #3d2a0a; border-color: #93370d; color: #fec84b; } }
:root[data-theme="dark"] tr.hl td { background: #3d2a0a; }
:root[data-theme="dark"] .tag.blue { color: #b2ddff; background: #102a56; }
:root[data-theme="dark"] .tag.amber { color: #fec84b; background: #3d2a0a; }
:root[data-theme="dark"] .demo-hint, .verdict.warn { background: #3d2a0a; border-color: #93370d; color: #fec84b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sub[style*="color:#b54708"] { color: #fec84b !important; } }
:root[data-theme="dark"] .sub[style*="color:#b54708"] { color: #fec84b !important; }

/* a phone: nothing in the page is wider than the screen — a drop-down with long choices, a field or a card with a wide table inside
   took its full width and the whole page scrolled sideways (12 pages of the Field Checks dashboard at 390 px) */
@media (max-width: 760px) {
  main select, main input, main textarea { max-width: 100%; }
  main label { max-width: 100%; min-width: 0; }
  main .card, main figure, main .group, main .grid2 > *, main .view > * { min-width: 0; max-width: 100%; }
  main .card { overflow-wrap: break-word; }
  main :not(.table-wrap) > table { display: block; max-width: 100%; overflow-x: auto; }   /* a table drawn without its scrolling box scrolls by itself */
  .modal-box select, .modal-box input, .modal-box textarea, .modal-box label { max-width: 100%; }
}
