/*
    DevSite only, linked from the DevSite UI's App.razor. The shared screen parts the
    theme has no class for: the filter bar, the grid's scroll box and footer, pinned columns, the
    dense table, the row "more" menu, a masked value, the 2FA boxes, the job log, the chart's
    colours, the group card and Page Manage. Every colour is a theme variable; the mockup (#/tpl-kit) shows each.
*/

/* ------------------------------------------------------------------ mockup tokens */

/* The mockup's line, stripe, muted, label, text, select arrow and picked option colours (docs/ui/SSP-DevSite-UI.html :root),
   mixed from a riho variable or a named colour. Declared on body, where riho switches --white for dark mode, so they switch too.
   Muted is text: it stays at 4.5:1 or more on the card and on the tint, in light and dark. */
body {
    --ssp-ui-line: color-mix(in srgb, var(--white), gray 12%);
    --ssp-ui-stripe: color-mix(in srgb, var(--white), gray 4%);
    --ssp-ui-muted: color-mix(in srgb, var(--white), black 59%);
    --ssp-ui-sort: color-mix(in srgb, var(--white), gray 45%);
    --ssp-ui-label: rgb(from var(--chart-text-color) r g b / 1);
    --ssp-ui-tint: color-mix(in srgb, var(--theme-deafult) 6%, transparent);
    --ssp-ui-card: var(--white);
    --ssp-ui-line2: var(--chart-border);
    --ssp-ui-text: color-mix(in srgb, color-mix(in srgb, var(--theme-deafult) 26.5%, black), maroon 4%);
    --ssp-ui-caret: color-mix(in srgb, color-mix(in srgb, white, dimgray 75%), cornflowerblue 10%);
    --ssp-ui-picked: color-mix(in srgb, var(--theme-deafult) 10%, transparent);
}

/* The mockup's badge tones (.b-ok, .b-off, .b-warn, .b-info): a see-through fill of the tone and a darker text of it.
   Text keeps 4.5:1 on its fill over a striped or hovered row: info takes the mockup's alert text (3.4:1), riho's secondary is
   darkened (2.6:1), ok goes a shade darker in a light table cell (4.47:1), primary a shade lighter on a hovered dark row (4.41:1). */
body {
    --ssp-ui-badge-ok: color-mix(in srgb, color-mix(in srgb, white, var(--theme-deafult) 94%), forestgreen 40.5%);
    --ssp-ui-badge-ok-row: color-mix(in srgb, color-mix(in srgb, black, green 96%), royalblue 34.5%);
    --ssp-ui-badge-ok-bg: color-mix(in srgb, color-mix(in srgb, forestgreen, lightseagreen 54%) 12%, transparent);
    --ssp-ui-badge-off: color-mix(in srgb, color-mix(in srgb, crimson, white 14%), brown 57%);
    --ssp-ui-badge-off-bg: color-mix(in srgb, color-mix(in srgb, color-mix(in srgb, white, red 71.5%), dodgerblue 10%) 10%, transparent);
    --ssp-ui-badge-warn: color-mix(in srgb, color-mix(in srgb, black, orange 55.5%), darkgreen 6%);
    --ssp-ui-badge-warn-bg: color-mix(in srgb, color-mix(in srgb, color-mix(in srgb, black, gold 94%), red 16.5%) 12%, transparent);
    --ssp-ui-badge-info: color-mix(in srgb, color-mix(in srgb, black, royalblue 49%), dodgerblue 29.5%);
    --ssp-ui-badge-info-bg: color-mix(in srgb, color-mix(in srgb, dodgerblue, red 14%) 12%, transparent);
    --ssp-ui-badge-secondary: color-mix(in srgb, color-mix(in srgb, black, tomato 63%), forestgreen 4.5%);
}

body.dark-only {
    --ssp-ui-badge-ok: color-mix(in srgb, color-mix(in srgb, white, cyan 52%), forestgreen 52.5%);
    --ssp-ui-badge-off: color-mix(in srgb, color-mix(in srgb, white, salmon 36%), crimson 24.5%);
    --ssp-ui-badge-warn: color-mix(in srgb, color-mix(in srgb, white, orange 60.5%), mediumaquamarine 8%);
    --ssp-ui-badge-info: color-mix(in srgb, color-mix(in srgb, white, cornflowerblue 61.5%), lightskyblue 14.5%);
    --ssp-ui-badge-primary-row: color-mix(in srgb, var(--ssp-ui-accent), white 6%);
}

/* The mockup's .toggle: a grey track (its rgb 207 214 218, mixed to the same) and a white knob, in light and dark alike,
   as the mockup gives it no dark colour. On, the track takes the theme colour, the mockup's --primary. */
body {
    --ssp-ui-switch-track: color-mix(in srgb, color-mix(in srgb, gainsboro, steelblue 7%), lightblue 7%);
    --ssp-ui-switch-dot: white;
}

/* Every size a page and a dialog share, the mockup's .inp, .btn, .fld label and .modal, counted in --ssp-ui-px. The page
   is zoomed by fit-screen.css; a dialog or a drawer is not (select2 places its list by page coordinates), so its pixel takes the zoom. */
body {
    --ssp-ui-px: 1px;
}

:is(.modal, .ssp-drawer) {
    --ssp-ui-px: calc(1px * var(--ssp-zoom));
}

:is(body, .modal, .ssp-drawer) {
    --ssp-ui-dialog-w: calc(640 * var(--ssp-ui-px));
    --ssp-ui-dialog-w-lg: calc(920 * var(--ssp-ui-px));
    --ssp-ui-dialog-w-xl: calc(1140 * var(--ssp-ui-px));
    --ssp-ui-drawer-w: calc(420 * var(--ssp-ui-px));
    --ssp-ui-dialog-title-font: calc(21 * var(--ssp-ui-px));
    --ssp-ui-control-h: calc(34 * var(--ssp-ui-px));
    --ssp-ui-control-font: calc(13 * var(--ssp-ui-px));
    --ssp-ui-control-pad: calc(12 * var(--ssp-ui-px));
    --ssp-ui-control-arrow-room: calc(30 * var(--ssp-ui-px));
    --ssp-ui-control-radius: calc(6 * var(--ssp-ui-px));
    --ssp-ui-btn-font: calc(13.5 * var(--ssp-ui-px));
    --ssp-ui-btn-pad: calc(20 * var(--ssp-ui-px));
    --ssp-ui-label-font: calc(12 * var(--ssp-ui-px));
    --ssp-ui-label-line: calc(15 * var(--ssp-ui-px));
    --ssp-ui-label-gap: calc(5 * var(--ssp-ui-px));
    --ssp-ui-textarea-pad: calc(10 * var(--ssp-ui-px));
    --ssp-ui-text-font: calc(13 * var(--ssp-ui-px));
    --ssp-ui-check: calc(18 * var(--ssp-ui-px));
    --ssp-ui-switch-w: calc(34 * var(--ssp-ui-px));
    --ssp-ui-check-gap: calc(8 * var(--ssp-ui-px));
    --ssp-ui-switch-knob: calc(14 * var(--ssp-ui-px));
    --ssp-ui-switch-inset: calc(2 * var(--ssp-ui-px));
    --ssp-ui-switch-radius: calc(12 * var(--ssp-ui-px));
}

/* The mockup's dark palette (:root[data-theme="dark"]): blue-grey surfaces, where riho's dark is navy.
   Mixed from slategray and steelblue to within a unit of the mockup's: riho has no such variable, and
   its own dark variables hang on body[class=dark-only], which a modal's extra class switches off. */
