:root {
    --blue: #2f5bea;
    --bg: #f5f7fb;
    --card: #fff;
    --border: #dce2ea;
    --text: #162033;
    --muted: #687386;
    --danger: #fff1f1;
    --warn: #fff9e7;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Segoe UI, Arial, sans-serif;
    background: var(--bg);
    color: var(--text)
}

a {
    color: var(--blue);
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 10px 18px;
    box-shadow: 0 2px 6px #0000000a
}

.brand a {
    font-weight: 800;
    color: #1a2b4e;
    font-size: 18px
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px
}

.topbar nav a {
    font-weight: 600;
    color: #1d2b44
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 22px
}

.hero {
    background: linear-gradient(135deg, #ffffff, #e9f0ff);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 26px;
    margin-bottom: 18px;
    box-shadow: 0 4px 16px #0000000a
}

.hero h1,
.page-head h1,
h1 {
    margin: 0 0 8px
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px
}

.grid {
    display: grid;
    gap: 16px
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr))
}

.wide {
    grid-column: 1/-1
}

.card,
.subcard {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px #00000008
}

.subcard {
    background: #fbfcff
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 9px;
    text-align: left;
    vertical-align: top
}

th {
    background: #f1f4f9;
    font-weight: 700
}

.wide-table {
    overflow: auto
}

.num {
    text-align: right;
    white-space: nowrap
}

.muted {
    color: var(--muted)
}

.small {
    font-size: 12px;
    color: #445
}

.pill {
    display: inline-block;
    background: #e9efff;
    color: #2449c6;
    border: 1px solid #cdd9ff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px
}

.danger {
    background: var(--danger)
}

.warn {
    background: var(--warn)
}

.danger-btn {
    background: #c53030 !important
}

.button,
button {
    display: inline-block;
    border: 0;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none
}

.button:hover,
button:hover {
    text-decoration: none;
    filter: brightness(.95)
}

.button.secondary {
    background: #edf1fa;
    color: #24324f;
    border: 1px solid var(--border)
}

.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center
}

.searchbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px
}

.searchbar input,
.searchbar select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    min-width: 220px
}

.searchbar input {
    flex: 1
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-weight: 700;
    color: #26354f
}

.form input,
.form select,
.form textarea,
.qty {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit
}

.form textarea {
    min-height: 76px
}

.hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 12px
}

.thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border)
}

.preview {
    max-width: 260px;
    max-height: 180px;
    border: 1px solid var(--border);
    border-radius: 10px
}

.autocomplete {
    position: relative
}

.autocomplete-list {
    position: absolute;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 34px #00000024;
    max-height: min(620px, calc(100vh - 160px));
    overflow: auto;
    z-index: 200;
    min-width: 560px;
    width: max-content;
    max-width: min(920px, calc(100vw - 72px))
}

.autocomplete-item {
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    cursor: pointer
}

.autocomplete-item:hover {
    background: #edf3ff
}

.autocomplete-title {
    font-weight: 700;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px
}

.autocomplete-balance {
    flex: 0 0 auto;
    color: #065f46;
    background: #e8f8ee;
    border: 1px solid #a7e8bd;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 12px;
    white-space: nowrap
}

.autocomplete-balance-negative {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca
}

.autocomplete-meta {
    color: var(--muted);
    font-size: 12px
}

.hidden {
    display: none !important
}

.action-lines-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 14px;
    transition: min-height .18s ease
}

.action-lines-wrap.action-lines-dropdown-open {
    overflow-y: visible;
    min-height: var(--action-lines-dropdown-height, 760px)
}

.action-line-headers,
.action-line-row {
    display: grid;
    grid-template-columns: minmax(640px, 2.8fr) 90px 115px 175px 175px minmax(260px, 1.2fr) minmax(150px, .8fr) minmax(170px, 1fr) minmax(160px, 1fr) minmax(150px, 1fr) minmax(170px, 1fr) 46px;
    gap: 10px;
    min-width: 2330px
}

.action-line-headers {
    align-items: center;
    margin-bottom: 6px;
    color: #44506a;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em
}

.action-line-row {
    align-items: end;
    margin-bottom: 12px
}

.action-line-row input,
.action-line-row select {
    width: 100%;
    min-height: 46px;
    padding: 12px 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px
}

.readonly-mini {
    background: #f7f9fc !important;
    color: #42506a
}

.search-cell {
    position: relative;
    z-index: 20
}

.action-line-row .line-search {
    font-size: 17px;
    font-weight: 650
}

.action-line-row .autocomplete-list {
    min-width: min(1040px, calc(100vw - 96px));
    max-width: min(1160px, calc(100vw - 96px));
    max-height: min(640px, calc(100vh - 140px))
}

.line-row,
.component-row {
    display: grid;
    gap: 8px;
    align-items: end;
    margin-bottom: 10px
}

.line-row {
    grid-template-columns: minmax(260px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(120px, 1fr) minmax(130px, 1fr) 80px 100px 140px 140px minmax(170px, 1fr) 40px;
    min-width: 1450px
}

.component-row {
    grid-template-columns: 2fr 120px 40px
}

.line-row input,
.line-row select,
.component-row input {
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 8px
}

.remove-btn {
    background: #fff1f1;
    color: #a32020;
    border: 1px solid #ffd1d1
}

.invoice-sheet {
    background: white;
    border: 1px solid var(--border);
    padding: 36px;
    border-radius: 8px;
    max-width: 1100px;
    margin: 0 auto
}

.invoice-sheet h1 {
    text-align: center;
    margin-bottom: 24px
}

.invoice-meta p {
    margin: 4px 0
}

.signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 50px
}

.print-actions {
    margin-bottom: 16px;
    display: flex;
    gap: 10px
}

@media(max-width:900px) {
    .grid.two {
        grid-template-columns: 1fr
    }

    .page-head {
        flex-direction: column
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column
    }

    .line-row {
        grid-template-columns: 1fr
    }

    .component-row {
        grid-template-columns: 1fr
    }

    .action-line-headers {
        display: none
    }

    .action-line-row {
        grid-template-columns: 1fr;
        min-width: 0
    }

    .searchbar {
        flex-direction: column
    }
}

@media print {

    .topbar,
    .print-actions {
        display: none
    }

    .container {
        max-width: none;
        padding: 0
    }

    .invoice-sheet {
        border: 0;
        box-shadow: none
    }

    .card {
        box-shadow: none
    }

    body {
        background: white
    }
}

/* v1.2.0: Видаткова накладна за XLSX-шаблоном */
.invoice-sheet-template {
    max-width: 210mm;
    min-height: 285mm;
    margin: 0 auto;
    padding: 18mm 14mm 16mm;
    color: #000;
    font-family: "Times New Roman", Times, serif;
    font-size: 16pt;
    border: 1px solid #ddd;
    box-shadow: 0 6px 24px #00000014;
}

.invoice-sheet-template .invoice-title {
    text-align: center;
    font-size: 18pt;
    line-height: 1.25;
    margin-top: 0;
}

.invoice-template-spacer.spacer-lg {
    height: 28mm
}

.invoice-template-spacer.spacer-md {
    height: 11mm
}

.invoice-template-spacer.spacer-sm {
    height: 8mm
}

.invoice-template-spacer.spacer-table {
    height: 27mm
}

.invoice-template-spacer.spacer-bottom {
    height: 24mm
}

.invoice-date-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: flex-end;
    font-size: 16pt;
}

.invoice-inline-value {
    display: inline-block;
    min-width: 58mm;
    border-bottom: 1px solid #000;
    text-align: center;
    padding: 0 3mm 1mm;
}

.signature-line-row {
    display: grid;
    grid-template-columns: 34mm minmax(56mm, 1fr) 8mm 54mm 8mm;
    align-items: end;
    column-gap: 0;
    line-height: 1.1;
}

.signature-label {
    text-align: right;
    padding-right: 2mm
}

