:root {
    --primary: #1b3855;
    --primary-hover: #142a40;
    --bg: #f4f8f8;
    --card: #ffffff;
    --text: #193036;
    --muted: #607780;
    --line: #d2e1e3;
    --sidebar: #1b3855;
    --surface-soft: #edf5f5;
    --sidebar-width: 270px;
}

html[data-theme='dark'] {
    color-scheme: dark;
    --primary: #1b3855;
    --primary-hover: #274c71;
    --bg: #0f0f0f;
    --card: #3f3f3f;
    --text: #ffffff;
    --muted: #d6dee2;
    --line: #262626;
    --sidebar: #0f0f0f;
    --surface-soft: #0f0f0f;
}

html,
body {
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(9, 83, 94, .10), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(7, 68, 77, .08), transparent 30%),
        var(--bg);
    color: var(--text);
    letter-spacing: -.01em;
    touch-action: manipulation;
}

html[data-theme='dark'] body {
    background: #0f0f0f;
    color: #ffffff;
}

a {
    color: var(--primary);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar);
    color: #fff;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    z-index: 1050;
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 16px 0 34px rgba(0, 0, 0, .22);
    transition: width .24s ease, transform .24s ease;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar .brand {
    min-height: 90px;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    gap: .75rem;
}

.brand-mark,
.auth-brand-mark {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .85rem;
    background: linear-gradient(145deg, var(--primary), var(--primary-hover));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 800;
    color: #fff;
    flex: 0 0 auto;
}

.brand-eyebrow {
    font-size: .68rem;
    color: rgba(255, 255, 255, .56);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.brand-title {
    line-height: 1.1;
}

.brand-subtitle {
    color: rgba(255, 255, 255, .62);
}

.sidebar .nav-link {
    color: rgba(229, 231, 235, .82);
    border-radius: .75rem;
    padding: .64rem .72rem;
    font-size: .92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .55rem;
    transition: all .2s ease;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    min-width: 1.3rem;
    text-align: center;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: color-mix(in srgb, var(--primary) 24%, transparent 76%);
    color: #fff;
    transform: translateX(2px);
}

.nav-link-logout {
    margin-top: .4rem;
    border-top: 1px solid rgba(255, 255, 255, .16);
    border-radius: 0;
    padding-top: .9rem !important;
}

.content-area {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: margin-left .24s ease, width .24s ease;
}

.auth-content {
    margin-left: 0;
    width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 70px;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    margin: 1rem 1rem 0;
    background: color-mix(in srgb, var(--card) 88%, var(--surface-soft) 12%);
    backdrop-filter: blur(12px);
}

html[data-theme='dark'] .topbar {
    background: #0f0f0f;
    color: #ffffff;
}

.topbar h6 {
    font-weight: 800;
    letter-spacing: -.02em;
}

.page-container {
    padding: 1.5rem 1.1rem 2rem;
}

.card,
.app-card,
.metric,
.stat-card {
    border-radius: 1rem;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--card) 94%, var(--surface-soft) 6%);
    box-shadow: 0 12px 24px rgba(15, 23, 42, .07);
}

html[data-theme='dark'] .card,
html[data-theme='dark'] .app-card,
html[data-theme='dark'] .metric,
html[data-theme='dark'] .stat-card,
html[data-theme='dark'] .modal-content,
html[data-theme='dark'] .table-responsive {
    background: #0f0f0f;
    border-color: var(--line);
    color: #ffffff;
}

.metric {
    padding: 1.25rem;
}

.metric span {
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
}

.metric strong {
    display: block;
    margin-top: .15rem;
    font-size: 1.45rem;
    font-family: 'Plus Jakarta Sans', 'Manrope', sans-serif;
    letter-spacing: -.04em;
}

.table-actions {
    display: inline-flex;
}

.table-actions-toggle {
    width: 2.35rem;
    min-height: 2.35rem;
    align-items: center;
    justify-content: center;
    border-radius: .8rem;
}

.table-actions-menu {
    min-width: 13.5rem;
    max-width: calc(100vw - 1.5rem);
    padding: .45rem;
    border-radius: .9rem;
    border-color: var(--line);
    background: var(--card);
    color: var(--text);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .16);
    z-index: 2055;
}