body.dark-only {
    --ssp-ui-bg: color-mix(in srgb, black, slategray 20%);
    --ssp-ui-card: color-mix(in srgb, color-mix(in srgb, black, slategray 22%), steelblue 7.5%);
    --ssp-ui-stripe: color-mix(in srgb, color-mix(in srgb, black, slategray 25%), steelblue 10%);
    --ssp-ui-line: color-mix(in srgb, color-mix(in srgb, black, slategray 40%), var(--theme-deafult) 2%);
    --ssp-ui-line2: color-mix(in srgb, color-mix(in srgb, black, slategray 44%), var(--theme-deafult) 3%);
    --ssp-ui-input: color-mix(in srgb, color-mix(in srgb, black, slategray 29%), steelblue 8%);
    --ssp-ui-input-line: color-mix(in srgb, color-mix(in srgb, black, slategray 45.5%), steelblue 8.5%);
    --ssp-ui-text: color-mix(in srgb, color-mix(in srgb, white, slategray 13.5%), cyan 1.5%);
    --ssp-ui-label: color-mix(in srgb, white, slategray 60%);
    --ssp-ui-muted: color-mix(in srgb, color-mix(in srgb, gray, slategray 60%), white 20%);
    --ssp-ui-sort: color-mix(in srgb, gray, slategray 60%);
    --ssp-ui-accent: color-mix(in srgb, color-mix(in srgb, var(--theme-deafult) 65%, cyan), white 24.7%);
    --ssp-ui-tint: color-mix(in srgb, color-mix(in srgb, var(--theme-deafult) 62%, cyan) 10%, transparent);
    --ssp-ui-picked: color-mix(in srgb, color-mix(in srgb, var(--theme-deafult) 62%, cyan) 16%, transparent);
    --ssp-ui-caret: color-mix(in srgb, color-mix(in srgb, white, slategray 95.5%), orange 4%);
    --ssp-ui-warn: color-mix(in srgb, orange, white 45%);
    --ssp-ui-danger: color-mix(in srgb, crimson, white 70%);
}

/* DataTables sets its own Open Sans on the wrapper; the grid keeps the page font. */
.ssp-grid div.dataTables_wrapper {
    font-family: inherit;
}

/* The mockup's near-black text, a shade of the theme colour, in light mode; dark keeps riho's. */
body:not(.dark-only) .page-body {
    --bs-body-color: var(--ssp-ui-text);
    color: var(--bs-body-color);
}

/* riho spaces letters .5px on every card; the mockup draws the whole page at .2px. */
.page-body,
.page-body .card {
    letter-spacing: .2px;
}

.card:has(.ssp-grid) > .card-body {
    padding: 20px 18px;
}

/* ------------------------------------------------------------------ filter bar */

/* The fields in as many equal columns as the card holds; the buttons after them join the last
   row when they fit there, else take a row of their own (riho-blazor.js places them). */
/* Each field has its label above it. The label is one fixed line, so buttons sharing the fields'
   row drop by exactly that much and every control and button in the row stretches to one height. */
.ssp-filter {
    --ssp-filter-label: calc(var(--ssp-ui-label-line) + var(--ssp-ui-label-gap));
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    align-items: start;
    gap: 12px;
    margin-bottom: 18px;
}

.ssp-filter > .ssp-filter-field {
    display: flex;
    flex-direction: column;
}

.ssp-filter > .ssp-filter-field > .form-label {
    flex: none;
    height: var(--ssp-ui-label-line);
    margin-top: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* A tick and a switch, on a page and in a dialog: riho's 18px box (style.css:10011) and the mockup's 34 x 18 .toggle, level
   with the first line of its text. Bootstrap sized them in em (bootstrap.css:2314-2340) and riho put a margin under every
   label, so they came out small and high. */
:is(.page-body, .modal-body) .form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--ssp-ui-check-gap);
    min-height: 0;
    padding-left: 0;
}

:is(.page-body, .modal-body) .form-check > .form-check-input {
    flex: none;
    width: var(--ssp-ui-check);
    height: var(--ssp-ui-check);
    margin: 0;
}

/* The mockup's .toggle in place of bootstrap's outlined pill and its grey dot (bootstrap.css:2393-2413): no line, the
   track's fill, a 14px knob 2px in from the end that is on. */
:is(.page-body, .modal-body) .form-switch > .form-check-input {
    width: var(--ssp-ui-switch-w);
    border: 0;
    border-radius: var(--ssp-ui-switch-radius);
    background-color: var(--ssp-ui-switch-track);
    background-image: radial-gradient(closest-side, var(--ssp-ui-switch-dot) calc(100% - .25px), transparent calc(100% + .25px));
    background-size: var(--ssp-ui-switch-knob) var(--ssp-ui-switch-knob);
    background-repeat: no-repeat;
    background-position: var(--ssp-ui-switch-inset) center;
}

:is(.page-body, .modal-body) .form-switch > .form-check-input:checked {
    background-color: var(--theme-deafult);
    background-position: calc(100% - var(--ssp-ui-switch-inset)) center;
}

:is(.page-body, .modal-body) .form-check > .form-check-label {
    min-width: 0;
    margin: 0;
    line-height: var(--ssp-ui-check);
}

/* A tick in the bar stands where a box would: one control high, in the boxes' text size. */
.ssp-filter > .ssp-filter-field > .form-check {
    height: var(--ssp-ui-control-h);
    align-items: center;
    margin-bottom: 0;
    font-size: var(--ssp-ui-control-font);
}

/* A tick beside a labelled field leaves that label's line empty and drops half a control less a tick, so it centres on
   the box; its text's first line stays level with it and a longer text runs on below. */
.form-check.ssp-check-field {
    margin-top: calc(var(--ssp-ui-label-line) + var(--ssp-ui-label-gap));
    margin-bottom: 0;
    padding-top: calc((var(--ssp-ui-control-h) - var(--ssp-ui-check)) / 2);
}

/* A field's label, in the bar, on a page and in a dialog: the mockup's .fld label, a block. Bootstrap's inline-block label
   (bootstrap.css:437) stood in a taller line of text, 2px more than its own. Outside the bar a label may wrap. */
.page-body .form-label,
.modal .modal-body .form-label,
.ssp-drawer .form-label {
    display: block;
    margin-bottom: var(--ssp-ui-label-gap);
    color: var(--ssp-ui-label);
    font-size: var(--ssp-ui-label-font);
    font-weight: 400;
    line-height: var(--ssp-ui-label-line);
    letter-spacing: .3px;
}

/* A dialog's text is one size, its boxes': riho sets a tick's text, a listed row, a hint and an alert each its own. */
.modal-body,
.modal-body :is(.form-check-label, .list-group-item, .form-text, .alert, p, small, a:not(.btn)) {
    font-size: var(--ssp-ui-text-font);
}

.modal-body .list-group-item {
    padding: calc(8 * var(--ssp-ui-px)) calc(16 * var(--ssp-ui-px));
}

/* Every box and select on a page or in a dialog is one line of the mockup's .inp, a file box too. A list keeps its own. */
:is(.page-body, .modal-body) input.form-control,
:is(.page-body, .modal-body) select.form-select:not([multiple]) {
    height: var(--ssp-ui-control-h);
    padding-top: 0;
    padding-bottom: 0;
    padding-left: var(--ssp-ui-control-pad);
    border-radius: var(--ssp-ui-control-radius);
    font-size: var(--ssp-ui-control-font);
}

/* A file box is not centred like a text box: its name sits on the line and its button fills the height, flush to the
   box's start (bootstrap.css .form-control::file-selector-button pulls it out by the padding it no longer has). */
:is(.page-body, .modal-body) input.form-control[type=file] {
    line-height: calc(var(--ssp-ui-control-h) - 2 * var(--bs-border-width));
}

:is(.page-body, .modal-body) input.form-control[type=file]::file-selector-button {
    height: 100%;
    margin: 0 var(--ssp-ui-control-pad) 0 calc(-1 * var(--ssp-ui-control-pad));
    padding: 0 var(--ssp-ui-control-pad);
}

