/*
 * Site and admin pages: Bootstrap 5.3 (public/vendor/bootstrap) + only what Bootstrap lacks.
 * No inline styles anywhere: the CSP forbids them. Colors follow data-bs-theme (js/theme.js).
 */
.mono {
    font-family: var(--bs-font-monospace);
    word-break: break-all;
}

/* In list tables mono values (part numbers, CRC, hashes) stay whole and the .table-responsive wrapper scrolls. */
.table .mono {
    word-break: normal;
    white-space: nowrap;
}

/* Narrow cards: login and other single forms. */
.login,
.narrow {
    max-width: 24rem;
}

/*
 * Form icons as same-origin files: the CSP (default-src 'self') blocks Bootstrap's built-in data: SVGs.
 * Same pictures as bootstrap.min.css 5.3.8. Absolute paths: Chrome resolves a relative url() in a custom
 * property against the stylesheet that uses it (bootstrap.min.css), not this one.
 */
.form-select {
    --bs-form-select-bg-img: url("/vendor/bootstrap/5.3.8/img/select-light.svg");
}

[data-bs-theme="dark"] .form-select {
    --bs-form-select-bg-img: url("/vendor/bootstrap/5.3.8/img/select-dark.svg");
}

.form-check-input:checked[type="checkbox"] {
    --bs-form-check-bg-image: url("/vendor/bootstrap/5.3.8/img/check.svg");
}

.form-check-input:checked[type="radio"] {
    --bs-form-check-bg-image: url("/vendor/bootstrap/5.3.8/img/radio.svg");
}

.form-check-input[type="checkbox"]:indeterminate {
    --bs-form-check-bg-image: url("/vendor/bootstrap/5.3.8/img/indeterminate.svg");
}

/* A table flush inside a card: first and last cells line up with the card header text. */
.card > .table-responsive > .table > :not(caption) > * > :first-child {
    padding-inline-start: var(--bs-card-spacer-x);
}

.card > .table-responsive > .table > :not(caption) > * > :last-child {
    padding-inline-end: var(--bs-card-spacer-x);
}

/* Readable secondary outline buttons (Bootstrap's grey is under 4.5:1 on the tinted navbar). */
.btn-outline-secondary {
    --bs-btn-color: var(--bs-secondary-color);
}

/* Dark mode: Bootstrap 5.3 keeps the light-theme base colours for outline buttons and colored links. */
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: var(--bs-secondary-text-emphasis);
    --bs-btn-border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .btn-outline-danger {
    --bs-btn-color: var(--bs-danger-text-emphasis);
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: var(--bs-primary-text-emphasis);
}

[data-bs-theme="dark"] .link-secondary {
    color: var(--bs-secondary-color) !important;
}

[data-bs-theme="dark"] .link-danger {
    color: var(--bs-danger-text-emphasis) !important;
}

/*
 * Fields with an error keep the red border and the message, without Bootstrap's status icon: it is a data: SVG,
 * which the CSP blocks (and reports in the console).
 */
.form-control.is-invalid,
.form-control.is-valid {
    padding-right: .75rem;
    background-image: none;
}

/* The same selectors as Bootstrap's, so that this later rule wins. */
.form-select.is-invalid:not([multiple]):not([size]),
.form-select.is-invalid:not([multiple])[size="1"],
.form-select.is-valid:not([multiple]):not([size]),
.form-select.is-valid:not([multiple])[size="1"] {
    --bs-form-select-bg-icon: none;
}

/* ALTCHA state line of the anonymous forms (js/altcha.js): reserves its height, so the form does not jump. */
.altcha {
    min-height: 1.5rem;
}