.table-actions-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 2.45rem;
    border-radius: .65rem;
    font-weight: 700;
}

.table-actions-menu form {
    margin: 0;
}

.table-actions-menu.is-floating {
    position: fixed;
    display: block;
    margin: 0;
    overflow-y: auto;
    transform: none !important;
}

.table-actions-menu.is-positioning {
    visibility: hidden;
    pointer-events: none;
}

html[data-theme='dark'] .table-actions-menu {
    background: #080808;
    border-color: var(--line);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
}

html[data-theme='dark'] .table-actions-menu .dropdown-item {
    color: var(--text);
}

html[data-theme='dark'] .table-actions-menu .dropdown-item.text-danger {
    color: var(--bs-danger) !important;
}

html[data-theme='dark'] .table-actions-menu .dropdown-item:hover,
html[data-theme='dark'] .table-actions-menu .dropdown-item:focus {
    background: rgba(255, 255, 255, .08);
}

.table {
    color: var(--text);
}

html[data-theme='dark'] .table {
    --bs-table-color: #ffffff;
    --bs-table-bg: #050505;
    --bs-table-border-color: var(--line);
    --bs-table-striped-color: #ffffff;
    --bs-table-striped-bg: #0b0b0b;
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: #111111;
    color: #ffffff;
}

.table thead th {
    font-size: .74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom-color: var(--line);
}

html[data-theme='dark'] .table thead th {
    background: #080808;
    color: #ffffff;
    border-bottom-color: var(--line);
}

.table td {
    border-color: color-mix(in srgb, var(--line) 68%, transparent 32%);
}

html[data-theme='dark'] .table td,
html[data-theme='dark'] .table th,
html[data-theme='dark'] .table> :not(caption)>*>* {
    background-color: transparent;
    border-color: var(--line);
    color: #ffffff;
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--line);
    background-color: color-mix(in srgb, var(--card) 96%, var(--surface-soft) 4%);
    color: var(--text);
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .form-select,
html[data-theme='dark'] .input-group-text {
    background-color: #050505;
    border-color: #2d2d2d;
    color: #ffffff;
}

html[data-theme='dark'] .form-control::placeholder {
    color: #aeb8bd;
}

html[data-theme='dark'] .form-control:disabled,
html[data-theme='dark'] .form-select:disabled,
html[data-theme='dark'] .form-control[readonly] {
    background-color: #101010;
    color: #d6dee2;
}

html[data-theme='dark'] .form-check-input {
    background-color: #050505;
    border-color: #4b5563;
}

html[data-theme='dark'] .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 20%, transparent 80%);
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
}

.btn,
.nav-link,
.dropdown-item,
.mobile-bottom-link {
    touch-action: manipulation;
}

.btn:active,
.nav-link:active,
.dropdown-item:active,
.mobile-bottom-link:active {
    transform: scale(.98);
}

.install-steps {
    display: grid;
    gap: .8rem;
}

.install-step {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--card) 92%, var(--surface-soft) 8%);
}

.install-step span {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}

html[data-theme='dark'] .install-step {
    background: #080808;
    border-color: var(--line);
    color: #ffffff;
}

.btn-light,
.text-bg-light {
    background: color-mix(in srgb, var(--card) 86%, var(--surface-soft) 14%) !important;
    border-color: var(--line) !important;
    color: var(--text) !important;
}