/* The text or button joined to a box's end is the box's height; bootstrap's keeps its own 38px (bootstrap.css:2640). */
:is(.page-body, .modal-body) .input-group > .input-group-text {
    height: var(--ssp-ui-control-h);
    padding: 0 var(--ssp-ui-control-pad);
    font-size: var(--ssp-ui-control-font);
    line-height: 1;
}

:is(.page-body, .modal-body) .input-group > .input-group-text:last-child {
    border-radius: 0 var(--ssp-ui-control-radius) var(--ssp-ui-control-radius) 0;
}

/* Every tab carries the active one's 2px line, unseen (mockup .tab); riho draws it under the active tab only (style.css:13045),
   which stood 2px taller than the rest. riho's dark hover would colour the unseen line (style.css:39446). */
.border-tab.nav-tabs .nav-item .nav-link {
    border-bottom: 2px solid transparent;
}

body.dark-only .border-tab.nav-tabs .nav-item .nav-link:hover:not(.active, :focus) {
    border-bottom-color: transparent;
}

/* A badge in a cell or a tab centres on the text beside it. Bootstrap's baseline (bootstrap.css:4761) left it 1.5px
   off, and middle alone, which centres on the lower-case letters, still 1.3px; a tenth of its font up closes the rest. */
:is(td, .nav-link) .badge {
    position: relative;
    top: -.1em;
    vertical-align: middle;
}

:is(.page-body, .modal-body) textarea.form-control {
    padding: var(--ssp-ui-textarea-pad) var(--ssp-ui-control-pad);
    border-radius: var(--ssp-ui-control-radius);
    font-size: var(--ssp-ui-control-font);
}

/* riho pins every select2 at 47px with !important (style.css:27967), so only !important brings it down. */
/* The mockup's .sel: its line in place of riho's near-white one (style.css:27967), room on the right for its arrow. */
:is(.page-body, .modal-body) .select2-container .select2-selection--single {
    height: var(--ssp-ui-control-h) !important;
    padding: 0 var(--ssp-ui-control-arrow-room) 0 var(--ssp-ui-control-pad);
    border-color: var(--bs-border-color);
    border-radius: var(--ssp-ui-control-radius) !important;
}

/* A box's text is not spaced like the page's (.inp, .sel), and is the page's colour, not select2's #444. */
:is(.page-body, .modal-body) .select2-container .select2-selection--single .select2-selection__rendered {
    padding: 0;
    color: var(--ssp-ui-text);
    font-size: var(--ssp-ui-control-font);
    line-height: calc(var(--ssp-ui-control-h) - 2px);
    letter-spacing: 0;
}

/* The mockup's arrow is two 5px gradient tiles, 10 x 5, its middle 17.5px from the box's right and 18.5px from its top;
   select2's is an 8 x 5 triangle at the middle of a 20px strip, so the strip is narrowed to the triangle and set there. */
:is(.page-body, .modal-body) .select2-container .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: calc(12.5 * var(--ssp-ui-px));
    width: calc(10 * var(--ssp-ui-px));
    height: var(--ssp-ui-control-h);
}

:is(.page-body, .modal-body) .select2-container .select2-selection--single .select2-selection__arrow b {
    top: calc(16 * var(--ssp-ui-px));
    left: 0;
    margin: 0;
    border-width: calc(5 * var(--ssp-ui-px)) calc(5 * var(--ssp-ui-px)) 0;
    border-color: var(--ssp-ui-caret) transparent transparent;
}

:is(.page-body, .modal-body) .select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-width: 0 calc(5 * var(--ssp-ui-px)) calc(5 * var(--ssp-ui-px));
    border-color: transparent transparent var(--ssp-ui-caret);
}

/* Filter, Remove, Export, then a rule and the screen's own buttons, New first. */
.ssp-filter > .ssp-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
}

.ssp-filter > .ssp-filter-actions.ssp-filter-inline {
    padding-top: var(--ssp-filter-label);
}

/* Every button on a page or in a dialog is one line of the mockup's .btn, a small one too. An extra-small one in a table
   row, a link and the sign-in bar keep their own. */
:is(.page-body, .modal-body, .ssp-drawer) .btn:not(.btn-xs, .btn-link, .btn-block) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--ssp-ui-control-h);
    padding: 0 var(--ssp-ui-btn-pad);
    border-radius: var(--ssp-ui-control-radius);
    font-size: var(--ssp-ui-btn-font);
    letter-spacing: .8px;
}

:is(.page-body, .modal-body, .ssp-drawer) .btn:not(.btn-xs, .btn-link, .btn-block) > i {
    margin: 0 !important;
}

.ssp-filter-sep {
    width: 1px;
    height: 26px;
    margin: 0 6px;
    background-color: var(--ssp-ui-line2);
}

/* The mockup's dropdown (.sd-pop, .sd-list): a card with a rounded line all round, rounded 13px rows, a tint under the
   pointer, the picked option in the theme colour with a tick at its right end. select2 drops the line and the corners
   next to the box (select2.css .select2-dropdown--below). */
.select2-container--open .select2-dropdown:is(.select2-dropdown--below, .select2-dropdown--above) {
    padding: 6px;
    border: 1px solid var(--ssp-ui-line2);
    border-radius: 8px;
    background-color: var(--ssp-ui-card);
}

.select2-container--default .select2-results__option {
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: normal;
    letter-spacing: .2px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--ssp-ui-tint);
    color: inherit;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    display: flex;
    align-items: center;
    background-color: var(--ssp-ui-picked);
    color: var(--ssp-ui-accent, var(--theme-deafult));
    font-weight: 600;
}

/* riho's dark list (style.css:39218) is navy at 60% white, its pointer row !important. */
body.dark-only .select2-container--default .select2-results__option {
    color: var(--ssp-ui-text);
}

body.dark-only .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--ssp-ui-tint) !important;
    color: var(--ssp-ui-text) !important;
}

body.dark-only .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--ssp-ui-picked) !important;
    color: var(--ssp-ui-accent) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    height: var(--ssp-ui-control-h);
    border-radius: var(--ssp-ui-control-radius);
    font-size: var(--ssp-ui-control-font);
}

.select2-results__option[aria-selected=true]::after {
    content: "\f00c";
    margin-left: auto;
    padding-left: 8px;
    font-family: FontAwesome;
    font-size: 11px;
}

/* The mockup's calendar is as wide as its field, with Clear and Today under the days. */
.flatpickr-calendar.ssp-calendar {
    width: 100%;
    min-width: 190px;
}

.ssp-calendar .flatpickr-days,
.ssp-calendar .dayContainer {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.ssp-calendar .flatpickr-day {
    max-width: none;
}

.ssp-calendar-foot {
    display: flex;
    justify-content: space-between;
    padding: 4px 6px;
    border-top: 1px solid var(--ssp-ui-line);
}

/* riho sizes the month line for a 307px calendar; at the field's width the year was cut off. */
.ssp-calendar .flatpickr-months .flatpickr-month {
    height: 36px;
}

.ssp-calendar .flatpickr-current-month {
    padding-top: 8px;
    font-size: 13px;
}

.ssp-calendar span.flatpickr-weekday {
    font-size: 10px;
}

.ssp-calendar .flatpickr-day {
    height: 28px;
    line-height: 28px;
    font-size: 11.5px;
}

.ssp-calendar-foot > .btn {
    padding: 2px 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ssp-ui-accent, var(--theme-deafult));
    text-decoration: none;
}

/* riho's link colour is the theme colour, too dark to read on the dark card; the mockup draws links in its accent. */
.ssp-text-link,
.ssp-text-link:hover {
    color: var(--ssp-ui-accent, var(--theme-deafult));
}

