/* BuzDistr — telefon va kichik planshet uchun ixcham ko‘rinish (max 900px) */

.m-burger, .m-overlay, .m-bottom-nav { display: none; }

@media (max-width: 900px) {
    /* ===== Umumiy zichlik ===== */
    html { font-size: 13.5px; }

    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        display: block !important;
        height: 100dvh;
        min-height: 100dvh;
        font-size: 13px;
        -webkit-text-size-adjust: 100%;
    }

    .content h1 { font-size: 1.15rem !important; }
    .content h2 { font-size: 1.05rem !important; margin-bottom: 6px !important; }
    .content h3 { font-size: 0.9rem !important; }
    .content h4 { font-size: 0.85rem !important; }
    .content p { line-height: 1.4; }

    .btn,
    .content button.btn,
    .modal .btn {
        padding: 7px 10px !important;
        font-size: 0.82rem !important;
        border-radius: 10px !important;
        min-height: 34px;
        line-height: 1.2;
        gap: 5px;
    }

    .btn i { font-size: 0.85em; }

    input, select, textarea {
        font-size: 14px !important;
    }

    .content input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    .content select,
    .modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    .modal select {
        min-height: 36px;
        height: auto !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    /* ===== Yon menyu — chapdan chiquvchi panel ===== */
    .sidebar,
    .sidebar.expanded {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(78vw, 270px) !important;
        align-items: stretch !important;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        z-index: 2000 !important;
        box-shadow: none;
    }

    body.m-nav-open .sidebar {
        transform: translateX(0);
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
    }

    .sidebar .logo {
        width: 100%;
        justify-content: flex-start !important;
        padding: 6px 8px !important;
        margin-bottom: 8px !important;
    }

    .sidebar .logo .sidebar-logo-text-wrap { display: flex !important; }

    .sidebar .nav-item {
        width: 100% !important;
        height: 40px !important;
        justify-content: flex-start !important;
        padding: 0 12px !important;
        margin: 1px 0 !important;
    }

    .sidebar .nav-text {
        display: block !important;
        white-space: nowrap;
        font-size: 13.5px;
    }

    .sidebar .nav-item::after,
    .sidebar .nav-item::before { display: none !important; }

    .sidebar .settings-nav-item { margin-top: 6px; }

    .m-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
        z-index: 1990;
    }

    body.m-nav-open .m-overlay { opacity: 1; pointer-events: auto; }
    body.m-nav-open { overflow: hidden; }

    /* ===== Yuqori qator ===== */
    .main {
        width: 100% !important;
        min-width: 0 !important;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 900;
        gap: 6px;
        padding: 6px 8px !important;
        padding-top: calc(6px + env(safe-area-inset-top)) !important;
        min-height: 48px;
        flex-wrap: nowrap !important;
    }

    .header > div:first-child { min-width: 0; flex: 1; gap: 6px !important; }

    .m-burger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 34px;
        height: 34px;
        border: none;
        border-radius: 10px;
        background: rgba(0, 151, 178, 0.12);
        color: var(--primary);
        font-size: 15px;
        cursor: pointer;
    }

    .page-title {
        font-size: 0.98rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    #headerClock,
    #user-info,
    #realtimeStatusBadge,
    #companySaasHeaderBtn,
    .live-push-indicator,
    [id*="livePush"],
    [class*="live-push"] { display: none !important; }

    .admin-profile { gap: 4px !important; flex-shrink: 0; }

    .admin-profile .btn {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 32px;
        min-height: 32px;
        height: 32px;
        justify-content: center;
    }

    .admin-profile .admin-chat-header-btn {
        width: 32px !important;
        height: 32px !important;
        flex-shrink: 0;
        font-size: 13px;
    }

    .avatar { width: 28px !important; height: 28px !important; font-size: 12px; }

    /* ===== Kontent maydoni ===== */
    .content {
        padding: 8px 8px calc(64px + env(safe-area-inset-bottom)) !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

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

    .content input[type="date"] {
        min-width: 0 !important;
        width: auto !important;
        flex: 1 1 110px;
    }

    .content div[style*="display: flex"]:not([style*="nowrap"]):not([style*="overflow-x"]),
    .content div[style*="display:flex"]:not([style*="nowrap"]):not([style*="overflow-x"]) {
        flex-wrap: wrap;
        min-width: 0;
    }

    .content [style*="width: 180px"],
    .content [style*="width:180px"],
    .content [style*="width: 200px"],
    .content [style*="width: 220px"],
    .content [style*="width: 140px"] { max-width: 100%; }

    /* Bloklar orasidagi bo‘shliq kichik */
    .content [style*="margin-bottom: 20px"],
    .content [style*="margin-bottom: 24px"],
    .content [style*="margin-bottom: 25px"],
    .content [style*="margin-bottom: 30px"] { margin-bottom: 10px !important; }

    .content [style*="padding: 20px"],
    .content [style*="padding: 24px"],
    .content [style*="padding: 30px"] { padding: 10px !important; }

    .products-table,
    .content .card,
    .content [class*="-card"]:not(.stat-card):not(.product-card) {
        border-radius: 12px !important;
    }

    .content .products-table { padding: 10px !important; margin-bottom: 10px !important; }

    /* ===== Ko‘rsatkich kartalari — ixcham, ko‘p ma’lumot sig‘adi ===== */
    .stats-grid,
    .stats-grid.stats-grid--suppliers-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    .stats-grid.stats-grid--products-kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 5px !important;
        margin-bottom: 8px !important;
    }

    .stat-card {
        padding: 8px 9px !important;
        min-width: 0;
        min-height: 0 !important;
        border-radius: 10px !important;
        animation: none !important;
    }

    .stat-card:hover { transform: none !important; }

    .stat-title {
        font-size: 0.62rem !important;
        letter-spacing: 0.2px !important;
        line-height: 1.2 !important;
        margin-bottom: 2px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stat-number {
        font-size: 0.98rem !important;
        line-height: 1.2 !important;
        word-break: break-word;
    }

    .stats-grid .stat-card .product-count,
    .stats-grid .stat-card .stat-sub,
    .stats-grid .stat-card small { display: none !important; }

    .stats-grid.stats-grid--products-kpis .stat-card { padding: 6px 7px !important; }
    .stats-grid.stats-grid--products-kpis .stat-title { white-space: normal; font-size: 0.56rem !important; }

    .stats-grid.stats-grid--orders-status {
        display: flex !important;
        overflow-x: auto;
        gap: 5px !important;
        padding-bottom: 2px;
        scroll-snap-type: x proximity;
    }

    .stats-grid.stats-grid--orders-status .stat-card {
        flex: 0 0 auto;
        min-width: 74px;
        padding: 6px 8px !important;
        scroll-snap-align: start;
    }

    /* Avto-ustunli to‘rlar (moliyaviy kartalar va h.k.) — 2 ustun */
    .content div[style*="auto-fit"],
    .content div[style*="auto-fill"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .content div[style*="grid-template-columns"]:not(.stats-grid):not([style*="auto-fill"]):not([style*="auto-fit"]),
    .modal div[style*="grid-template-columns"]:not([style*="auto-fill"]):not([style*="auto-fit"]) {
        grid-template-columns: 1fr !important;
    }

    .form-row,
    .form-grid,
    .grid-2,
    .grid-3,
    .dashboard-two-col {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* ===== Dashboard ===== */
    .dashboard-page .stat-card { box-shadow: none !important; }

    .content [class^="fin-card"],
    .content [class*=" fin-card"] {
        padding: 8px 9px !important;
        border-radius: 10px !important;
        border-top-width: 3px !important;
        min-height: 0 !important;
    }

    .content [class*="fin-card"] > div { margin-top: 3px !important; }
    .content [class*="fin-card"] > div[style*="height: 36px"],
    .content [class*="fin-card"] svg { display: none !important; }

    .content [class*="fin-card"] span { font-size: 0.6rem !important; }

    .content [class*="fin-card"] > div:first-child { flex-wrap: nowrap !important; gap: 4px; }
    .content [class*="fin-card"] > div:first-child > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .content [class*="fin-card"] > div:first-child > span + span { flex-shrink: 0; padding: 1px 5px !important; }
    .content [class*="fin-card"] > div > div:first-child { font-size: 0.95rem !important; }
    .content [class*="fin-card"] > div > div + div { font-size: 0.6rem !important; margin-top: 1px !important; }

    /* Global filtr: [ombor][tiklash] / [sana — sana] */
    .dashboard-page > .products-table.no-print { padding: 6px !important; margin-bottom: 8px !important; }
    .dashboard-page > .products-table.no-print > div:first-child { display: none !important; }

    .dashboard-page > .products-table.no-print > div:nth-child(2) {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 5px !important;
        width: 100%;
    }

    .dashboard-page > .products-table.no-print > div:nth-child(2) > :nth-child(1) { grid-column: 1; grid-row: 1; }
    .dashboard-page > .products-table.no-print > div:nth-child(2) > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap !important; }
    .dashboard-page > .products-table.no-print > div:nth-child(2) > :nth-child(3) { grid-column: 2; grid-row: 1; }
    .dashboard-page > .products-table.no-print label { display: none !important; }
    .dashboard-page > .products-table.no-print select { width: 100% !important; height: 32px !important; min-height: 32px; }
    .dashboard-page > .products-table.no-print input[type="date"] { height: 32px !important; min-height: 32px; font-size: 12.5px !important; }
    .dashboard-page > .products-table.no-print > div:nth-child(2) > :nth-child(1) { width: 100%; }
    .dashboard-page > .products-table.no-print .btn { height: 32px !important; min-height: 32px; padding: 0 10px !important; width: auto !important; }

    .dashboard-page > .stat-card > div:first-child { margin-bottom: 6px !important; padding-bottom: 6px !important; }
    .dashboard-page > .stat-card > div:first-child > span { display: none !important; }

    .dashboard-chart-wrap { height: 170px !important; min-height: 0 !important; }
    .dashboard-chart-wrap canvas { max-height: 170px !important; }

    .dashboard-page [style*="max-height: 3"] { max-height: 240px !important; }

    .rep-tabs { flex-wrap: nowrap !important; overflow-x: auto; gap: 4px !important; }
    .rep-tabs > * { flex: 0 0 auto; padding: 5px 9px !important; font-size: 0.72rem !important; min-height: 0 !important; }

    /* ===== Sahifa ustidagi qatorlar ===== */
    .products-top-bar,
    .products-filter-bar,
    .page-header,
    .section-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    .products-title-section h2 { font-size: 1.05rem !important; margin: 0 !important; }

    .products-top-bar > div[style] {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px !important;
    }

    .products-top-bar > div[style] .btn {
        padding: 6px 4px !important;
        font-size: 0.72rem !important;
        justify-content: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-header .btn { flex: 1 1 auto; justify-content: center; }

    .filter-left,
    .filter-right {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 6px !important;
    }

    .filter-left > *,
    .categories-wrap { max-width: 100%; min-width: 0; margin-bottom: 4px !important; }

    .search-box,
    .search-box[style] {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        width: 100% !important;
        height: 36px !important;
    }

    .filter-select,
    .filter-select[style],
    select[style*="min-width"] {
        min-width: 0 !important;
        max-width: none !important;
        height: 34px !important;
        font-size: 13px !important;
    }

    .content div[style*="min-width: 250px"],
    .content div[style*="min-width:250px"] {
        min-width: 0 !important;
        flex-basis: 100% !important;
    }

    .kassa-nav {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        -webkit-overflow-scrolling: touch;
    }

    .kassa-nav > * { flex: 0 0 auto; padding: 8px 10px !important; font-size: 0.75rem !important; }

    .suppliers-incomes-list-scale { zoom: 1 !important; }

    /* Omborlar va kategoriya tugmalari — bitta qatorda suriladi */
    .warehouse-filter-bar {
        padding: 6px 8px !important;
        margin-bottom: 6px !important;
        border-width: 1px !important;
    }

    .warehouse-filter-bar > div {
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 6px !important;
        overflow: hidden !important;
    }

    .warehouse-filter-bar strong { min-width: 0 !important; font-size: 0.72rem !important; white-space: nowrap; }

    #warehouseButtons,
    .categories-section {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 5px !important;
    }

    .warehouse-btn,
    .warehouse-btn[style] {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 5px 10px !important;
        font-size: 0.72rem !important;
    }

    .category-item { padding: 4px 9px !important; font-size: 0.72rem !important; }

    /* Mahsulot qidiruv va filtrlari */
    .products-filter-bar .filter-left > div[style*="nowrap"] {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 6px !important;
        overflow: visible !important;
    }

    .products-filter-bar .filter-left > div[style*="nowrap"] > .search-box { grid-column: 1 / -1; }
    .products-filter-bar .filter-left > div[style*="nowrap"] > .filter-select { width: 100% !important; }

    .products-filter-bar .filter-left > div[style*="nowrap"] > .btn {
        grid-column: 1 / -1;
        min-width: 0 !important;
        max-width: none !important;
        height: 32px !important;
        justify-content: center;
    }

    .pagination-bar {
        justify-content: center !important;
        margin: 8px 0 !important;
    }

    /* ===== Jadvallar ===== */
    .products-table-card,
    .products-table,
    .table-container,
    .table-wrapper,
    .table-responsive {
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .content table { width: 100%; }

    .content table th,
    .content table td {
        padding: 6px 7px !important;
        font-size: 0.78rem !important;
    }

    /* Ko‘p ustunli jadval — ixcham 2 ustunli kartochka (JS data-label qo‘yadi) */
    .content table.m-cards { min-width: 0 !important; border: none !important; background: transparent !important; }
    .content table.m-cards thead { display: none !important; }
    .content table.m-cards,
    .content table.m-cards tbody { display: block !important; width: 100% !important; }

    .content table.m-cards tbody tr {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 10px;
        position: relative;
        margin: 0 0 6px !important;
        padding: 8px 10px !important;
        border: 1px solid var(--border) !important;
        border-radius: 10px !important;
        background: var(--white);
    }

    .content table.m-cards tbody td {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
        white-space: normal !important;
        font-size: 0.78rem !important;
        line-height: 1.3;
        background: transparent !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content table.m-cards tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.58rem;
        font-weight: 700;
        letter-spacing: 0.3px;
        text-transform: uppercase;
        color: var(--text-light);
        margin-bottom: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content table.m-cards tbody td[data-label=""]::before { display: none; }

    .content table.m-cards tbody td * { max-width: 100%; }

    /* Har katak bitta qatorda: ichki bloklar yonma-yon, uzunlari "…" bilan qisqaradi */
    .content table.m-cards tbody td:not(:last-child) {
        white-space: nowrap !important;
        text-overflow: ellipsis;
        font-size: 0.74rem !important;
    }

    .content table.m-cards tbody td:not(:last-child) div,
    .content table.m-cards tbody td:not(:last-child) p {
        display: inline !important;
        margin: 0 4px 0 0 !important;
        font-size: inherit !important;
    }

    .content table.m-cards tbody td:not(:last-child) br { display: none; }

    .content table.m-cards tbody td:not(:last-child) small,
    .content table.m-cards tbody td:not(:last-child) .sla-indicator,
    .content table.m-cards tbody td:not(:last-child) div + div {
        font-size: 0.64rem !important;
        opacity: 0.85;
        margin-left: 3px !important;
    }

    .content table.m-cards tbody td:not(:last-child) span[style*="padding"] { padding: 0 4px !important; }

    .content table.m-cards tbody td.m-empty { display: none !important; }

    .content table.m-cards tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 5px 8px !important; }

    .content table.m-cards tbody td[data-label="№"],
    .content table.m-cards tbody td[data-label="#"] { display: none !important; }

    /* Amallar katagi — kartaning pastida to‘liq qator */
    .content table.m-cards tbody td:last-child {
        grid-column: span 2;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }

    .content table.m-cards tbody td:last-child::before { display: none !important; }

    .content table.m-cards tbody td .sla-indicator { display: inline !important; }

    .content table.m-cards .orders-action-icons,
    .content table.m-cards .action-icons {
        min-width: 0 !important;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 5px !important;
        margin-left: auto;
    }

    .content table.m-cards .order-action-btn {
        width: 30px !important;
        height: 30px !important;
        border-radius: 8px !important;
    }

    .content table.m-cards .order-action-btn i { font-size: 0.85rem !important; }

    .content table.m-cards tbody tr.m-full-row { display: block !important; }
    .content table.m-cards tbody tr.m-full-row td { display: block !important; text-align: center !important; border: none !important; }
    .content table.m-cards tbody tr.m-full-row td::before { display: none; }

    .content .products-table:has(table.m-cards) {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    body.dark-theme .content table.m-cards tbody tr {
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.09) !important;
    }

    body.dark-theme .content table.m-cards tbody td::before { color: #8aa0b8; }

    /* Qidiruv/amal kartalari yonlama surilmasin */
    .products-table.no-print {
        overflow: visible !important;
        padding: 8px !important;
        gap: 6px !important;
    }

    .products-table.no-print > div { flex: 1 1 100% !important; min-width: 0 !important; gap: 6px !important; }
    .products-table.no-print .btn { flex: 1 1 auto; justify-content: center; }

    /* ===== Mahsulotlar — ixcham ro‘yxat ===== */
    .products-table-card { padding: 0 !important; background: transparent !important; border: none !important; box-shadow: none !important; }
    .products-data-table { min-width: 0 !important; border: none !important; }
    .products-data-table thead { display: none; }
    .products-data-table,
    .products-data-table tbody { display: block; width: 100%; }

    .products-data-table tbody tr {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        gap: 2px 8px;
        padding: 6px 8px !important;
        margin: 0 !important;
        border: none !important;
        border-bottom: 1px solid var(--border) !important;
        border-left: 3px solid transparent !important;
        border-radius: 0 !important;
        background: var(--white);
    }

    .products-data-table tbody tr:first-child { border-radius: 10px 10px 0 0 !important; }
    .products-data-table tbody tr:last-child { border-radius: 0 0 10px 10px !important; border-bottom: none !important; }

    .products-data-table tbody td {
        display: block;
        border: none !important;
        padding: 0 !important;
        min-width: 0 !important;
        width: auto !important;
        background: transparent !important;
    }

    .products-data-table td.product-row-number { display: none !important; }

    /* Mahsulot (rasm + nom) | qoldiq */
    .products-data-table tbody td:nth-child(2) { order: 1; flex: 1 1 calc(100% - 96px); }
    .products-data-table tbody td:nth-child(6) { order: 2; flex: 0 0 88px; text-align: right; }

    /* Kategoriya, ta’minotchi, holat — nom ostida mayda qatorda */
    .products-data-table tbody td:nth-child(3),
    .products-data-table tbody td:nth-child(4),
    .products-data-table tbody td:nth-child(5) {
        order: 3;
        flex: 0 0 auto;
        font-size: 0.64rem !important;
        line-height: 1.2;
        color: var(--text-light);
        max-width: 40%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .products-data-table tbody td:nth-child(3) { margin-left: 46px; }

    .products-data-table tbody td:nth-child(3) *,
    .products-data-table tbody td:nth-child(4) *,
    .products-data-table tbody td:nth-child(5) * {
        font-size: 0.64rem !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        line-height: 1.3 !important;
    }

    .products-data-table .product-cell-info { gap: 8px !important; align-items: center; }

    .products-data-table .product-thumbnail,
    .products-data-table .product-thumbnail img {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px;
        flex-shrink: 0;
        border-radius: 8px !important;
    }

    .product-cell-details { min-width: 0; }

    .product-cell-name {
        font-size: 0.84rem !important;
        line-height: 1.25 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
    }

    .product-cell-name > span,
    .product-cell-name [class*="badge"] { font-size: 0.6rem !important; padding: 0 4px !important; }

    .products-data-table .product-cell-sku { display: none !important; }
    .products-data-table .product-thumbnail,
    .products-data-table .product-thumbnail img { width: 34px !important; height: 34px !important; min-width: 34px; }
    .products-data-table tbody td:nth-child(3) { margin-left: 42px; }

    .products-data-table tbody td:nth-child(6) * { font-size: 0.66rem !important; line-height: 1.3 !important; }
    .products-data-table .stock-bar-container { height: 4px !important; margin: 2px 0 !important; }
    .products-data-table .stock-split-legend { display: none !important; }

    /* Gorizontal suriladigan qatorlarda chiziq ko‘rinmasin */
    .content *::-webkit-scrollbar:horizontal { height: 0 !important; }
    .content * { scrollbar-width: thin; }

    .warehouse-filter-bar strong { display: none !important; }
    .categories-wrap { margin-bottom: 0 !important; }
    .categories-section { padding: 0 !important; margin: 0 !important; }
    .products-filter-bar { margin-bottom: 6px !important; }

    /* Qidiruv to‘liq qator; ikki filtr + "Narhsiz" bitta qatorda */
    .products-filter-bar .filter-left > div[style*="nowrap"] {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
    }

    .products-filter-bar .filter-left > div[style*="nowrap"] > .btn {
        grid-column: auto !important;
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
        overflow: hidden;
        font-size: 0 !important;
        justify-content: center;
    }

    .products-filter-bar .filter-left > div[style*="nowrap"] > .btn i { font-size: 13px !important; margin: 0 !important; }

    body.dark-theme .products-data-table tbody tr {
        background: rgba(255, 255, 255, 0.035);
        border-bottom-color: rgba(255, 255, 255, 0.07) !important;
    }

    /* ===== Oynalar — pastdan, to‘liq kenglikda ===== */
    .modal { align-items: flex-end !important; z-index: 2100 !important; }

    body:has(.modal.active) .m-bottom-nav,
    body:has(.modal[style*="display: flex"]) .m-bottom-nav,
    body:has(.modal[style*="display: block"]) .m-bottom-nav { display: none; }

    /* :not(#m-x) — ID darajasidagi eski qoidalardan kuchliroq bo‘lishi uchun */
    .modal:not(#m-x) .modal-content,
    .modal:not(#m-x) .modal-content[style],
    .modal:not(#m-x) .modal-dialog,
    .modal:not(#m-x) .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        max-height: 94dvh !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        overflow-y: auto;
    }

    .modal-header {
        padding: 10px 12px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .modal-header h2,
    .modal-header h3 { font-size: 1rem !important; }

    .modal-header > * { min-width: 0; max-width: 100%; }
    .modal-header .modal-close { margin-left: auto !important; }

    .modal [class*="-tabs"],
    .modal .tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        order: 5;
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal [class*="-tabs"] > * { flex: 0 0 auto; white-space: nowrap; }

    .modal div[style*="display: flex"]:not([style*="nowrap"]):not([style*="overflow-x"]),
    .modal div[style*="display:flex"]:not([style*="nowrap"]):not([style*="overflow-x"]) {
        flex-wrap: wrap;
        min-width: 0;
    }

    .modal .btn { max-width: 100%; white-space: normal; }

    .modal:not(#m-x) .modal-content table {
        display: block !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal-content img { max-width: 100%; height: auto; }
    .modal-body { padding: 10px 12px calc(14px + env(safe-area-inset-bottom)) !important; font-size: 13px; }
    .modal .form-group { margin-bottom: 10px !important; }
    .modal label { font-size: 0.78rem !important; margin-bottom: 3px !important; }

    .modal-footer,
    .modal-actions { flex-wrap: wrap; gap: 6px; }

    .modal-footer .btn,
    .modal-actions .btn { flex: 1 1 auto; }

    .toast {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(62px + env(safe-area-inset-bottom)) !important;
        max-width: none !important;
        font-size: 13px !important;
    }

    /* ===== Pastki navigatsiya ===== */
    .m-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 950;
        padding: 3px 2px calc(3px + env(safe-area-inset-bottom));
        background: rgba(6, 22, 28, 0.97);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .m-bottom-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        border: none;
        background: transparent;
        color: rgba(203, 233, 238, 0.7);
        font-size: 9.5px;
        font-weight: 600;
        padding: 5px 2px;
        border-radius: 8px;
        cursor: pointer;
    }

    .m-bottom-nav button i { font-size: 15px; }

    .m-bottom-nav button.active {
        color: var(--secondary);
        background: rgba(126, 217, 87, 0.1);
    }
}

@media (max-width: 900px) {
    /* 5+ kartali ko'rsatkichlar — 3 ustun */
    .content .stats-grid:has(> .stat-card:nth-child(5)):not(.stats-grid--products-kpis) {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .content .stats-grid:has(> .stat-card:nth-child(5)) .stat-card { padding: 7px 8px !important; min-height: 0 !important; }

    /* Asboblar paneli: tugmalar yonma-yon */
    .content .customers-page-toolbar,
    .content .action-buttons {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center;
        gap: 6px !important;
    }

    .content .customers-page-toolbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        margin-bottom: 8px !important;
    }

    .content .customers-page-toolbar > .action-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100% !important;
    }

    .content .customers-page-toolbar .btn {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        justify-content: center;
    }

    .content .customers-page-toolbar > .customers-toolbar-settings {
        font-size: 0 !important;
        width: 34px !important;
        padding: 0 !important;
    }

    .content .customers-page-toolbar > .customers-toolbar-settings i { font-size: 0.85rem; margin: 0 !important; }

    .content .action-buttons .btn,
    .content .customers-page-toolbar > .btn {
        width: auto !important;
        flex: 1 1 auto;
        min-height: 32px;
        padding: 6px 9px !important;
        font-size: 0.74rem !important;
        margin: 0 !important;
    }

    /* Filtrlar: 2 ustun */
    .content .search-bar { padding: 8px !important; gap: 6px !important; margin-bottom: 8px !important; }

    .content .search-bar .filter-group {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100%;
    }

    .content .search-bar .filter-group .filter-select {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 34px;
        height: 34px;
        font-size: 0.76rem !important;
        padding: 0 8px !important;
        margin: 0 !important;
    }
}

@media (max-width: 380px) {
    #adminThemeSwitch { display: none !important; }
}

@media (max-width: 339px) {
    .content table.m-cards tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