html[data-theme='dark'] .btn-light,
html[data-theme='dark'] .text-bg-light,
html[data-theme='dark'] .alert-light {
    background: #080808 !important;
    border-color: var(--line) !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .bg-white,
html[data-theme='dark'] .bg-light,
html[data-theme='dark'] .bg-body,
html[data-theme='dark'] .table-light,
html[data-theme='dark'] .modal-header,
html[data-theme='dark'] .modal-footer {
    background-color: #050505 !important;
    border-color: var(--line) !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .dropdown-menu,
html[data-theme='dark'] .list-group-item,
html[data-theme='dark'] .offcanvas {
    background-color: #050505;
    border-color: var(--line);
    color: #ffffff;
}

html[data-theme='dark'] .dropdown-divider {
    border-top-color: var(--line);
}

html[data-theme='dark'] .btn-close {
    filter: invert(1) grayscale(100%);
    opacity: .9;
}

html[data-theme='dark'] .dropdown-item,
html[data-theme='dark'] .modal-title,
html[data-theme='dark'] .card-title,
html[data-theme='dark'] .form-label,
html[data-theme='dark'] .text-body,
html[data-theme='dark'] .text-dark,
html[data-theme='dark'] .text-secondary,
html[data-theme='dark'] .text-body-secondary {
    color: #ffffff !important;
}

html[data-theme='dark'] .text-muted,
html[data-theme='dark'] .form-text,
html[data-theme='dark'] small,
html[data-theme='dark'] .small {
    color: #d6dee2 !important;
}

html[data-theme='dark'] .border,
html[data-theme='dark'] .border-top,
html[data-theme='dark'] .border-end,
html[data-theme='dark'] .border-bottom,
html[data-theme='dark'] .border-start {
    border-color: var(--line) !important;
}

.notification-card {
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.notification-card:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

html[data-theme='dark'] .notification-card,
html[data-theme='dark'] #pushNotificationBox {
    background: #050505 !important;
    border-color: var(--line) !important;
    color: #ffffff;
}

html[data-theme='dark'] .notification-card:hover {
    background: #0b0b0b !important;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .42);
}

html[data-theme='dark'] .alert-info {
    background: rgba(34, 199, 220, .14);
    border-color: rgba(34, 199, 220, .34);
    color: #ffffff;
}

html[data-theme='dark'] .alert-warning {
    background: rgba(245, 158, 11, .14);
    border-color: rgba(245, 158, 11, .34);
    color: #ffffff;
}

html[data-theme='dark'] .alert-danger {
    background: rgba(220, 53, 69, .16);
    border-color: rgba(220, 53, 69, .38);
    color: #ffffff;
}

html[data-theme='dark'] .alert-success {
    background: rgba(25, 135, 84, .18);
    border-color: rgba(25, 135, 84, .42);
    color: #ffffff;
}

html[data-theme='dark'] select option {
    background: #050505;
    color: #ffffff;
}

html[data-theme='dark'] .auth-shell {
    background: #000000;
}

.badge-soft {
    background: color-mix(in srgb, var(--primary) 12%, transparent 88%);
    color: var(--primary);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(9, 83, 94, .16), transparent 36%),
        radial-gradient(circle at bottom right, rgba(31, 149, 165, .13), transparent 34%),
        var(--bg);
}

.auth-card {
    max-width: 460px;
    width: 100%;
    border-radius: 1.25rem;
    overflow: hidden;
}

.auth-brand-header {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.35rem;
}

.auth-brand-title {
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', 'Manrope', sans-serif;
}

.auth-brand-subtitle {
    color: var(--muted);
    font-size: .86rem;
}

.auth-login-title {
    font-weight: 800;
    letter-spacing: -.03em;
}

.admin-create-company-panel {
    width: min(760px, 100vw);
    background: color-mix(in srgb, var(--card) 94%, var(--surface-soft) 6%);
    color: var(--text);
    border-left: 1px solid var(--line);
}

.offcanvas.offcanvas-end {
    width: min(760px, 100vw) !important;
}

.offcanvas.offcanvas-end.inventory-history-panel {
    width: min(980px, 100vw) !important;
}

.admin-create-company-panel .offcanvas-body {
    padding: 1.25rem 1.5rem 1.75rem;
}

.admin-create-company-panel .offcanvas-header {
    padding: 1.25rem 1.5rem;
}

.admin-create-company-panel .offcanvas-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
}

.admin-create-company-panel .btn-close {
    filter: none;
}

html[data-theme='dark'] .admin-create-company-panel {
    background: #050505;
    color: #ffffff;
}

html[data-theme='dark'] .admin-create-company-panel .btn-close {
    filter: invert(1) grayscale(100%);
}

.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 20, 24, .48);
    backdrop-filter: blur(5px);
}

.app-loading-overlay.is-visible {
    display: flex;
}

.app-loading-card {
    display: flex;
    align-items: center;
    gap: .95rem;
    width: min(420px, 100%);
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(3, 27, 32, .24);
}