/* ------------------------------------------------------------------ grid */

/* Grid.razor wraps the table in this box and Pager.razor puts length, info and pager in the
   footer under it, so the rows scroll and the pager stays put. */
/* The frame is the box, not the table (mockup .tbl-wrap): on a fit screen the box runs down to the
   pager, so a short list still sits in a panel the height of the card. */
.ssp-grid-scroll {
    overflow: auto;
    border: 1px solid var(--ssp-ui-line);
    border-radius: 6px;
}

/* The theme's border sits outside the table's 100%, which scrolled every table sideways by 2px. */
.ssp-grid-scroll > table.dataTable {
    box-sizing: border-box;
    margin: 0 !important;
    border: 0 !important;
    font-family: inherit;
    font-size: 13px;
    line-height: normal;
}

/* riho paints every button in a DataTables box white (style.css:7254), black when dark (style.css:38102, eight selectors deep),
   so an icon-only link in a row vanished; it takes the colour of a dialog's eye button (.input-group-text) instead. The same
   link in a drawer kept .btn-link's theme colour (style.css:6328), lost on the dark panel. */
.ssp-grid .dataTables_wrapper .btn-link,
.ssp-drawer .btn-link {
    color: var(--ssp-ui-text, var(--bs-body-color)) !important;
}

/* The mockup's th / td. !important because riho's dark-mode table rules run eight selectors deep. */
.ssp-grid-scroll > table.dataTable > thead > tr > th {
    padding: 12px 26px 12px 12px !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--ssp-ui-line) !important;
    font-weight: 700;
    white-space: nowrap;
    background-image: none !important;
}

.ssp-grid-scroll > table.dataTable > tbody > tr {
    background-color: transparent !important;
}

.ssp-grid-scroll > table.dataTable > tbody > tr > td {
    padding: 11px 12px !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--ssp-ui-line) !important;
    background: var(--ssp-ui-card) !important;
}

.ssp-grid-scroll > table.dataTable > tbody > tr:nth-child(odd) > td {
    background: var(--ssp-ui-stripe) !important;
}

/* The tint is see-through, so it is laid over an opaque base or a pinned cell shows what scrolls under it. */
.ssp-grid-scroll > table.dataTable > tbody > tr:hover > td {
    background: linear-gradient(var(--ssp-ui-tint), var(--ssp-ui-tint)), var(--ssp-ui-card) !important;
}

/* One grey "↑↓" at the right of a sortable header; the sorted one takes the theme colour. */
.ssp-grid-scroll > table.dataTable > thead > tr > th:is(.sorting, .sorting_asc, .sorting_desc)::before {
    content: none !important;
}

.ssp-grid-scroll > table.dataTable > thead > tr > th:is(.sorting, .sorting_asc, .sorting_desc)::after {
    content: "\2191\2193" !important;
    position: absolute;
    top: 12px !important;
    right: 8px !important;
    bottom: auto !important;
    color: var(--ssp-ui-sort);
    font-size: 11px;
    letter-spacing: -1px;
    line-height: normal;
    opacity: 1 !important;
}

.ssp-grid-scroll > table.dataTable > thead > tr > th:is(.sorting_asc, .sorting_desc)::after {
    color: var(--theme-deafult);
}

/* The mockup's .badge in a cell and out of one, where riho's is a button's size (style.css:5995). Its line is the mockup's
   normal one at 10.5px, 13px, given in px: normal rounds to whole pixels after the page's zoom and came out 0.8px short. */
:is(.page-body, .modal, .ssp-drawer) .badge {
    padding: calc(4 * var(--ssp-ui-px)) calc(10 * var(--ssp-ui-px));
    border-radius: calc(6 * var(--ssp-ui-px));
    font-size: calc(10.5 * var(--ssp-ui-px));
    font-weight: 600;
    line-height: calc(13 * var(--ssp-ui-px));
    letter-spacing: .4px;
}

/* riho pins a badge in a table row to a 15px line four classes deep (style.css:7534). */
.ssp-grid-scroll > table.dataTable > tbody > tr > td .badge {
    line-height: calc(13 * var(--ssp-ui-px)) !important;
}

:is(.page-body, .modal, .ssp-drawer) .badge.badge-light-success {
    background-color: var(--ssp-ui-badge-ok-bg);
    color: var(--ssp-ui-badge-ok);
}

:is(.page-body, .modal, .ssp-drawer) .badge.badge-light-danger {
    background-color: var(--ssp-ui-badge-off-bg);
    color: var(--ssp-ui-badge-off);
}

:is(.page-body, .modal, .ssp-drawer) .badge.badge-light-warning {
    background-color: var(--ssp-ui-badge-warn-bg);
    color: var(--ssp-ui-badge-warn);
}

:is(.page-body, .modal, .ssp-drawer) .badge.badge-light-info {
    background-color: var(--ssp-ui-badge-info-bg);
    color: var(--ssp-ui-badge-info);
}

body:not(.dark-only) :is(.page-body, .modal, .ssp-drawer) td .badge.badge-light-success {
    color: var(--ssp-ui-badge-ok-row);
}

body:not(.dark-only) :is(.page-body, .modal, .ssp-drawer) .badge.badge-light-secondary {
    color: var(--ssp-ui-badge-secondary);
}

/* Light, riho's primary tint is the mockup's .b-p already; dark, the mockup's is brighter, as its theme colour is. */
body.dark-only :is(.page-body, .modal, .ssp-drawer) .badge.badge-light-primary {
    background-color: var(--ssp-ui-picked);
    color: var(--ssp-ui-accent);
}

body.dark-only :is(.page-body, .modal, .ssp-drawer) tr:hover > td .badge.badge-light-primary {
    color: var(--ssp-ui-badge-primary-row);
}

/* Row actions: plain grey icons, coloured only under the pointer (mockup .acts .btn-ic). */
.ssp-grid-scroll ul.action {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
}

.ssp-grid-scroll ul.action > li {
    margin: 0 !important;
}

/* The mockup's .btn-ic carries the icon's 15px on its 19px normal line, given in px as the dense grid's icon is. */
.ssp-grid-scroll ul.action > li > a {
    display: inline-block;
    padding: 4px 6px;
    font-size: 15px;
    line-height: 19px;
}

/* Font Awesome 4 draws its glyphs at different widths; one centred box per icon keeps a row's pair even. */
.ssp-grid-scroll ul.action > li > a > i {
    color: var(--ssp-ui-muted) !important;
    font-size: 15px;
    width: 1.1em;
    text-align: center;
}

.ssp-grid-scroll ul.action > li > a:hover > i {
    color: var(--theme-deafult) !important;
}

.ssp-grid-scroll ul.action > li > a:hover > i.txt-danger {
    color: var(--bs-danger) !important;
}

.ssp-grid-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
}

.ssp-grid-foot .ssp-grid-show {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.ssp-grid-foot .dataTables_info {
    white-space: normal;
}

.ssp-grid-foot .dataTables_length,
.ssp-grid-foot .dataTables_info {
    margin: 0;
    padding: 0 !important;
}

.ssp-grid-foot .dataTables_length label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.ssp-grid-foot {
    font-size: 13px;
}

/* The footer's words are the page's text; riho greys them (#333, and 60% white dark, style.css:38120, eight selectors deep). */
.ssp-grid-foot :is(.dataTables_length, .dataTables_length label, .dataTables_info) {
    color: var(--ssp-ui-text) !important;
}

/* The mockup's .show .sel: its 66px holds two digits, a size of 100 widens the box instead of being cut. riho's 2.7142em
   floor (style.css:7287) stood it 1.3px over the control height; the arrow is the select2 box's, drawn as the mockup draws it. */
div.ssp-grid-foot div.dataTables_length select {
    width: auto;
    min-width: 66px;
    height: var(--ssp-ui-control-h);
    min-height: var(--ssp-ui-control-h);
    margin: 0;
    padding: 0 var(--ssp-ui-control-arrow-room) 0 var(--ssp-ui-control-pad);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--ssp-ui-control-radius);
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--ssp-ui-caret) 50%), linear-gradient(135deg, var(--ssp-ui-caret) 50%, transparent 50%);
    background-position: calc(100% - 17 * var(--ssp-ui-px)) calc(15 * var(--ssp-ui-px)), calc(100% - 12 * var(--ssp-ui-px)) calc(15 * var(--ssp-ui-px));
    background-size: calc(5 * var(--ssp-ui-px)) calc(5 * var(--ssp-ui-px));
    background-repeat: no-repeat;
    color: var(--ssp-ui-text);
    font-size: var(--ssp-ui-control-font);
}