.signature-name,
.signature-signature {
    min-height: 8mm;
    border-bottom: 1px solid #000;
    text-align: center;
    padding: 0 2mm 1mm;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signature-signature {
    min-width: 44mm
}

.signature-slash {
    text-align: center
}

.signature-hints {
    display: grid;
    grid-template-columns: 34mm minmax(56mm, 1fr) 8mm 54mm 8mm;
    column-gap: 0;
    font-size: 11pt;
    line-height: 1.1;
    margin-top: 1mm;
}

.signature-hints span:nth-child(2),
.signature-hints span:nth-child(4) {
    text-align: center
}

.invoice-template-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: "Times New Roman", Times, serif;
    font-size: 14pt;
}

.invoice-template-table th,
.invoice-template-table td {
    border: 1px solid #000;
    color: #000;
    background: #fff;
    padding: 3mm 2mm;
    vertical-align: middle;
    line-height: 1.15;
}

.invoice-template-table th {
    text-align: center;
    font-weight: 400;
    font-size: 15pt;
}

.invoice-template-table th:nth-child(1),
.invoice-template-table td:nth-child(1) {
    width: 20mm;
    text-align: center
}

.invoice-template-table th:nth-child(2),
.invoice-template-table td:nth-child(2) {
    width: auto
}

.invoice-template-table th:nth-child(3),
.invoice-template-table td:nth-child(3) {
    width: 42mm;
    text-align: center
}

.invoice-template-table th:nth-child(4),
.invoice-template-table td:nth-child(4) {
    width: 30mm;
    text-align: center
}

.invoice-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 4mm;
    margin-top: 22mm;
    font-size: 16pt;
}

.invoice-total-value {
    display: inline-block;
    min-width: 40mm;
    border-bottom: 1px solid #000;
    text-align: center;
    padding: 0 2mm 1mm;
}

.final-receiver-row {
    margin-top: 0
}

@page {
    size: A4 portrait;
    margin: 12mm
}

@media print {
    .invoice-sheet-template {
        width: auto;
        min-height: auto;
        padding: 0;
        border: 0;
        box-shadow: none;
        font-size: 16pt;
    }

    .invoice-sheet-template .invoice-title {
        font-size: 18pt
    }

    .invoice-template-table {
        font-size: 14pt
    }

    .invoice-template-table th {
        font-size: 15pt
    }
}

.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap
}

.inline-form {
    display: inline-flex;
    margin: 0
}

.link-button {
    background: transparent;
    color: var(--blue);
    border: 0;
    padding: 0;
    border-radius: 0;
    font-weight: 700;
    cursor: pointer
}

.link-button:hover {
    text-decoration: underline;
    filter: none
}

.danger-link {
    color: #b42318
}

.danger-card {
    border-color: #ffd1d1;
    background: #fffafa
}

.print-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px
}

@media print {
    .print-actions {
        display: none !important
    }
}

/* v1.4.0 auth / admin split */
.nav-separator {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
}

.userbox {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.userbox form {
    margin: 0;
}

.link-button {
    background: transparent !important;
    color: var(--blue) !important;
    padding: 0 !important;
    border: 0 !important;
    font-weight: 700;
    cursor: pointer;
}

.danger-link {
    color: #c53030 !important;
}

.inline-form {
    display: inline;
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.login-wrap {
    min-height: 70vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(460px, 100%);
}

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    margin: 10px 0;
}

.danger-alert {
    background: var(--danger);
    color: #8a1f1f;
    border: 1px solid #ffcaca;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.quick-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 10px #00000008;
    color: var(--text);
    text-decoration: none;
}

.quick-card strong {
    display: block;
    font-size: 18px;
    margin-bottom: 6px;
}

.quick-card span {
    color: var(--muted);
    font-size: 13px;
}

.quick-card:hover {
    text-decoration: none;
    border-color: #bdc9ef;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 10px #00000008;
}

.stat-card span {
    color: var(--muted);
    display: block;
}

.stat-card strong {
    font-size: 28px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 14px;
}

.checkbox-line,
.checkbox-inline {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    font-weight: 600 !important;
}

.checkbox-line input,
.checkbox-inline input {
    width: auto !important;
}

.inline-add {
    display: grid;
    grid-template-columns: 1fr 90px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.dict-row-form {
    display: grid;
    grid-template-columns: 1fr 90px 90px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.dict-row-form input,
.inline-add input {
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.table-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap
}

.button.compact,
button.compact {
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px
}

.column-filter-row th {
    background: #fbfcff;
    padding: 6px
}

.column-filter-row input {
    width: 100%;
    min-width: 90px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 12px
}

.hidden-row {
    display: none !important
}

.filter-empty-row td {
    text-align: center;
    padding: 18px
}

/* v1.5.0: Google Sheets-like filters + transit warehouse */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e03131;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

th[data-sheet-filter] {
    position: relative;
    padding-right: 30px;
    white-space: nowrap;
}

.sheet-filter-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    background: #e7ecf5;
    color: #24324f;
    border: 1px solid #cfd8e8;
    font-size: 12px;
    line-height: 1;
}

th.filter-active .sheet-filter-button {
    background: #2f5bea;
    color: #fff;
    border-color: #2f5bea;
}

.sheet-filter-menu {
    position: absolute;
    z-index: 2000;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 36px #00000026;
    padding: 12px;
}

.sheet-filter-title {
    font-weight: 800;
    margin-bottom: 8px;
}

.sheet-filter-search {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 8px;
}

.sheet-filter-control-row,
.sheet-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.sheet-filter-control-row button {
    background: #edf1fa;
    color: #24324f;
    border: 1px solid var(--border);
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.sheet-filter-values {
    max-height: 250px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 6px;
    margin-bottom: 10px;
}

.sheet-filter-option {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 5px 4px;
    cursor: pointer;
    font-size: 13px;
}

.sheet-filter-option:hover {
    background: #f4f7ff;
}

.sheet-filter-option input {
    width: auto;
}

.transit-status-pending {
    background: #fffdf4;
}

.transit-status-clarification {
    background: #fff4e6;
}

.transit-status-refused {
    background: #fff1f1;
}

.transit-status-marked_deleted,
.action-row-transit-deleted {
    background: #ffecec;
}

.action-row-transit-deleted td {
    background: #ffecec;
}

.transit-status-accepted {
    background: #f1fff5;
}

.transit-actions {
    min-width: 220px;
}

.transit-actions summary {
    cursor: pointer;
    color: var(--blue);
    font-weight: 700;
}

.transit-actions form {
    display: grid;
    gap: 6px;
    margin: 8px 0;
}

.transit-actions input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* v1.6.0: transit notifications, location type, admin asset totals */
.transit-notification-widget {
    position: relative;
    margin-left: auto;
}

.notification-button {
    position: relative;
    background: #edf1fa;
    color: #24324f;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
}

.notification-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e03131;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.notification-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 380px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 14px 42px #0000002b;
    padding: 12px;
    z-index: 3000;
}

.notification-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.notification-summary {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.notification-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
}

.notification-item {
    display: block;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcff;
    color: var(--text);
    text-decoration: none;
}

.notification-item:hover {
    text-decoration: none;
    background: #eef4ff;
}

.notification-item strong,
.notification-item span,
.notification-item em {
    display: block;
}

.notification-item span {
    color: #26354f;
    margin-top: 3px;
}

.notification-item em {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
    font-style: normal;
}

.notification-kind-transit_refused {
    border-color: #ffcaca;
    background: #fff7f7;
}

.notification-kind-transit_clarification {
    border-color: #ffd9ad;
    background: #fff8ed;
}

.notification-kind-transit_accepted {
    border-color: #bce8c9;
    background: #f4fff7;
}

.transit-summary-grid {
    margin-bottom: 16px;
}

.transit-summary-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    margin: 6px 0;
}

.transit-summary-card span {
    color: var(--muted);
    font-weight: 700;
}

.section-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.transit-section details summary {
    cursor: pointer;
    list-style-position: inside;
}

.transit-section details summary h2 {
    display: inline-block;
    margin-left: 4px;
}

.active-section {
    border-left: 5px solid #2f5bea;
}

.history-section {
    border-left: 5px solid #aab4c4;
}

.asset-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.asset-type-card {
    position: relative;
    background: #f8fbff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    cursor: help;
}

.asset-type-card span {
    color: var(--muted);
    font-weight: 700;
}

.asset-type-card strong {
    display: block;
    font-size: 30px;
    margin-top: 4px;
}

.asset-tooltip {
    display: none;
    position: absolute;
    left: 12px;
    top: calc(100% + 8px);
    width: 320px;
    max-width: 80vw;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 36px #00000026;
    padding: 12px;
    z-index: 1500;
}

.asset-type-card:hover .asset-tooltip,
.asset-type-card:focus .asset-tooltip {
    display: block;
}

.asset-tooltip ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.asset-tooltip li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
}

