/* Mobile / installed-app look (below 992px). The desktop layout is not touched. */
.m-appbar, .m-tabbar, .m-only { display: none; }

@media (max-width: 991.98px) {
    html, body { overscroll-behavior-y: none; }
    body { -webkit-tap-highlight-color: transparent; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    .m-only { display: block; }
    .d-desktop { display: none !important; }

    /* top app bar */
    .m-appbar {
        display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 1030;
        padding: calc(.55rem + env(safe-area-inset-top)) .75rem .55rem; color: #fff; background: var(--app-gradient);
        box-shadow: 0 2px 12px rgba(var(--app-primary-rgb), .25);
    }
    .m-appbar .m-title { flex: 1; font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
    .m-appbar .m-icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; text-decoration: none; }
    .m-appbar .m-icon-btn:active { background: rgba(255,255,255,.3); }
    .m-appbar .m-balance { background: rgba(255,255,255,.18); border-radius: 2rem; padding: .3rem .7rem; font-weight: 600; font-size: .85rem; color: #fff; text-decoration: none; white-space: nowrap; }

    /* bottom tab bar */
    .m-tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; justify-content: space-around; align-items: flex-end;
        padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); background: var(--bs-body-bg);
        box-shadow: 0 -4px 18px rgba(0,0,0,.08); border-top: 1px solid var(--bs-border-color-translucent);
    }
    .m-tabbar a, .m-tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .68rem; color: var(--bs-secondary-color); text-decoration: none; background: none; border: 0; padding: .15rem 0; user-select: none; }
    .m-tabbar i { font-size: 1.35rem; line-height: 1; }
    .m-tabbar .active { color: var(--app-primary); font-weight: 600; }
    .m-tabbar .m-fab { position: relative; top: -16px; }
    .m-tabbar .m-fab span.circle { width: 56px; height: 56px; border-radius: 50%; background: var(--app-gradient); color: #fff; display: flex; align-items: center; justify-content: center;
        box-shadow: 0 6px 18px rgba(var(--app-primary-rgb), .45); border: 4px solid var(--bs-body-bg); }
    .m-tabbar .m-fab i { font-size: 1.6rem; }

    /* content */
    main { min-height: auto !important; }
    .m-content { padding: .9rem .8rem 1rem !important; }
    .card { border: 0; border-radius: 1rem; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
    .card-header:first-child { border-radius: 1rem 1rem 0 0; }
    .form-control, .form-select { font-size: 16px; border-radius: .8rem; } /* 16px: no zoom on iOS */
    .form-control-lg, .form-select-lg, .input-group-lg > .form-control { font-size: 1.1rem; }
    .btn { border-radius: .8rem; }
    .btn-lg { padding: .8rem 1rem; }
    .btn:active, .m-tile:active, .op-choice label:active { transform: scale(.97); }
    .alert { border-radius: .9rem; border: 0; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
    h1, .h4 { font-size: 1.25rem; }
    .table { font-size: .875rem; }
    .op-choice label { border-radius: .9rem; padding: .75rem .5rem; }

    /* drawer (the desktop sidebar opens from the side) */
    .sidebar.offcanvas-lg { width: 84vw !important; max-width: 320px; }

    /* PIN pop-up as a bottom sheet */
    .pin-modal { align-items: flex-end !important; padding: 0 !important; }
    .pin-modal .pin-box { max-width: none !important; border-radius: 1.4rem 1.4rem 0 0 !important; padding-bottom: env(safe-area-inset-bottom); animation: m-sheet .22s ease-out; }
}
@keyframes m-sheet { from { transform: translateY(100%); } to { transform: none; } }

/* home screen pieces (used on mobile) */
.m-hero { border-radius: 1.3rem; padding: 1.2rem; color: #fff; background: var(--app-gradient); box-shadow: 0 10px 28px rgba(var(--app-primary-rgb), .35); position: relative; overflow: hidden; }
.m-hero::after { content: ""; position: absolute; width: 180px; height: 180px; right: -50px; top: -60px; border-radius: 50%; background: rgba(255,255,255,.12); }
.m-hero .m-hero-label { font-size: .8rem; opacity: .85; }
.m-hero .m-hero-amount { font-size: 2rem; font-weight: 700; letter-spacing: .01em; }
.m-hero .btn-light { color: var(--app-primary-dark); font-weight: 600; }
.m-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem .4rem; }
.m-tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-decoration: none; color: var(--bs-body-color); font-size: .74rem; text-align: center; line-height: 1.15; }
.m-tile .ico { width: 54px; height: 54px; border-radius: 1.1rem; display: flex; align-items: center; justify-content: center; font-size: 1.45rem; color: #fff; box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.m-tile .ico.c1 { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.m-tile .ico.c2 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.m-tile .ico.c3 { background: linear-gradient(135deg, #10b981, #059669); }
.m-tile .ico.c4 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.m-tile .ico.c5 { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.m-tile .ico.c6 { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
.m-tile .ico.c7 { background: linear-gradient(135deg, #64748b, #334155); }
.m-tile .ico.c8 { background: var(--app-gradient); }
.m-list .m-item { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; text-decoration: none; color: var(--bs-body-color); border-bottom: 1px solid var(--bs-border-color-translucent); }
.m-list .m-item:last-child { border-bottom: 0; }
.m-list .m-avatar { width: 42px; height: 42px; border-radius: .9rem; display: flex; align-items: center; justify-content: center; background: rgba(var(--app-primary-rgb), .12); color: var(--app-primary); font-size: 1.2rem; flex: none; }
.m-list .m-main { flex: 1; min-width: 0; }
.m-list .m-main .t { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-list .m-main .s { font-size: .75rem; color: var(--bs-secondary-color); }
.m-list .m-right { text-align: right; font-size: .9rem; font-weight: 600; }

/* PWA install banner */
.pwa-banner { position: fixed; left: .75rem; right: .75rem; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 1050; display: none;
    background: var(--bs-body-bg); border-radius: 1.1rem; box-shadow: 0 12px 34px rgba(0,0,0,.22); padding: .9rem; animation: m-sheet .25s ease-out; }
.pwa-banner.show { display: block; }
.pwa-banner.no-tabbar { bottom: calc(.75rem + env(safe-area-inset-bottom)); }
.pwa-banner .pwa-icon { width: 48px; height: 48px; border-radius: .9rem; flex: none; }
.pwa-banner .pwa-steps { font-size: .82rem; color: var(--bs-secondary-color); margin-top: .5rem; }
@media (min-width: 992px) { .pwa-banner { left: auto; width: 380px; bottom: 1rem; } }

/* standalone (installed) app */
@media (display-mode: standalone) { .powered-by { display: none; } }

/* sign-in pages */
.guest-logo { width: 72px; height: 72px; border-radius: 1.3rem; box-shadow: 0 10px 26px rgba(var(--app-primary-rgb), .35); }
.guest-sub { color: var(--bs-secondary-color); }
@media (max-width: 991.98px) {
    .guest-body { padding-bottom: 0; }
    .guest-hero { position: absolute; inset: 0 0 auto 0; height: 300px; background: var(--app-gradient); border-radius: 0 0 2rem 2rem; z-index: 0; }
    .guest-wrap { position: relative; z-index: 1; padding-top: calc(2.5rem + env(safe-area-inset-top)) !important; }
    .guest-brand, .guest-brand .guest-sub { color: #fff; }
    .guest-logo { box-shadow: 0 10px 26px rgba(0,0,0,.25); border: 3px solid rgba(255,255,255,.6); }
}
.guest-lang { position: absolute; top: calc(.75rem + env(safe-area-inset-top)); right: .75rem; z-index: 2; background: rgba(255,255,255,.2); color: #fff; }
@media (min-width: 992px) { .guest-lang { background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); } }

/* ---------------------------------------------------------------- native-app feel (2.6) */
.m-sheet, .m-sheet-backdrop { display: none; }
@media (max-width: 991.98px) {
    /* the side menu is desktop only: on phones the "More" sheet replaces it */
    .app-sidebar { display: none !important; }
    .m-appbar, .m-tabbar, .m-sheet-head, .m-grid, .m-tiles, .btn, .nav-link { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
    a, button, .btn, label { touch-action: manipulation; }
    .m-content { animation: m-enter .22s ease-out; }

    /* tab bar: filled icon and a pill behind the active tab */
    .m-tabbar a:not(.m-fab), .m-tabbar > button { position: relative; }
    .m-tabbar a.active:not(.m-fab) i { background: rgba(var(--app-primary-rgb), .12); border-radius: 1rem; padding: .12rem .9rem; }
    .m-tabbar .m-dot { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: .62rem; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--bs-body-bg); }

    /* bottom sheet */
    .m-sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 1060; background: rgba(15, 23, 42, .45); opacity: 0; transition: opacity .25s; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
    .m-sheet-backdrop.show { opacity: 1; }
    .m-sheet-backdrop[hidden] { display: none; }
    .m-sheet { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1065; max-height: 88vh; max-height: 88dvh;
        background: var(--bs-body-bg); border-radius: 1.5rem 1.5rem 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
        transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); will-change: transform; }
    .m-sheet.open { transform: none; }
    .m-sheet.dragging { transition: none; }
    .m-sheet-grab { padding: .55rem 0 .2rem; display: flex; justify-content: center; touch-action: none; }
    .m-sheet-grab span { width: 42px; height: 5px; border-radius: 3px; background: var(--bs-border-color); }
    .m-sheet-head { display: flex; align-items: center; gap: .75rem; padding: .4rem 1rem .9rem; border-bottom: 1px solid var(--bs-border-color-translucent); touch-action: none; }
    .m-avatar-lg { width: 46px; height: 46px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--app-gradient); }
    .m-sheet-balance { text-decoration: none; text-align: right; font-weight: 700; color: var(--app-primary); line-height: 1.1; white-space: nowrap; }
    .m-sheet-balance small { display: block; font-weight: 500; font-size: .66rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .04em; }
    .m-sheet-x { width: 34px; height: 34px; border-radius: 50%; border: 0; flex: none; background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
    .m-sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: .4rem 1rem 1.2rem; }
    .m-sheet-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--bs-secondary-color); margin: 1rem 0 .6rem; }
    .m-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem .35rem; }
    .m-cell { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-decoration: none; color: var(--bs-body-color); font-size: .72rem; text-align: center; line-height: 1.15; }
    .m-cell .ico { position: relative; width: 52px; height: 52px; border-radius: 1rem; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; color: #fff; box-shadow: 0 5px 12px rgba(0, 0, 0, .12); transition: transform .12s; }
    .m-cell:active .ico { transform: scale(.9); }
    .m-cell.active .lbl { color: var(--app-primary); font-weight: 600; }
    .m-cell .ico.c1 { background: linear-gradient(135deg, #3b82f6, #6366f1); }
    .m-cell .ico.c2 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
    .m-cell .ico.c3 { background: linear-gradient(135deg, #10b981, #059669); }
    .m-cell .ico.c4 { background: linear-gradient(135deg, #f59e0b, #f97316); }
    .m-cell .ico.c5 { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
    .m-cell .ico.c6 { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
    .m-cell .ico.c7 { background: linear-gradient(135deg, #64748b, #334155); }
    .m-cell .ico.c8 { background: var(--app-gradient); }
    .m-cell .m-count { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #ef4444; color: #fff; font-size: .62rem; line-height: 19px; border: 2px solid var(--bs-body-bg); }
    .m-sheet-list { border-radius: 1rem; background: var(--bs-tertiary-bg); overflow: hidden; }
    .m-sheet-list .m-item { color: var(--bs-body-color); }
    .m-sheet-list .m-item.text-danger .t { color: var(--bs-danger); }
    body.m-sheet-on { overflow: hidden; }

    /* page loading bar (shown when leaving a page) */
    .m-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 2000; background: rgba(255, 255, 255, .9); box-shadow: 0 0 8px rgba(255, 255, 255, .8); transition: width 8s cubic-bezier(.1, .7, .1, 1); }
    .m-progress.go { width: 85%; }
}
@keyframes m-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* installed app: no web-site chrome */
@media (display-mode: standalone) { .web-only { display: none !important; } }

/* home banners (carousel) */
.m-banners { border-radius: 1.1rem; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, .1); }
.m-banner { display: block; position: relative; aspect-ratio: 12 / 5; background: var(--bs-tertiary-bg); -webkit-user-select: none; user-select: none; }
.m-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-banner-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem .9rem .9rem; color: #fff; font-weight: 600; font-size: .95rem; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
.m-banners .carousel-indicators { margin-bottom: .35rem; }
.m-banners .carousel-indicators [data-bs-target] { width: 7px; height: 7px; border-radius: 50%; border: 0; margin: 0 3px; opacity: .55; transition: width .2s, opacity .2s; }
.m-banners .carousel-indicators .active { width: 18px; border-radius: 4px; opacity: 1; }
.m-banners:has(.m-banner-cap) .carousel-indicators { justify-content: flex-end; margin-right: .75rem; }

/* notice pop-up */
.notice-modal .modal-content { border: 0; border-radius: 1.3rem; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.notice-head { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; color: #fff; }
.notice-head > i { font-size: 1.3rem; }
.notice-count { font-size: .75rem; background: rgba(255, 255, 255, .22); border-radius: 1rem; padding: .1rem .5rem; }
.notice-body { font-size: .95rem; line-height: 1.55; max-height: 55vh; overflow-y: auto; }
.notice-foot { padding: 0 1rem 1rem; }
@media (max-width: 575.98px) { .notice-modal .modal-dialog { margin: 1rem; } }