/* The mockup's .pager: one outlined strip, the current page filled. */
.ssp-grid-foot .dataTables_paginate {
    display: flex;
    margin-left: auto !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--ssp-ui-line);
    border-radius: 4px;
}

.ssp-grid-foot .dataTables_paginate > span {
    display: contents;
}

.ssp-grid-foot .dataTables_paginate .paginate_button,
.ssp-grid-foot .dataTables_paginate .paginate_button.disabled,
.ssp-grid-foot .dataTables_paginate .paginate_button:hover {
    margin: 0 !important;
    padding: 7px 13px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ssp-ui-muted) !important;
    font-size: 13px;
    line-height: normal;
    letter-spacing: .8px;
}

.ssp-grid-foot .dataTables_paginate .paginate_button.current,
.ssp-grid-foot .dataTables_paginate .paginate_button.current:hover {
    background: var(--theme-deafult) !important;
    color: var(--bs-white) !important;
}

/*
    The header row stays on top while the rows scroll, and a pinned column stays beside them. Both
    need a solid fill: every box from the card down to the header cell takes the card's own fill,
    and a pinned body cell takes its row's, so stripes and hover carry on under the pin.
*/
.card:has(.ssp-grid-scroll) > .card-body,
.pm-body,
.pm-left,
.pm-right,
.ssp-grid,
.ssp-grid .dataTables_wrapper,
.ssp-grid-scroll,
.ssp-grid-scroll > table,
.ssp-grid-scroll > table > thead,
.ssp-grid-scroll > table > thead > tr,
.ssp-grid-scroll > table > thead > tr > th {
    background-color: inherit;
}

/* That fill is square, and it sat over the card's rounded corners. A track the radius cannot clip
   is drawn clear, so the right-hand corners stay round under the scrollbar. */
.card:has(.ssp-grid-scroll) > .card-body {
    border-radius: inherit;
    scrollbar-color: var(--ssp-ui-muted) transparent;
}

.ssp-grid-scroll > table.dataTable > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.ssp-grid-scroll > table.dataTable.ssp-pin-start > * > tr > :first-child {
    position: sticky;
    z-index: 1;
    background-color: inherit;
}

.ssp-grid-scroll > table.dataTable.ssp-pin-start > * > tr > :first-child {
    left: 0;
    box-shadow: inset -1px 0 0 var(--chart-border);
}

.ssp-grid-scroll > table.dataTable.ssp-pin-start > thead > tr > th:first-child {
    z-index: 3;
}

/* The "more" button of a row and the menu it opens. The menu is hung on body, not the row, so the
   grid's scroll box cannot clip it. */
.ssp-more-toggle {
    padding: 0 4px;
    line-height: 1;
}

.ssp-more-menu {
    position: fixed;
    display: block;
    z-index: 1060;
}

.ssp-more-menu .dropdown-item i {
    width: 18px;
    margin-right: 6px;
}

/* More than 12 columns (Grid.razor): smaller type, headers wrap and cells wrap past 130px, so a
   wide report fits more before it scrolls. !important as the grid's own padding above is. */
.ssp-grid-scroll > table.dataTable.ssp-dense > thead > tr > th {
    padding: 9px 6px !important;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
    vertical-align: bottom;
}

.ssp-grid-scroll > table.dataTable.ssp-dense > tbody > tr > td {
    max-width: 130px;
    padding: 8px 6px !important;
    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
}

/* The mockup's dense badge and row icons: the badge keeps the cell's 1.3 line; an icon's line is given in px, as normal
   rounds after the page's zoom. */
.ssp-grid-scroll > table.dataTable.ssp-dense .badge {
    padding: 3px 7px;
    line-height: 1.3 !important;
    white-space: nowrap;
}

.ssp-grid-scroll > table.dataTable.ssp-dense ul.action > li > a {
    padding: 2px 4px;
    font-size: 14px;
    line-height: 18px;
}

.ssp-grid-scroll > table.dataTable.ssp-dense ul.action > li > a > i {
    font-size: 14px;
}

/* The arrows stay in sight on a dense grid as they do on every other one, where the mockup shows them under the
   pointer only, which reads as a header that does not sort at all. They follow the text, as the mockup's do there,
   inline so they never take a line of their own in a narrow column. */
.ssp-grid-scroll > table.dataTable.ssp-dense > thead > tr > th:is(.sorting, .sorting_asc, .sorting_desc)::after {
    position: static;
    display: inline;
    margin-left: 3px;
    font-size: 9px;
    vertical-align: baseline;
}

/* ------------------------------------------------------------------ 2FA code */

/* riho two-factor.html draws its QR 100px, sized for a modal; on a page it is scanned from a phone at arm's length, so it
   is drawn larger, and never wider than the card on a narrow screen. */
.main-qr-code .modal-toggle-wrapper .modal-img .qr-img img {
    width: calc(180 * var(--ssp-ui-px));
    max-width: 100%;
    height: auto;
}

/* riho two-factor.html's six boxes (Screen/Otp.razor). riho draws them only inside .authenticate form, so its row with the
   12px gap is drawn here; on a page or popup each box is a square of the control height around it. */
.ssp-otp {
    --ssp-otp-side: var(--ssp-ui-control-h);
    display: flex;
    gap: calc(12 * var(--ssp-ui-px));
}

.ssp-otp input.form-control.code-input {
    flex: none;
    width: var(--ssp-otp-side);
    height: var(--ssp-otp-side);
    padding: 0;
    border-radius: var(--ssp-ui-control-radius);
    font-weight: 600;
    text-align: center;
}

/* The login card can be narrower than six of its taller boxes: there they share the row, square at any width. */
.ssp-login .ssp-otp {
    --ssp-otp-side: var(--ssp-login-control-h);
    justify-content: center;
}

.ssp-login .ssp-otp input.form-control.code-input {
    flex: 1 1 0;
    min-width: 0;
    max-width: var(--ssp-otp-side);
    height: auto;
    aspect-ratio: 1;
}

/* login.css fixes the card button's height; a link does not centre its text in that height the way a button does. */
.ssp-login a.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* A field label of the card: bootstrap's near-black in light, which vanishes on riho's dark card; the mockup's dark label there. */
.ssp-login .ssp-login-label {
    color: rgba(var(--bs-dark-rgb), 1);
}

body.dark-only .ssp-login .ssp-login-label {
    color: var(--ssp-ui-label);
}

/* bootstrap's blue link and red error are both 2.6:1 on riho's dark card; the mockup's dark accent and danger text instead. */
body.dark-only .ssp-login .btn-link.text-primary {
    color: var(--ssp-ui-accent) !important;
}

/* The code step's Back to login is a plain small link in the theme colour, lost on riho's dark card the same way. */
body.dark-only .ssp-login a.small {
    color: var(--ssp-ui-accent);
}

/* The code step's Verify waits disabled for six digits; bootstrap fades the whole button, its white text too, into riho's
   dark card. There only the fill fades, by the same amount, so the label stays white. */