.asset-tooltip li:last-child {
    border-bottom: 0;
}

.asset-tooltip b {
    white-space: nowrap;
}

@media(max-width:900px) {
    .transit-notification-widget {
        margin-left: 0;
    }
    .notification-panel {
        left: 0;
        right: auto;
    }
}

/* v1.6.1: full asset summary available for all users */
.asset-summary-mini {
    margin-bottom: 18px;
}

.asset-type-card,
a.asset-type-card {
    color: var(--text);
    text-decoration: none;
}

a.asset-type-card:hover {
    text-decoration: none;
    border-color: #9db3ea;
    box-shadow: 0 8px 24px #2f5bea22;
}

.asset-total-card {
    background: linear-gradient(135deg, #fff, #eef4ff);
    border-color: #bdd0ff;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    align-items: end;
}

.filters-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-weight: 700;
    color: #24324f;
}

.filters-grid input,
.filters-grid select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-weight: 400;
    color: var(--text);
}

.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.app-footer {
    max-width: 1500px;
    margin: 10px auto 0;
    padding: 18px 22px 28px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

@media(max-width:700px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
    .section-title-row {
        flex-direction: column;
    }
}

/* v1.6.2: notification badges must not show or highlight zero */
.nav-badge.hidden,
.notification-count.hidden {
    display: none !important;
}

/* v1.6.3: action colors, collapsible filters, custom catalog review */
.action-pill[data-action-type="Отримання"] {
    background: #e8f8ee;
    color: #166534;
    border-color: #a7e8bd;
}

.action-pill[data-action-type="Відвантаження"] {
    background: #ffe8f1;
    color: #9d174d;
    border-color: #f9b4d0;
}

.action-pill[data-action-type="Крафт"] {
    background: #f1e8ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}

.action-pill[data-action-type="Використання"] {
    background: #ffe7e7;
    color: #b91c1c;
    border-color: #fca5a5;
}

.table-filter-card {
    overflow: visible;
}

.filter-panel-head,
.section-title-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.filter-panel-head h2 {
    margin: 0 0 4px;
}

.filter-panel-head p {
    margin: 0;
}

.filter-panel-body {
    margin-top: 12px;
    display: grid;
    gap: 12px;
}

.global-filter-row {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.global-filter-row label,
.table-filter-grid label {
    display: grid;
    gap: 5px;
    font-weight: 700;
    color: #26354f;
}

.global-filter-row label {
    flex: 1;
    min-width: 260px;
}

.global-filter-row input,
.table-filter-grid select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    font: inherit;
}

.table-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.autocomplete-custom {
    background: #fffaf0;
}

.autocomplete-custom:hover {
    background: #fff3d6;
}

.review-needed-row {
    background: #fff9e8;
}

.review-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.review-alert,
.review-card {
    border-color: #facc15;
    background: #fffbea;
}

.review-stat {
    border-color: #facc15;
    background: #fffbea;
}

.review-stat strong {
    color: #a16207;
}

@media(max-width:900px) {
    .filter-panel-head,
    .section-title-row,
    .global-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* v1.6.4: location colors, invoice hints, dictionary/catalog cleanup */
.login-card {
    display: grid;
    gap: 14px;
}

.login-card button {
    justify-self: start;
    margin-top: 4px;
}

.password-field {
    display: grid;
    gap: 5px;
    font-weight: 700;
    color: #26354f;
}

.password-field-title {
    display: block !important;
}

.password-input-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
}

.password-input-wrap input {
    min-width: 0;
}

.form .password-checkbox-label {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    align-self: flex-start;
    justify-self: start;
    width: auto;
    max-width: max-content;
    gap: 6px;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 600;
    color: #4b6287;
    cursor: pointer;
    user-select: none;
}

.form .password-checkbox-label input {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.form .password-checkbox-label span {
    display: inline-block;
}

.last-invoice-hint {
    display: block;
    margin-top: 4px;
    color: #4b6287;
}

.table-search-label {
    display: grid;
    gap: 5px;
    font-weight: 700;
    color: #26354f;
    min-width: 240px;
}

.table-search-label input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    font: inherit;
    font-weight: 400;
}

.table-toolbar-stack {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.location-type-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 800;
    background: var(--type-bg, #e9efff);
    color: var(--type-fg, #2449c6);
    border: 1px solid var(--type-border, #cdd9ff);
    white-space: nowrap;
}

.asset-type-card.location-type-colored {
    background: linear-gradient(135deg, #fff, var(--type-bg, #f8fbff));
    border-color: var(--type-border, var(--border));
}

.asset-type-card.location-type-colored strong {
    color: var(--type-fg, var(--text));
}

.dict-inline-add-no-order {
    grid-template-columns: 1fr auto;
}

.dict-row-form-no-order {
    grid-template-columns: 1fr 90px auto;
}

.supplier-location-field.hidden,
.receiver-location-field.hidden {
    display: none !important;
}

@media(max-width:900px) {
    .table-toolbar-stack {
        width: 100%;
        justify-content: stretch;
    }
    .table-search-label {
        min-width: 100%;
    }
}

/* v1.8.2: normalized headers for user/admin accounts */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: block;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #dbe3ef;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
    padding: 0;
}

.app-topbar .topbar-inner {
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 18px;
}

.app-topbar .topbar-main-row {
    min-height: 64px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
}

.app-topbar .brand-link {
    display: inline-flex;
    align-items: center;
    min-width: 132px;
    white-space: nowrap;
    color: #16233f;
    font-size: 20px;
    font-weight: 850;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.app-topbar .brand-link:hover {
    color: #16233f;
    text-decoration: none;
}

.app-topbar .topbar-nav {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.app-topbar .topbar-nav::-webkit-scrollbar {
    height: 4px;
}

.app-topbar .topbar-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.app-topbar .nav-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 10px;
    color: #25324b;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.15;
    white-space: nowrap;
    flex: 0 0 auto;
}

.app-topbar .nav-tab:hover {
    color: #2456ff;
    background: #f3f6ff;
    text-decoration: none;
}

.app-topbar .nav-tab.active {
    color: #2456ff;
    background: #eef3ff;
}

.app-topbar .nav-tab.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -13px;
    height: 3px;
    border-radius: 999px;
    background: #2456ff;
}

.app-topbar .topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
}

.app-topbar .topbar-userbox {
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #66738c;
    font-size: 14px;
    white-space: nowrap;
}

.app-topbar .userbox-name {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar .topbar-userbox form {
    margin: 0;
    flex: 0 0 auto;
}

.app-topbar .logout-link,
.app-topbar .link-button.logout-link {
    display: inline-flex;
    align-items: center;
    border: 0 !important;
    background: transparent !important;
    color: #2456ff !important;
    padding: 8px 0 !important;
    border-radius: 8px;
    font-weight: 750;
    cursor: pointer;
}

.app-topbar .logout-link:hover {
    color: #1744d8 !important;
    text-decoration: underline;
    filter: none;
}

.app-topbar .topbar-sub-row {
    border-top: 1px solid #edf1f7;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.app-topbar .secondary-nav {
    gap: 8px;
    padding: 7px 0;
}

.app-topbar .sub-tab {
    min-height: 32px;
    padding: 7px 10px;
    color: #657188;
    font-size: 14px;
    font-weight: 650;
}

.app-topbar .sub-tab.active {
    color: #2456ff;
    background: #f3f6ff;
}

.app-topbar .sub-tab.active::after {
    bottom: -8px;
}

.app-topbar .transit-notification-widget {
    position: relative;
    margin-left: 0;
    flex: 0 0 auto;
}

.app-topbar .notification-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    border: 1px solid #d8e1f1;
    border-radius: 999px;
    background: #f4f7fb;
    color: #25324b;
    padding: 8px 12px;
    font-weight: 700;
    box-shadow: none;
}

.app-topbar .notification-button:hover {
    background: #eef3ff;
    color: #2456ff;
    filter: none;
}

.app-topbar .notification-count,
.app-topbar .nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 999px;
    background: #2456ff;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    font-weight: 800;
}

.app-topbar .notification-panel {
    right: 0;
    top: calc(100% + 10px);
    width: 380px;
    max-width: calc(100vw - 24px);
    border-radius: 14px;
    z-index: 3000;
}

.app-topbar .brand-mark,
.app-topbar .header-icon,
.app-topbar .nav-icon,
.app-topbar svg,
.app-topbar i,
.app-topbar [class*="icon-"] {
    display: none !important;
}

.guest-topbar .topbar-main-row {
    grid-template-columns: auto 1fr;
}

@media (max-width: 1200px) {
    .app-topbar .topbar-main-row {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 14px;
        padding: 8px 0;
    }

    .app-topbar .topbar-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        padding-bottom: 6px;
    }

    .app-topbar .nav-tab.active::after {
        bottom: -8px;
    }
}

@media (max-width: 760px) {
    .app-topbar .topbar-inner {
        padding: 0 12px;
    }

    .app-topbar .topbar-main-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .app-topbar .brand-link {
        min-width: 0;
        font-size: 18px;
    }

    .app-topbar .topbar-nav {
        width: 100%;
    }

    .app-topbar .topbar-actions {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .app-topbar .userbox-name {
        max-width: 200px;
    }
}

@media print {
    .app-topbar {
        display: none !important;
    }
}


/* v1.8.3: requested cleanup of headers and filter captions */
.compact-filter-head {
    justify-content: flex-end;
    min-height: 0;
}

.compact-filter-head + .filter-panel-body {
    margin-top: 10px;
}

.app-topbar .notification-button.bell-button {
    position: relative;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
    color: #e6a21a;
}

.app-topbar .notification-button.bell-button .bell-icon {
    display: block;
    font-size: 18px;
    line-height: 1;
}

.app-topbar .notification-button.bell-button .notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    margin-left: 0;
}

/* v1.8.4: requested admin colors, dictionary form fixes, menu order */
.app-topbar.admin-topbar .nav-tab.admin-clickable-tab {
    background: #e9f7ef;
    color: #146c43;
    border: 1px solid #b7e4c7;
}

.app-topbar.admin-topbar .nav-tab.admin-clickable-tab:hover,
.app-topbar.admin-topbar .nav-tab.admin-clickable-tab.active {
    background: #d1f3df;
    color: #0f5132;
    border-color: #86d6a5;
}

.app-topbar.admin-topbar .nav-tab.admin-clickable-tab.active::after {
    background: #198754;
}

.admin-clickable-card {
    background: linear-gradient(135deg, #ecfdf3, #ffffff);
    border-color: #9bd8b0;
    box-shadow: 0 6px 18px #19875418;
}

.admin-clickable-card strong {
    color: #146c43;
}

.admin-clickable-card:hover {
    border-color: #52b788;
    box-shadow: 0 10px 28px #1987542b;
    transform: translateY(-1px);
}

.dictionary-table {
    table-layout: fixed;
}

.dictionary-table th:nth-child(1),
.dictionary-table td:nth-child(1) {
    width: 58%;
}

.dictionary-table th:nth-child(2),
.dictionary-table td:nth-child(2) {
    width: 120px;
    text-align: center;
    vertical-align: middle;
}

.dictionary-table th:nth-child(3),
.dictionary-table td:nth-child(3) {
    width: 190px;
    vertical-align: middle;
}

.dictionary-value-input {
    width: 100%;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.dictionary-active-cell .dictionary-active-label {
    justify-content: center;
    margin: 0;
}

.dictionary-actions {
    justify-content: flex-start;
    gap: 12px;
}

@media(max-width:700px) {
    .dictionary-table,
    .dictionary-table thead,
    .dictionary-table tbody,
    .dictionary-table tr,
    .dictionary-table th,
    .dictionary-table td {
        display: block;
        width: 100% !important;
    }

    .dictionary-table thead {
        display: none;
    }

    .dictionary-table td {
        border-bottom: 0;
        padding: 7px 0;
    }

    .dictionary-table tr {
        border-bottom: 1px solid var(--border);
        padding: 8px 0;
    }

    .dictionary-active-cell .dictionary-active-label {
        justify-content: flex-start;
    }
}

/* v1.8.5: compact, consistent headers; restore logo and active tab highlighting */
.container {
    padding-top: 12px;
}

.app-topbar {
    min-height: 0;
    padding: 0;
}

.app-topbar .topbar-inner {
    max-width: none;
    padding: 0 14px;
}

.app-topbar .topbar-main-row,
.guest-topbar .topbar-main-row {
    min-height: 40px;
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 8px;
    padding: 4px 0 !important;
}

.app-topbar .brand-link {
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto;
    min-width: 112px;
    padding: 2px 0;
    color: #16233f !important;
    font-size: 17px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none !important;
}

.app-topbar .brand-link:hover {
    color: #2456ff !important;
    text-decoration: none !important;
}

.app-topbar .topbar-nav {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px;
}

.app-topbar .nav-tab {
    min-height: 28px;
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #25324b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.app-topbar .nav-tab:hover {
    color: #2456ff;
    background: #f3f6ff;
    border-color: #d8e3ff;
    text-decoration: none;
}

.app-topbar .nav-tab.active {
    color: #1744d8;
    background: #eaf1ff;
    border-color: #bfd0ff;
}

.app-topbar .nav-tab.active::after,
.app-topbar .sub-tab.active::after,
.app-topbar.app-topbar .nav-tab.admin-clickable-tab.active::after {
    display: none !important;
    content: none !important;
}

.app-topbar.admin-topbar .nav-tab.admin-clickable-tab {
    background: #eefaf3;
    color: #146c43;
    border-color: #c5ebd3;
}

.app-topbar.admin-topbar .nav-tab.admin-clickable-tab:hover,
.app-topbar.admin-topbar .nav-tab.admin-clickable-tab.active {
    background: #d7f5e2;
    color: #0f5132;
    border-color: #80d29f;
}

.app-topbar .topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    padding: 0 !important;
}

.app-topbar .topbar-userbox {
    gap: 6px;
    font-size: 12px;
    line-height: 1.1;
}

.app-topbar .userbox-name {
    max-width: 220px;
}

.app-topbar .logout-link,
.app-topbar .link-button.logout-link {
    padding: 2px 0 !important;
    font-size: 12px;
    line-height: 1.1;
}

.app-topbar .notification-button.bell-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
}

.app-topbar .notification-button.bell-button .bell-icon {
    font-size: 15px;
}

.app-topbar .notification-panel {
    top: calc(100% + 6px);
}

@media (max-width: 1200px) {
    .app-topbar .topbar-main-row,
    .guest-topbar .topbar-main-row {
        display: flex !important;
        grid-template-columns: none !important;
        gap: 8px;
        padding: 4px 0 !important;
    }

    .app-topbar .topbar-actions {
        grid-column: auto !important;
        justify-content: flex-end;
    }
}

@media (max-width: 760px) {
    .app-topbar .topbar-inner {
        padding: 0 10px;
    }

    .app-topbar .topbar-main-row,
    .guest-topbar .topbar-main-row {
        display: flex !important;
        grid-template-columns: none !important;
        flex-wrap: wrap;
        gap: 6px;
    }

    .app-topbar .brand-link {
        min-width: 0;
        font-size: 16px;
    }

    .app-topbar .topbar-nav {
        order: 3;
        flex-basis: 100%;
        width: 100%;
    }

    .app-topbar .topbar-actions {
        margin-left: auto;
    }

    .app-topbar .userbox-name {
        max-width: 180px;
    }
}

/* v1.8.6: 1C-style column visibility controls for every regular table */
.column-hidden {
    display: none !important;
}

.column-visibility-toolbar {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}

.column-visibility-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.column-visibility-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #2f5bea;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.column-visibility-menu {
    position: fixed;
    z-index: 2100;
    top: auto;
    right: auto;
    width: 300px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 36px #00000026;
    padding: 12px;
    text-align: left;
}

.column-visibility-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.column-visibility-hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 8px;
}

