/* ==========================================================================
   VYBO admin

   Engineered paper: the technical section of a VYBO catalogue. Ink on white,
   one hard double rule, square corners, open tables with hairlines. Documents
   and data carry the colour; the interface stays quiet around them.

   A red line is VYBO. A red block with an icon is a problem. Nothing you click
   is brand red. Tokens come from research/brand/tokens.md.
   ========================================================================== */

@font-face {
    font-family: "Onest";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/onest/onest-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Onest";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/onest/onest-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: light;

    /* Brand */
    --vybo-red: #e30007;
    --vybo-ink: #171717;
    --vybo-grey: #87888a;

    /* Surfaces and lines */
    --bg: #ffffff;
    --surface: #f2f2f2;
    --band: #ededed;
    --line: #d9d9d9;
    --line-control: #87888a;

    /* Text */
    --text: #171717;
    --text-muted: #595959;

    /* Action */
    --action: #171717;
    --action-hover: #2d2d2d;
    --focus: #171717;

    /* States: text on tint */
    --danger: #b80006;
    --danger-bg: #fdecec;
    --warning: #9a4a00;
    --warning-bg: #fff1e4;
    --success: #157a33;
    --success-bg: #e8f6ec;
    --info: #006a99;
    --info-bg: #e5f5fc;

    /* Series chips: small swatches beside text only, never a state */
    --series-v810: #00a2e8;
    --series-v900: #22b14c;
    --series-v800: #ff7f27;
    --series-a550: #ed1c24;
    --series-x550: #0000ff;

    /* Type */
    --font: "Onest", Arial, sans-serif;
    --text-title: 24px;
    --text-section: 18px;
    --text-body: 14px;
    --text-table: 13px;
    --text-label: 12px;
    --row: 28px;

    /* Shape */
    --radius: 0;
    --rule: 3px;
    --rule-height: calc(var(--rule) * 3);

    /* Page furniture */
    --gutter: 32px;
    --bar-height: 56px;
    --logo-width: 84px;

    /* Bootstrap, mapped onto the tokens */
    --bs-body-font-family: var(--font);
    --bs-body-font-size: var(--text-body);
    --bs-body-line-height: 1.4286;
    --bs-body-color: var(--text);
    --bs-body-color-rgb: 23, 23, 23;
    --bs-body-bg: var(--bg);
    --bs-secondary-color: var(--text-muted);
    --bs-secondary-bg: var(--surface);
    --bs-tertiary-bg: var(--surface);
    --bs-emphasis-color: var(--text);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius);
    --bs-border-radius-sm: var(--radius);
    --bs-border-radius-lg: var(--radius);
    --bs-border-radius-xl: var(--radius);
    --bs-border-radius-xxl: var(--radius);
    --bs-border-radius-pill: var(--radius);
    --bs-link-color: var(--text);
    --bs-link-color-rgb: 23, 23, 23;
    --bs-link-hover-color: var(--text);
    --bs-link-hover-color-rgb: 23, 23, 23;
    --bs-primary: var(--action);
    --bs-primary-rgb: 23, 23, 23;
    --bs-danger: var(--danger);
    --bs-danger-rgb: 184, 0, 6;
    --bs-success: var(--success);
    --bs-success-rgb: 21, 122, 51;
    --bs-warning: var(--warning);
    --bs-warning-rgb: 154, 74, 0;
    --bs-info: var(--info);
    --bs-info-rgb: 0, 106, 153;
    --bs-danger-text-emphasis: var(--danger);
    --bs-danger-bg-subtle: var(--danger-bg);
    --bs-danger-border-subtle: var(--danger-bg);
    --bs-success-text-emphasis: var(--success);
    --bs-success-bg-subtle: var(--success-bg);
    --bs-success-border-subtle: var(--success-bg);
    --bs-warning-text-emphasis: var(--warning);
    --bs-warning-bg-subtle: var(--warning-bg);
    --bs-warning-border-subtle: var(--warning-bg);
    --bs-info-text-emphasis: var(--info);
    --bs-info-bg-subtle: var(--info-bg);
    --bs-info-border-subtle: var(--info-bg);
    --bs-form-invalid-color: var(--danger);
    --bs-form-invalid-border-color: var(--danger);
    --bs-form-valid-color: var(--success);
    --bs-form-valid-border-color: var(--success);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--text-body);
    line-height: 20px;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