body.dark-only .ssp-login .btn-primary:disabled {
    opacity: 1;
    background-color: color-mix(in srgb, var(--theme-deafult) calc(var(--bs-btn-disabled-opacity) * 100%), transparent) !important;
    border-color: color-mix(in srgb, var(--theme-deafult) calc(var(--bs-btn-disabled-opacity) * 100%), transparent) !important;
}

body.dark-only .ssp-login .text-danger {
    color: var(--ssp-ui-danger) !important;
}

/* ------------------------------------------------------------------ job progress */

.ssp-progress-counts {
    display: flex;
    gap: 24px;
    margin-bottom: 10px;
}

.ssp-progress-counts b {
    display: block;
    font-size: 18px;
}

.ssp-log {
    height: 120px;
    margin-top: 12px;
    padding: 8px 12px;
    overflow: auto;
    border: 1px solid var(--chart-border);
    border-radius: 6px;
    background-color: var(--light-background);
    font-family: var(--bs-font-monospace);
    font-size: 12px;
}

.ssp-log > div {
    white-space: pre-wrap;
}

/* Text shown with the line breaks it was typed with, as the legacy lists' <pre> did. */
.ssp-kept-lines {
    white-space: pre-wrap;
}

/* ------------------------------------------------------------------ group card */

/* A group of screens on a landing page: its letter, name, a line on what it covers, its screens.
   riho's .border-t-primary loses to its own .card borders, all !important; the second selector
   outranks riho's dark card rule (style.css, body.dark-only ... .page-body .card:not(.email-body)). */
.page-body .card.ssp-group-card,
body.dark-only .page-wrapper .page-body-wrapper .page-body .card.ssp-group-card:not(.email-body) {
    border-top: 3px solid var(--theme-deafult) !important;
}

.ssp-group-code {
    display: grid;
    flex: 0 0 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    background-color: var(--theme-deafult);
    color: var(--white);
    font-weight: 700;
}

.ssp-group-links {
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: 14px;
    list-style: none;
}

.ssp-group-links li {
    padding: 3px 0;
    break-inside: avoid;
    font-size: 13px;
}

/* riho's link colour is the theme's, too dark to read on a dark card. */
.ssp-group-links a {
    color: var(--body-font-color);
}

.ssp-group-links a:hover {
    color: var(--theme-deafult);
}

/* ------------------------------------------------------------------ page manage */

/*
    The layout gives the menu card whatever the window leaves. The menu list and the page list sit
    side by side and each takes the full height, rows scrolling above a pager kept at the bottom,
    as every list does (fit-screen.css). When the card is too narrow for both, they wrap.
*/
.card-body[data-main-pane="menu"]:not(.d-none) {
    display: flex;
    flex-direction: column;
}

.card-body[data-main-pane="menu"] > * {
    flex-shrink: 0;
}

.card-body[data-main-pane="menu"] > .pm-body {
    flex: 1 1 0;
    min-height: 16rem;
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    border-top: 1px solid var(--chart-border);
    container-type: inline-size;
}

.pm-left,
.pm-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top: 1rem;
}

.pm-left {
    flex: 1 1 17.5rem;
    padding-right: 1rem;
    border-right: 1px solid var(--chart-border);
}

.pm-right {
    flex: 999 1 28rem;
    min-width: 0;
    padding-left: 1rem;
}

.pm-body .ssp-grid,
.pm-body .ssp-grid .dataTables_wrapper {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
}

.pm-body .ssp-grid .dataTables_wrapper > :not(.ssp-grid-scroll),
.pm-right > :not(.ssp-grid) {
    flex-shrink: 0;
}

.pm-body .ssp-grid-scroll {
    flex: 1 1 0;
    min-height: 160px;
}

/* Below the two flex bases added up (17.5rem + 28rem) the panes wrap; one scroll then serves both. */
@container (width < 45.5rem) {
    .card-body[data-main-pane="menu"] > .pm-body {
        align-content: flex-start;
    }

    .pm-left,
    .pm-right {
        padding-left: 0;
        padding-right: 0;
    }

    .pm-left {
        border-right: 0;
        border-bottom: 1px solid var(--chart-border);
        padding-bottom: 1rem;
    }

    .pm-body .ssp-grid,
    .pm-body .ssp-grid .dataTables_wrapper,
    .pm-body .ssp-grid-scroll {
        flex: none;
    }
}

.pm-text {
    flex: 1;
    min-width: 0;
}

.pm-ic {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.pm-ic-lg {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.pm-grip,
#menu-list .pm-seat-drag {
    cursor: grab;
    padding: 0 4px;
}

.pm-grip-space {
    padding: 0 4px;
}

/* Widths come from here, not from the rows drawn or DataTables' inline sizes, so switching site
   type does not shift the columns; the tick columns share what is left equally. */
#page-list .ssp-grid-scroll > table.dataTable {
    table-layout: fixed;
}

#page-list .ssp-grid-scroll > table.dataTable > thead > tr > th.pm-page-col {
    width: 16% !important;
}

#page-list .ssp-grid-scroll > table.dataTable > thead > tr > th.pm-fn-col {
    width: 13% !important;
}

#page-list .ssp-grid-scroll > table.dataTable > thead > tr > th:last-child {
    width: 7% !important;
}

/* No column here sorts, so the header keeps no room for an arrow and a site type name may wrap. */
#page-list .ssp-grid-scroll > table.dataTable > thead > tr > th.pm-vis-col,
#page-list .ssp-grid-scroll > table.dataTable > tbody > tr > td.pm-vis-col {
    width: auto !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    font-size: 12px;
    line-height: 1.25;
}

/* Five equal columns get narrow on a small screen; the name shrinks with it rather than break inside a word. */
#page-list .ssp-grid-scroll > table.dataTable > thead > tr > th.pm-vis-col {
    font-size: clamp(10px, 0.75vw + 2px, 12px);
}

#page-list .ssp-grid-scroll > table.dataTable > thead > tr > th.pm-grip-col,
#page-list .ssp-grid-scroll > table.dataTable > tbody > tr > td.pm-grip-col {
    width: 28px !important;
    padding-right: 0 !important;
}

#menu-list [data-select] {
    cursor: pointer;
}

/* riho unsets an open select2's width inside a modal (style.css:6254), which shrank the box to its text in this row
   while the list was open; it grows from the row instead. The button takes the box's height. */
[data-add-row] > .select2-container {
    flex: 1 1 auto;
    min-width: 0;
}

[data-add-row] > .btn {
    display: inline-flex;
    align-items: center;
}

/* The one column sizes to its rows and comes out 1px over the box, which drew a sideways bar.
   A fixed layout would end that too, but it narrows the list to its header. */
#menu-list .ssp-grid-scroll {
    overflow-x: hidden;
}

/* The menu tree in the left list: a column per level, a line down while that level has more menus
   below, an elbow into each row. Lines reach through the cell and row padding (11px + 4px + border)
   to join the next row; a little overlap does no harm. */
#menu-list .pm-branch,
#menu-list .pm-fold {
    position: relative;
    flex: 0 0 14px;
    align-self: stretch;
}

#menu-list .pm-branch-line::before,
#menu-list .pm-branch-tee::before,
#menu-list .pm-branch-end::before {
    content: "";
    position: absolute;
    left: 6px;
    top: -17px;
    bottom: -17px;
    border-left: 1px solid var(--ssp-ui-sort);
}

#menu-list .pm-branch-end::before {
    bottom: 50%;
}

/* An open menu's line starts under its caret, so its menus hang from it. */
#menu-list .pm-fold-open::after {
    content: "";
    position: absolute;
    left: 6px;
    top: calc(50% + 8px);
    bottom: -17px;
    border-left: 1px solid var(--ssp-ui-sort);
}