.column-visibility-options {
    max-height: 270px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 6px;
    margin-bottom: 10px;
    background: #fbfcff;
}

.column-visibility-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 5px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #26354f;
}

.column-visibility-option:hover {
    background: #f0f4ff;
}

.column-visibility-option input {
    width: auto;
}

.column-visibility-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media print {
    .column-visibility-toolbar {
        display: none !important;
    }
}



/* v1.12.1: draggable column order for all regular tables */
th.column-reorder-enabled {
    cursor: grab;
    user-select: none;
}

th.column-reorder-enabled:active {
    cursor: grabbing;
}

th.column-dragging {
    opacity: .55;
}

th.column-drag-over-left {
    box-shadow: inset 4px 0 0 var(--blue);
}

th.column-drag-over-right {
    box-shadow: inset -4px 0 0 var(--blue);
}

th.column-reorder-enabled .sheet-filter-button,
th.column-reorder-enabled button,
th.column-reorder-enabled a,
th.column-reorder-enabled input,
th.column-reorder-enabled select {
    cursor: pointer;
}

@media print {
    th.column-reorder-enabled {
        cursor: default;
    }
}

/* v1.8.8: inventory table alignment and catalog OK status */
.inventory-table {
    min-width: 1120px;
    table-layout: fixed;
}

