/* ==========================================================================
   Immensive – mobile app layer
   Turns the admin / team / user shells into an app-like experience on phones
   and installed PWAs: green hero header, rounded cards, floating bottom tab bar,
   bottom-sheet menu. Desktop (>= 992px) is untouched.
   Brand: green #96c139, ink #2b2b2b. Font: Rubik (already loaded by style.css).
   ========================================================================== */

:root {
    --ims-green: #96c139;
    --ims-green-d: #4f7a12;
    --ims-green-dd: #2f4f0b;
    --ims-ink: #1d2417;
    --ims-muted: #6b7686;
    --ims-bg: #f4f6f1;
    --ims-line: #e6ebe0;
    --ims-bar-h: 60px;
    --ims-tab-h: 70px;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
}

/* Elements that only exist for the mobile shell are invisible on desktop. */
.ims-tabbar, .ims-backdrop, .ims-sheet, .ims-ios { display: none; }
.ims-backdrop[hidden], .ims-sheet[hidden], .ims-install[hidden], .ims-ios[hidden],
.ims-row[hidden], .ims-acc[hidden], .ims-group[hidden] { display: none !important; }

/* Navigation progress bar (all sizes) */
.ims-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2100; pointer-events: none; opacity: 0; transition: opacity .2s; }
.ims-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #96c139, #d4ee8a); box-shadow: 0 0 10px rgba(150, 193, 57, .8); }
.ims-progress.is-running { opacity: 1; }
.ims-progress.is-running span { width: 86%; transition: width 9s cubic-bezier(.1, .6, .2, 1); }