a { text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.nav-link:focus-visible,
.dropdown-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; box-shadow: none; }

.btn-close { --bs-btn-close-focus-shadow: none; }
.btn-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* The double rule ---------------------------------------------------------
   Red above ink, red at 90 % of the ink length, once per screen. */

.vybo-rule {
    position: relative;
    height: var(--rule-height);
}

.vybo-rule::before,
.vybo-rule::after {
    content: "";
    position: absolute;
    left: 0;
    height: var(--rule);
}

.vybo-rule::before { top: 0; width: 90%; background: var(--vybo-red); }
.vybo-rule::after { bottom: 0; width: 100%; background: var(--vybo-ink); }

/* Shell ------------------------------------------------------------------- */

.admin__skip {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 1080;
    padding: 6px 12px;
    background: var(--action);
    color: #fff;
    transform: translateY(-200%);
}

.admin__skip:focus { transform: none; color: #fff; }

.admin__header { position: relative; }

/* As in the catalogues, the logo sits on the rule, and a white plate interrupts
   both lines. The centre of the frame lands on the centre of the rule. */
.admin__logo {
    position: absolute;
    z-index: 2;
    left: calc(var(--gutter) - 8px);
    top: calc(var(--bar-height) + var(--rule-height) / 2);
    display: block;
    padding: 0 8px;
    background: var(--bg);
    transform: translateY(-50%);
}

.admin__logo img { display: block; width: var(--logo-width); height: auto; }

.admin__bar {
    --bs-navbar-padding-x: 0;
    --bs-navbar-padding-y: 0;
    --bs-navbar-color: var(--text);
    --bs-navbar-hover-color: var(--text);
    --bs-navbar-active-color: var(--text);
    --bs-navbar-nav-link-padding-x: 12px;
    height: var(--bar-height);
    padding-left: calc(var(--gutter) + var(--logo-width) + 28px);
    padding-right: var(--gutter);
    font-size: var(--text-body);
}

.admin__menu-toggle {
    margin-left: auto;
    padding: 6px 2px;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 26px;
    line-height: 1;
}

.admin__menu .offcanvas-body { flex-grow: 1; }
.admin__menu .navbar-nav { flex-grow: 1; gap: 4px; }

.admin__bar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--bar-height);
    border: 0;
    background: none;
    font-weight: 500;
    white-space: nowrap;
}

/* The location marker hangs from the top edge of the page, because the rule
   already runs under the whole row. */
.admin__bar .nav-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--bs-navbar-nav-link-padding-x);
    right: var(--bs-navbar-nav-link-padding-x);
    height: var(--rule);
    background: transparent;
    transition: background-color 150ms ease-out;
}

.admin__bar .nav-link:hover::before,
.admin__bar .nav-link.show::before { background: var(--line-control); }

.admin__bar .nav-link.active { font-weight: 600; }
.admin__bar .nav-link.active::before { background: var(--vybo-red); }

.admin__bar .dropdown-toggle::after {
    content: "\F282";
    margin: 1px 0 0;
    border: 0;
    font-family: "bootstrap-icons";
    font-size: 10px;
    line-height: 1;
    vertical-align: 0;
}

.admin__user { margin-left: auto; min-width: 0; }
.admin__user-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.admin__user-role { color: var(--text-muted); font-weight: 400; }

.dropdown-menu {
    --bs-dropdown-min-width: 200px;
    --bs-dropdown-padding-y: 4px;
    --bs-dropdown-spacer: 0;
    --bs-dropdown-font-size: var(--text-body);
    --bs-dropdown-color: var(--text);
    --bs-dropdown-border-color: var(--line-control);
    --bs-dropdown-border-radius: 0;
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-hover-bg: var(--surface);
    --bs-dropdown-link-active-color: var(--text);
    --bs-dropdown-link-active-bg: transparent;
    --bs-dropdown-item-padding-x: 16px;
    --bs-dropdown-item-padding-y: 7px;
    box-shadow: 0 8px 20px rgb(23 23 23 / 0.1);
}

.dropdown-item.active {
    box-shadow: inset var(--rule) 0 0 var(--vybo-red);
    font-weight: 600;
}

.dropdown-item .bi { margin-right: 6px; }

.admin__content { padding: 44px var(--gutter) 48px; }