.inventory-col-category { width: 14%; }
.inventory-col-name { width: 22%; }
.inventory-col-service { width: 11%; }
.inventory-col-type { width: 10%; }
.inventory-col-unit { width: 6%; }
.inventory-col-qty { width: 9%; }
.inventory-col-fact { width: 10%; }
.inventory-col-serial { width: 13%; }
.inventory-col-comment { width: 15%; }

.inventory-fact-cell {
    min-width: 120px;
}

.inventory-fact-input {
    min-width: 105px;
    text-align: right;
}

.status-ok {
    display: inline-block;
    background: #e8f7ee;
    color: #17643a;
    border: 1px solid #bfe8cf;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.transit-action-cell {
    min-width: 170px;
    white-space: nowrap;
}

.transit-actions form {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

/* v1.9.2: compact CSV import/export controls */
.page-actions,
.import-export-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.compact-import-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
}

.compact-import-form input[type="file"] {
    max-width: 220px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.vertical-import-form {
    display: flex;
    align-items: flex-start;
    margin-top: 12px;
}

.import-export-card .button {
    margin-top: 4px;
}

/* v1.9.5: import CSV header explanations */
.import-control-with-help {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.csv-import-guide {
    margin-bottom: 16px;
}

.csv-header-hint {
    width: 100%;
    max-width: 720px;
    margin-top: 8px;
    padding: 9px 10px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.03);
}

.page-actions .csv-header-hint {
    max-width: 620px;
    text-align: left;
}

.csv-header-hint summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--primary);
}

.csv-header-line {
    margin: 8px 0;
    overflow-x: auto;
}

.csv-header-line code {
    display: inline-block;
    min-width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.csv-import-notes {
    margin: 8px 0 0 18px;
    padding: 0;
}

.csv-header-label {
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

/* v1.9.7: highlight required import columns */
.csv-header-legend {
    margin: 8px 0 6px;
}

.csv-header-token-list code {
    line-height: 2.15;
}

.csv-header-token {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.csv-header-token-required {
    background: #fff2cc;
    border-color: #e0b84f;
    color: #5f3b00;
    font-weight: 800;
}

.csv-header-separator {
    color: var(--muted);
    margin: 0 2px;
}


/* v1.9.1: invoice row copy, sticky actions table, invoice filters, dashboard tile placement */
.quick-grid-break {
    grid-column: 1 / -1;
    height: 0;
    min-height: 0;
    padding: 0;
    margin: -14px 0 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}

.actions-table-scroll {
    height: calc(100vh - 220px);
    min-height: 360px;
    max-height: 760px;
    overflow: auto;
    padding: 0;
    position: relative;
}

.actions-table-scroll .actions-table {
    min-width: 1900px;
    border-collapse: separate;
    border-spacing: 0;
}

.actions-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 12;
    background: #f1f4f9;
    box-shadow: 0 1px 0 var(--border), 0 2px 6px #00000012;
}

.actions-table-scroll tbody tr:last-child td {
    border-bottom: 0;
}

.actions-table-scroll::-webkit-scrollbar {
    height: 14px;
    width: 14px;
}

.actions-table-scroll::-webkit-scrollbar-thumb {
    background: #b9c4d8;
    border-radius: 999px;
    border: 3px solid #eef2f8;
}

.actions-table-scroll::-webkit-scrollbar-track {
    background: #eef2f8;
}

#invoices_table {
    min-width: 1100px;
}

@media (max-width: 900px) {
    .quick-grid-break {
        display: none;
    }

    .actions-table-scroll {
        height: auto;
        max-height: none;
    }
}

.form input.readonly-input {
    background: #f3f6fb;
    color: var(--muted);
    cursor: not-allowed;
}


/* v1.9.4: location/inventory filters and compact search placeholders */
.table-search-label {
    min-width: min(360px, 100%);
}
.table-search-label input[data-table-search-target] {
    min-width: 260px;
}
#location_actions_table,
#inventory_sessions_table {
    min-width: 980px;
}
@media(max-width:900px) {
    .table-search-label input[data-table-search-target] {
        min-width: 100%;
    }
}