#menu-list .pm-branch-tee::after,
#menu-list .pm-branch-end::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 0;
    top: 50%;
    border-top: 1px solid var(--ssp-ui-sort);
}

#menu-list .pm-fold {
    display: grid;
    place-items: center;
    font-size: 16px;
    line-height: 1;
    color: var(--ssp-ui-muted);
}

/* riho's light fill also turns text white; a picked row keeps the colour of the others. */
#menu-list .bg-light-primary {
    color: inherit;
}

/* The "Site type" label before the segment; riho's .f-light grey is 3.2:1 on the light card. */
.f-light:has(+ #menu-tabs) {
    color: var(--ssp-ui-muted);
}

/* Sized as the mockup's site type segment: name and count centred on one line. */
#menu-tabs .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12.5px;
}

#menu-tabs .btn .badge {
    padding: 1px 7px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.5;
    border-radius: 5px;
}

/* riho's light badge text is the same colour as the active button, so the count vanished on it. */
#menu-tabs .btn.active .badge {
    color: inherit;
}

/* The slate chip ("unpublished"): riho's slate fill holds its text at 4:1 in light and 2.4:1 in dark. */
:is(.page-body, .modal, .ssp-drawer) .badge.badge-light-dark {
    background-color: var(--ssp-ui-line);
    color: var(--ssp-ui-label);
}

/* ------------------------------------------------------------------ danger button */

/* riho's danger fill (style.css .btn-danger, !important) holds white text at 2.9:1; this one holds 5.4:1, its hover 7:1. */
.btn.btn-danger {
    border-color: color-mix(in srgb, var(--bs-danger), black 10%) !important;
    background-color: color-mix(in srgb, var(--bs-danger), black 10%) !important;
}

.btn.btn-danger:is(:hover, :focus-visible, :active, .active) {
    border-color: color-mix(in srgb, var(--bs-danger), black 25%) !important;
    background-color: color-mix(in srgb, var(--bs-danger), black 25%) !important;
}

/* ------------------------------------------------------------------ dark palette */

/* riho's dark card, field and pager rules are long chains, several !important; each rule here
   repeats the chain it answers. */
body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) {
    border-color: var(--ssp-ui-line2) !important;
    background-color: var(--ssp-ui-card);
    box-shadow: none;
    color: var(--ssp-ui-text);
}

body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .card-body {
    background-color: transparent;
}

/* One dark box for a page, a dialog and the filter bar alike: riho writes its text at 60% white (riho-gaps.css, style.css:39210). */
body.dark-only :is(.form-control, .form-select),
body.dark-only .select2-container--default .select2-selection--single,
body.dark-only .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ssp-ui-text);
}

/* The mockup's .btn-l: the tint for its fill and its line, the page's text. riho's .btn-light writes it black (!important). */
.ssp-filter > .ssp-filter-actions > .btn-light {
    color: var(--ssp-ui-text) !important;
}

body.dark-only .ssp-filter > .ssp-filter-actions > .btn-light {
    border-color: var(--ssp-ui-tint) !important;
    background-color: var(--ssp-ui-tint) !important;
}

body.dark-only .ssp-grid-scroll > table.dataTable,
body.dark-only .ssp-grid-scroll > table.dataTable > thead > tr > th,
body.dark-only .ssp-grid-scroll > table.dataTable > tbody > tr > td,
body.dark-only .ssp-grid-foot {
    color: var(--ssp-ui-text) !important;
}

body.dark-only .ssp-grid-scroll > table.dataTable,
body.dark-only .ssp-grid-scroll > table.dataTable > thead > tr > th {
    background-color: var(--ssp-ui-card) !important;
}

body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .ssp-grid-foot .dataTables_length select {
    border-color: var(--ssp-ui-input-line);
    background-color: var(--ssp-ui-card);
    color: var(--ssp-ui-text);
}

body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .ssp-grid-foot .dataTables_paginate {
    border-color: var(--ssp-ui-line);
}

body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .ssp-grid-foot .dataTables_paginate .paginate_button,
body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .ssp-grid-foot .dataTables_paginate .paginate_button.disabled {
    color: var(--ssp-ui-muted) !important;
}

body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .ssp-grid-foot .dataTables_paginate .paginate_button.current {
    color: white !important;
}

/* A dialog sits outside .page-wrapper, where riho's dark rules for lists, tabs and alerts stop, and riho's
   dark sign-up card paints every <p> in it the card's own colour, which hid the hint under each field. */
body.dark-only .dark-sign-up p.f-light {
    color: var(--ssp-ui-label);
}

body.dark-only .dark-sign-up .list-group-item {
    border-color: var(--ssp-ui-line2);
    background-color: var(--ssp-ui-input);
    color: var(--ssp-ui-text);
}

/* In a page riho's own rule (style.css .page-wrapper .input-group-text) lines the eye in its navy, the page's colour, while the
   box beside it carries the mockup's line. This rule only ties it, and wins by loading after style.css (App.razor). */
body.dark-only .input-group .input-group-text {
    border-color: var(--ssp-ui-input-line);
    background-color: var(--ssp-ui-input);
    color: var(--ssp-ui-text);
}

/* riho's pale alerts have no dark text; the mockup's dark alerts carry its warn and danger text colours, and an info
   line, which the mockup has no colour for, the page's own text on riho's navy tint. */
body.dark-only .alert-light-warning {
    color: var(--ssp-ui-warn);
}

body.dark-only .alert-light-danger {
    color: var(--ssp-ui-danger);
}

body.dark-only .alert-light-info {
    color: var(--ssp-ui-text);
}

/* bootstrap-notify's template carries col-sm-4, a third of the screen for a word like "Saved."; the toast takes its text's
   width instead, room kept for the close cross. */
.notify-alert.alert {
    width: auto;
    max-width: calc(100vw - 40px);
    padding: 10px 40px 10px 15px;
    font-size: 13px;
}

/* riho's dark danger alert is translucent orange, under 4:1 against white, and its notify close button is the
   theme colour, which disappears on it. A toast or the login card's refusal goes a deep red. */
body.dark-only .notify-alert.alert-danger,
body.dark-only .ssp-login .alert-danger {
    background-color: color-mix(in srgb, crimson, black 35%) !important;
}

body.dark-only .notify-alert,
body.dark-only .notify-alert .close {
    color: white;
}

/* The theme colour as text is 2.3:1 on the dark card; the mockup writes such text in its accent instead. */
body.dark-only code {
    color: var(--ssp-ui-accent) !important;
}

body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .border-tab.nav-tabs .nav-link.active,
body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .border-tab.nav-tabs .nav-link:focus,
body.dark-only .page-wrapper .page-body-wrapper .page-body .card:not(.email-body) .border-tab.nav-tabs .nav-link:hover,
body.dark-only .modal .border-tab.nav-tabs .nav-link.active,
body.dark-only .modal .border-tab.nav-tabs .nav-link:focus,
body.dark-only .modal .border-tab.nav-tabs .nav-link:hover {
    color: var(--ssp-ui-accent);
}

/* riho's dark tables hang on .page-wrapper … .card (style.css:37895-37909); a modal and a drawer are drawn outside .page-wrapper,
   so their tables kept the light .table td near-black text and every line its light grey, as did a GroupBox's .border. */
body.dark-only :is(.modal, .ssp-drawer) .table th,
body.dark-only :is(.modal, .ssp-drawer) .table td {
    color: var(--ssp-ui-text);
}

body.dark-only :is(.modal, .ssp-drawer) :is(thead, tbody, tfoot, tr, td, th),
body.dark-only :is(.modal, .ssp-drawer) .table thead th,
body.dark-only :is(.modal, .ssp-drawer) .table > :not(:last-child) > :last-child > *,
body.dark-only :is(.modal, .ssp-drawer) :is(.border, .border-bottom) {
    border-color: var(--ssp-ui-line) !important;
}