/* Page header ------------------------------------------------------------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 24px;
}

.page-header__title {
    font-size: var(--text-title);
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.008em;
}

.page-header__description {
    margin-top: 2px;
    max-width: 72ch;
    color: var(--text-muted);
}

.page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Buttons ----------------------------------------------------------------- */

.btn {
    --bs-btn-padding-x: 14px;
    --bs-btn-padding-y: 7px;
    --bs-btn-font-family: var(--font);
    --bs-btn-font-size: var(--text-body);
    --bs-btn-font-weight: 500;
    --bs-btn-line-height: 20px;
    --bs-btn-border-radius: 0;
    --bs-btn-focus-box-shadow: none;
    --bs-btn-disabled-opacity: 1;
    transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}

.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn .bi { margin-right: 4px; }

.btn-sm {
    --bs-btn-padding-x: 8px;
    --bs-btn-padding-y: 1px;
    --bs-btn-font-size: var(--text-label);
    --bs-btn-line-height: 18px;
    --bs-btn-border-radius: 0;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--action);
    --bs-btn-border-color: var(--action);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--action-hover);
    --bs-btn-hover-border-color: var(--action-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #000;
    --bs-btn-active-border-color: #000;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--line-control);
    --bs-btn-disabled-border-color: var(--line-control);
}

.btn-outline-primary {
    --bs-btn-color: var(--text);
    --bs-btn-border-color: var(--text);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: var(--surface);
    --bs-btn-hover-border-color: var(--text);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: var(--band);
    --bs-btn-active-border-color: var(--text);
    --bs-btn-disabled-color: var(--text-muted);
    --bs-btn-disabled-border-color: var(--line-control);
}

/* Destructive: outline at rest, solid only in the confirm dialog. */
.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-color: var(--danger);
    --bs-btn-hover-bg: var(--danger-bg);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-active-color: var(--danger);
    --bs-btn-active-bg: var(--danger-bg);
    --bs-btn-active-border-color: var(--danger);
}

.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #9c0005;
    --bs-btn-hover-border-color: #9c0005;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #850004;
    --bs-btn-active-border-color: #850004;
}

/* Forms ------------------------------------------------------------------- */

.form-narrow { max-width: 520px; }

.form-field { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: var(--text-label);
    line-height: 16px;
    font-weight: 600;
}

.form-text {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: var(--text-label);
    line-height: 16px;
}

.form-control {
    padding: 7px 10px;
    border-color: var(--line-control);
    border-radius: 0;
    color: var(--text);
    font-size: var(--text-body);
    line-height: 20px;
}

.form-control:focus {
    border-color: var(--line-control);
    box-shadow: none;
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.form-control.is-invalid {
    padding-right: 10px;
    border-color: var(--danger);
    background-image: none;
}

.form-control.is-invalid:focus { border-color: var(--danger); box-shadow: none; outline-color: var(--danger); }

.invalid-feedback {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    color: var(--danger);
    font-size: var(--text-label);
    line-height: 16px;
}

.invalid-feedback .bi { flex: none; margin-top: 1px; }

.form-check { min-height: 20px; margin: 0; }

.form-check-input {
    margin-top: 3px;
    border-color: var(--line-control);
}

.form-check-input[type="checkbox"] { border-radius: 0; }

.form-check-input:focus { border-color: var(--line-control); box-shadow: none; outline: 2px solid var(--focus); outline-offset: 1px; }
.form-check-input:checked { background-color: var(--action); border-color: var(--action); }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

.choice-list { display: grid; gap: 4px; margin-bottom: 16px; }
.choice-list legend { float: none; width: auto; margin-bottom: 4px; padding: 0; }

/* A chosen row carries the same red location marker as the menu. */
.choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: border-color 150ms ease-out, background-color 150ms ease-out;
}

.choice:hover { border-color: var(--line-control); }
.choice:has(input:checked) { border-color: var(--text); box-shadow: inset var(--rule) 0 0 var(--vybo-red); }
.choice .form-check-input { margin: 3px 0 0; float: none; }
.choice__name { display: block; font-weight: 600; }
.choice__text { display: block; color: var(--text-muted); font-size: var(--text-label); line-height: 16px; }

.form-fact { margin-bottom: 16px; }
.form-fact strong { font-weight: 600; }

/* Tables ------------------------------------------------------------------ */

.data-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
    --bs-table-hover-bg: var(--surface);
    --bs-table-hover-color: var(--text);
    margin: 0;
    font-size: var(--text-table);
    line-height: 20px;
    font-variant-numeric: tabular-nums;
}

