/*
 * Phone and tablet layout.
 *
 * This file is intentionally loaded after every desktop stylesheet and every
 * rule is scoped to a narrow viewport.  The desktop workspace therefore keeps
 * its current geometry while touch devices get a purpose-built layout.
 */

@media (max-width: 920px) {
    :root {
        --mobile-gutter: 12px;
        --mobile-radius: 10px;
        --mobile-touch: 44px;
    }

    html { scroll-behavior: auto; }
    body { overflow-x: hidden; }
    button, a, input, select, textarea { touch-action: manipulation; }

    /* App frame and navigation. */
    .workspace { width: 100%; margin-left: 0; }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 40;
        height: 54px;
        padding: 0 10px;
        gap: 8px;
        background: rgba(255,255,255,.98);
        backdrop-filter: blur(10px);
    }
    .topbar-left { min-width: 0; flex: 1 1 auto; gap: 10px; }
    .mobile-menu {
        width: 40px;
        height: 40px;
        padding: 10px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        border-radius: 9px;
    }
    .breadcrumb {
        min-width: 0;
        display: flex !important;
        align-items: center;
    }
    .breadcrumb span, .breadcrumb b { display: none; }
    .breadcrumb strong {
        overflow: hidden;
        color: #26384a;
        font-size: 13px;
        font-weight: 600;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar-actions { flex: 0 0 auto; gap: 5px; }
    .notification-button, .user-menu-button { min-width: 40px; height: 40px; }
    .notification-button { width: 40px; }
    .user-menu-button { padding: 0 4px; }
    .user-menu-button .avatar { width: 32px; height: 32px; }
    .user-meta, .user-menu-button > svg { display: none; }
    .user-dropdown { position: fixed; top: 49px; right: 8px; width: min(260px, calc(100vw - 16px)); }

    .sidebar {
        width: min(330px, calc(100vw - 42px));
        padding-bottom: env(safe-area-inset-bottom);
        contain: layout paint;
    }
    .sidebar-brand { height: 64px; padding: 0 14px 0 18px; }
    .brand-symbol, .brand-symbol img { width: 29px; height: 40px; }
    .brand-lockup { gap: 11px; }
    .brand-lockup strong { font-size: 13px; }
    .brand-lockup small { font-size: 8.5px; }
    .sidebar-close {
        width: 42px;
        height: 42px;
        padding: 0;
        display: grid;
        place-items: center;
        border-radius: 9px;
        font-size: 27px;
    }
    .sidebar-nav { padding: 14px 12px 24px; }
    .nav-section + .nav-section { margin-top: 8px; }
    .nav-section-toggle { min-height: 50px; padding: 6px 8px 6px 16px; }
    .nav-section-heading { min-height: 48px; }
    .nav-section-chevron-wrap { width: 30px; height: 30px; }
    .nav-link { min-height: 50px; padding: 5px 8px; gap: 10px; }
    .nav-icon { width: 34px; height: 34px; }
    .nav-icon svg { width: 19px; height: 19px; }
    .nav-link-copy > span { font-size: 13px; }
    .nav-link-copy > small, .nav-section-heading small, .nav-section-copy small { font-size: 9px; }
    .nav-label { font-size: 13px; }

    /* Common page rhythm. */
    .content-shell {
        width: 100%;
        max-width: none;
        padding: 13px var(--mobile-gutter) calc(28px + env(safe-area-inset-bottom));
    }
    .page-heading-row {
        min-height: 0;
        margin: 0 0 12px;
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 12px;
    }
    .page-heading-row h1 { margin: 3px 0 0; font-size: clamp(22px, 7vw, 28px); line-height: 1.06; }
    .page-heading-row p { margin-top: 5px; font-size: 10px; line-height: 1.35; }
    .page-kicker { font-size: 7.5px; }
    .heading-actions { margin-top: 0; }
    .panel { border-radius: var(--mobile-radius); box-shadow: 0 2px 10px rgba(16,24,40,.04); }
    .primary-button, .secondary-button { min-height: var(--mobile-touch); }
    input, select, textarea { font-size: 16px; }
    .message-stack { right: var(--mobile-gutter); left: var(--mobile-gutter); width: auto; }
    .message { min-height: 46px; }

    /* Report filters become a compact horizontal control rail. */
    .procurement-report-controls { overflow: visible; }
    .procurement-primary-controls {
        padding: 11px;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
    .procurement-primary-controls > label,
    .report-period-control { min-width: 0; grid-column: auto; }
    .procurement-primary-controls select,
    .report-date-field input { height: 44px; font-size: 14px; }
    .report-period-layout { align-items: stretch; flex-direction: column; gap: 8px; }
    .report-period-toggle { min-height: 44px; justify-content: flex-start; }
    .report-period-dates { width: 100%; grid-template-columns: 1fr 1fr; }

    .catalog-filter-workbench { padding: 9px; overflow: visible; }
    .catalog-filter-switcher {
        margin: 0 -1px;
        padding: 1px;
        display: flex;
        gap: 7px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }
    .catalog-filter-switcher::-webkit-scrollbar { display: none; }
    .catalog-filter-trigger {
        min-width: 154px;
        height: 46px;
        flex: 1 0 154px;
        scroll-snap-align: start;
    }
    .catalog-filter-trigger strong { font-size: 10px; }

    .catalog-filter-palette:not([hidden]) {
        position: fixed;
        z-index: 1000;
        inset: auto 8px max(8px, env(safe-area-inset-bottom));
        max-height: calc(100dvh - 70px);
        margin: 0;
        padding: 10px;
        overflow: auto;
        overscroll-behavior: contain;
        background: #fff;
        border-color: #cfd9e3;
        border-radius: 14px;
        box-shadow: 0 18px 60px rgba(10,22,36,.28);
        -webkit-overflow-scrolling: touch;
    }
    .catalog-filter-palette > header {
        position: sticky;
        z-index: 2;
        top: -10px;
        padding: 9px 0 10px;
        grid-template-columns: minmax(0, 1fr) auto 38px;
        background: #fff;
        border-bottom: 1px solid #e8edf1;
    }
    .catalog-filter-palette > header > div small { display: none; }
    .catalog-filter-search { grid-column: 1 / -1; grid-row: 2; }
    .catalog-filter-search input { height: 42px; font-size: 15px; }
    .catalog-filter-palette > header > button { height: 38px; }
    .catalog-filter-palette > header > .catalog-filter-close { width: 38px; }
    .catalog-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .catalog-filter-chip > span { height: 40px; padding: 0 10px; font-size: 10px; }

    /* Report toolbar is touch friendly but still dense. */
    .procurement-table-toolbar {
        min-height: 0;
        padding: 10px;
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 8px;
    }
    .procurement-live-search { width: 100%; min-width: 0; }
    .procurement-live-search input { height: 44px; font-size: 15px; }
    .report-mode-switcher { width: 100%; height: 42px; }
    .report-mode-switcher button { min-width: 0; flex: 1 1 50%; }
    .report-table-actions { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
    .report-table-actions > *, .report-table-actions .secondary-button, .report-download-button { width: 100%; }
    .report-view-settings-popover {
        position: fixed;
        z-index: 1001;
        inset: auto 8px max(8px, env(safe-area-inset-bottom));
        width: auto;
        max-height: calc(100dvh - 70px);
        overflow: auto;
        border-radius: 14px;
    }

    /* Dense operational tables: keep a real table instead of kilometre-long cards. */
    .data-table-scroll,
    .procurement-report-scroll,
    .rk-procurement-scroll,
    .data-completion-table-wrap,
    .request-table-wrap,
    .repair-kit-composition-table-wrap {
        position: relative;
        overflow: auto !important;
        overscroll-behavior: contain;
        scrollbar-color: #8d9aaa #edf0f4;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    .procurement-report-scroll { height: min(66dvh, 620px); min-height: 430px; }
    .procurement-report-table,
    .procurement-report-table thead,
    .procurement-report-table tbody { display: table !important; }
    .procurement-report-table { width: 100%; min-width: 1120px; table-layout: fixed; border-collapse: collapse; }
    .procurement-report-table colgroup { display: table-column-group !important; }
    .procurement-report-table thead { position: sticky !important; z-index: 8; top: 0; padding: 0 !important; background: #f7f9fb; }
    .procurement-report-table thead tr { display: table-row !important; }
    .procurement-report-table thead th,
    .procurement-report-table thead th:nth-child(n) {
        width: auto;
        height: 40px;
        padding: 0 8px;
        display: table-cell !important;
        color: #657487;
        background: #f7f9fb;
        border-right: 1px solid #e2e7ec;
        border-bottom: 1px solid #d8e0e6;
        font-size: 8px;
        vertical-align: middle;
    }
    .procurement-report-table .report-column-group { display: none !important; }
    .procurement-report-table .sortable-heading,
    .procurement-report-table .report-column-summary {
        min-height: 0;
        padding: 0;
        justify-content: flex-start;
        background: transparent;
        border: 0;
        border-radius: 0;
        font-size: inherit;
    }
    .procurement-report-table tbody { padding: 0 !important; }
    .procurement-report-table tbody tr {
        display: table-row !important;
        background: #fff;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }
    .procurement-report-table tbody td,
    .procurement-report-table tbody td:nth-child(n) {
        width: auto;
        min-height: 0;
        height: 44px;
        padding: 6px 8px;
        display: table-cell !important;
        overflow: hidden;
        color: var(--ink);
        background: #fff;
        border: 0;
        border-right: 1px solid #edf0f3;
        border-bottom: 1px solid #e7ebef;
        box-shadow: none;
        font-size: 10px;
        text-align: left;
        text-overflow: ellipsis;
        vertical-align: middle;
        white-space: nowrap;
    }
    .procurement-report-table tbody td::before { display: none !important; content: none !important; }
    .procurement-report-table tbody .report-product-name { grid-column: auto; }
    .procurement-report-table th:first-child,
    .procurement-report-table td:first-child {
        position: sticky !important;
        z-index: 7;
        left: 0;
        width: 46px !important;
        min-width: 46px;
        max-width: 46px;
        background: #fff;
        box-shadow: 1px 0 0 #dde4ea;
    }
    .procurement-report-table thead th:first-child { z-index: 12; background: #f7f9fb; }
    .procurement-report-table tbody tr:nth-child(even) td:first-child { background: #fbfcfd; }
    .procurement-report-table tbody tr.is-in-purchase-request td:first-child { background: #f0faf4; }
    .procurement-report-table th:nth-child(2),
    .procurement-report-table td:nth-child(2) {
        position: sticky !important;
        z-index: 6;
        left: 46px;
        min-width: 170px;
        background: #fff;
        box-shadow: 1px 0 0 #dfe5ea;
    }
    .procurement-report-table thead th:nth-child(2) { z-index: 11; background: #f7f9fb; }
    .procurement-report-table tbody tr:nth-child(even) td:nth-child(2) { background: #fbfcfd; }
    .procurement-report-table tbody tr.is-in-purchase-request td:nth-child(2) { background: #f0faf4; }
    .procurement-report-table .report-request-cell { text-align: center; }

    .report-merge-tooltip,
    .gost-detail-tooltip,
    .gost-composition-tooltip,
    .repair-kit-metric-tooltip,
    .global-report-tooltip-portal {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        max-height: min(62dvh, 460px) !important;
        padding: 13px !important;
        overflow: auto !important;
        font-size: 10px;
        -webkit-overflow-scrolling: touch;
    }

    /* Purchase requests are a vertical stack on a phone. */
    .requests-heading { align-items: stretch; flex-direction: column; }
    .request-heading-actions { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
    .request-create-form { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .request-create-form label { min-width: 0; }
    .request-create-form input { height: 44px; font-size: 15px; }
    .request-create-form .primary-button { padding-inline: 13px; }
    .request-board-shell { padding: 0; overflow: visible; }
    .request-board {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .request-card { width: 100%; min-width: 0; height: auto; min-height: 0; }
    .request-board .request-card-header { padding: 12px; }
    .request-card-number-row { align-items: flex-start; gap: 8px; }
    .request-card-utilities { flex-wrap: wrap; justify-content: flex-end; }
    .request-card-utilities .secondary-button, .request-delete-button { min-height: 36px; }
    .request-title-value { min-height: 42px; }
    .request-title-form { grid-template-columns: minmax(0, 1fr) 42px; }
    .request-title-form input, .request-quantity-form input { font-size: 16px; }
    .request-table-wrap { max-height: 52dvh; }
    .request-table { min-width: 820px; }
    .request-table thead { position: sticky; z-index: 3; top: 0; }
    .request-table th { height: 40px; }
    .request-table td { height: 48px; }

    /* Mobile reports are vertical records. Nothing in these tables may widen the page. */
    .procurement-report-scroll,
    .rk-procurement-scroll,
    .repair-kit-composition-table-wrap {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-x: none;
        touch-action: pan-y;
    }
    .procurement-report-scroll {
        height: min(68dvh, 660px);
        min-height: 430px;
        padding: 8px;
        background: #f2f5f7;
    }
    .procurement-report-table,
    .procurement-report-table tbody {
        width: 100% !important;
        min-width: 0 !important;
        display: block !important;
    }
    .procurement-report-table colgroup,
    .procurement-report-table thead { display: none !important; }
    .procurement-report-table tbody { padding: 0 !important; }
    .procurement-report-table tbody tr[data-report-row] {
        position: relative;
        width: 100%;
        margin: 0 0 9px;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        background: #fff;
        border: 1px solid #dce4ea;
        border-radius: 11px;
        box-shadow: 0 2px 8px rgba(18, 42, 62, .045);
    }
    .procurement-report-table tbody tr[data-report-row].is-in-purchase-request {
        border-left: 3px solid #38a978;
    }
    .procurement-report-table tbody tr[data-report-row] > td,
    .procurement-report-table tbody tr[data-report-row] > td:nth-child(n) {
        position: static !important;
        z-index: auto;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        min-height: 48px;
        height: auto;
        padding: 8px 10px;
        display: flex !important;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible;
        color: #173148;
        background: #fff !important;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        box-shadow: none;
        font-size: 12px;
        line-height: 1.35;
        text-align: left !important;
        text-overflow: clip;
        white-space: normal;
    }
    .procurement-report-table tbody tr[data-report-row] > td:nth-of-type(even) { border-right: 0; }
    .procurement-report-table tbody tr[data-report-row] > td[hidden] { display: none !important; }
    .procurement-report-table tbody tr[data-report-row] > td::before {
        margin-bottom: 4px;
        display: block !important;
        color: #7a8897;
        content: attr(data-label) !important;
        font-size: 8px;
        font-weight: 500;
        letter-spacing: .035em;
        line-height: 1.2;
        text-transform: uppercase;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="transit_signed"]::before { content: "Подписано, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="transit_factory_ready"]::before { content: "Готово на заводе, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="transit_departed"]::before { content: "Вышло МЛ, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="transit_customs"]::before { content: "Оформлено таможней, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="transit_rail_loaded"]::before { content: "Погружено на ЖД, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="transit_rail_unloaded"]::before { content: "Выгружено с ЖД, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="in_transit"]::before { content: "В пути, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="need_percent"]::before { content: "Потребность, %" !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="need_kg"]::before { content: "Потребность, кг" !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="need_units"]::before { content: "Потребность, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="carton"]::before { content: "Ящ. норма, шт." !important; }
    .procurement-report-table tbody tr[data-report-row] > td.report-request-cell {
        position: absolute !important;
        z-index: 4;
        top: 10px;
        right: 10px;
        left: auto !important;
        width: 34px !important;
        min-width: 34px !important;
        min-height: 34px;
        padding: 0;
        align-items: center;
        border: 0;
        background: transparent !important;
    }
    .procurement-report-table tbody tr[data-report-row] > td.report-request-cell::before { display: none !important; }
    .procurement-report-table .report-request-picker,
    .procurement-report-table .gost-request-picker { width: 34px; height: 34px; }
    .procurement-report-table .report-request-picker > summary,
    .procurement-report-table .gost-request-open { width: 34px; height: 34px; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="article"],
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="gost"],
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="name"],
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="assembly"] {
        grid-column: 1 / -1;
        border-right: 0;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="article"],
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="gost"] {
        min-height: 38px;
        padding-top: 9px;
        padding-right: 54px;
        padding-bottom: 7px;
        background: #f8fafb !important;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="name"] {
        min-height: 54px;
        padding-top: 10px;
        padding-right: 54px;
        padding-bottom: 10px;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="name"]::before { margin-bottom: 3px; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="name"] .report-product-name-line,
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="name"] .gost-product-name-line,
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="name"] > span {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 6px;
        color: #0f2940;
        font-size: 13.5px;
        line-height: 1.35;
        white-space: normal;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="assembly"] {
        order: 100;
        grid-column: auto;
        min-height: 42px;
        padding: 8px 10px 10px;
        background: #f7fbfd !important;
        border-top: 1px solid #dce8ee;
        border-right: 0;
        border-bottom: 0;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="assembly"] .repair-kit-assembly-status {
        width: 100%;
        min-height: 30px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        text-align: left;
    }
    .procurement-report-table tbody tr[data-report-row].is-assembly-expanded {
        margin-bottom: 0;
        border-bottom-color: transparent;
        border-radius: 11px 11px 0 0;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="need_units"] {
        background: #eef8fc !important;
    }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="need_units"] strong { font-size: 14px; }
    .procurement-report-table tbody tr[data-report-row] > td[data-column-key="brand"] strong { font-weight: 500; }
    .procurement-report-table tbody tr[data-report-row] .report-cell-unit { margin-left: 3px; font-size: 9px; }
    .procurement-report-table tbody .repair-kit-assembly-detail-row {
        width: 100%;
        margin: 0 0 9px;
        display: block !important;
        overflow: hidden;
        background: #fff;
        border: 1px solid #d8e4ea;
        border-top: 2px solid #1993c6;
        border-radius: 0 0 11px 11px;
    }
    .procurement-report-table tbody .repair-kit-assembly-detail-row[hidden] { display: none !important; }
    .procurement-report-table tbody .repair-kit-assembly-detail-row > td {
        width: 100% !important;
        padding: 0 !important;
        display: block !important;
        overflow: hidden;
        border: 0;
    }
    .repair-kit-assembly-overview { min-height: 0; display: block; }
    .repair-kit-assembly-overview > header { width: auto; min-width: 0; padding: 12px; display: block; }
    .repair-kit-assembly-overview > header h3 { font-size: 14px; white-space: normal; }
    .repair-kit-assembly-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .repair-kit-assembly-summary > span { min-width: 0; min-height: 62px; padding: 10px 12px; }
    .repair-kit-assembly-summary > .repair-kit-target-summary { min-width: 0; }
    .repair-kit-assembly-summary > span::before { top: 0; bottom: 0; height: auto; transform: none; }
    .repair-kit-assembly-components { padding: 8px; background: #f2f5f7; }
    .repair-kit-assembly-component.is-heading { display: none; }
    .repair-kit-assembly-component {
        margin-bottom: 7px;
        min-height: 0;
        padding: 9px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        background: #fff;
        border: 1px solid #e0e7ec;
        border-radius: 8px;
    }
    .repair-kit-assembly-component > span { padding: 0; border: 0 !important; }
    .repair-kit-assembly-component > span:first-child { grid-column: 1 / -1; padding-bottom: 6px; border-bottom: 1px solid #edf1f4 !important; }
    .repair-kit-assembly-component strong { white-space: normal; }
    .repair-kit-assembly-component > .repair-kit-assembly-metric {
        min-height: 49px;
        padding: 7px 8px;
        display: grid;
        grid-template-columns: auto 1fr;
        align-content: center;
        align-items: baseline;
        column-gap: 4px;
        background: #f8fafb;
        border-radius: 6px;
    }
    .repair-kit-assembly-component > .repair-kit-assembly-metric::before {
        grid-column: 1 / -1;
        margin-bottom: 3px;
        color: #718293;
        content: attr(data-mobile-label);
        font-size: 9px;
        font-weight: 500;
        line-height: 1.15;
        letter-spacing: .02em;
    }
    .repair-kit-assembly-component > .repair-kit-assembly-metric strong {
        color: #19364d;
        font-size: 13px;
        font-weight: 500;
        line-height: 1.2;
    }
    .repair-kit-assembly-component > .repair-kit-assembly-metric > small {
        margin: 0;
        color: #8493a1;
        font-size: 9px;
        line-height: 1.2;
    }
    .repair-kit-assembly-component > .repair-kit-assembly-deficit {
        background: #edf9f4;
    }
    .repair-kit-assembly-component.is-shortage > .repair-kit-assembly-deficit {
        background: #fff1f2;
    }
    .repair-kit-assembly-component > .repair-kit-assembly-deficit strong {
        color: #0b7b54;
    }
    .repair-kit-assembly-component.is-shortage > .repair-kit-assembly-deficit strong {
        color: #c33b46;
    }
    .repair-kit-assembly-component > .repair-kit-assembly-deficit > small {
        grid-column: 1 / -1;
        margin-top: 3px;
        color: #5f8175;
    }
    .repair-kit-assembly-component.is-shortage > .repair-kit-assembly-deficit > small {
        color: #a65d63;
    }

    /* RK procurement uses the same compact card language. */
    .rk-procurement-scroll { max-height: 70dvh; padding: 8px; background: #f2f5f7; }
    .rk-procurement-table,
    .rk-procurement-table tbody { width: 100% !important; min-width: 0 !important; display: block !important; }
    .rk-procurement-table colgroup,
    .rk-procurement-table thead { display: none !important; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] {
        position: relative;
        width: 100%;
        margin: 0 0 9px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        background: #fff;
        border: 1px solid #dce4ea;
        border-radius: 11px;
        box-shadow: 0 2px 8px rgba(18, 42, 62, .045);
    }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td {
        min-width: 0;
        min-height: 48px;
        height: auto;
        padding: 8px 10px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible;
        color: #173148;
        background: #fff;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        font-size: 12px;
        line-height: 1.35;
        text-align: left !important;
        white-space: normal;
    }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td::before {
        margin-bottom: 4px;
        display: block;
        color: #7a8897;
        font-size: 8px;
        font-weight: 500;
        letter-spacing: .035em;
        text-transform: uppercase;
    }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(1) { position: absolute; z-index: 3; top: 10px; right: 10px; width: 34px; min-height: 34px; padding: 0; border: 0; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(2) { grid-column: 1 / -1; min-height: 62px; padding-right: 54px; font-size: 13.5px; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(2)::before { content: "Наименование"; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(3)::before { content: "Бренд"; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(4)::before { content: "Составы RK"; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(5)::before { content: "Статус"; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(6)::before { content: "Требуется, шт."; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(7)::before { content: "Остаток, шт."; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(8)::before { content: "В пути, шт."; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(9)::before { content: "В заявках, шт."; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(10)::before { content: "К закупке, шт."; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(11)::before { content: "К закупке, кг"; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(12)::before { content: "Ящ. норма, шт."; }
    .rk-procurement-table tbody tr[data-rk-procurement-row] > td:nth-child(even):not(:nth-child(2)) { border-right: 0; }
    .rk-procurement-table .rk-add-cell > button { width: 34px; height: 34px; }
    .rk-procurement-table .rk-status-cell { flex-direction: row !important; align-items: center !important; justify-content: flex-start !important; flex-wrap: wrap; gap: 5px; }
    .rk-procurement-table .rk-status-cell::before { width: 100%; }
    .rk-procurement-table .rk-to-purchase { background: #eef8fc !important; font-size: 13px !important; }

    /* RK composition: catalogue first, editor second, both scroll locally. */
    .repair-kit-purchase-workspace { height: auto; display: flex; flex-direction: column; gap: 10px; }
    .repair-kit-catalog { height: min(42dvh, 390px); max-height: 390px; margin: 0; flex: 0 0 auto; }
    .repair-kit-catalog > header { min-height: 58px; padding: 10px 12px; }
    .repair-kit-catalog > header h2 { font-size: 17px; }
    .repair-kit-catalog-controls { margin: 8px; }
    .repair-kit-list-search input { height: 44px; font-size: 15px; }
    .repair-kit-list-filters { grid-template-columns: 1fr 1fr; }
    .repair-kit-list-filters select { height: 42px; font-size: 14px; }
    .repair-kit-empty-filter { grid-column: 1 / -1; min-height: 40px; }
    .repair-kit-list-item { min-height: 58px; padding: 8px 10px; }
    .repair-kit-list-copy strong { font-size: 12px; }
    .repair-kit-list-meta em { font-size: 10px; }
    .repair-kit-composer { min-height: 460px; }
    .repair-kit-composer-header { min-height: 66px; padding: 11px 12px; }
    .repair-kit-composer-header h2 { font-size: 17px; }
    .repair-kit-add-panel { padding: 10px; }
    .repair-kit-add-panel form { grid-template-columns: minmax(0, 1fr) 92px; gap: 7px; }
    .repair-kit-add-panel input { height: 44px; font-size: 15px; }
    .repair-kit-add-panel .primary-button { grid-column: 1 / -1; height: 44px; font-size: 11px; }
    .repair-kit-search-results {
        position: fixed;
        z-index: 1000;
        top: 116px;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 62dvh;
        overflow: auto;
        border-radius: 12px;
        box-shadow: 0 20px 58px rgba(12,26,41,.25);
    }
    .repair-kit-search-columns { display: none; }
    .repair-kit-search-result {
        min-width: 0;
        padding: 11px;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .repair-kit-search-result > span:first-child,
    .repair-kit-search-result > b { grid-column: 1 / -1; }
    .repair-kit-search-result > span:first-child strong { font-size: 13px; }
    .repair-kit-search-result > b { font-size: 10px; }
    .repair-kit-search-result > i { padding: 7px; background: #f5f7f9; border-radius: 6px; font-size: 11px; text-align: left; }
    .repair-kit-search-result > i::before { margin-bottom: 2px; display: block; color: #7b8997; font-size: 7.5px; text-transform: uppercase; }
    .repair-kit-search-result > i:nth-of-type(1)::before { content: "Остаток"; }
    .repair-kit-search-result > i:nth-of-type(2)::before { content: "В пути"; }
    .repair-kit-search-result > i:nth-of-type(3)::before { content: "В заявках"; }
    .repair-kit-composition-table-wrap { max-height: 55dvh; padding: 8px; background: #f2f5f7; }
    .repair-kit-composition-table,
    .repair-kit-composition-table tbody { width: 100%; min-width: 0 !important; display: block; }
    .repair-kit-composition-table thead { display: none; }
    .repair-kit-composition-table tbody tr {
        position: relative;
        width: 100%;
        margin-bottom: 9px;
        padding-bottom: 38px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        background: #fff;
        border: 1px solid #dce4ea;
        border-radius: 11px;
    }
    .repair-kit-composition-table tbody td {
        min-width: 0;
        min-height: 48px;
        height: auto;
        padding: 8px 10px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible !important;
        background: #fff !important;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        font-size: 12px;
        text-align: left !important;
        white-space: normal;
    }
    .repair-kit-composition-table tbody td::before { margin-bottom: 4px; color: #7a8897; font-size: 8px; letter-spacing: .035em; text-transform: uppercase; }
    .repair-kit-composition-table tbody td:nth-child(1) { grid-column: 1 / -1; min-height: 60px; border-right: 0; }
    .repair-kit-composition-table tbody td:nth-child(1)::before { content: "Название"; }
    .repair-kit-composition-table tbody td:nth-child(2)::before { content: "Бренд"; }
    .repair-kit-composition-table tbody td:nth-child(3)::before { content: "Количество, шт."; }
    .repair-kit-composition-table tbody td:nth-child(4)::before { content: "Остаток, шт."; }
    .repair-kit-composition-table tbody td:nth-child(5)::before { content: "В пути, шт."; }
    .repair-kit-composition-table tbody td:nth-child(6)::before { content: "В заявках, шт."; }
    .repair-kit-composition-table tbody td:nth-child(even):not(:last-child) { border-right: 0; }
    .repair-kit-composition-table tbody td:last-child {
        position: absolute;
        right: 4px;
        bottom: 4px;
        width: 34px;
        min-height: 34px;
        padding: 0;
        align-items: center;
        border: 0;
    }
    .repair-kit-composition-table .repair-kit-component-name-line strong { font-size: 13.5px; white-space: normal; }

    /* Data completion tasks stay one tap away without six full-width rows. */
    .data-completion-overview {
        margin: 0 calc(-1 * var(--mobile-gutter)) 10px;
        padding: 0 var(--mobile-gutter) 5px;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }
    .data-completion-overview::-webkit-scrollbar { display: none; }
    .data-completion-card { min-width: min(78vw, 290px); min-height: 76px; flex: 0 0 min(78vw, 290px); scroll-snap-align: start; }
    .data-completion-panel-header { min-height: 0; padding: 12px; align-items: stretch; flex-direction: column; }
    .data-completion-panel-header .primary-button { width: 100%; }
    .data-completion-toolbar { min-height: 0; padding: 10px; align-items: stretch; flex-direction: column; }
    .data-completion-toolbar label { width: 100%; min-width: 0; }
    .data-completion-toolbar input { height: 44px; font-size: 15px; }
    .data-completion-toolbar .secondary-button { height: 42px; }
    .data-completion-table-wrap { height: min(65dvh, 610px); max-height: none; }
    .data-completion-table thead { top: 0; }
    .data-completion-pagination { align-items: flex-start; flex-direction: column; }

    /* Control centre: readable sections instead of a squeezed desktop grid. */
    .control-center-lab-shell { padding: 10px var(--mobile-gutter) 24px; }
    .decision-page-head { min-height: 56px; margin-bottom: 10px; align-items: flex-end; gap: 10px; }
    .decision-page-head h1 { font-size: 24px; }
    .decision-page-head form { flex: 0 0 138px; }
    .lab-period-control { height: 44px; }
    .control-center-live-shell .control-center-main-stage,
    .lab-command, .lab-stream, .lab-terminal {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
    }
    .control-center-live-shell .lab-stream-refined { display: flex; flex-direction: column; gap: 10px; background: transparent; }
    .control-center-live-shell .decision-feed { min-height: 0; border: 0; }
    .control-center-live-shell .decision-feed-scroll { overflow: visible; background: transparent; }
    .control-center-live-shell .decision-group-primary {
        height: auto;
        flex: 0 0 auto;
        overflow: visible;
    }
    .control-center-live-shell .decision-group-primary .decision-row { min-height: 68px; flex-basis: 68px; }
    .decision-row { padding: 7px 9px; grid-template-columns: 4px minmax(0, 1fr) auto 12px; gap: 7px; }
    .decision-row-copy strong { font-size: 9.5px; }
    .decision-row-copy em { font-size: 7.5px; }
    .decision-row-value b { font-size: 13px; }
    .decision-row-open { font-size: 0; }
    .control-center-live-shell .decision-feed-rk {
        height: auto;
        min-height: 0;
        max-height: none;
        margin-top: 10px;
        flex: 0 0 auto;
    }
    .control-center-live-shell .decision-rk-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .control-center-live-shell .decision-rk-summary > span { min-height: 54px; padding: 9px 10px; }
    .control-center-live-shell .decision-rk-list > a {
        min-height: 48px;
        grid-template-columns: 3px minmax(0, 1fr) 58px 58px;
        padding-inline: 10px;
    }
    .control-center-live-shell .decision-context { min-height: 0; display: flex; flex-direction: column; gap: 10px; background: transparent; }
    .control-center-live-shell .decision-context > section { height: auto !important; min-height: 0; max-height: none; flex: 0 0 auto; }
    .control-center-live-shell .decision-context-trend { height: 250px !important; }
    .control-center-live-shell .decision-context .lab-chart { height: 250px; }
    .control-center-live-shell .decision-context-requests,
    .control-center-live-shell .decision-context-quality { max-height: 430px; overflow: hidden; }
    .control-center-live-shell .decision-request-list,
    .control-center-live-shell .decision-quality-list { max-height: 330px; overflow-y: auto; }

    /* Forms, settings, users and dialogs. */
    .settings-grid, .security-grid, .user-admin-layout, .users-layout { grid-template-columns: 1fr; }
    .permission-section-list, .permission-readonly-grid { grid-template-columns: 1fr; }
    .permission-form-toolbar { align-items: flex-start; flex-direction: column; }
    .permission-form-toolbar > div:last-child { width: 100%; }
    .permission-form-toolbar button { min-height: 36px; flex: 1; }
    .system-settings-panel-head { min-height: 0; }
    .delivery-settings-form { padding-inline: 12px; overflow: visible; }
    .delivery-settings-list, .delivery-settings-actions { width: 100%; }
    .delivery-setting-row {
        min-width: 0;
        min-height: 62px;
        padding: 8px 0;
        grid-template-columns: minmax(76px, 1fr) 82px 12px 96px;
        gap: 5px;
    }
    .delivery-setting-name strong { font-size: 12px; }
    .delivery-setting-name small { font-size: 8.5px; }
    .delivery-setting-source { font-size: 9px; }
    .delivery-rule-input { height: 38px; }
    .delivery-rule-input input { min-width: 0; font-size: 16px; }
    .delivery-settings-actions { align-items: stretch; flex-direction: column; gap: 7px; }
    .delivery-settings-actions .primary-button { width: 100%; min-height: 42px; }
    dialog:not(.report-period-menu),
    .user-create-dialog,
    .action-confirm-dialog,
    .request-duplicate-dialog,
    .rk-request-dialog,
    .report-request-popover[data-request-add-dialog] {
        width: calc(100vw - 16px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 16px) !important;
        margin: auto !important;
        border-radius: 14px !important;
    }
    .action-confirm-card, .request-duplicate-dialog-card { padding: 22px 18px; }
    .action-confirm-actions { align-items: stretch; flex-direction: column-reverse; }
    .action-confirm-actions button { min-height: 44px; }
    .user-create-form > header { min-height: 62px; padding: 12px; }
    .user-create-fields { padding: 12px; grid-template-columns: 1fr; }
    .user-create-fields input { height: 44px; font-size: 16px; }
    .create-permission-sections { padding: 0 12px 14px; }

    /* Authentication also fits small and short screens. */
    .login-page { min-height: 100dvh; padding: 14px 12px; }
    .login-card { width: min(100%, 440px); padding: 24px 20px 22px; border-radius: 15px; }
    .login-card-top { padding-bottom: 18px; }
    .login-heading { margin: 22px 0 18px; }
    .login-heading h1 { font-size: 27px; }
    .field-wrap input { height: 50px; font-size: 16px; }
    .login-submit { min-height: 50px; }
}

/*
 * Mobile width contract.
 *
 * This late override keeps desktop on the dense workspace,
 * while every viewport up to 920px gets a vertical, single-screen-width UI.
 * Horizontal rails are replaced by wrapping controls and record cards.
 */
@media (max-width: 920px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
    }
    .app-layout,
    .workspace,
    .content-shell,
    .content-shell > *,
    .panel,
    .panel > *,
    form,
    fieldset {
        min-width: 0;
        max-width: 100%;
    }
    img,
    canvas,
    video,
    iframe { max-width: 100%; }
    pre,
    code,
    .document-cell,
    .item-identity,
    .item-identity > div,
    .supplier-order-identity,
    .supplier-order-details { overflow-wrap: anywhere; }

    /* Controls wrap inside the viewport instead of becoming swipe rails. */
    .catalog-filter-switcher {
        width: 100%;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        overflow: visible;
        scroll-snap-type: none;
    }
    .catalog-filter-trigger {
        width: 100%;
        min-width: 0;
        max-width: none;
        flex: none;
    }
    .table-tabs {
        width: 100%;
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        overflow: visible !important;
    }
    .table-tabs > a,
    .table-tabs > button {
        min-width: 0;
        min-height: 40px;
        flex: 1 1 132px;
        justify-content: center;
        white-space: normal;
        text-align: center;
    }
    .shipment-board {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        overflow: visible;
    }
    .procurement-flow {
        width: 100%;
        padding: 10px;
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        overflow: hidden;
    }
    .procurement-flow > b { transform: rotate(90deg); }
    .data-completion-overview {
        width: 100%;
        margin: 0 0 10px;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
        scroll-snap-type: none;
    }
    .data-completion-card {
        width: 100%;
        min-width: 0;
        min-height: 82px;
        max-width: none;
        flex: none;
    }
    .pagination,
    .pagination > div,
    .data-completion-pagination,
    .data-completion-pagination > div {
        max-width: 100%;
        flex-wrap: wrap;
        gap: 7px;
    }
    .pagination a,
    .data-completion-pagination a { min-height: 40px; display: inline-flex; align-items: center; }

    /* No component is allowed to expose a sideways scroll area on phones. */
    .data-table-scroll,
    .compact-table-wrap,
    .request-table-wrap,
    .data-completion-table-wrap,
    .procurement-task-table-wrap,
    .supplier-order-composition-scroll,
    .supplier-order-lines,
    .supplier-order-scroll,
    .request-board-shell,
    .shipment-board {
        max-width: 100%;
        overflow-x: hidden !important;
        overscroll-behavior-x: none;
        touch-action: pan-y;
    }
    .repair-kit-search-results { overflow-x: hidden !important; overflow-y: auto !important; }
    .repair-kit-search-result,
    .repair-kit-search-result > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

    /* Standard data tables become compact two-column record cards. */
    .data-table:not(.procurement-report-table):not(.rk-procurement-table),
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block;
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) thead,
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) colgroup { display: none; }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody {
        padding: 8px;
        display: grid;
        gap: 9px;
        background: #f3f6f8;
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody tr {
        position: relative;
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        background: #fff;
        border: 1px solid #dfe6eb;
        border-radius: 10px;
        box-shadow: 0 2px 7px rgba(18, 39, 57, .035);
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td,
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td:nth-child(n) {
        width: auto;
        min-width: 0;
        min-height: 53px;
        height: auto;
        padding: 9px 10px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible;
        color: #3f4f62;
        background: #fff;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        font-size: 12px;
        line-height: 1.35;
        text-align: left;
        text-overflow: clip;
        white-space: normal;
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td:nth-child(even) { border-right: 0; }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td::before {
        margin-bottom: 5px;
        display: block;
        color: #7c8998;
        font-size: 8px;
        font-weight: 550;
        letter-spacing: .045em;
        line-height: 1.2;
        text-transform: uppercase;
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td.numeric { text-align: left; }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td[colspan] {
        grid-column: 1 / -1;
        border-right: 0;
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) .item-identity,
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) .document-cell {
        grid-column: 1 / -1;
        padding-right: 48px;
        border-right: 0;
    }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) .item-identity strong,
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) .item-identity span,
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) .document-cell strong,
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) .document-cell span {
        max-width: 100%;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    /* Inventory. */
    .inventory-data-table td:nth-child(1)::before { content: "Товар"; }
    .inventory-data-table td:nth-child(2)::before { content: "Артикул поставщика"; }
    .inventory-data-table td:nth-child(3)::before { content: "В наличии"; }
    .inventory-data-table td:nth-child(4)::before { content: "Доступно"; }
    .inventory-data-table td:nth-child(5)::before { content: "Резерв"; }
    .inventory-data-table td:nth-child(6)::before { content: "В пути"; }
    .inventory-data-table td:nth-child(7)::before { content: "Себестоимость"; }
    .inventory-data-table td:last-child:not([colspan]),
    .planning-data-table td:last-child:not([colspan]),
    .policy-table td:last-child:not([colspan]),
    .purchase-orders-table td:last-child:not([colspan]),
    .requirements-table td:last-child:not([colspan]) {
        position: absolute;
        top: 7px;
        right: 7px;
        width: 38px !important;
        min-height: 38px !important;
        padding: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        border: 0 !important;
        background: transparent !important;
    }
    .inventory-data-table td:last-child:not([colspan])::before,
    .planning-data-table td:last-child:not([colspan])::before,
    .policy-table td:last-child:not([colspan])::before,
    .purchase-orders-table td:last-child:not([colspan])::before,
    .requirements-table td:last-child:not([colspan])::before { display: none !important; content: none; }

    /* Planning workspace. */
    .planning-data-table td:nth-child(1)::before { content: "Товар"; }
    .planning-data-table td:nth-child(2)::before { content: "Состояние"; }
    .planning-data-table td:nth-child(3)::before { content: "Остаток"; }
    .planning-data-table td:nth-child(4)::before { content: "В пути"; }
    .planning-data-table td:nth-child(5)::before { content: "Позиция"; }
    .planning-data-table td:nth-child(6)::before { content: "Расход в день"; }
    .planning-data-table td:nth-child(7)::before { content: "Покрытие"; }
    .planning-data-table td:nth-child(8)::before { content: "Заказать до"; }
    .planning-data-table td:nth-child(9)::before { content: "Ящ. норма, шт."; }
    .planning-data-table td:nth-child(10)::before { content: "Срок"; }
    .planning-data-table td:nth-child(11)::before { content: "Рекомендация"; }

    /* Stock policies. */
    .policy-table td:nth-child(1)::before { content: "Товар"; }
    .policy-table td:nth-child(2)::before { content: "Статус"; }
    .policy-table td:nth-child(3)::before { content: "Режим"; }
    .policy-table td:nth-child(4)::before { content: "Поставщик"; }
    .policy-table td:nth-child(5)::before { content: "Срок"; }
    .policy-table td:nth-child(6)::before { content: "Страховой запас"; }
    .policy-table td:nth-child(7)::before { content: "MOQ"; }
    .policy-table td:nth-child(8)::before { content: "Ящ. норма, шт."; }
    .policy-table td[colspan]::before { content: "Параметры планирования"; }
    .policy-table td[colspan] + td::before { content: "Ящ. норма, шт."; }

    /* Orders, requirements, analytics, snapshots and security. */
    .purchase-orders-table td:nth-child(1)::before { content: "Заказ"; }
    .purchase-orders-table td:nth-child(2)::before { content: "Поставщик"; }
    .purchase-orders-table td:nth-child(3)::before { content: "Сумма"; }
    .purchase-orders-table td:nth-child(4)::before { content: "Статус"; }
    .purchase-orders-table td:nth-child(5)::before { content: "Ожидается"; }
    .purchase-orders-table td:nth-child(6)::before { content: "Выполнение"; }
    .requirements-table td:nth-child(1)::before { content: "Потребность"; }
    .requirements-table td:nth-child(2)::before { content: "Инициатор"; }
    .requirements-table td:nth-child(3)::before { content: "Сумма"; }
    .requirements-table td:nth-child(4)::before { content: "Статус"; }
    .requirements-table td:nth-child(5)::before { content: "Срок"; }
    .analytics-suppliers-table td:nth-child(1)::before { content: "Поставщик"; }
    .analytics-suppliers-table td:nth-child(2)::before { content: "Категория"; }
    .analytics-suppliers-table td:nth-child(3)::before { content: "Расходы"; }
    .analytics-suppliers-table td:nth-child(4)::before { content: "OTD"; }
    .analytics-suppliers-table td:nth-child(5)::before { content: "Рейтинг"; }
    .analytics-suppliers-table td:nth-child(6)::before { content: "Риск"; }
    .planning-history-table td:nth-child(1)::before { content: "Дата"; }
    .planning-history-table td:nth-child(2)::before { content: "В наличии"; }
    .planning-history-table td:nth-child(3)::before { content: "Доступно"; }
    .planning-history-table td:nth-child(4)::before { content: "Резерв"; }
    .planning-history-table td:nth-child(5)::before { content: "В пути"; }
    .planning-history-table td:nth-child(6)::before { content: "Расход"; }
    .planning-history-table td:nth-child(7)::before { content: "Себестоимость"; }
    .security-events-table td:nth-child(1)::before { content: "Время"; }
    .security-events-table td:nth-child(2)::before { content: "Событие"; }
    .security-events-table td:nth-child(3)::before { content: "Пользователь"; }
    .security-events-table td:nth-child(4)::before { content: "IP-адрес"; }
    .security-events-table td:nth-child(5)::before { content: "Путь"; }
    .analytics-suppliers-table td:first-child,
    .planning-history-table td:first-child,
    .security-events-table td:first-child { grid-column: 1 / -1; border-right: 0; }

    /* Purchase request lines. */
    .request-table,
    .request-table tbody {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block;
    }
    .request-table thead { display: none; }
    .request-table tbody { padding: 8px; display: grid; gap: 9px; background: #f2f5f7; }
    .request-table tbody tr {
        position: relative;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        background: #fff;
        border: 1px solid #dce5eb;
        border-radius: 10px;
    }
    .request-table tbody td,
    .request-table tbody td:nth-child(n) {
        width: auto;
        min-width: 0;
        min-height: 54px;
        height: auto;
        padding: 9px 10px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible;
        background: #fff;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        text-align: left;
        white-space: normal;
    }
    .request-table tbody td:nth-child(even) { border-right: 0; }
    .request-table tbody td::before {
        margin-bottom: 5px;
        color: #788696;
        font-size: 8px;
        letter-spacing: .04em;
        text-transform: uppercase;
    }
    .request-table tbody td:nth-child(1) { grid-column: 1 / -1; min-height: 62px; border-right: 0; }
    .request-table tbody td:nth-child(1)::before { content: "Подшипник"; }
    .request-table tbody td:nth-child(2)::before { content: "Бренд"; }
    .request-table tbody td:nth-child(3)::before { content: "В заявке"; }
    .request-table tbody td:nth-child(4)::before { content: "Продано"; }
    .request-table tbody td:nth-child(5)::before { content: "В наличии"; }
    .request-table tbody td:nth-child(6)::before { content: "В пути"; }
    .request-table tbody td:nth-child(7)::before { content: "Вес итого"; }
    .request-table .request-product-cell strong { max-width: 100%; overflow: visible; white-space: normal; }
    .request-table .request-period-column,
    .request-table td.request-period-column { background: var(--request-period-cell) !important; }
    .request-quantity-editor,
    .request-quantity-form { width: 100%; max-width: 100%; }

    /* Data-quality queues. */
    .data-completion-table,
    .data-completion-table tbody,
    .procurement-task-table,
    .procurement-task-table tbody {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block;
    }
    .data-completion-table thead,
    .procurement-task-table thead { display: none; }
    .data-completion-table tbody,
    .procurement-task-table tbody {
        padding: 8px;
        display: grid;
        gap: 9px;
        background: #f2f5f7;
    }
    .data-completion-table tbody tr,
    .procurement-task-table tbody tr {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        background: #fff;
        border: 1px solid #dfe6eb;
        border-radius: 10px;
    }
    .data-completion-table tbody td,
    .procurement-task-table tbody td,
    .data-completion-table tbody td:nth-child(n),
    .procurement-task-table tbody td:nth-child(n) {
        width: auto;
        min-width: 0;
        min-height: 53px;
        height: auto;
        padding: 9px 10px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible;
        background: #fff;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        font-size: 12px;
        line-height: 1.35;
        text-align: left;
        text-overflow: clip;
        white-space: normal;
    }
    .data-completion-table tbody td:nth-child(even),
    .procurement-task-table tbody td:nth-child(even) { border-right: 0; }
    .data-completion-table tbody td::before,
    .procurement-task-table tbody td::before {
        margin-bottom: 5px;
        display: block;
        color: #7c8998;
        font-size: 8px;
        font-weight: 550;
        letter-spacing: .04em;
        text-transform: uppercase;
    }
    .data-completion-table .numeric { text-align: left; }
    .data-completion-table td[colspan],
    .procurement-task-table td[colspan] { grid-column: 1 / -1; border-right: 0; }

    .data-completion-table.is-create-pv td:nth-child(1)::before,
    .procurement-task-table.is-create-pv td:nth-child(1)::before { content: "ГОСТ"; }
    .data-completion-table.is-create-pv td:nth-child(2)::before,
    .procurement-task-table.is-create-pv td:nth-child(2)::before { content: "Разделы 1С"; }
    .data-completion-table.is-create-pv td:nth-child(3)::before,
    .procurement-task-table.is-create-pv td:nth-child(3)::before { content: "Сторонние бренды"; }
    .data-completion-table.is-create-pv td:nth-child(4)::before,
    .procurement-task-table.is-create-pv td:nth-child(4)::before { content: "Позиций"; }
    .data-completion-table.is-create-pv td:nth-child(5)::before,
    .procurement-task-table.is-create-pv td:nth-child(5)::before { content: "Расход за историю"; }
    .data-completion-table.is-create-pv td:nth-child(6)::before,
    .procurement-task-table.is-create-pv td:nth-child(6)::before { content: "Пример товара"; }
    .data-completion-table.is-create-pv td:nth-child(7)::before,
    .procurement-task-table.is-create-pv td:nth-child(7)::before { content: "Что сделать"; }

    .data-completion-table.is-products td:nth-child(1) { grid-column: 1 / -1; border-right: 0; }
    .data-completion-table.is-products td:nth-child(1)::before { content: "Наименование"; }
    .data-completion-table.is-products td:nth-child(2)::before { content: "Артикул 1С"; }
    .data-completion-table.is-products td:nth-child(3)::before { content: "Бренд"; }
    .data-completion-table.is-products td:nth-child(4)::before { content: "Раздел 1С"; }
    .data-completion-table.is-products td:nth-child(5)::before { content: "ГОСТ"; }
    .data-completion-table.is-products td:nth-child(6)::before { content: "FOB"; }
    .data-completion-table.is-products td:nth-child(7)::before { content: "Вес, кг"; }
    .data-completion-table.is-products td:nth-child(8)::before { content: "Ящ. норма"; }
    .data-completion-table.is-products td:nth-child(9)::before { content: "Продажи"; }
    .data-completion-table.is-products td:nth-child(10)::before { content: "Остаток"; }
    .data-completion-table.is-products td:nth-child(11)::before { content: "В пути"; }
    .data-completion-table.is-products td:nth-child(12)::before { content: "Потребность"; }
    .data-completion-table.is-products td:nth-child(13)::before { content: "Что сделать"; }
    .data-completion-table.is-products td:nth-child(13) { grid-column: 1 / -1; border-right: 0; }

    .data-completion-table.is-supplier-orders td:nth-child(1)::before { content: "Заказ поставщику"; }
    .data-completion-table.is-supplier-orders td:nth-child(2)::before { content: "Статус"; }
    .data-completion-table.is-overdue-orders td:nth-child(2)::before { content: "Поставщик"; }
    .data-completion-table.is-overdue-orders td:nth-child(3)::before { content: "Статус"; }
    .data-completion-table.is-overdue-orders td:nth-child(4)::before { content: "Расчётная дата"; }
    .data-completion-table.is-overdue-orders td:nth-child(5)::before { content: "В пути, шт."; }

    .procurement-task-table.is-missing-gost td:nth-child(1)::before { content: "Артикул 1С"; }
    .procurement-task-table.is-missing-gost td:nth-child(2)::before { content: "Наименование"; }
    .procurement-task-table.is-missing-gost td:nth-child(3)::before { content: "Раздел 1С"; }
    .procurement-task-table.is-missing-gost td:nth-child(4)::before { content: "Бренд"; }
    .procurement-task-table.is-missing-gost td:nth-child(5)::before { content: "Расход за историю"; }
    .procurement-task-table.is-missing-gost td:nth-child(6)::before { content: "Действие"; }
    .procurement-task-table.gost-missing-table td:nth-child(1) { grid-column: 1 / -1; border-right: 0; }
    .procurement-task-table.gost-missing-table td:nth-child(1)::before { content: "Позиция"; }
    .procurement-task-table.gost-missing-table td:nth-child(2)::before { content: "Артикул 1С"; }
    .procurement-task-table.gost-missing-table td:nth-child(3)::before { content: "Раздел 1С"; }
    .procurement-task-table.gost-missing-table td:nth-child(4)::before { content: "FOB"; }
    .procurement-task-table.gost-missing-table td:nth-child(5)::before { content: "Расход за историю"; }
    .procurement-task-table.gost-missing-table td:nth-child(6)::before { content: "Продано за период"; }
    .procurement-task-table.gost-missing-table td:nth-child(7)::before { content: "Остаток"; }
    .procurement-task-table.gost-missing-table td:nth-child(8)::before { content: "В пути"; }
    .procurement-task-table.gost-missing-table td:nth-child(9)::before { content: "Действие"; }

    .procurement-task-tabs,
    .gost-missing-context { grid-template-columns: minmax(0, 1fr); }
    .procurement-task-toolbar,
    .procurement-task-toolbar-actions {
        width: 100%;
        min-width: 0;
        align-items: stretch;
        flex-direction: column;
    }
    .procurement-task-toolbar label,
    .procurement-task-toolbar-actions .primary-button { width: 100%; min-width: 0; }

    /* Supplier orders: vertical line cards and a card-based composition. */
    .supplier-order-lines { border: 0; background: transparent; }
    .supplier-order-line,
    .supplier-order-line:nth-child(n) {
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin-top: 7px;
        padding: 10px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 12px;
        align-items: start;
        background: #fff;
        border: 1px solid #e2e8ed;
        border-radius: 8px;
    }
    .supplier-order-line.is-heading { display: none; }
    .supplier-order-line > span:first-child { grid-column: 1 / -1; }
    .supplier-order-line > span:nth-child(2)::before { content: "Количество"; }
    .supplier-order-line > span:nth-child(3)::before { content: "FOB"; }
    .supplier-order-line > span:nth-child(n+2)::before {
        margin-bottom: 3px;
        display: block;
        color: #8592a0;
        font-size: 7.5px;
        text-transform: uppercase;
    }
    .supplier-order-composition-table,
    .supplier-order-composition-table tbody {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block;
    }
    .supplier-order-composition-table thead { display: none; }
    .supplier-order-composition-table tbody { padding: 8px; display: grid; gap: 9px; background: #f3f6f8; }
    .supplier-order-composition-table tbody tr {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        background: #fff;
        border: 1px solid #dde5eb;
        border-radius: 10px;
    }
    .supplier-order-composition-table tbody td,
    .supplier-order-composition-table tbody td:nth-child(n) {
        width: auto;
        min-width: 0;
        min-height: 55px;
        height: auto;
        padding: 9px 10px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        overflow: visible;
        background: #fff;
        border: 0;
        border-right: 1px solid #edf1f4;
        border-bottom: 1px solid #edf1f4;
        font-size: 11px;
        white-space: normal;
    }
    .supplier-order-composition-table tbody td:nth-child(even) { border-right: 0; }
    .supplier-order-composition-table tbody td::before {
        margin-bottom: 5px;
        color: #7d8997;
        font-size: 8px;
        letter-spacing: .04em;
        text-transform: uppercase;
    }
    .supplier-order-composition-table tbody td:nth-child(1) { grid-column: 1 / -1; border-right: 0; }
    .supplier-order-composition-table tbody td:nth-child(1)::before { content: "Позиция из 1С"; }
    .supplier-order-composition-table tbody td:nth-child(2)::before { content: "Количество"; }
    .supplier-order-composition-table tbody td:nth-child(3)::before { content: "FOB"; }
    .supplier-order-composition-table tbody td:nth-child(4)::before { content: "Базовый расчёт"; }
    .supplier-order-composition-table tbody td:nth-child(5)::before { content: "Прогноз по статусу"; }
    .supplier-order-composition-table tbody td:nth-child(6)::before { content: "Рабочая дата"; }
    .supplier-order-composition-table tbody td:nth-child(7)::before { content: "Данные строки"; }
    .supplier-order-composition-table tbody td[colspan] { grid-column: 1 / -1; border-right: 0; }

    .supplier-order-detail-grid { grid-template-columns: minmax(0, 1fr); }
    .supplier-order-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .supplier-order-source-data { grid-template-columns: minmax(0, 1fr); }
    .supplier-order-detail-heading { align-items: stretch; flex-direction: column; }
    .supplier-order-detail-state { width: 100%; min-width: 0; }
    .supplier-order-composition-head { align-items: flex-start; flex-direction: column; gap: 5px; }
    .supplier-order-review-form,
    .supplier-order-detail-review { grid-template-columns: minmax(0, 1fr); }
    .supplier-order-review-form > div { max-width: 100%; flex-wrap: wrap; }
    .supplier-order-review-form button { min-height: 42px; flex: 1 1 190px; }

    /* Settings and remaining dense page grids. */
    .delivery-settings-grid { grid-template-columns: minmax(0, 1fr); }
    .status-lead-time-head,
    .status-lead-time-row {
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) minmax(58px, 74px) minmax(58px, 74px);
        gap: 4px;
    }
    .fob-lead-time-row { grid-template-columns: minmax(0, 1fr) minmax(82px, 102px); }
    .lead-time-value-button,
    .lead-time-value-editor { min-width: 0; }
    .control-center-dashboard-grid,
    .control-center-dashboard-grid.is-full,
    .dashboard-grid,
    .dashboard-grid-primary,
    .dashboard-grid-secondary,
    .analytics-grid { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr) !important; }
    .control-center-dashboard-grid.is-full > *,
    .control-center-dashboard-grid.is-full .control-center-actions,
    .control-center-dashboard-grid.is-full .control-center-requests,
    .control-center-dashboard-grid.is-full .control-center-repair-kits,
    .control-center-dashboard-grid.is-full .control-center-data-quality,
    .control-center-dashboard-grid.is-full .control-center-demand-chart {
        min-width: 0;
        grid-column: 1 !important;
        grid-row: auto !important;
    }
    .control-center-demand-chart-summary { min-width: 0 !important; flex-wrap: wrap; }
    .chart-canvas,
    .control-center-demand-chart-canvas { overflow: hidden; }
}

@media (max-width: 560px) {
    .data-completion-overview { grid-template-columns: minmax(0, 1fr); }
    .supplier-order-filters { grid-template-columns: minmax(0, 1fr); }
    .supplier-order-search { grid-column: 1; }
    .supplier-order-detail-data { grid-template-columns: minmax(0, 1fr); }
    .supplier-order-detail-data > div,
    .supplier-order-detail-data > div:nth-child(n) { border-left: 0; }
}

@media (max-width: 390px) {
    .catalog-filter-switcher { grid-template-columns: minmax(0, 1fr); }
    .catalog-filter-trigger { min-width: 0; flex-basis: auto; }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody tr,
    .request-table tbody tr,
    .data-completion-table tbody tr,
    .procurement-task-table tbody tr,
    .supplier-order-composition-table tbody tr { grid-template-columns: minmax(0, 1fr); }
    .data-table:not(.procurement-report-table):not(.rk-procurement-table) tbody td,
    .request-table tbody td,
    .data-completion-table tbody td,
    .procurement-task-table tbody td,
    .supplier-order-composition-table tbody td { border-right: 0; }
    .supplier-order-detail-metrics { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
    :root { --mobile-gutter: 9px; }

    .topbar { padding-inline: 8px; }
    .breadcrumb strong { font-size: 12px; }
    .content-shell { padding-top: 10px; }
    .page-heading-row { align-items: stretch; flex-direction: column; }
    .page-heading-row h1 { font-size: 24px; }
    .page-heading-row p { display: none; }

    .report-period-dates { grid-template-columns: 1fr; }
    .catalog-filter-grid { grid-template-columns: 1fr; }
    .procurement-report-scroll { height: 68dvh; min-height: 400px; }
    .procurement-report-table { min-width: 1040px; }

    .request-heading-actions { grid-template-columns: 1fr; }
    .request-archive-link { width: 100%; }
    .request-create-form { grid-template-columns: 1fr; gap: 7px; }
    .request-create-form .primary-button { width: 100%; }
    .request-card-number-row { flex-direction: column; }
    .request-card-utilities { width: 100%; justify-content: flex-start; }

    .repair-kit-catalog { height: 46dvh; }
    .repair-kit-add-panel form { grid-template-columns: minmax(0, 1fr) 82px; }

    .decision-page-head { align-items: stretch; flex-direction: column; }
    .decision-page-head form { width: 100%; flex-basis: auto; }
    .decision-row { grid-template-columns: 4px minmax(0, 1fr) auto 12px; }
    .control-center-live-shell .decision-rk-summary { grid-template-columns: 1fr 1fr; }
    .control-center-live-shell .decision-rk-list > a { grid-template-columns: 3px minmax(0, 1fr) 54px 54px; gap: 6px; }
    .control-center-live-shell .decision-context-trend,
    .control-center-live-shell .decision-context .lab-chart { height: 225px !important; }
    .lab-chart-values { gap: 8px; }
    .lab-chart-values span { min-width: 0; }

    .login-security { padding-inline: 8px; font-size: 8px; }
    .login-page-footer { display: none; }
}

@media (max-width: 390px) {
    .notification-button { display: none; }
    .catalog-filter-trigger { min-width: 142px; flex-basis: 142px; }
    .report-table-actions { grid-template-columns: 1fr 1fr; }
    .control-center-live-shell .decision-rk-summary { grid-template-columns: 1fr 1fr; }
}

/*
 * Mobile report interactions.
 * Kept at the end of the file so these rules win over the legacy compact-table
 * fallback without changing a single desktop breakpoint.
 */
@media (max-width: 920px) {
    /* Column filters use a centered native modal, never a clipped dropdown. */
    .mobile-report-column-dialog {
        position: fixed;
        z-index: 2100;
        inset: 0;
        width: calc(100% - 24px) !important;
        max-width: none !important;
        max-height: min(80dvh, 640px) !important;
        margin: auto !important;
        padding: 0;
        overflow: hidden;
        color: #15283a;
        background: #fff;
        border: 1px solid #cdd8e2;
        border-radius: 15px !important;
        box-shadow: 0 22px 70px rgba(7, 23, 38, .28);
    }
    .mobile-report-column-dialog::backdrop {
        background: rgba(9, 22, 35, .48);
        backdrop-filter: blur(1.5px);
    }
    .mobile-report-column-dialog > section {
        max-height: min(78dvh, 650px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .mobile-report-column-dialog > section > header {
        min-height: 62px;
        padding: 11px 12px 10px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex: 0 0 auto;
        background: #fff;
        border-bottom: 1px solid #e3e9ee;
    }
    .mobile-report-column-dialog > section > header > div {
        min-width: 0;
        display: grid;
        gap: 2px;
    }
    .mobile-report-column-dialog > section > header small {
        color: #168ab9;
        font-size: 8px;
        font-weight: 700;
        letter-spacing: .12em;
    }
    .mobile-report-column-dialog > section > header strong {
        overflow: hidden;
        color: #102b42;
        font-size: 16px;
        font-weight: 600;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-report-column-dialog > section > header button {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        color: #607387;
        background: #f3f6f8;
        border: 1px solid #dce4ea;
        border-radius: 10px;
        font-size: 23px;
        line-height: 1;
    }
    .mobile-report-column-dialog [data-mobile-column-dialog-body] {
        min-height: 0;
        padding: 10px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-report-column-dialog .report-column-popover,
    .mobile-report-column-dialog .report-column-popover-right {
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: none !important;
        display: block !important;
        overflow: visible !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .mobile-report-column-dialog .report-column-popover > header { display: none; }
    .mobile-report-column-dialog .report-column-sort-options {
        margin: 0 0 9px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }
    .mobile-report-column-dialog .report-column-sort-options a {
        min-height: 54px;
        padding: 9px 11px;
        display: grid;
        align-content: center;
        gap: 2px;
        background: #f4f7f9;
        border: 1px solid #e1e7ec;
        border-radius: 10px;
    }
    .mobile-report-column-dialog .report-column-sort-options a.is-active {
        color: #067bab;
        background: #edf8fc;
        border-color: #aadced;
    }
    .mobile-report-column-dialog .report-column-search {
        min-height: 44px;
        margin: 0 0 8px;
        padding: 0 12px;
        display: flex;
        align-items: center;
        gap: 8px;
        background: #f5f7f9;
        border: 1px solid #e0e6eb;
        border-radius: 10px;
    }
    .mobile-report-column-dialog .report-column-search input {
        width: 100%;
        min-width: 0;
        height: 42px;
        padding: 0;
        font-size: 16px;
        background: transparent;
        border: 0 !important;
        outline: 0;
        box-shadow: none !important;
    }
    .mobile-report-column-dialog .report-column-options {
        max-height: min(42dvh, 360px);
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 1px solid #e1e7ec;
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-report-column-dialog .report-column-options > label {
        min-height: 46px;
        padding: 8px 10px;
        display: flex;
        align-items: center;
        gap: 9px;
        font-size: 13px;
        border-bottom: 1px solid #edf1f4;
    }
    .mobile-report-column-dialog .report-column-options > label:last-of-type { border-bottom: 0; }
    .mobile-report-column-dialog .report-column-options input { width: 21px; height: 21px; flex: 0 0 auto; }
    .mobile-report-column-dialog .report-column-check {
        width: 21px;
        height: 21px;
        display: grid;
        border-radius: 6px;
    }
    .mobile-report-column-dialog .report-column-popover > footer {
        min-height: 48px;
        padding: 9px 0 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        background: #fff;
        border: 0;
    }
    .mobile-report-column-dialog .report-column-popover > footer button {
        min-height: 40px;
        padding: 0 12px;
        color: #41566a;
        background: #fff;
        border: 1px solid #d6dfe7;
        border-radius: 9px;
    }

    /* All report explanations become a bounded, scrollable bottom sheet. */
    .mobile-report-tooltip-backdrop {
        position: fixed;
        z-index: 1880;
        inset: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        background: rgba(9, 22, 35, .46);
        border: 0;
        backdrop-filter: blur(1.5px);
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
    }
    .global-report-tooltip-portal {
        position: fixed !important;
        z-index: 1900 !important;
        top: auto !important;
        right: 10px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        max-height: min(70dvh, 560px) !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column;
        overflow-x: hidden !important;
        overflow-y: hidden !important;
        overscroll-behavior: contain;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        border-radius: 14px !important;
        box-shadow: 0 20px 65px rgba(4, 15, 27, .38) !important;
        pointer-events: auto !important;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-report-tooltip-head {
        position: relative;
        min-height: 52px;
        padding: 14px 50px 11px 15px;
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        background: #172033;
        border-bottom: 1px solid rgba(255,255,255,.1);
    }
    .mobile-report-tooltip-head > span:first-child {
        position: absolute;
        top: 7px;
        left: 50%;
        width: 34px;
        height: 3px;
        background: rgba(255,255,255,.22);
        border-radius: 99px;
        transform: translateX(-50%);
    }
    .mobile-report-tooltip-head > strong {
        min-width: 0;
        overflow: hidden;
        color: #fff;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.25;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-report-tooltip-content {
        min-height: 0;
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
        overflow-x: hidden;
        overflow-y: auto;
        color: #dbe5ef;
        font-size: 13px;
        line-height: 1.48;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-report-tooltip-content,
    .mobile-report-tooltip-content * { box-sizing: border-box; }
    .mobile-report-tooltip-content > * { max-width: 100%; }
    .mobile-report-tooltip-content > span,
    .mobile-report-tooltip-content > small,
    .mobile-report-tooltip-content .report-merge-period,
    .mobile-report-tooltip-content .report-merge-gost,
    .mobile-report-tooltip-content .report-merge-meta,
    .mobile-report-tooltip-content .gost-tooltip-list {
        width: 100%;
        display: block !important;
    }
    .mobile-report-tooltip-content .report-merge-period {
        min-width: 0;
        overflow: hidden;
    }
    .mobile-report-tooltip-source-title { display: none !important; }
    .mobile-report-tooltip-close {
        position: absolute;
        z-index: 2;
        top: 8px;
        right: 9px;
        width: 36px;
        height: 36px;
        margin: 0;
        display: grid;
        place-items: center;
        color: #dce8f1;
        background: #26374d;
        border: 1px solid #405268;
        border-radius: 9px;
        font-size: 22px;
        line-height: 1;
    }
    .mobile-report-tooltip-content .report-transit-usage { display: none !important; }
    .mobile-report-tooltip-content small,
    .mobile-report-tooltip-content .report-merge-gost,
    .mobile-report-tooltip-content .report-heading-merge-note {
        font-size: 11px !important;
        line-height: 1.42;
    }
    .mobile-report-tooltip-content b,
    .mobile-report-tooltip-content strong,
    .mobile-report-tooltip-content code {
        font-size: 12.5px;
        line-height: 1.42;
    }
    .mobile-report-tooltip-content code {
        padding: 8px 9px;
        display: block;
        overflow-wrap: anywhere;
        white-space: normal;
    }
    .mobile-report-tooltip-content .report-transit-order-head b,
    .mobile-report-tooltip-content .report-transit-order-head strong,
    .mobile-report-tooltip-content .report-transit-order > small,
    .mobile-report-tooltip-content .report-transit-order-dates small,
    .mobile-report-tooltip-content .report-transit-order-dates b,
    .mobile-report-tooltip-content .report-transit-order em {
        font-size: 11.5px !important;
    }
    .mobile-report-tooltip-content .report-transit-order { padding: 10px 2px; gap: 6px; }
    .mobile-report-tooltip-content .report-transit-order-dates > span { padding: 8px; }
    .mobile-report-tooltip-content .report-transit-rk-summary,
    .mobile-report-tooltip-content .gost-composition-metrics,
    .mobile-report-tooltip-content .rk-status-metrics { gap: 6px; }
    .mobile-report-tooltip-content .rk-source-tooltip-item { grid-template-columns: 1fr; gap: 8px; }
    .mobile-report-tooltip-content .rk-source-tooltip-metrics { grid-template-columns: minmax(0, 1fr); }

    /* A detail row must escape the sticky service-cell geometry on phones. */
    .procurement-report-table tbody .repair-kit-assembly-detail-row {
        position: relative !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        display: block !important;
        overflow: visible !important;
    }
    .procurement-report-table tbody .repair-kit-assembly-detail-row > td,
    .procurement-report-table tbody .repair-kit-assembly-detail-row > td:first-child {
        position: static !important;
        z-index: auto !important;
        left: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        padding: 0 !important;
        display: block !important;
        overflow: visible !important;
        background: #fff !important;
        border: 0 !important;
        box-shadow: none !important;
    }
    .repair-kit-assembly-panel,
    .repair-kit-assembly-overview,
    .repair-kit-assembly-components {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
}