.consignment-focused-row {
    outline: 2px solid rgba(13, 202, 240, .55);
    outline-offset: -2px;
}

.sidebar-backdrop {
    display: none;
}

.mobile-bottom-nav {
    display: none;
}

body.sidebar-collapsed {
    --sidebar-width: 86px;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .sidebar .nav-link span {
    display: none;
}

body.sidebar-collapsed .sidebar .brand {
    justify-content: center;
}

body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
}

body.sidebar-collapsed .sidebar .nav-link i {
    margin: 0;
}

@media (max-width: 991.98px) {
    html,
    body {
        min-height: 100dvh;
        overflow-y: auto;
        overscroll-behavior-y: auto;
    }

    body.is-authenticated {
        background:
            linear-gradient(180deg, rgba(27, 56, 85, .08), transparent 180px),
            var(--bg);
    }

    .sidebar {
        transform: translateX(-102%);
        width: min(88vw, 340px);
        border-radius: 0;
        padding-top: env(safe-area-inset-top);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .content-area {
        margin-left: 0;
        width: 100%;
        min-height: 100dvh;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        border: 0;
        background: rgba(15, 23, 42, .46);
        opacity: 0;
        pointer-events: none;
        z-index: 1040;
        transition: opacity .2s ease;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .page-container {
        padding: .9rem .8rem calc(10rem + env(safe-area-inset-bottom, 0px));
    }

    .topbar {
        min-height: 58px;
        margin: .55rem .7rem 0;
        padding: .65rem .75rem;
        border-radius: 1.15rem;
        box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
    }

    .topbar h6 {
        font-size: .95rem;
    }

    .topbar small {
        display: none;
    }

    .topbar .btn {
        min-width: 2.75rem;
        min-height: 2.75rem;
        border-radius: .95rem;
    }

    .topbar-actions {
        gap: .45rem !important;
    }

    .mobile-bottom-nav {
        position: fixed !important;
        top: auto !important;
        left: 12px;
        right: 12px;
        bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px)) !important;
        z-index: 1030;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: .35rem;
        min-height: 68px;
        padding: .45rem;
        border: 1px solid color-mix(in srgb, var(--line) 76%, transparent 24%);
        border-radius: 1.35rem;
        background: color-mix(in srgb, var(--card) 90%, transparent 10%);
        box-shadow: 0 18px 46px rgba(15, 23, 42, .2);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        transform: translate3d(0, 0, 0);
        will-change: transform;
        transition: opacity .18s ease, transform .18s ease;
    }

    body.app-overlay-open .mobile-bottom-nav,
    body.modal-open .mobile-bottom-nav {
        opacity: 0;
        pointer-events: none;
        transform: translate3d(0, 110%, 0);
    }

    .mobile-bottom-link {
        border: 0;
        border-radius: 1rem;
        background: transparent;
        color: var(--muted);
        min-width: 0;
        min-height: 56px;
        padding: .35rem .25rem;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .18rem;
        text-decoration: none;
        font-size: .7rem;
        font-weight: 800;
        line-height: 1.1;
    }

    .mobile-bottom-link i {
        font-size: 1.2rem;
        line-height: 1;
    }

    .mobile-bottom-link.active {
        background: var(--primary);
        color: #ffffff;
        box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 36%, transparent 64%);
    }

    .mobile-bottom-link:not(.active):hover,
    .mobile-bottom-link:not(.active):focus {
        background: color-mix(in srgb, var(--primary) 10%, transparent 90%);
        color: var(--primary);
    }

    .metric,
    .card,
    .app-card,
    .stat-card {
        border-radius: 1.2rem;
    }

    .metric {
        padding: 1rem;
    }

    .metric strong {
        font-size: 1.2rem;
    }

    .btn {
        min-height: 2.75rem;
        border-radius: .95rem;
        font-weight: 800;
    }

    .form-control,
    .form-select,
    .input-group-text {
        min-height: 3rem;
        border-radius: .95rem;
        font-size: 1rem;
    }

    textarea.form-control {
        min-height: 6rem;
    }

    .dropdown-menu.table-actions-menu {
        min-width: min(18rem, calc(100vw - 1.5rem));
    }

    .table-responsive {
        overflow: visible;
    }

    .table-responsive > .table {
        border-collapse: separate;
        border-spacing: 0 .85rem;
    }

    .table-responsive > .table thead {
        display: none;
    }

    .table-responsive > .table tbody,
    .table-responsive > .table tr,
    .table-responsive > .table td {
        display: block;
        width: 100%;
    }

    .table-responsive > .table tr {
        padding: .85rem;
        border: 1px solid var(--line);
        border-radius: 1.1rem;
        background: color-mix(in srgb, var(--card) 94%, var(--surface-soft) 6%);
        box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
        margin-bottom: 8px;
    }

    .table-responsive > .table td {
        border: 0;
        padding: .3rem .15rem;
    }

    .table-responsive > .table td:first-child {
        font-weight: 800;
        color: var(--text);
    }

    .table-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: .35rem;
    }

    .table-actions-toggle {
        width: 3rem;
        min-height: 3rem;
        border-radius: 1rem;
    }

    .modal-dialog {
        margin: .5rem;
    }

    .modal-dialog-centered {
        min-height: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 1.25rem;
        max-height: calc(100dvh - 1rem - env(safe-area-inset-bottom, 0px));
        overflow: hidden;
    }

    .modal-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }

    .modal-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .offcanvas.offcanvas-end,
    .offcanvas.offcanvas-end.inventory-history-panel,
    .admin-create-company-panel {
        width: 100vw !important;
        max-width: 100vw;
        border-radius: 0;
    }

    .offcanvas.offcanvas-end {
        top: max(.65rem, env(safe-area-inset-top));
        height: calc(100dvh - max(.65rem, env(safe-area-inset-top)));
    }

    .admin-create-company-panel .offcanvas-header {
        padding: 1rem 1rem .85rem;
    }

    .admin-create-company-panel .offcanvas-body {
        padding: 1rem 1rem calc(4rem + env(safe-area-inset-bottom, 0px));
    }

    .auth-shell {
        min-height: 100dvh;
        padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    }

    .auth-card {
        border-radius: 1.35rem;
    }
}