.data-table > thead > tr > th {
    padding: 0 16px 6px 0;
    border-bottom: 1px solid var(--text);
    font-size: var(--text-label);
    line-height: 16px;
    font-weight: 600;
    vertical-align: bottom;
    white-space: nowrap;
}

.data-table > tbody > tr > td {
    height: var(--row);
    padding: 3px 16px 4px 0;
    vertical-align: middle;
}

.data-table > tbody > tr > td:first-child,
.data-table > thead > tr > th:first-child { padding-left: 8px; }

.data-table > tbody > tr > td:last-child,
.data-table > thead > tr > th:last-child { padding-right: 8px; }

.data-table__strong { font-weight: 600; }
.data-table__muted { color: var(--text-muted); }
.data-table__actions { width: 1%; white-space: nowrap; text-align: right; }

/* The buttons are 2 px taller than a line of text, and the row stays at 28 px. */
.data-table > tbody > tr > td.data-table__actions { padding-block: 2px 3px; }

.row-actions { display: flex; justify-content: flex-end; gap: 6px; }

/* Status chips ------------------------------------------------------------ */

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px;
    border: 1px solid var(--line-control);
    font-size: var(--text-label);
    line-height: 16px;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: 1px;
}

.status-chip .bi { font-size: 10px; }
.status-chip--success { color: var(--success); background: var(--success-bg); border-color: var(--success); }
.status-chip--warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning); }
.status-chip--danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger); }
.status-chip--info { color: var(--info); background: var(--info-bg); border-color: var(--info); }
.status-chip--ink { color: #fff; background: var(--action); border-color: var(--action); }

/* Messages ---------------------------------------------------------------- */

.alert {
    --bs-alert-padding-x: 12px;
    --bs-alert-padding-y: 9px;
    --bs-alert-margin-bottom: 16px;
    --bs-alert-border-radius: 0;
    display: flex;
    gap: 8px;
    max-width: 72ch;
    font-size: var(--text-body);
}

.alert > .bi { flex: none; }

/* Empty state ------------------------------------------------------------- */

.empty-state {
    max-width: 720px;
    padding: 20px 24px 22px;
    background: var(--surface);
}

.empty-state__title {
    font-size: var(--text-section);
    line-height: 24px;
    font-weight: 600;
}

.empty-state__text { margin-top: 4px; max-width: 62ch; }
.empty-state__action { margin-top: 14px; }

/* Confirm dialog ---------------------------------------------------------- */

.modal {
    --bs-modal-width: 440px;
    --bs-modal-padding: 24px;
    --bs-modal-border-radius: 0;
    --bs-modal-border-width: 1px;
    --bs-modal-border-color: var(--text);
    --bs-modal-footer-border-width: 0;
    --bs-modal-footer-gap: 8px;
    --bs-modal-box-shadow: none;
}

.modal-backdrop { --bs-backdrop-bg: var(--vybo-ink); --bs-backdrop-opacity: 0.35; }
.modal-title { font-size: var(--text-section); line-height: 24px; font-weight: 600; }
.modal-text { margin-top: 6px; }
.modal-footer { padding-top: 0; }

/* Sign-in and error pages -------------------------------------------------
   A VYBO catalogue cover: the family line-up rising to the right, the title
   block under it, the double rule at the foot with the logo sitting on it. */

.cover {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.cover__page {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-end;
    gap: 40px;
    width: 100%;
    max-width: 1344px;
    margin-inline: auto;
    padding: 40px 64px 36px;
}

.cover__product { margin: auto 0; }

.cover__product img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 44vh;
    object-fit: contain;
}

.cover__title {
    font-size: var(--text-title);
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.008em;
}

.cover__lead { margin-top: 2px; max-width: 62ch; color: var(--text-muted); }
.cover__lead + .btn { margin-top: 16px; }

.cover__block .alert { margin: 14px 0 0; }

.cover__foot {
    position: relative;
    padding-bottom: 84px;
}

.cover__logo {
    position: absolute;
    right: max(64px, calc((100% - 1344px) / 2 + 64px));
    top: calc(var(--rule-height) / 2);
    box-sizing: content-box;
    width: 128px;
    height: auto;
    padding: 0 14px;
    background: var(--bg);
    transform: translateY(-50%);
}

.login-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    max-width: 820px;
    margin-top: 16px;
}

