/* =====================================================================
   TELEFON BRAUZERIDA — Android ilovadagidek ko'rinish
   (pastki menyu, «Ko'proq» varag'i, ilova uslubidagi yuqori panel va sahifa).

   Markup: views/layouts/_mobile_nav.php (+ _topbar.php dagi orqaga tugmasi),
   mantiq: web/js/mobile-nav.js. Faqat ≤ 991 px va `body.has-mnav` da
   (Android ilovada `has-mnav` yo'q — u yerda bularni ilovaning o'zi chizadi).
   Sahifa uslubi `mobile/app/src/main/assets/app-ui.css` bilan bir xil.
   ===================================================================== */

.mnav,
.msheet,
.app-topbar__back,
.app-topbar__sub {
    display: none;
}

@media (max-width: 991.98px) {
    body.has-mnav {
        --mnav-h: 66px;
        -webkit-tap-highlight-color: transparent;
    }

    /* ---------------------------------------------------------------- saytning kompyuter qismlari */
    body.has-mnav .app-sidebar,
    body.has-mnav .app-backdrop,
    body.has-mnav .app-footer,
    body.has-mnav .app-topbar [data-sidebar-toggle],
    body.has-mnav .app-topbar__crumbs,
    body.has-mnav .app-topbar .app-tgbtn,
    body.has-mnav .app-topbar .app-balbtn,
    body.has-mnav .app-topbar .app-deskbtn,
    body.has-mnav .app-topbar .app-branch,
    body.has-mnav .page-head__title.sn-dup {
        display: none !important;
    }

    body.has-mnav .app-content {
        margin-left: 0;
    }

    body.has-mnav .app-main {
        padding: 14px 14px calc(var(--mnav-h) + 24px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* ---------------------------------------------------------------- yuqori panel (ilovadagidek) */
    body.has-mnav .app-topbar {
        height: 60px;
        padding: 0 .3rem 0 .85rem;
        gap: .1rem;
    }

    body.has-mnav .app-topbar__back:not([hidden]) {
        display: grid;
        place-items: center;
        margin-left: -.55rem;
        font-size: 1.1rem;
    }

    /* Sarlavha har doim ko'rinadi (tor ekranda balans uchun yashirilardi — balans endi «Obuna» bo'limida) */
    body.has-mnav .app-topbar .app-topbar__title {
        display: block;
    }

    body.has-mnav .app-topbar__title {
        font-size: 1.15rem;
        font-weight: 650;
        line-height: 1.25;
    }

    body.has-mnav .app-topbar__sub:not([hidden]) {
        display: flex;
        align-items: center;
        gap: .3rem;
        max-width: 100%;
        border: 0;
        padding: 0;
        background: none;
        color: var(--app-muted);
        font-size: .78rem;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.has-mnav .app-topbar__sub i {
        font-size: .65rem;
    }

    body.has-mnav .app-topbar .app-iconbtn {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
    }

    /* Bonus — ilovadagidek dumaloq tugma, yozuvsiz */
    body.has-mnav .app-topbar .app-bonusbtn {
        width: 34px;
        height: 34px;
        padding: 0;
        margin: 0 .25rem;
        border-radius: 50%;
        justify-content: center;
        flex: 0 0 34px;
    }

    body.has-mnav .app-topbar .app-bonusbtn__label {
        display: none;
    }

    /*
     * Ko'rinish sozlamalari — ekranning o'ng chetida, yarmi ko'rinib turadi (tishli g'ildirak).
     * Chapga surilsa yoki bosilsa — to'liq chiqadi, chiqib turganda bosilsa — sozlamalar paneli
     * (`edge-dock.js`); yuqoriga/pastga surib joyini o'zgartirsa bo'ladi.
     */
    body.has-mnav .ui-handle.edge-dock.is-tucked {
        transform: translateX(50%);
    }

    /* ---------------------------------------------------------------- pastki menyu */
    body.has-mnav .mnav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        display: flex;
        height: calc(var(--mnav-h) + env(safe-area-inset-bottom, 0px));
        padding: 6px 4px env(safe-area-inset-bottom, 0px);
        background: var(--app-surface);
        border-top: 1px solid var(--app-border);
        box-shadow: 0 -10px 26px -20px rgba(15, 23, 42, .4);
    }

    /* Ekran klaviaturasi ochiq — yozishga joy qolsin (ilovadagidek) */
    body.has-mnav.mnav-kb .mnav {
        display: none;
    }

    .mnav__item {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border: 0;
        padding: 0;
        background: none;
        color: var(--app-muted);
        font-size: 11.5px;
        font-weight: 500;
        text-decoration: none;
        -webkit-touch-callout: none;
        user-select: none;
    }

    .mnav__item:hover,
    .mnav__item:focus {
        color: var(--app-text);
    }

    .mnav__pill {
        position: relative;
        width: 58px;
        height: 32px;
        border-radius: 16px;
        display: grid;
        place-items: center;
        font-size: 18px;
        transition: background-color .2s ease, color .2s ease;
    }

    .mnav__item:active .mnav__pill {
        background: rgba(100, 116, 139, .12);
    }

    .mnav__item.is-active {
        color: var(--app-text);
        font-weight: 600;
    }

    .mnav__item.is-active .mnav__pill {
        background: var(--app-accent-soft);
        color: var(--app-accent);
    }

    .mnav__label {
        max-width: 100%;
        padding: 0 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mnav__badge {
        position: absolute;
        top: -4px;
        right: 4px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 9px;
        border: 2px solid var(--app-surface);
        background: #ef4444;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 14px;
        text-align: center;
    }

    .mnav__badge--dot {
        top: 2px;
        right: 14px;
        min-width: 11px;
        width: 11px;
        height: 11px;
        padding: 0;
    }

    /* Sahifaning o'z pastki paneli (to'lov, saqlash) — menyu ustida */
    body.has-mnav .sale-paybar,
    body.has-mnav .sale-savebar {
        bottom: calc(var(--mnav-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: .6rem;
    }

    body.has-mnav.has-paybar .app-main {
        padding-bottom: calc(var(--mnav-h) + 160px) !important;
    }

    body.has-mnav.has-savebar .app-main {
        padding-bottom: calc(var(--mnav-h) + 140px) !important;
    }

    body.has-mnav.mnav-kb .sale-paybar,
    body.has-mnav.mnav-kb .sale-savebar {
        bottom: 0;
    }

    /* Yordam (chat) tugmasi — menyu ustida */
    body.has-mnav .sc-fab {
        bottom: calc(var(--mnav-h) + 14px + env(safe-area-inset-bottom, 0px));
    }

    body.has-mnav.has-paybar .sc-fab {
        bottom: calc(var(--mnav-h) + 132px + env(safe-area-inset-bottom, 0px));
    }

    body.has-mnav.has-savebar .sc-fab {
        bottom: calc(var(--mnav-h) + 120px + env(safe-area-inset-bottom, 0px));
    }

    /* ---------------------------------------------------------------- «Ko'proq» varag'i */
    body.has-mnav .msheet:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1060;
    }

    .msheet__scrim {
        position: absolute;
        inset: 0;
        background: rgba(2, 6, 23, .45);
        opacity: 0;
        transition: opacity .22s ease;
    }

    .msheet.is-open .msheet__scrim {
        opacity: 1;
    }

    .msheet__panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 88vh;
        max-height: 88dvh;
        display: flex;
        flex-direction: column;
        background: var(--app-surface);
        border-radius: 28px 28px 0 0;
        box-shadow: 0 -16px 40px -12px rgba(2, 6, 23, .35);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateY(100%);
        transition: transform .28s cubic-bezier(.2, .8, .2, 1);
        will-change: transform;
    }

    .msheet.is-open .msheet__panel {
        transform: translateY(0);
    }

    /* Barmoq bilan surilayotganda — animatsiyasiz, barmoq ortidan */
    .msheet.is-dragging .msheet__panel,
    .msheet.is-dragging .msheet__scrim {
        transition: none;
    }

    .msheet__grab {
        flex: 0 0 auto;
        display: flex;
        justify-content: center;
        padding: 10px 0 14px;
        touch-action: none;
        cursor: grab;
    }

    .msheet__grab span {
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--app-border);
    }

    .msheet__scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0 16px 20px;
    }

    /* Faqat filial tanlash (sarlavha ostidagi filial nomi bosilganda) */
    .msheet.is-branches .msheet__only-full {
        display: none;
    }

    .msheet__profile {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px;
        border-radius: 20px;
        background: var(--app-surface-2);
    }

    .msheet__avatar {
        flex: none;
        border-radius: 50%;
        object-fit: cover;
        display: grid;
        place-items: center;
        color: #fff;
        font-size: 1.3rem;
        font-weight: 650;
    }

    .msheet__who {
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    .msheet__who strong {
        font-size: 17px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .msheet__who small {
        font-size: 13px;
        color: var(--app-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .msheet__label {
        padding: 20px 4px 10px;
        font-size: 13px;
        font-weight: 600;
        color: var(--app-muted);
    }

    .msheet__grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .msheet__tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        min-width: 0;
        padding: 14px 6px 12px;
        border-radius: 18px;
        background: var(--app-surface-2);
        color: var(--app-text);
        font-size: 12.5px;
        line-height: 1.25;
        text-align: center;
        text-decoration: none;
        -webkit-touch-callout: none;
        user-select: none;
        transition: transform .08s ease;
    }

    .msheet__tile:active {
        transform: scale(.97);
    }

    .msheet__tile:hover {
        color: var(--app-text);
    }

    .msheet__tile.is-active {
        background: var(--app-accent-soft);
    }

    .msheet__ticon {
        position: relative;
        width: 44px;
        height: 44px;
        border-radius: 14px;
        display: grid;
        place-items: center;
        background: var(--app-accent-soft);
        color: var(--app-accent);
        font-size: 18px;
    }

    .msheet__tile.is-active .msheet__ticon {
        background: var(--app-surface);
    }

    .msheet__ticon .mnav__badge {
        top: -6px;
        right: -8px;
    }

    .msheet__tlabel {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-word;
    }

    .msheet__card {
        margin-top: 18px;
        padding: 4px 0;
        border-radius: 20px;
        background: var(--app-surface-2);
    }

    .msheet__branches .msheet__card {
        margin-top: 0;
    }

    .msheet__branches:not([hidden]) {
        display: block;
    }

    .msheet__row {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
        min-height: 56px;
        padding: 9px 14px;
        border: 0;
        background: none;
        color: var(--app-text);
        font-size: 15.5px;
        text-align: left;
        text-decoration: none;
        -webkit-touch-callout: none;
        user-select: none;
    }

    .msheet__row:hover {
        color: var(--app-text);
    }

    .msheet__row:active {
        background: rgba(100, 116, 139, .1);
    }

    .msheet__ricon {
        width: 38px;
        height: 38px;
        flex: none;
        border-radius: 12px;
        display: grid;
        place-items: center;
        background: var(--app-accent-soft);
        color: var(--app-accent);
        font-size: 16px;
    }

    .msheet__rtext {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .msheet__rtext small {
        font-size: 12.5px;
        color: var(--app-muted);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .msheet__rgo {
        flex: none;
        font-size: 12px;
        color: var(--app-muted);
    }

    .msheet__row.is-active,
    .msheet__row.is-active .msheet__rtext {
        color: var(--app-accent);
    }

    .msheet__row--danger,
    .msheet__row--danger:hover {
        color: #dc2626;
    }

    .msheet__row--danger .msheet__ricon {
        background: rgba(220, 38, 38, .12);
        color: #dc2626;
    }

    .msheet__ver {
        padding-top: 18px;
        text-align: center;
        font-size: 12px;
        color: var(--app-muted);
    }

    /* Bo'limlar tartibi (varaq ichida) */
    .msheet__sorthead {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0 4px 12px;
    }

    .msheet__sorthead strong {
        font-size: 17px;
    }

    .msheet__sorthead small {
        font-size: 13px;
        color: var(--app-muted);
        line-height: 1.4;
    }

    .msheet__sortgroup + .msheet__sortgroup {
        margin-top: 14px;
    }

    .msheet__sortlist .msheet__label {
        padding-top: 6px;
    }

    .msheet__sortitems {
        display: grid;
        gap: 6px;
    }

    .msheet__sortitem {
        position: relative;
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 52px;
        padding: 6px 10px 6px 6px;
        border-radius: 16px;
        background: var(--app-surface-2);
        font-size: 15px;
        user-select: none;
        -webkit-touch-callout: none;
    }

    .msheet__sortitem.is-tab {
        background: var(--app-accent-soft);
    }

    .msheet__sortitem.is-dragging {
        z-index: 2;
        background: var(--app-surface);
        box-shadow: 0 14px 30px -12px rgba(2, 6, 23, .45), 0 0 0 1px rgba(var(--app-accent-rgb), .45);
    }

    .msheet__sortgrip {
        width: 36px;
        height: 40px;
        flex: none;
        display: grid;
        place-items: center;
        color: var(--app-muted);
        touch-action: none;
        cursor: grab;
    }

    .msheet__sorticon {
        width: 34px;
        height: 34px;
        flex: none;
        border-radius: 11px;
        display: grid;
        place-items: center;
        background: var(--app-surface);
        color: var(--app-accent);
        font-size: 15px;
    }

    .msheet__sorttext {
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .msheet__sorttag {
        flex: none;
        padding: 2px 8px;
        border-radius: 999px;
        background: var(--app-accent);
        color: #fff;
        font-size: 11px;
        font-weight: 600;
    }

    .msheet__sortbtns {
        position: sticky;
        bottom: -20px;
        display: flex;
        gap: 10px;
        margin: 16px -16px -20px;
        padding: 12px 16px 16px;
        background: var(--app-surface);
        border-top: 1px solid var(--app-border);
    }

    .msheet__sortbtns .btn {
        flex: 1 1 0;
        min-height: 48px;
        border-radius: 14px;
        font-weight: 600;
    }

    .msheet.is-sorting .msheet__main {
        display: none;
    }

    .msheet.is-sorting .msheet__sort[hidden] {
        display: block !important;
    }

    /* ---------------------------------------------------------------- sahifa: ilovadagidek (barmoq uchun) */
    body.has-mnav a,
    body.has-mnav button,
    body.has-mnav .btn,
    body.has-mnav .nav-link,
    body.has-mnav .dropdown-item,
    body.has-mnav .page-link {
        -webkit-touch-callout: none;
    }

    body.has-mnav .page-head {
        margin-bottom: 14px;
        gap: 10px;
    }

    body.has-mnav .page-head__title {
        font-size: 1.3rem;
    }

    body.has-mnav .page-head__sub {
        margin-top: 0;
        font-size: .84rem;
    }

    body.has-mnav .page-head__actions {
        width: 100%;
    }

    body.has-mnav .page-head__actions > .btn,
    body.has-mnav .page-head__actions > a.btn,
    body.has-mnav .page-head__actions > .dropdown {
        flex: 1 1 auto;
    }

    body.has-mnav .page-head__actions > .dropdown > .btn {
        width: 100%;
    }

    body.has-mnav .card,
    body.has-mnav .app-card {
        border-radius: 20px;
    }

    body.has-mnav .card-header:first-child {
        border-radius: 20px 20px 0 0;
    }

    body.has-mnav .card-footer:last-child {
        border-radius: 0 0 20px 20px;
    }

    body.has-mnav .btn {
        border-radius: 14px;
        font-weight: 600;
    }

    body.has-mnav .btn:not(.btn-sm):not(.btn-link):not(.btn-close) {
        min-height: 46px;
    }

    body.has-mnav .btn:active {
        transform: scale(.97);
    }

    body.has-mnav .form-control,
    body.has-mnav .form-select,
    body.has-mnav .input-group-text,
    body.has-mnav .input-group > .btn {
        border-radius: 14px;
    }

    body.has-mnav .form-control:not(.form-control-sm):not(textarea),
    body.has-mnav .form-select:not(.form-select-sm) {
        min-height: 48px;
    }

    /* 16px — kichikroq bo'lsa telefon maydonga bosganda sahifani kattalashtiradi */
    body.has-mnav .form-control:not(.form-control-sm),
    body.has-mnav .form-select:not(.form-select-sm) {
        font-size: 16px;
    }

    body.has-mnav .table-responsive {
        border-radius: 16px;
    }

    body.has-mnav .list-group {
        border-radius: 18px;
    }

    body.has-mnav .pagination .page-link {
        min-width: 42px;
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.has-mnav .nav-tabs,
    body.has-mnav .nav-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    body.has-mnav .nav-tabs .nav-link,
    body.has-mnav .nav-pills .nav-link {
        white-space: nowrap;
    }

    body.has-mnav .dropdown-menu {
        border-radius: 16px;
        padding: 6px;
        box-shadow: 0 16px 40px -12px rgba(2, 6, 23, .35);
    }

    body.has-mnav .dropdown-item {
        border-radius: 10px;
        padding: .6rem .8rem;
    }
}

/* Oynalar telefonda — pastdan chiqadigan varaq (ilovadagidek) */
@media (max-width: 767.98px) {
    body.has-mnav .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down):not(.modal-fullscreen-md-down) {
        margin: 0;
        max-width: none;
        width: 100%;
        min-height: 100%;
        display: flex;
        align-items: flex-end;
        padding-top: 48px;
    }

    body.has-mnav .modal-dialog.modal-dialog-scrollable:not(.modal-fullscreen):not(.modal-fullscreen-sm-down):not(.modal-fullscreen-md-down) {
        height: 100%;
    }

    body.has-mnav .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down):not(.modal-fullscreen-md-down) > .modal-content {
        width: 100%;
        border: 0;
        border-radius: 26px 26px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    body.has-mnav .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down):not(.modal-fullscreen-md-down) > .modal-content::before {
        content: "";
        flex: 0 0 auto;
        display: block;
        width: 40px;
        height: 4px;
        margin: 8px auto 0;
        border-radius: 2px;
        background: var(--app-border);
    }

    body.has-mnav .modal.fade .modal-dialog:not(.modal-fullscreen):not(.modal-fullscreen-sm-down):not(.modal-fullscreen-md-down) {
        transform: translateY(80px);
        transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    }

    body.has-mnav .modal.show .modal-dialog {
        transform: none;
    }

    body.has-mnav .modal-footer {
        gap: 8px;
    }

    body.has-mnav .modal-footer > .btn {
        flex: 1 1 0;
        margin: 0;
    }
}