@media (max-width: 575.98px) {
    .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 {
        gap: .85rem !important;
        margin-bottom: 1rem !important;
    }

    .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 > div,
    .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 > form {
        width: 100%;
    }

    .d-flex.flex-wrap.gap-2,
    form.d-flex.gap-2 {
        width: 100%;
    }

    form.d-flex.gap-2 {
        display: grid !important;
        grid-template-columns: 1fr auto;
    }

    h1.h3 {
        font-size: 1.45rem;
    }

    .row.g-3 > [class*='col-'] {
        margin-bottom: .1rem;
    }
}

@media all and (display-mode: standalone) {
    body.is-authenticated {
        user-select: none;
    }

    input,
    textarea,
    select {
        user-select: text;
    }

    .topbar {
        margin-top: max(.55rem, env(safe-area-inset-top));
    }
}

html.is-standalone-pwa body.is-authenticated {
    min-height: 100dvh;
}

html.is-standalone-pwa .page-container {
    padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px));
}

html.is-standalone-pwa .mobile-bottom-nav {
    position: fixed !important;
    bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px)) !important;
}

html[data-theme='dark'] .mobile-bottom-nav {
    background: rgba(5, 5, 5, .92);
    border-color: #262626;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .45);
}

html[data-theme='dark'] .mobile-bottom-link:not(.active) {
    color: #d6dee2;
}

html[data-theme='dark'] .mobile-bottom-link:not(.active):hover,
html[data-theme='dark'] .mobile-bottom-link:not(.active):focus {
    background: rgba(255, 255, 255, .08);
    color: #ffffff;
}

html[data-theme='dark'] .table-responsive > .table tr {
    background: #050505;
    border-color: var(--line);
}

@media (min-width: 992px) {
    body,
    body.sidebar-open {
        overflow-y: auto !important;
    }

    body.sidebar-open .sidebar-backdrop {
        display: none;
        opacity: 0;
        pointer-events: none;
    }

    .sidebar {
        border-radius: 0;
    }
}