.login-form .form-field { margin: 0; }
.login-form .form-control { padding-block: 9px; }

.login-form__submit { margin-top: 20px; padding-block: 9px; white-space: nowrap; }

.login-form__meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 24px;
}

.login-form__hint { color: var(--text-muted); }

/* Narrow screens ---------------------------------------------------------- */

@media (max-width: 991.98px) {
    :root { --gutter: 16px; }

    .form-control { padding-block: 11px; font-size: 16px; line-height: 20px; }
    .form-check-input { margin-top: 2px; }

    .admin__bar { padding-left: var(--gutter); }

    .admin__menu { --bs-offcanvas-width: 300px; --bs-offcanvas-border-color: var(--text); }
    .admin__menu .offcanvas-header { justify-content: flex-end; padding: 12px 16px; }
    .admin__menu .offcanvas-body { display: flex; flex-direction: column; padding: 0 16px 16px; }
    .admin__menu .navbar-nav { gap: 0; }

    /* Groups stay open in the drawer: there is room, and no hover to lean on. */
    .admin__bar .nav-link { height: 44px; padding-inline: 0; font-size: 16px; }
    .admin__bar .nav-link::before { display: none; }
    .admin__bar .nav-link.active { box-shadow: inset var(--rule) 0 0 var(--vybo-red); padding-left: 12px; }
    .admin__bar .dropdown-toggle { pointer-events: none; color: var(--text-muted); font-size: var(--text-label); font-weight: 600; height: 32px; margin-top: 12px; }
    .admin__bar .dropdown-toggle::after { display: none; }
    .admin__bar .dropdown-toggle.active { box-shadow: none; padding-left: 0; }

    .admin__bar .navbar-nav .dropdown-menu {
        display: block;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .admin__bar .dropdown-item { padding: 10px 0; font-size: 16px; }
    .admin__bar .dropdown-item.active { padding-left: 12px; }
    .admin__bar .dropdown-item:hover { background: none; }

    .admin__user { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
    .admin__user .dropdown-toggle { height: auto; margin: 0; color: var(--text); font-size: var(--text-body); }
    .admin__user .dropdown-menu { display: block; position: static; padding: 0; border: 0; box-shadow: none; }

    /* The bottom padding keeps the last form line clear of the logo plate. */
    .cover__page { gap: 24px; padding: 24px var(--gutter) 56px; }

    .cover__logo { right: var(--gutter); width: 96px; padding: 0 10px; }
    .cover__foot { padding-bottom: 60px; }

    .login-form { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
    .login-form .form-control { padding-block: 11px; }
    .login-form__submit { margin-top: 0; padding-block: 11px; }
    .login-form__meta { order: 3; }
}

@media (max-width: 575.98px) {
    /* Only the two largest motors, across the full width of the phone. */
    .cover__product { margin-inline: calc(var(--gutter) * -1); }
    .cover__product img { aspect-ratio: 400 / 146; max-height: none; object-fit: cover; object-position: right center; }

    .page-header__actions { width: 100%; }
    .page-header__actions .btn { flex: 1; }

    .row-actions { flex-direction: column; align-items: stretch; }
    .row-actions .btn { width: 100%; }
    .data-table > tbody > tr > td { padding-block: 8px; }

    .form-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* Dictionary --------------------------------------------------------------- */

.dictionary-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dictionary-filter .form-control { flex: 1 1 240px; width: auto; }
.dictionary-filter .form-select { flex: 0 1 200px; width: auto; }

.dictionary-table { min-width: 960px; }
.dictionary-table > tbody > tr > td { vertical-align: top; }
.dictionary-table__source { width: 26%; }
.dictionary-table__source .data-table__strong { white-space: pre-line; }
.dictionary-table textarea { min-height: 44px; padding: 4px 6px; font-size: 13px; line-height: 18px; resize: vertical; }
.dictionary-table textarea[readonly] { background: var(--surface); }
.dictionary-table__chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.dictionary-table__message { max-width: 180px; margin-top: 4px; font-size: 12px; white-space: normal; text-align: left; }
.dictionary-table__message.is-error { padding: 2px 4px; color: var(--danger); background: var(--danger-bg); }
.dictionary-table > tbody > tr.is-dirty > td { background: var(--warning-bg); }

/* Overview, runs, history -------------------------------------------------- */

.section-title { margin: 24px 0 8px; font-size: var(--text-section); line-height: 24px; font-weight: 600; }
.overview-list { margin: 0; padding: 0; font-size: var(--text-table); list-style: none; }
.overview-list li { min-height: var(--row); padding: 4px 8px; border-bottom: 1px solid var(--line); }

.review-table { min-width: 960px; }
.review-decision { display: flex; gap: 6px; }
.review-decision .form-select { flex: 0 0 170px; width: auto; }
.review-decision .form-control { flex: 1 1 160px; min-width: 0; padding: 1px 6px; font-size: var(--text-table); }

.run { max-width: 640px; margin-bottom: 16px; }
.run__state { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.run__progress { height: 8px; background: var(--band); }
.run__bar { height: 100%; background: var(--action); transition: width 200ms ease-out; }
.run__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 16px; max-width: 640px; margin: 0; font-size: var(--text-table); }
.run__facts dt { color: var(--text-muted); font-weight: 400; }
.run__facts dd { margin: 0; }

.dictionary-filter .history-date { flex: 0 1 150px; }

/* Exports ----------------------------------------------------------------- */

.export-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.export-form .form-field { flex: 0 1 220px; min-width: 0; margin: 0; }
.export-form .export-form__split { flex-basis: 120px; }

/* Documents --------------------------------------------------------------- */

.documents { display: flex; align-items: flex-start; gap: 24px; }
.documents__side { flex: none; width: 420px; min-width: 260px; max-width: 70%; overflow: auto; resize: horizontal; padding-right: 12px; border-right: 1px solid var(--line); }
.documents__detail { flex: 1 1 0; min-width: 0; }
.documents__count { margin: 8px 0; }
.documents__tree { max-height: calc(100vh - 260px); overflow: auto; font-size: var(--text-table); }
.documents__list { margin: 0; padding: 0; list-style: none; }
.documents__list .documents__list { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
.documents__folder,
.documents__document { display: flex; align-items: center; gap: 6px; width: 100%; min-height: var(--row); padding: 2px 4px; border: 0; background: none; color: var(--text); text-align: left; text-decoration: none; }
.documents__document { flex-wrap: wrap; }
.documents__folder:hover,
.documents__document:hover { background: var(--surface); }
.documents__document.is-selected { background: var(--band); font-weight: 600; }
.documents__folder .bi { font-size: 10px; transition: transform .1s; }
.documents__folder[aria-expanded="true"] .bi { transform: rotate(90deg); }
.documents__name { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.documents__path { order: 3; flex: 0 0 100%; color: var(--text-muted); font-size: var(--text-label); overflow-wrap: anywhere; }
.documents__number { flex: none; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.documents__marks { display: flex; flex: none; gap: 4px; }
.documents__title { margin: 0 0 4px; font-size: var(--text-section); overflow-wrap: anywhere; }
.documents__subtitle { margin: 16px 0 4px; font-size: var(--text-body); font-weight: 600; }
.documents__files { margin: 0; padding: 0; font-size: var(--text-table); list-style: none; }
.documents__files li { display: flex; gap: 12px; min-height: var(--row); align-items: center; border-bottom: 1px solid var(--line); }
.documents__files li > :nth-child(2) { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.documents__role { flex: 0 0 56px; color: var(--text-muted); }
.documents__download { flex: none; padding: 0 6px; color: var(--text); }

/* The comparison: two documents side by side, the interface quiet around them. */
.viewer { margin-top: 12px; }
.viewer__languages { display: flex; align-items: center; gap: 6px; min-height: 24px; margin-bottom: 8px; }
.viewer__panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.viewer__head { display: flex; align-items: baseline; gap: 12px; min-height: var(--row); font-size: var(--text-table); }
.viewer__title { flex: 1 1 0; font-size: var(--text-body); font-weight: 600; }
.viewer__frame { display: block; width: 100%; height: calc(100vh - 320px); min-height: 480px; border: 1px solid var(--line); background: var(--surface); }
.viewer__pane .alert { margin: 0; }

@media (max-width: 991.98px) {
    .viewer__panes { grid-template-columns: minmax(0, 1fr); }
    .documents { flex-direction: column; }
    .documents__side { width: 100%; max-width: none; padding-right: 0; border-right: 0; resize: none; }
    .documents__tree { max-height: 50vh; }
}