/* v1.11.0: low stock reminders and copy action affordances */
.info-alert {
  background: #eef4ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}
.low-stock-card {
  border-color: #fecaca;
  background: #fff7f7;
}
.low-stock-card h2 {
  color: #991b1b;
}
.compact-title-row {
  align-items: center;
  gap: 12px;
}
.button.compact {
  padding: 6px 10px;
  font-size: 0.9rem;
}

/* v1.12.0: adaptive mobile layout without page zoom */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

.wide-table,
.table-wrap,
.table-scroll,
.actions-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.wide-table table,
.table-wrap table,
.table-scroll table,
.actions-table-scroll table {
    width: max-content;
    min-width: 700px;
}

.form input,
.form select,
.form textarea,
.searchbar input,
.searchbar select,
.filters-grid input,
.filters-grid select,
.table-search-label input {
    min-width: 0;
}

@media (min-width: 768px) and (max-width: 1099px) {
    .container {
        max-width: 100%;
        padding: 16px;
    }

    .quick-grid,
    .stats-grid,
    .asset-type-grid,
    .transit-summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .app-topbar .topbar-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .app-topbar .nav-tab {
        flex: 0 0 auto;
    }

    .card,
    .subcard {
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    :root {
        --mobile-page-pad: 12px;
    }

    body {
        font-size: 16px;
        line-height: 1.45;
        background: var(--bg);
    }

    .container {
        width: 100%;
        max-width: none;
        margin: 0;
        padding-top: calc(var(--mobile-page-pad) + env(safe-area-inset-top));
        padding-right: calc(var(--mobile-page-pad) + env(safe-area-inset-right));
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
        padding-left: calc(var(--mobile-page-pad) + env(safe-area-inset-left));
    }

    .app-footer {
        max-width: 100%;
        padding: 14px var(--mobile-page-pad) calc(18px + env(safe-area-inset-bottom));
    }

    .hero,
    .card,
    .subcard,
    .review-card,
    .low-stock-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 14px;
        border-radius: 16px;
        margin-bottom: 12px;
    }

    .hero h1,
    .page-head h1,
    h1 {
        font-size: clamp(24px, 7vw, 32px);
        line-height: 1.15;
    }

    h2 {
        font-size: clamp(20px, 5.8vw, 26px);
        line-height: 1.2;
    }

    .page-head,
    .actions-row,
    .searchbar,
    .filter-actions,
    .table-tools,
    .table-toolbar-stack,
    .section-title-row,
    .global-filter-row,
    .filter-panel-head,
    .print-actions,
    .compact-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .grid,
    .grid.two,
    .quick-grid,
    .stats-grid,
    .checkbox-grid,
    .filters-grid,
    .transit-summary-grid,
    .asset-type-grid,
    .dict-inline-add-no-order,
    .dict-row-form-no-order {
        grid-template-columns: 1fr !important;
    }

    .quick-grid,
    .stats-grid,
    .asset-type-grid,
    .checkbox-grid {
        gap: 12px;
    }

    .quick-grid-break {
        display: none !important;
    }

    .quick-card,
    .stat-card,
    .asset-type-card,
    .transit-summary-card {
        min-width: 0;
        width: 100%;
        border-radius: 16px;
    }

    input,
    select,
    textarea,
    .qty,
    .form input,
    .form select,
    .form textarea,
    .searchbar input,
    .searchbar select,
    .filters-grid input,
    .filters-grid select,
    .table-search-label input {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
        padding: 12px 14px;
        border-radius: 12px;
    }

    textarea,
    .form textarea {
        min-height: 92px;
    }

    button,
    .button {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 14px;
        border-radius: 12px;
        text-align: center;
    }

    .actions-row > .button,
    .actions-row > button,
    .searchbar > .button,
    .searchbar > button,
    .filter-actions > .button,
    .filter-actions > button,
    .page-head .button,
    .table-toolbar-stack > .button,
    .table-toolbar-stack > button,
    .compact-import-form button,
    .vertical-import-form button {
        width: 100%;
    }

    .link-button {
        min-height: 0;
        width: auto;
        padding: 0;
        font-size: inherit;
    }

    .compact-import-form,
    .vertical-import-form,
    .inline-form {
        width: 100%;
    }

    .compact-import-form input[type="file"],
    .vertical-import-form input[type="file"] {
        width: 100%;
    }

    .app-topbar {
        position: sticky;
        top: 0;
    }

    .app-topbar .topbar-inner {
        padding-right: calc(10px + env(safe-area-inset-right));
        padding-left: calc(10px + env(safe-area-inset-left));
    }

    .app-topbar .topbar-main-row,
    .guest-topbar .topbar-main-row {
        align-items: stretch;
        gap: 8px;
        padding: 6px 0 !important;
    }

    .app-topbar .brand-link {
        min-height: 40px;
        height: auto;
        font-size: 17px;
    }

    .app-topbar .topbar-nav {
        display: flex;
        width: 100%;
        max-width: 100%;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 0 8px;
        scrollbar-width: thin;
    }

    .app-topbar .nav-tab {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 10px 12px;
        border: 1px solid #dbe3ef;
        border-radius: 999px;
        background: #f8fbff;
        white-space: nowrap;
    }

    .app-topbar .nav-tab.active {
        background: #eaf1ff;
        border-color: #b9c9ff;
    }

    .app-topbar .nav-tab.active::after {
        display: none;
    }

    .app-topbar .topbar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        gap: 8px;
    }

    .app-topbar .userbox,
    .app-topbar .topbar-userbox {
        min-width: 0;
        flex: 1 1 auto;
        justify-content: flex-end;
    }

    .app-topbar .userbox-name {
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-topbar .notification-panel {
        position: fixed;
        top: calc(54px + env(safe-area-inset-top));
        right: calc(10px + env(safe-area-inset-right));
        left: calc(10px + env(safe-area-inset-left));
        width: auto;
        max-width: none;
        max-height: min(76dvh, calc(var(--vh, 1vh) * 76));
        overflow-y: auto;
    }

    .wide-table,
    .card.has-direct-table,
    .subcard.has-direct-table,
    .table-wrap,
    .table-scroll,
    .actions-table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wide-table table,
    .card.has-direct-table > table,
    .subcard.has-direct-table > table,
    .table-wrap table,
    .table-scroll table,
    .actions-table-scroll table {
        width: max-content;
        min-width: 720px;
    }

    .dictionary-table {
        min-width: 0 !important;
    }

    th,
    td {
        padding: 10px;
    }

    .table-actions {
        min-width: 150px;
    }

    .table-actions a,
    .table-actions button,
    .table-actions .link-button {
        display: inline-flex;
        align-items: center;
        min-height: 36px;
        padding: 6px 8px;
    }

    .actions-table-scroll {
        max-height: calc(var(--vh, 1vh) * 72);
        min-height: 260px;
    }

    #actions_table,
    #invoices_table,
    #location_actions_table,
    #location_balance_table,
    #inventory_sessions_table,
    #catalog_table,
    #asset_rows_table,
    #asset_totals_table {
        min-width: 980px;
    }

    .action-lines-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        min-height: 0;
    }

    .action-lines-wrap.action-lines-dropdown-open {
        overflow-y: visible;
        min-height: min(620px, calc(var(--vh, 1vh) * 72));
    }

    .action-line-headers,
    .action-line-row {
        min-width: 1720px;
        grid-template-columns: minmax(560px, 2.6fr) 86px 110px 150px 150px minmax(220px, 1fr) minmax(135px, .7fr) minmax(145px, .8fr) minmax(145px, .8fr) minmax(135px, .8fr) minmax(150px, .8fr) 46px;
    }

    .line-row {
        min-width: 1360px;
    }

    .action-line-row input,
    .action-line-row select,
    .line-row input,
    .line-row select,
    .component-row input {
        min-height: 48px;
        font-size: 16px;
    }

    .autocomplete-list,
    .action-line-row .autocomplete-list {
        position: fixed;
        left: calc(12px + env(safe-area-inset-left));
        right: calc(12px + env(safe-area-inset-right));
        top: auto;
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: min(62dvh, calc(var(--vh, 1vh) * 62));
        z-index: 6000;
    }

    .location-search-wrap .autocomplete-list,
    .location-search-wrap .location-autocomplete-list {
        position: absolute;
        left: 0;
        right: 0;
        top: calc(100% + 6px);
        bottom: auto;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        max-height: min(260px, calc(var(--vh, 1vh) * 42));
        z-index: 7000;
    }

    .receiver-location-field,
    .supplier-location-field {
        overflow: visible;
    }

    .autocomplete-item {
        padding: 12px 14px;
    }

    .autocomplete-title {
        gap: 10px;
        flex-wrap: wrap;
    }

    .autocomplete-balance {
        font-size: 12px;
    }

    .invoice-sheet,
    .invoice-sheet-template {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 14px;
        overflow-x: auto;
        border-radius: 14px;
    }

    .invoice-template-table {
        min-width: 760px;
    }

    .filter-panel-body {
        max-width: 100%;
    }
}

@media (min-width: 1100px) {
    .container {
        max-width: 1500px;
    }
}

/* v1.13.0: action drafts */
.draft-highlight {
    background: #fff7ed;
    border-color: #fdba74 !important;
    color: #7c2d12 !important;
    box-shadow: 0 0 0 2px #fed7aa55;
}