body.dark-only :is(.modal, .ssp-drawer) {
    scrollbar-color: var(--ssp-ui-muted) transparent;
}

body.dark-only #menu-tabs .btn-outline-primary:not(.active),
body.dark-only .profile-dropdown .btn-outline-primary:not(:hover) {
    border-color: var(--ssp-ui-accent);
    color: var(--ssp-ui-accent);
}

/* riho styles the profile menu's entries as links; Change Password opens a dialog, so it is a button drawn and hovered the same. */
.profile-dropdown .ssp-profile-item {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
}

.page-wrapper .page-header .header-wrapper .nav-right .profile-dropdown li:hover .ssp-profile-item span {
    color: var(--theme-deafult);
    transition: color 0.3s ease;
}

.page-wrapper .page-header .header-wrapper .nav-right .profile-dropdown li:hover .ssp-profile-item svg {
    stroke: var(--theme-deafult);
    transition: stroke 0.3s ease;
}

/* riho's :hover look for the account menu while a key has focus in it (riho-blazor.js shuts it on Esc); riho
   strips the focus outline from links and buttons, so the entry under the keyboard gets one back. */
.page-wrapper .page-header .header-wrapper .nav-right .profile-nav:has(:focus-visible):not(.ssp-menu-shut) .onhover-show-div {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    border-radius: 5px;
    overflow: hidden;
}

.page-wrapper .page-header .header-wrapper .nav-right .profile-nav :is(.profile-media, a, button):focus-visible {
    outline: 2px solid var(--theme-deafult) !important;
    outline-offset: 2px;
}

body.dark-only .page-wrapper .page-header .header-wrapper .nav-right .profile-nav :is(.profile-media, a, button):focus-visible {
    outline-color: var(--ssp-ui-accent) !important;
}

.page-wrapper .page-header .header-wrapper .nav-right .profile-dropdown li:has(:focus-visible) :is(span, svg) {
    color: var(--theme-deafult);
    stroke: var(--theme-deafult);
}

/* riho's dark mode greys every span (style.css, body.dark-only span), a badge's text with it. */
body.dark-only .badge-primary {
    color: white;
}

/* The mockup's dialog (.modal, .mb, .mf), its widths from the tokens at the top so it shrinks with the page's zoom;
   the mockup has no extra large, which keeps Bootstrap's 1140px and shrinks the same. */
@media (min-width: 576px) {
    .modal {
        --bs-modal-width: var(--ssp-ui-dialog-w);
    }
}

@media (min-width: 992px) {
    .modal-lg {
        --bs-modal-width: var(--ssp-ui-dialog-w-lg);
    }
}

@media (min-width: 1200px) {
    .modal-xl {
        --bs-modal-width: var(--ssp-ui-dialog-w-xl);
    }
}

.modal-toggle-wrapper > .modal-header {
    padding: calc(24 * var(--ssp-ui-px)) calc(20 * var(--ssp-ui-px)) calc(8 * var(--ssp-ui-px));
    font-size: var(--ssp-ui-dialog-title-font);
    font-weight: 600;
}

.modal-toggle-wrapper > .modal-body {
    padding: calc(14 * var(--ssp-ui-px)) calc(22 * var(--ssp-ui-px)) calc(6 * var(--ssp-ui-px));
}

.modal-toggle-wrapper > .modal-body:last-child {
    padding: calc(14 * var(--ssp-ui-px)) calc(22 * var(--ssp-ui-px)) calc(20 * var(--ssp-ui-px));
}

/* Bootstrap fills a box and a tick from --bs-body-bg (vendors/bootstrap.css:2112 and :2341) and ssp.css hands that
   variable the brand's PAGE colour, so every one of them came out the grey of the page behind it and read as a field
   nobody may type in - in a dialog and in the filter bar alike. A tick that is on keeps its accent fill, a switch its track. */
body:not(.dark-only) :is(.modal, .ssp-filter) :is(.form-control, .form-select, .form-check-input:not(:checked, [role=switch])):not(:disabled),
body:not(.dark-only) :is(.modal, .ssp-filter) .select2-container--default .select2-selection--single {
    background-color: var(--white);
}

/* The mockup has one dark box (--input, --input-line) for a page, a dialog and the filter bar alike. */
body.dark-only :is(.form-control, .form-select):not(:disabled),
body.dark-only .select2-container--default:not(.select2-container--disabled) :is(.select2-selection--single, .select2-selection--multiple) {
    background-color: var(--ssp-ui-input) !important;
}

/* riho's dark box line (style.css:35935) is a white wash, not the mockup's --input-line that the text joined to it already
   carries, so a box and its end read as two colours. */
body.dark-only :is(.form-control, .form-select) {
    border-color: var(--ssp-ui-input-line);
}

body.dark-only .select2-container--default :is(.select2-selection--single, .select2-selection--multiple) {
    border-color: var(--ssp-ui-input-line) !important;
}

/* Chrome paints a box it filled in light blue with black text through !important rules no rule here outranks, a pale box
   in a dark dialog. A transition that never ends keeps each box's own fill and text, in light and dark alike. */
input:-webkit-autofill {
    transition: background-color 8640000s, color 8640000s;
}

/* riho writes a dark file box's name at a fifth of white and lines it navy (style.css:40504), and its button from --light-background,
   dark only on body[class=dark-only], which a dialog's modal-open misses. The button takes the dark Cancel's colours. */
body.dark-only .form-control[type=file]:not(:disabled):not([readonly]) {
    border-color: var(--ssp-ui-input-line);
    color: var(--ssp-ui-text);
}

body.dark-only .form-control::file-selector-button {
    background-color: var(--ssp-ui-input-line);
    color: var(--ssp-ui-text);
}

body.dark-only .form-control:hover:not(:disabled):not([readonly])::file-selector-button {
    background-color: color-mix(in srgb, var(--ssp-ui-input-line), var(--ssp-ui-text) 12%);
}

/* SweetAlert keeps will-change: transform on the open dialog, so its text stays a grey-smoothed layer at a half pixel and
   reads blurred; the open animation still runs without it. */
.swal-overlay--show-modal .swal-modal {
    will-change: auto;
}

/* riho pins the confirm dialog's Cancel to a light grey (style.css .swal-button--cancel, !important) in dark mode too. */
body.dark-only .swal-button--cancel {
    background-color: var(--ssp-ui-input-line) !important;
    color: var(--ssp-ui-text);
}

body.dark-only .swal-button--cancel:is(:hover, :focus-visible, :active) {
    background-color: color-mix(in srgb, var(--ssp-ui-input-line), var(--ssp-ui-text) 12%) !important;
}

/* ------------------------------------------------------------------ drawer */

/* Bootstrap's offcanvas from the right (vendors/bootstrap.css .offcanvas, .offcanvas-end). riho unsets its position, visibility
   and background for its own panel (style.css .offcanvas), which left the drawer in the page flow; these take them back. */
.ssp-drawer.offcanvas {
    --bs-offcanvas-width: var(--ssp-ui-drawer-w);
    position: fixed;
    visibility: hidden;
    z-index: var(--bs-offcanvas-zindex);
    background-color: var(--ssp-ui-card);
}

.ssp-drawer.offcanvas.show {
    visibility: visible;
}

.ssp-drawer .offcanvas-header {
    border-bottom: 1px solid var(--ssp-ui-line);
}

.ssp-drawer .offcanvas-title {
    font-size: var(--ssp-ui-dialog-title-font);
    font-weight: 600;
}

.ssp-drawer .offcanvas-body {
    font-size: var(--ssp-ui-text-font);
}