/* Portrait only: on a phone held sideways show a notice instead of a squashed layout. */
.ims-rotate { display: none; position: fixed; inset: 0; z-index: 2000; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; text-align: center; padding: 24px;
    background: linear-gradient(155deg, #2f4f0b 0%, #4f7a12 55%, #7fae22 100%); }
.ims-rotate i { font-size: 46px; animation: ims-rot 2.2s ease-in-out infinite; }
.ims-rotate p { margin: 0; font-size: 17px; font-weight: 500; }
@keyframes ims-rot { 0%, 100% { transform: rotate(90deg); } 45%, 60% { transform: rotate(0); } }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
    .ims-rotate { display: flex; }
    html, body { overflow: hidden !important; }
}

/* Install banner + iOS help use the same look on every page, including the login screen. */
.ims-btn { appearance: none; -webkit-appearance: none; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; font: 600 15px/1 Rubik, system-ui, sans-serif; cursor: pointer; }
.ims-btn--primary { background: var(--ims-green); color: #1b2a07; }
.ims-btn--ghost { background: transparent; color: var(--ims-muted); }
.ims-install { position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 1080; display: grid; grid-template-columns: 44px 1fr; gap: 6px 12px; align-items: center;
    padding: 14px; border-radius: 22px; background: #fff; box-shadow: 0 18px 50px rgba(20, 34, 6, .28); transform: translateY(140%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.ims-install.is-in { transform: none; }
.ims-install img { border-radius: 12px; width: 44px; height: 44px; }
.ims-install p { margin: 0; font-size: 14px; line-height: 1.35; color: var(--ims-ink); }
.ims-install__actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
body:has(.ims-tabbar) .ims-install { bottom: calc(var(--ims-tab-h) + var(--sab) + 14px); }
.ims-ios { position: fixed; inset: 0; z-index: 2050; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(15, 24, 6, .55); }
.ims-ios:not([hidden]) { display: flex; }
.ims-ios__card { width: 100%; max-width: 420px; padding: 24px 22px calc(22px + var(--sab)); border-radius: 26px; background: #fff; }
.ims-ios__card h2 { margin: 0 0 14px; font-size: 20px; color: var(--ims-ink); }
.ims-ios__card ol { margin: 0 0 20px; padding: 0; list-style: none; display: grid; gap: 12px; }
.ims-ios__card li { display: flex; align-items: center; gap: 14px; font-size: 15px; color: var(--ims-ink); }
.ims-ios__card li i { width: 38px; height: 38px; border-radius: 12px; background: rgba(150, 193, 57, .16); color: var(--ims-green-d); display: grid; place-items: center; }
.ims-ios__card .ims-btn { width: 100%; }

.ims-ptr { position: fixed; top: calc(var(--sat) + 8px); left: 50%; z-index: 2100; width: 38px; height: 38px; margin-left: 0; border-radius: 50%; background: #fff; color: var(--ims-green-d);
    display: grid; place-items: center; box-shadow: 0 6px 20px rgba(20, 34, 6, .25); opacity: 0; transform: translate(-50%, 0); pointer-events: none; }
.ims-ptr.is-loading i { animation: ims-spin .8s linear infinite; }
@keyframes ims-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Phone / tablet-portrait shell
   ========================================================================== */
@media (max-width: 991.98px) {

    html { -webkit-text-size-adjust: 100%; }
    html.pwa-standalone, html.pwa-standalone body { overscroll-behavior-y: none; }
    html.ims-lock, html.ims-lock body { overflow: hidden; }
    body { background: var(--ims-bg) !important; -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-font-smoothing: antialiased; font-size: 15px; }
    a, button, .btn { -webkit-touch-callout: none; }
    .ims-tabbar, .ims-sheet, .ims-topbar, .topbar { -webkit-user-select: none; user-select: none; }
    #main-wrapper, .min-h-screen { background: transparent !important; }

    /* ---- left sidebar is replaced by the bottom menu sheet ------------------ */
    body #main-wrapper .left-sidebar, body #main-wrapper .nav-toggler, body #main-wrapper .topbartoggler { display: none !important; }

    /* ---- top app bar ---------------------------------------------------------- */
    body #main-wrapper .topbar { position: fixed; top: 0; left: 0; right: 0; width: auto; z-index: 60; height: calc(var(--ims-bar-h) + var(--sat)); padding-top: var(--sat);
        background: transparent !important; box-shadow: none; border: 0; transition: background-color .25s ease, box-shadow .25s ease; }
    html.ims-scrolled body #main-wrapper .topbar, html.ims-nohero body #main-wrapper .topbar {
        background: linear-gradient(135deg, #2f4f0b 0%, #4f7a12 100%) !important; box-shadow: 0 8px 26px rgba(30, 50, 8, .3); }
    body #main-wrapper .topbar .top-navbar { height: var(--ims-bar-h); min-height: 0; padding: 0 14px; flex-wrap: nowrap; align-items: center; justify-content: space-between; background: transparent !important; }
    body #main-wrapper .topbar .navbar-header { position: static !important; top: auto !important; width: auto; height: var(--ims-bar-h); flex: 1 1 auto; padding: 0; background: transparent !important; border: 0; display: flex; align-items: center; }
    body #main-wrapper .topbar .navbar-brand { padding: 0; margin: 0; display: flex; align-items: center; }
    body #main-wrapper .topbar .navbar-brand a { display: flex; align-items: center; height: auto; padding: 0; line-height: 1; }
    body #main-wrapper .topbar .logo-text { display: block !important; height: auto; line-height: 0; }
    body #main-wrapper .topbar img.dark-logo { display: block !important; height: 24px; width: auto; max-width: 150px; filter: brightness(0) invert(1); opacity: .96; }
    body #main-wrapper .topbar .navbar-collapse { display: flex !important; flex: 0 0 auto; width: auto; padding: 0; background: transparent !important; box-shadow: none; position: static !important; top: auto !important; left: auto !important; height: auto !important; border: 0 !important; }
    body #main-wrapper .topbar .navbar-nav.float-left { display: none !important; }
    body #main-wrapper .topbar .navbar-nav.float-right { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
    body #main-wrapper .topbar .navbar-nav .nav-item { margin: 0 !important; }
    body #main-wrapper .topbar .nav-notif .nnb-toggle { width: 40px; height: 40px; color: #fff; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .2); font-size: 16px; }
    body #main-wrapper .topbar .nav-notif .nnb-toggle:hover, body #main-wrapper .topbar .nav-notif .nnb-toggle:active { background: rgba(255, 255, 255, .28); color: #fff; }
    body #main-wrapper .topbar .nav-notif .nnb-badge { top: -3px; right: -3px; background: #fff; color: var(--ims-green-d); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
    body #main-wrapper .topbar .nav-link.dropdown-toggle { padding: 0; display: flex; align-items: center; }
    body #main-wrapper .topbar .nav-link.dropdown-toggle::after, body #main-wrapper .topbar .nav-link .svg-icon { display: none; }
    body #main-wrapper .topbar .nav-link img { width: 38px; height: 38px; object-fit: cover; border: 2px solid rgba(255, 255, 255, .55); }
    body #main-wrapper .topbar .nav-link .beld, body #main-wrapper .topbar .nav-link > span { display: none; }
    body #main-wrapper .topbar .dropdown-menu { position: fixed !important; top: calc(var(--ims-bar-h) + var(--sat) + 6px) !important; right: 12px !important; left: auto !important; transform: none !important; border: 0; border-radius: 18px; padding: 8px; box-shadow: 0 18px 50px rgba(20, 34, 6, .25); min-width: 220px; }
    body #main-wrapper .topbar .dropdown-item { border-radius: 12px; padding: 12px 14px; font-size: 15px; }
    body #main-wrapper .nav-notif .nnb-dropdown, body #main-wrapper .nav-notif .nnb-dropdown[style] { position: fixed; top: calc(var(--ims-bar-h) + var(--sat) + 6px); left: 12px; right: 12px; width: auto; max-width: none; max-height: 70vh; border: 0; border-radius: 20px; box-shadow: 0 18px 50px rgba(20, 34, 6, .28); }

    /* ---- page: gradient hero + content ---------------------------------------- */
    body #main-wrapper .page-wrapper { margin: 0 !important; padding: 0 0 calc(var(--ims-tab-h) + var(--sab) + 24px) !important; min-height: 100vh; background: transparent !important; }
    html.ims-nohero body #main-wrapper .page-wrapper { padding-top: calc(var(--ims-bar-h) + var(--sat) + 8px) !important; }
    body #main-wrapper .page-wrapper > .page-breadcrumb {
        position: relative; margin: 0; padding: calc(var(--ims-bar-h) + var(--sat) + 14px) 20px 34px; overflow: hidden; color: #fff;
        background: radial-gradient(circle at 88% 8%, rgba(214, 240, 138, .35) 0, rgba(214, 240, 138, 0) 44%), linear-gradient(150deg, #2f4f0b 0%, #4f7a12 52%, #7fae22 100%);
        border-radius: 0 0 32px 32px; }
    body #main-wrapper .page-breadcrumb .page-title { color: #fff !important; font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 4px !important; white-space: normal; }
    body #main-wrapper .page-breadcrumb .breadcrumb { background: transparent; padding: 0; margin: 0; font-size: 13px; }
    body #main-wrapper .page-breadcrumb .breadcrumb-item, body #main-wrapper .page-breadcrumb .breadcrumb-item a, body #main-wrapper .page-breadcrumb .breadcrumb-item.active,
    body #main-wrapper .page-breadcrumb p, body #main-wrapper .page-breadcrumb small, body #main-wrapper .page-breadcrumb .text-muted { color: rgba(255, 255, 255, .8) !important; }
    body #main-wrapper .page-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, .5); }
    body #main-wrapper .page-breadcrumb .row { margin: 0; row-gap: 12px; }
    body #main-wrapper .page-breadcrumb [class*="col-"] { padding: 0; }
    body #main-wrapper .page-breadcrumb .btn, body #main-wrapper .page-breadcrumb a.btn { background: #fff !important; color: var(--ims-green-d) !important; border: 0 !important; box-shadow: 0 8px 20px rgba(20, 34, 6, .2); min-height: 40px; padding: 8px 16px; font-size: 14px; }
    /* Title on the left, action button on the right, one row (wraps only if the button cannot fit). */
    body #main-wrapper .page-breadcrumb .row { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 !important; }
    body #main-wrapper .page-breadcrumb .row > [class*="col-"] { flex: 0 1 auto; width: auto; max-width: none; padding: 0; text-align: left; margin: 0 !important; min-width: 0; }
    body #main-wrapper .page-breadcrumb .row > [class*="col-"]:first-child { flex: 1 1 0; }
    body #main-wrapper .page-breadcrumb .row > [class*="col-"]:last-child:not(:first-child) { flex: 0 0 auto; display: flex; justify-content: flex-end; align-items: center; }
    body #main-wrapper .page-breadcrumb .row .btn { float: none !important; margin: 0 !important; white-space: nowrap; flex: 0 0 auto; }
    body #main-wrapper .page-breadcrumb .page-title { white-space: normal; text-overflow: clip; overflow: visible; margin-top: 0 !important; }
    body #main-wrapper .page-breadcrumb .breadcrumb { margin: 2px 0 0 !important; }
    body #main-wrapper .page-breadcrumb .btn i { color: inherit; }
    body #main-wrapper .container-fluid { padding: 18px 14px 6px; }
    body #main-wrapper .page-wrapper > .container-fluid:first-child { padding-top: 20px; }

    /* ---- cards ------------------------------------------------------------------ */
    body #main-wrapper .card { border: 0; border-radius: 22px; margin-bottom: 14px; box-shadow: 0 8px 28px rgba(31, 45, 10, .07); overflow: hidden; background: #fff; }
    body #main-wrapper .card-body { padding: 18px 16px; }
    body #main-wrapper .card-header, body #main-wrapper .card-footer { background: transparent; border-color: var(--ims-line); padding: 14px 16px; }
    body #main-wrapper .card-title { font-size: 17px; font-weight: 600; color: var(--ims-ink); }
    body #main-wrapper .card-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 14px; }
    body #main-wrapper .card-group > .card { margin: 0; border: 0 !important; border-radius: 20px !important; }
    body #main-wrapper .card-group .card-body { padding: 14px; }
    body #main-wrapper .card-group h2, body #main-wrapper .card-group .h2, body #main-wrapper .card-group .display-6 { font-size: 26px; line-height: 1.1; }
    body #main-wrapper .card-group .badge { vertical-align: middle; }
    body #main-wrapper .card-group .text-muted, body #main-wrapper .card-group h6 { font-size: 12.5px; line-height: 1.3; }
    body #main-wrapper .card-group .card-body > .d-flex, body #main-wrapper .card-group a > .card-body > .d-flex { position: relative; flex-direction: column; align-items: flex-start !important; padding-right: 30px; }
    body #main-wrapper .card-group h6.text-truncate, body #main-wrapper .card-group .text-truncate { white-space: normal; overflow: visible; text-overflow: clip; }
    body #main-wrapper .card-group .badge { display: inline-block !important; }
    body #main-wrapper .card-group .ml-auto { position: absolute; top: 0; right: 0; margin: 0 !important; width: 32px; height: 32px; border-radius: 11px; background: rgba(150, 193, 57, .16); display: grid; place-items: center; }
    body #main-wrapper .card-group .ml-auto .opacity-7 { opacity: 1; font-size: 14px !important; color: var(--ims-green-d) !important; line-height: 1; }
    body #main-wrapper .card-group .ml-auto i { font-size: 14px !important; }
    body #main-wrapper .card-group .opacity-7, body #main-wrapper .card-group .display-5 { font-size: 22px; }
    body #main-wrapper .row { margin-left: -7px; margin-right: -7px; }
    body #main-wrapper .row > [class*="col-"] { padding-left: 7px; padding-right: 7px; }
    body #main-wrapper h1 { font-size: 26px; } body #main-wrapper h2 { font-size: 22px; } body #main-wrapper h3 { font-size: 20px; } body #main-wrapper h4 { font-size: 18px; }

    /* ---- buttons + forms: 44px touch targets, 16px text (no iOS zoom) ------------- */
    body #main-wrapper .btn { min-height: 44px; padding: 10px 18px; border-radius: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
    body #main-wrapper .btn-sm, body #main-wrapper .btn-group-sm > .btn { min-height: 36px; padding: 6px 12px; border-radius: 12px; }
    body #main-wrapper .btn-block { width: 100%; }
    body #main-wrapper .form-control, body #main-wrapper .custom-select, body #main-wrapper select, body #main-wrapper textarea, body #main-wrapper input[type="text"], body #main-wrapper input[type="email"], body #main-wrapper input[type="password"],
    body #main-wrapper input[type="number"], body #main-wrapper input[type="tel"], body #main-wrapper input[type="url"], body #main-wrapper input[type="search"], body #main-wrapper input[type="date"], body #main-wrapper input[type="datetime-local"], body #main-wrapper input[type="time"] {
        font-size: 16px !important; min-height: 46px; border-radius: 14px; border: 1.5px solid #e1e7da; padding: 10px 14px; background-color: #fff; box-shadow: none; max-width: 100%; }
    body #main-wrapper textarea { min-height: 96px; }
    body #main-wrapper .form-control:focus, body #main-wrapper .custom-select:focus, body #main-wrapper select:focus, body #main-wrapper textarea:focus, body #main-wrapper input:focus { border-color: var(--ims-green); box-shadow: 0 0 0 4px rgba(150, 193, 57, .2); outline: 0; }
    body #main-wrapper label { font-size: 13.5px; font-weight: 500; color: var(--ims-ink); margin-bottom: 6px; }
    body #main-wrapper .form-group { margin-bottom: 16px; }
    body #main-wrapper .input-group > .form-control { min-height: 46px; }
    body #main-wrapper .select2-container { width: 100% !important; }
    body #main-wrapper .select2-container--default .select2-selection--single, body #main-wrapper .select2-container--default .select2-selection--multiple { min-height: 46px; border-radius: 14px; border: 1.5px solid #e1e7da; }
    body #main-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 43px; padding-left: 14px; font-size: 16px; }
    body #main-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow { height: 44px; }
    body #main-wrapper input[type="checkbox"], body #main-wrapper input[type="radio"] { min-height: 0; accent-color: var(--ims-green-d); }
    body #main-wrapper .custom-control-label { font-size: 15px; }
    body #main-wrapper .nav-tabs, body #main-wrapper .nav-pills { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; border-bottom: 0; gap: 6px; }
    body #main-wrapper .nav-tabs::-webkit-scrollbar, body #main-wrapper .nav-pills::-webkit-scrollbar { display: none; }
    body #main-wrapper .nav-tabs .nav-link, body #main-wrapper .nav-pills .nav-link { white-space: nowrap; border-radius: 999px; border: 0; padding: 9px 16px; background: #fff; color: var(--ims-muted); }
    body #main-wrapper .nav-tabs .nav-link.active, body #main-wrapper .nav-pills .nav-link.active { background: var(--ims-green-d); color: #fff; }

    /* filter bars: let their fields wrap instead of running past the card */
    body #main-wrapper .search-container, body #main-wrapper form .d-flex.flex-wrap, body #main-wrapper .form-inline { flex-wrap: wrap !important; gap: 8px; }
    body #main-wrapper .search-container > *, body #main-wrapper .search-container .d-flex, body #main-wrapper .search-container .d-md-flex { max-width: 100%; min-width: 0; }
    body #main-wrapper .search-container input[type="date"], body #main-wrapper .search-container select, body #main-wrapper .search-container .search-input { flex: 1 1 140px; width: 100% !important; min-width: 0; }
    body #main-wrapper input[type="date"], body #main-wrapper input[type="datetime-local"], body #main-wrapper input[type="time"] { min-width: 0; max-width: 100%; }
    body #main-wrapper .form-inline .form-control { width: 100%; flex: 1 1 140px; }

    /* ---- tables: swipe sideways inside their own lane ------------------------------- */
    .ims-table-scroll, body #main-wrapper .table-responsive, body #main-wrapper .dataTables_wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border-radius: 14px; }
    body #main-wrapper table.table, body #main-wrapper table.dataTable { font-size: 14px; margin-bottom: 0; }
    body #main-wrapper table.table th, body #main-wrapper table.dataTable th { white-space: nowrap; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ims-muted); font-weight: 600; }
    body #main-wrapper table.table td { vertical-align: middle; }
    body #main-wrapper .dataTables_wrapper .dataTables_length, body #main-wrapper .dataTables_wrapper .dataTables_filter { float: none; text-align: left; margin-bottom: 10px; }
    body #main-wrapper .dataTables_wrapper .dataTables_filter input { width: 100%; margin: 6px 0 0; }
    body #main-wrapper .dataTables_wrapper .dataTables_info, body #main-wrapper .dataTables_wrapper .dataTables_paginate { float: none; text-align: center; padding-top: 10px; }
    body #main-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button { min-width: 38px; min-height: 38px; border-radius: 12px !important; padding: 8px 10px !important; }
    body #main-wrapper .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; }
    body #main-wrapper .page-link { border-radius: 12px !important; min-width: 40px; min-height: 40px; display: grid; place-items: center; }

    /* ---- modals become bottom sheets ---------------------------------------------------- */
    body #main-wrapper .modal-dialog, body #main-wrapper .modal-dialog-centered, body #main-wrapper .modal-lg, body #main-wrapper .modal-xl { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 !important; width: 100%; max-width: none; min-height: 0; align-items: flex-end; }
    body #main-wrapper .modal.fade .modal-dialog { transform: translate(0, 60px); transition: transform .3s ease-out; }
    body #main-wrapper .modal.show .modal-dialog { transform: none; }
    body #main-wrapper .modal-content { border: 0; border-radius: 26px 26px 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: var(--sab); }
    body #main-wrapper .modal-header { padding: 18px 18px 8px; border: 0; }
    body #main-wrapper .modal-body { padding: 8px 18px; }
    body #main-wrapper .modal-footer { padding: 10px 18px 18px; border: 0; gap: 8px; flex-wrap: nowrap; }
    body #main-wrapper .modal-footer .btn { flex: 1; margin: 0; }

    /* ---- alerts / flash messages float under the app bar ---------------------------------- */
    body #main-wrapper > .alert { position: fixed; top: calc(var(--ims-bar-h) + var(--sat) + 8px); left: 12px; right: 12px; z-index: 70; margin: 0; border: 0; border-radius: 16px; box-shadow: 0 14px 40px rgba(20, 34, 6, .22); animation: ims-drop .35s ease-out; transition: opacity .3s, transform .3s; }
    body #main-wrapper > .alert.ims-leaving { opacity: 0; transform: translateY(-12px); }
    body #main-wrapper .varify-note { margin: calc(var(--ims-bar-h) + var(--sat) + 8px) 12px 0; border-radius: 16px; font-size: 14px; }
    @keyframes ims-drop { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

    body #main-wrapper .footer { padding: 18px 18px 8px; font-size: 12px; line-height: 1.6; }
    body .cw-root { right: 14px !important; bottom: calc(var(--ims-tab-h) + var(--sab) + 16px) !important; }

    /* the on-screen keyboard owns the bottom edge while typing */
    html.ims-kbd .ims-tabbar { display: none; }
    html.ims-kbd body #main-wrapper .page-wrapper { padding-bottom: 24px !important; }

    /* ==================================================================================
       Floating bottom tab bar
       ================================================================================== */
    .ims-tabbar { display: flex; align-items: center; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: 8px 12px calc(8px + var(--sab));
        background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
        border-radius: 28px 28px 0 0; border: 1px solid rgba(255, 255, 255, .7); border-bottom: 0; box-shadow: 0 -12px 40px rgba(31, 45, 10, .16); }
    .ims-tabbar__items { flex: 1; min-width: 0; display: flex; }
    .ims-tab { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; color: #8791a0; text-decoration: none !important; font-size: 11px; font-weight: 500; line-height: 1; border-radius: 18px; transition: color .2s; }
    .ims-tab i { font-size: 19px; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
    .ims-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ims-tab:active { transform: scale(.94); }
    .ims-tab.is-active { color: var(--ims-green-d); font-weight: 600; }
    .ims-tab.is-active i { transform: translateY(-1px) scale(1.12); }
    .ims-tab.is-active::before { content: ""; position: absolute; inset: 2px 4px; border-radius: 16px; background: rgba(150, 193, 57, .17); z-index: -1; }
    .ims-tabbar__menu { flex: 0 0 54px; width: 54px; height: 54px; margin-bottom: 2px; border: 0; border-radius: 50%; background: var(--ims-ink); color: #fff; font-size: 19px; display: grid; place-items: center; box-shadow: 0 10px 24px rgba(20, 34, 6, .35); cursor: pointer; transition: transform .2s; }
    .ims-tabbar__menu:active { transform: scale(.92); }

    /* ==================================================================================
       Menu sheet
       ================================================================================== */
    .ims-backdrop { display: block; position: fixed; inset: 0; z-index: 1090; background: rgba(15, 24, 6, .5); opacity: 0; transition: opacity .28s ease; }
    .ims-backdrop.is-open { opacity: 1; }
    .ims-sheet { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; height: 90vh; height: 90dvh; max-height: 760px; background: #f6f8f2;
        border-radius: 30px 30px 0 0; box-shadow: 0 -20px 60px rgba(15, 24, 6, .35); transform: translateY(102%); transition: transform .34s cubic-bezier(.2, .8, .2, 1); padding-bottom: var(--sab); }
    .ims-sheet.is-open { transform: none; }
    .ims-sheet.is-dragging { transition: none; }
    .ims-sheet__grab { display: grid; place-items: center; padding: 10px 0 2px; flex: 0 0 auto; touch-action: none; }
    .ims-sheet__grab span { width: 44px; height: 5px; border-radius: 999px; background: #cdd5c3; }
    .ims-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 18px 12px; flex: 0 0 auto; }
    .ims-sheet__user { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none !important; }
    .ims-avatar { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #4f7a12, #96c139); color: #fff; font-weight: 600; font-size: 16px; letter-spacing: .02em; }
    .ims-sheet__who { display: grid; min-width: 0; }
    .ims-sheet__who strong { color: var(--ims-ink); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ims-sheet__who small { color: var(--ims-muted); font-size: 13px; }
    .ims-icon-btn { flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; color: var(--ims-ink); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(31, 45, 10, .1); cursor: pointer; }
    .ims-sheet__search { position: relative; margin: 0 14px 12px; flex: 0 0 auto; }
    .ims-sheet__search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #9aa5b1; font-size: 14px; pointer-events: none; }
    .ims-sheet__search input { width: 100%; height: 48px; padding: 0 16px 0 42px; border: 0; border-radius: 999px; background: #fff; font-size: 16px; color: var(--ims-ink); box-shadow: 0 4px 14px rgba(31, 45, 10, .07); -webkit-appearance: none; appearance: none; }
    .ims-sheet__search input:focus { outline: 0; box-shadow: 0 0 0 3px rgba(150, 193, 57, .35); }
    .ims-sheet__body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 2px 0 8px; }
    .ims-sheet__body { scrollbar-width: none; }
    .ims-sheet__body::-webkit-scrollbar, .ims-tabbar ::-webkit-scrollbar { display: none; width: 0; }
    .ims-group { margin: 0 14px 14px; padding: 6px; background: #fff; border-radius: 22px; box-shadow: 0 6px 20px rgba(31, 45, 10, .06); }
    .ims-group__title { margin: 0; padding: 10px 12px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #8b96a3; }
    .ims-group--plain { padding-top: 6px; }
    .ims-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; border-radius: 16px; background: transparent; color: var(--ims-ink); font: 500 15px/1.25 Rubik, system-ui, sans-serif; text-align: left; text-decoration: none !important; cursor: pointer; -webkit-appearance: none; appearance: none; }
    .ims-row > i:first-child { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(150, 193, 57, .16); color: var(--ims-green-d); font-size: 15px; }
    .ims-row > span { flex: 1; min-width: 0; }
    .ims-row:active { background: #eef3e6; }
    .ims-row.is-current { background: rgba(150, 193, 57, .16); color: var(--ims-green-dd); font-weight: 600; }
    .ims-row--child { padding: 11px 12px 11px 58px; font-weight: 400; font-size: 14.5px; }
    .ims-row--danger { color: #c0392b; }
    .ims-row--danger > i:first-child { background: rgba(192, 57, 43, .1); color: #c0392b; }
    .ims-acc__chev { flex: 0 0 auto; font-size: 12px; color: #9aa5b1; transition: transform .25s; }
    .ims-acc.is-open .ims-acc__chev { transform: rotate(180deg); }
    .ims-acc__list { display: block; max-height: 0; overflow: hidden; transition: max-height .3s ease; }
    .ims-acc.is-open .ims-acc__list { max-height: 900px; }
    .ims-empty { text-align: center; color: var(--ims-muted); padding: 30px 0; margin: 0; }
    .ims-sheet__foot { flex: 0 0 auto; padding: 8px 14px 10px; display: grid; gap: 2px; background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(31, 45, 10, .06); }
    .ims-sheet__foot form { margin: 0; }
}

/* ==========================================================================
   Login / guest screens on phones: green hero with the logo + a white card form
   ========================================================================== */
@media (max-width: 991.98px) {
    .auth-wrapper { align-items: stretch !important; justify-content: flex-start !important; background: var(--ims-bg) !important; min-height: 100vh; min-height: 100dvh; }
    .auth-wrapper #particle-bg { display: none; }
    .auth-wrapper .auth-box { width: 100%; max-width: none; margin: 0 !important; display: flex; flex-direction: column; flex-wrap: nowrap; border-radius: 0 !important; box-shadow: none !important; background: transparent; overflow: visible !important; }
    .auth-wrapper .auth-box > .modal-bg-img { flex: 0 0 auto; width: 100%; max-width: 100%; min-height: calc(230px + var(--sat)); padding: var(--sat) 0 40px; display: grid; place-items: center; position: relative;
        background: radial-gradient(circle at 85% 10%, rgba(214, 240, 138, .35) 0, rgba(214, 240, 138, 0) 46%), linear-gradient(150deg, #2f4f0b 0%, #4f7a12 52%, #7fae22 100%) !important; border-radius: 0 0 34px 34px; }
    .auth-wrapper .auth-box > .modal-bg-img::before { content: ""; width: 200px; height: 38px; background: url("../images/immensive.png") center / contain no-repeat; filter: brightness(0) invert(1); }
    .auth-wrapper .auth-box > [class*="col-lg-5"] { flex: 0 0 auto; width: auto; max-width: none; margin: -38px 14px 24px; padding: 0; position: relative; z-index: 2; background: #fff;
        border: 0 !important; border-radius: 28px !important; box-shadow: 0 18px 50px rgba(31, 45, 10, .16); -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
    .auth-wrapper .auth-box > [class*="col-lg-5"] > .p-3 { padding: 22px 20px 26px !important; }
    .auth-wrapper h2 { font-size: 24px; font-weight: 600; color: var(--ims-ink); }
    .auth-wrapper p { font-size: 14.5px; }
    .auth-wrapper .btn-dark, .auth-wrapper button[type="submit"].btn { background: var(--ims-green-d) !important; border: 0 !important; color: #fff !important; min-height: 48px; border-radius: 14px; font-size: 15px; letter-spacing: .02em; text-transform: none; font-weight: 600; box-shadow: 0 10px 24px rgba(79, 122, 18, .35); }
    .auth-wrapper .form-control { font-size: 16px !important; min-height: 48px; border-radius: 14px; border: 1.5px solid #e1e7da; padding: 10px 14px; box-shadow: none; }
    .auth-wrapper .form-control:focus { border-color: var(--ims-green); box-shadow: 0 0 0 4px rgba(150, 193, 57, .2); outline: 0; }
    .auth-wrapper a { color: var(--ims-green-d); }
}

/* Phones only: keep the in-card content from forcing sideways scroll on the whole page. */
@media (max-width: 575.98px) {
    body .container-fluid, body .page-wrapper { max-width: 100vw; overflow-x: clip; }
    body .page-breadcrumb .page-title { font-size: 24px; }
    body .card-group > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Desktop: the install button inside the user dropdown is the only mobile-shell element that shows. */
@media (min-width: 992px) {
    .ims-install { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .ims-sheet, .ims-backdrop, .ims-install, .ims-tab i, .ims-progress span, .ims-acc__list { transition: none !important; }
    .ims-rotate i { animation: none; }
}