.draft-card-highlight {
    border-color: #fb923c;
    background: linear-gradient(180deg, #fff7ed, #ffffff);
    box-shadow: 0 8px 24px #f9731630;
}

.draft-card-highlight strong::after {
    content: " · є чернетка";
    color: #c2410c;
    font-size: 12px;
    font-weight: 800;
}

.draft-alert {
    background: #fff7ed;
    color: #7c2d12;
    border: 1px solid #fdba74;
}

.draft-row {
    background: #fffaf3;
}

.danger-button {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.danger-link {
    color: #b91c1c;
}

.empty-state {
    display: grid;
    gap: 10px;
    justify-items: start;
    padding: 22px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: #fbfcff;
}

/* v1.13.1: searchable action location fields */
.location-search-wrap {
    position: relative;
    width: 100%
}

.location-search-input {
    width: 100%
}

.location-hidden-select {
    display: none !important
}

.location-search-wrap .autocomplete-list {
    min-width: 100%;
    width: 100%;
    max-width: min(720px, calc(100vw - 72px))
}

.location-clear-option {
    background: #f8fafc
}

/* v1.15.0: action table import and draft-on-logout helpers */
.import-inline-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin: 10px 0 14px;
  border: 1px solid var(--border, #d8dee9);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
}
.import-inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.import-inline-controls input[type="file"] {
  max-width: 100%;
}


/* v1.15.6: cleaner catalog detail card and selected action repeat controls */
.catalog-detail-card {
    padding: 24px;
    overflow: hidden;
}

.catalog-detail-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.catalog-detail-grid-no-photo {
    grid-template-columns: minmax(0, 1fr);
}

.catalog-detail-card .preview {
    width: 100%;
    max-width: 280px;
    max-height: 220px;
    object-fit: cover;
}

.catalog-detail-body {
    min-width: 0;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 0;
}

.detail-list > div {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbff;
}

.detail-list > .detail-full {
    grid-column: 1 / -1;
}

.detail-list dt {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 7px 0 0;
    color: #061733;
    font-size: 16px;
    line-height: 1.45;
    font-weight: 650;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.actions-table-tools {
    justify-content: flex-start;
    align-items: end;
}

.actions-table-tools .table-search-label {
    flex: 1 1 420px;
    max-width: 680px;
}

.actions-table-tools .bulk-action-form {
    margin: 0;
}

.actions-table .select-col,
.actions-table .select-cell {
    width: 68px;
    min-width: 68px;
    text-align: center;
    vertical-align: middle;
}

.actions-table .repeat-col,
.actions-table .repeat-cell {
    width: 122px;
    min-width: 122px;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.actions-table .select-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

@media (max-width: 767px) {
    .catalog-detail-card {
        padding: 14px;
    }

    .catalog-detail-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }
}


/* v1.16.0: adaptive full-width tables and user-resizable columns */
body.has-table-page .container {
    width: 100%;
    max-width: none;
}

.table-scroll,
.table-wrap,
.wide-table,
.actions-table-scroll,
.card.has-direct-table,
.subcard.has-direct-table {
    width: 100%;
}

.table-scroll table,
.table-wrap table,
.wide-table table,
.actions-table-scroll table,
.card.has-direct-table > table,
.subcard.has-direct-table > table {
    min-width: 100%;
}

table.resizable-table {
    table-layout: fixed;
}

table.resizable-table th,
table.resizable-table td {
    overflow-wrap: anywhere;
    word-break: normal;
}

table.resizable-table th {
    position: relative;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    z-index: 35;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.column-resize-handle::after {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 3px;
    width: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background .15s ease, box-shadow .15s ease;
}

.column-resize-handle:hover::after,
.column-resize-handle.is-resizing::after,
th.column-resizing .column-resize-handle::after {
    background: var(--blue);
    box-shadow: 0 0 0 2px #2f5bea22;
}

body.is-column-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

body.is-column-resizing * {
    cursor: col-resize !important;
}

body.is-column-dragging {
    cursor: grabbing !important;
    user-select: none !important;
}

body.is-column-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

.is-touch th.column-reorder-enabled {
    touch-action: pan-y;
}

.column-visibility-actions .column-reset-widths-button {
    white-space: nowrap;
}

@media print {
    .column-resize-handle {
        display: none !important;
    }
}

.actions-table-scroll table.resizable-table thead th {
    position: sticky;
    top: 0;
}


/* v1.16.1: reliable column resizing and floating horizontal table scrollbar */
table.resizable-table {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

table.resizable-table th {
    position: relative;
    padding-right: 22px;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    width: 16px;
    min-width: 16px;
    height: auto;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.column-resize-handle::after {
    content: "";
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: 7px;
    width: 2px;
    border-radius: 999px;
    background: #94a3b855;
    transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.column-resize-handle:hover::after,
.column-resize-handle.is-resizing::after,
th.column-resizing .column-resize-handle::after {
    background: var(--blue);
    box-shadow: 0 0 0 3px #2f5bea22;
    transform: scaleX(1.35);
}

table.resizable-table thead th:hover .column-resize-handle::after {
    background: #64748baa;
}

body.is-column-resizing,
body.is-column-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.table-floating-scrollbar {
    position: fixed;
    left: 16px;
    bottom: 10px;
    height: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 2000;
    background: #f8fafcf2;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    box-shadow: 0 10px 28px #0f172a22;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    scrollbar-width: auto;
}

.table-floating-scrollbar.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.table-floating-scrollbar__inner {
    height: 1px;
}

.table-floating-scrollbar::-webkit-scrollbar {
    height: 16px;
}

.table-floating-scrollbar::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
    border: 4px solid #f8fafc;
}

.table-floating-scrollbar::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 999px;
}

@media print {
    .table-floating-scrollbar,
    .column-resize-handle {
        display: none !important;
    }
}


/* v1.16.7: notifications/details for crew transit and fixed admin location table layout */
.card.has-direct-table,
.subcard.has-direct-table {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.admin-locations-list-card,
.admin-location-form-card {
    min-width: 0;
}

.admin-locations-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.admin-locations-table-scroll table {
    width: max-content;
    min-width: 100%;
}

@media (min-width: 900px) {
    .grid.two:has(.admin-locations-list-card) {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
        align-items: start;
    }
}

.editable-unit-input {
    background: #fff !important;
    border-color: #2f6fed !important;
    color: var(--text) !important;
}

/* v1.17.1: asset summary filtered export controls */
.compact-table-tools {
    justify-content: flex-end;
    align-items: end;
    gap: 8px;
    margin-bottom: 0;
}

.compact-table-tools .table-search-label {
    min-width: 220px;
}

/* v1.17.2: editable unit relation fields in user item cards */
.line-unit-relation {
    background: #fff;
}
.inventory-col-relation {
    min-width: 170px;
}
.inventory-table select[name="line_unit_relation"] {
    min-width: 160px;
}

/* v1.17.3: visible per-line unit relation column in invoice form */
.invoice-line-headers {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(120px, 1fr) minmax(170px, 1fr) 80px 100px 140px 140px minmax(170px, 1fr) 40px;
    gap: 8px;
    min-width: 1490px;
    align-items: center;
    margin-bottom: 6px;
    color: #44506a;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.invoice-lines-wrap .line-row {
    grid-template-columns: minmax(260px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(120px, 1fr) minmax(170px, 1fr) 80px 100px 140px 140px minmax(170px, 1fr) 40px;
    min-width: 1490px;
}
.invoice-lines-wrap .line-unit-relation {
    min-width: 170px;
}
@media (max-width: 760px) {
    .invoice-line-headers {
        display: none;
    }
    .invoice-lines-wrap .line-row {
        grid-template-columns: 1fr;
        min-width: 0;
    }
}



/* v1.17.8: invoice row autocomplete behaves like action rows */
.invoice-search-cell {
    position: relative;
    z-index: 20;
}

.invoice-lines-wrap .autocomplete-list {
    min-width: min(640px, calc(100vw - 96px));
    max-width: min(1160px, calc(100vw - 96px));
    max-height: min(640px, calc(100vh - 140px));
}

/* v1.17.7: fixed two-row admin navigation and admin+user transit alerts */
.app-topbar.admin-topbar .topbar-main-row {
    align-items: center;
}

.app-topbar.admin-topbar .admin-nav-two-row {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow: visible;
    padding: 4px 0;
}

.app-topbar.admin-topbar .admin-nav-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.app-topbar.admin-topbar .admin-nav-row::-webkit-scrollbar {
    height: 4px;
}

.app-topbar.admin-topbar .admin-nav-row::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.app-topbar.admin-topbar .admin-nav-row .nav-tab {
    flex: 0 0 auto;
}

.app-topbar.admin-topbar .topbar-actions {
    align-self: center;
}

@media (max-width: 760px) {
    .app-topbar.admin-topbar .admin-nav-two-row {
        order: 3;
        flex-basis: 100%;
        width: 100%;
    }

    .app-topbar.admin-topbar .admin-nav-row {
        gap: 8px;
        padding-bottom: 6px;
    }
}

/* v1.18.2: craft component numbers + craft history */
.component-headers {
    display: grid;
    grid-template-columns: 2fr 120px 150px 150px 40px;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700
}

.component-row {
    grid-template-columns: 2fr 120px 150px 150px 40px
}

.craft-history-table td:nth-child(9) {
    min-width: 280px;
    white-space: normal
}

/* v1.18.4: crafted item markers and craft composition details */
.crafted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #b8d7ff;
  background: #eef6ff;
  color: #175a9e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
}

.crafted-badge:hover {
  background: #ddeeff;
  color: #0d457c;
  text-decoration: none;
}

.crafted-badge-large {
  margin-left: 0;
  padding: 5px 12px;
  font-size: 13px;
}

.craft-search-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.craft-detail-card {
  border-left: 4px solid #8bbcff;
}

.craft-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.craft-result-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface-soft, #f8fafc);
}

.craft-detail-comment {
  margin-top: 14px;
}


/* v1.18.8: transit admin view without duplicate cards + readable bulk comment field */
.transit-bulk-accept-form {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

.transit-bulk-comment-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 260px;
    max-width: 520px;
    flex: 1 1 300px;
    font-weight: 700;
    color: #26354f;
}

.transit-bulk-comment-label span {
    font-size: 12px;
    line-height: 1.1;
}

.transit-bulk-comment-input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 400;
}

/* v1.18.9: crew balance bulk actions */
.crew-balance-form {
    display: block;
}
.crew-balance-actions {
    justify-content: flex-start;
    margin: 0 0 14px;
}
.crew-balance-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* v1.19.1: спрощена таблиця позицій для використання екіпажем */
.action-lines-wrap.crew-use-lines .action-line-headers,
.action-lines-wrap.crew-use-lines .action-line-row {
    grid-template-columns: minmax(640px, 2.8fr) 90px 115px 175px 175px minmax(260px, 1.2fr) 46px;
    min-width: 1540px;
}

.action-lines-wrap.crew-use-lines .action-line-headers span:nth-child(7),
.action-lines-wrap.crew-use-lines .action-line-headers span:nth-child(8),
.action-lines-wrap.crew-use-lines .action-line-headers span:nth-child(9),
.action-lines-wrap.crew-use-lines .action-line-headers span:nth-child(10),
.action-lines-wrap.crew-use-lines .action-line-headers span:nth-child(11),
.action-lines-wrap.crew-use-lines .action-line-row input[name="line_extra_column_1"],
.action-lines-wrap.crew-use-lines .action-line-row [data-field="category"],
.action-lines-wrap.crew-use-lines .action-line-row [data-field="supply_service"],
.action-lines-wrap.crew-use-lines .action-line-row [data-field="property_type"],
.action-lines-wrap.crew-use-lines .action-line-row [data-field="unit_relation"] {
    display: none !important;
}

/* v1.19.8: explicit number picker for serial/internal numbers */
.number-options-list {
    max-height: min(360px, calc(100vh - 120px));
    overflow: auto;
}
.number-option-item {
    font-weight: 700;
    white-space: nowrap;
}


.attached-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 800;
    color: #116149;
    background: #e5f8ef;
    border: 1px solid #a8e5c9;
    white-space: nowrap;
}

.page-title-badge {
    vertical-align: middle;
    margin-left: 8px;
}

.attached-location-checkbox {
    justify-content: flex-start;
    margin-top: -4px;
}

.board-base-form .checkbox-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.board-flag-cell {
    text-align: center;
    font-weight: 800;
}

.board-flag-on {
    color: #116149;
}

/* v1.21.1: board base layout and crew attached checkbox visibility */
.admin-location-form-card .form label,
.board-base-form .form label {
    min-width: 0;
}

.attached-location-field {
    display: block;
    margin-top: 4px;
    margin-bottom: 10px;
}

.attached-location-checkbox {
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    min-height: 24px;
}

.attached-location-checkbox input[type="checkbox"] {
    flex: 0 0 auto;
}

.admin-location-form-card textarea {
    display: block;
    margin-bottom: 12px;
}

.admin-location-form-card .actions-row {
    margin-top: 8px;
}

.board-table-toolbar {
    justify-content: flex-start;
    align-items: end;
    margin: 8px 0 16px;
}

.board-table-toolbar .table-search-label {
    min-width: min(360px, 100%);
}

.danger-nav-tab {
    color: #b91c1c !important;
    background: #fee2e2 !important;
    border-color: #fecaca !important;
}

.danger-nav-tab.active,
.danger-nav-tab:hover {
    color: #7f1d1d !important;
    background: #fecaca !important;
    border-color: #fca5a5 !important;
}

.danger-quick-card {
    border-color: #fca5a5 !important;
    background: linear-gradient(135deg, #fff, #fff1f2) !important;
}

.danger-quick-card strong {
    color: #b91c1c;
}

.board-flag-danger {
    color: #b91c1c;
}

/* v1.21.3: board integrations and board status dictionary */
.notice {
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 10px 12px;
  margin: 10px 0;
  background: rgba(15, 23, 42, 0.04);
}
.notice.success {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.08);
}
.compact-pre {
  white-space: pre-wrap;
  margin: 0;
  font: inherit;
  max-width: 260px;
}

/* v1.21.4: multiple search points for board integrations */
.integration-search-points {
  display: grid;
  gap: 12px;
}
.integration-search-point {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.025);
}
.integration-search-point textarea {
  min-height: 86px;
}
.small-button {
  padding: 6px 10px;
  font-size: 0.9rem;
}

/* v1.21.7: structured integration conditions */
.integration-conditions {
  display: grid;
  gap: 12px;
}
.integration-condition {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.025);
}
.integration-condition input,
.integration-condition select {
  width: 100%;
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .grid.three {
    grid-template-columns: 1fr;
  }
}

/* v1.21.8: large aircraft board status warning for actions and invoices */
.aircraft-board-status-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(127, 29, 29, 0.42);
  backdrop-filter: blur(2px);
}
.aircraft-board-status-warning-card {
  width: min(920px, 96vw);
  border: 6px solid #991b1b;
  border-radius: 24px;
  background: #fff1f1;
  color: #7f1d1d;
  padding: clamp(24px, 5vw, 54px);
  text-align: center;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}
