.mobile-nav-toggle,
.mobile-nav-head,
.mobile-nav-backdrop {
    display: none;
}

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

@media (max-width: 800px) {
    body {
        overflow-x: hidden;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .app-topbar {
        position: relative;
        z-index: 60;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: 8px 10px;
        padding: 10px 12px;
    }

    .mobile-nav-toggle,
    .mobile-nav-close {
        display: inline-grid;
        width: 44px;
        height: 44px;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, .28);
        border-radius: 8px;
        padding: 0;
        background: transparent;
        color: #fff;
        cursor: pointer;
    }

    .mobile-nav-toggle {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }

    .mobile-nav-toggle svg,
    .mobile-nav-close svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
    }

    .app-brand-logo {
        grid-column: 2;
        grid-row: 1;
        width: 156px;
        align-self: center;
    }

    .app-topbar-title {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: center;
    }

    .app-topbar-title h1 {
        font-size: 16px;
        line-height: 1.2;
    }

    .app-topbar .topbar-actions {
        grid-column: 3;
        grid-row: 1;
        align-self: center;
        justify-self: end;
        justify-content: flex-end;
        margin: 0;
    }

    .app-topbar .environment-badge {
        display: none;
    }

    .app-topbar .topbar-actions .btn {
        min-height: 40px;
        margin: 0;
        padding: 9px 12px;
    }

    .layout {
        display: block;
        min-height: calc(100vh - 100px);
    }

    .sidebar {
        position: fixed;
        z-index: 80;
        inset: 0 auto 0 0;
        display: block;
        width: min(300px, calc(100vw - 42px));
        padding: 10px 12px 24px;
        overflow-y: auto;
        border: 0;
        box-shadow: 18px 0 42px rgba(15, 23, 42, .24);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform .2s ease, visibility 0s linear .2s;
    }

    .mobile-nav-open .sidebar {
        transform: translateX(0);
        visibility: visible;
        transition-delay: 0s;
    }

    .mobile-nav-head {
        position: sticky;
        top: -10px;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 62px;
        margin: -10px -12px 10px;
        padding: 10px 12px;
        border-bottom: 1px solid #d9e2ef;
        background: #142238;
        color: #fff;
    }

    .mobile-nav-close {
        width: 40px;
        height: 40px;
    }

    .sidebar a,
    .sidebar a.nav-section-break {
        margin: 0 0 5px;
        padding: 12px;
        white-space: normal;
    }

    .sidebar a.nav-section-break {
        margin-top: 12px;
        border-left: 0;
    }

    .mobile-nav-backdrop {
        position: fixed;
        z-index: 70;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        padding: 0;
        background: rgba(15, 23, 42, .48);
        cursor: pointer;
    }

    .mobile-nav-open .mobile-nav-backdrop {
        display: block;
    }

    main {
        width: 100%;
        min-width: 0;
        padding: 12px;
    }

    .card {
        min-width: 0;
        margin-bottom: 12px;
        padding: 14px;
        border-radius: 10px;
    }

    .page-head {
        display: block;
        margin-bottom: 14px;
    }

    .page-head h2 {
        font-size: 22px;
        line-height: 1.2;
    }

    .page-head p,
    .section-head p {
        font-size: 14px;
        line-height: 1.4;
    }

    .head-actions,
    .page-actions,
    .offer-page-head .page-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
        margin-top: 12px;
    }

    .head-actions > .btn,
    .head-actions > form,
    .head-actions > form .btn,
    .page-actions > .btn,
    .page-actions > form,
    .page-actions > form .btn,
    .offer-page-head .page-actions > * {
        width: 100%;
        margin: 0;
        text-align: center;
    }

    .section-head {
        display: flex;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 12px;
    }

    .section-head > :first-child {
        flex: 1 1 190px;
    }

    .section-head .badge {
        margin-top: 0;
    }

    .btn {
        min-height: 44px;
        padding: 11px 14px;
    }

    .btn.compact {
        min-height: 40px;
        padding: 9px 11px;
    }

    input,
    select,
    textarea {
        min-height: 44px;
        font-size: 16px;
    }

    textarea {
        min-height: 100px;
    }

    .stats,
    .dashboard-stats,
    .todo-stats,
    .laser-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }

    .stats .card,
    .dashboard-stat {
        min-height: 96px;
        padding: 12px;
    }

    .stats .card b,
    .dashboard-stat b {
        font-size: 20px;
        overflow-wrap: anywhere;
    }

    .dashboard-page {
        gap: 12px;
    }

    .dashboard-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .dashboard-action {
        min-height: 88px;
        padding: 11px;
    }

    .dashboard-action span {
        overflow-wrap: anywhere;
    }

    .filter-grid,
    .product-filter-grid,
    .order-form,
    .order-edit-form,
    .order-item-form,
    .client-search-form,
    .client-form,
    .invoice-form,
    .material-form,
    .category-form,
    .new-category-form,
    .purchase-upload-row,
    .purchase-search-form,
    .offer-create-form,
    .offer-edit-form .offer-fields,
    .offer-filter-form,
    .offer-item-form,
    .laser-order-grid,
    .laser-calc-layout,
    .laser-settings-grid,
    .laser-minimum-box,
    .laser-files-filter-primary,
    .laser-files-filter-secondary,
    .todo-create-form,
    .todo-filter-form,
    .todo-inline-form,
    .settings-user-create,
    .settings-user-row-form {
        grid-template-columns: 1fr !important;
    }

    .order-edit-form .wide,
    .invoice-form .wide,
    .client-form .wide,
    .material-form .wide,
    .offer-create-form .wide,
    .offer-edit-form .wide,
    .offer-item-form .form-actions,
    .form-actions,
    .todo-task-input,
    .todo-create-submit,
    .laser-files-filter-actions {
        grid-column: 1 !important;
    }

    .filter-actions,
    .form-actions,
    .split-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }

    .filter-actions .btn,
    .form-actions .btn,
    .split-actions .btn,
    .form-actions form,
    .form-actions form .btn,
    .split-actions form,
    .split-actions form .btn {
        width: 100%;
        text-align: center;
    }

    .table-wrap,
    .invoice-document-table-wrap {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    th,
    td {
        padding: 9px 8px;
    }

    .purchase-document-body {
        padding: 0 10px 12px;
    }

    .purchase-actions,
    .purchase-badges,
    .purchase-document-actions {
        justify-content: flex-start;
    }

    .offer-totals {
        width: 100%;
    }

    .laser-drop-zone {
        min-height: 138px;
        padding: 18px;
    }

    .laser-toolbar,
    .laser-results-heading,
    .laser-files-filter-actions,
    .laser-list-toolbar-main {
        align-items: stretch;
        flex-direction: column;
    }

    .laser-toolbar .btn,
    .laser-files-filter-actions .btn,
    .laser-list-toolbar-main .btn {
        width: 100%;
        text-align: center;
    }

    .laser-status-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .laser-client-group summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .laser-client-statuses,
    .laser-client-accounting {
        grid-column: 1 / -1;
    }

    .todo-inline-form {
        position: static;
        min-width: 0;
        margin-top: 8px;
    }

    .settings-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .settings-summary > * {
        min-width: 0;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .head-actions,
    .page-actions,
    .offer-page-head .page-actions {
        grid-template-columns: 1fr;
    }

    .app-brand-logo {
        width: 138px;
    }

    .dashboard-action span {
        font-size: 14px;
    }
}