.aircraft-board-status-warning-title {
  font-size: clamp(2.4rem, 9vw, 5.8rem);
  line-height: 1;
  font-weight: 900;
  margin-bottom: 22px;
  text-transform: uppercase;
}
.aircraft-board-status-warning-text {
  font-size: clamp(1.35rem, 4.5vw, 3rem);
  line-height: 1.22;
  font-weight: 900;
  margin-bottom: 28px;
}
.aircraft-board-status-warning-close {
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  padding: 14px 28px;
}

/* v1.21.9: balanced header rows, quick menu rows, and integration rule filters */
.quick-grid.balanced-quick-grid {
    grid-template-columns: repeat(var(--balanced-grid-columns), minmax(0, 1fr));
}

@media (max-width: 640px) {
    .quick-grid.balanced-quick-grid {
        grid-template-columns: 1fr;
    }
}

#integration_rules_table {
    min-width: 1500px;
}

#integration_rules_table .compact-pre {
    max-width: 260px;
}

/* v1.21.11: searchable BPLA selector in integration rules */
.select-search-input {
  margin-bottom: 8px;
}

/* v1.21.12: searchable dropdown for BPLA integration selector */
.native-searchable-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.searchable-select-dropdown {
  position: relative;
  width: 100%;
}
.searchable-select-toggle {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  color: #0f1f38;
  font: inherit;
  font-weight: 600;
  text-align: left;
  padding: 10px 42px 10px 14px;
  cursor: pointer;
  position: relative;
}
.searchable-select-toggle::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #516173;
  font-size: 1rem;
}
.searchable-select-toggle:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: #93b4f5;
}
.searchable-select-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 31, 56, 0.18);
  padding: 10px;
}
.searchable-select-search {
  width: 100%;
  margin-bottom: 8px;
}
.searchable-select-options {
  max-height: 280px;
  overflow: auto;
}
.searchable-select-option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #0f1f38;
  font: inherit;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.searchable-select-option:hover,
.searchable-select-option:focus {
  background: #edf4ff;
  outline: none;
}
.searchable-select-option.selected {
  background: #dfeeff;
  font-weight: 700;
}
.searchable-select-empty {
  color: #66748a;
  padding: 12px;
  text-align: center;
}

/* v1.21.10: integration condition field layout and multiline sheet headers */
.integration-condition .grid.three {
  grid-template-columns: minmax(260px, 1.7fr) minmax(150px, .85fr) minmax(190px, 1fr);
  align-items: start;
}
.integration-condition textarea.integration-column-input {
  min-height: 46px;
  resize: vertical;
  line-height: 1.25;
}
.integration-condition .hint {
  max-width: 100%;
}
@media (max-width: 900px) {
  .integration-condition .grid.three {
    grid-template-columns: 1fr;
  }
}
