/* Smooth page-to-page navigation (no white flash / re-render blink) */
html { background-color: #f5f8fd; }
@view-transition { navigation: auto; }
@media (min-width: 768px) {
    .app-page .sidebar { view-transition-name: app-sidebar; }
    .app-page header { view-transition-name: app-header; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
::view-transition-group(app-sidebar), ::view-transition-group(app-header) { animation-duration: 0s; }
@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
/* Perla Inventory design system */
:root {
    --perla-primary: #f43f5e;
    --perla-primary-dark: #e11d48;
    --perla-primary-soft: #fff1f2;
    --perla-ink: #1f2937;
    --perla-muted: #667085;
    --perla-surface: #ffffff;
    --perla-page: #f5f8fd;
    --perla-sidebar: #fbfdff;
}

body {
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--perla-page) !important;
    color: var(--perla-ink);
}

.app-page h1, .app-page h2, .app-page h3, .app-page h4, .app-page h5, .app-page h6 { font-family: "Plus Jakarta Sans", sans-serif; }
.app-page .bg-light { background-color: var(--perla-page) !important; }
.app-page .bg-white { background-color: var(--perla-surface) !important; }
.app-page .text-danger { color: var(--perla-primary) !important; }
.app-page .bg-danger { background-color: var(--perla-primary) !important; }
.app-page .btn-danger { border-color: var(--perla-primary); background-color: var(--perla-primary); }
.app-page .btn-danger:hover, .app-page .btn-danger:focus { border-color: var(--perla-primary-dark); background-color: var(--perla-primary-dark); }
.app-page .card { border: 1px solid #edf0f3 !important; box-shadow: 0 2px 5px rgba(16, 24, 40, .045) !important; }
.app-page header { border-color: #e9edf1 !important; box-shadow: 0 1px 2px rgba(16, 24, 40, .025) !important; }

/* Sidebar Customizations */
.app-page .sidebar .text-white {
    color: #2f3542 !important;
}

.app-page .sidebar .bg-danger.text-white {
    color: #fff !important;
}

.app-page .sidebar .text-muted {
    color: #8b94a3 !important;
}

.app-page .sidebar hr {
    border-color: #e9edf1 !important;
    opacity: 1 !important;
}

.sidebar .nav-link {
    color: #606978 !important;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.app-page .sidebar { background-color: var(--perla-sidebar) !important; border-right: 1px solid #e9edf1; }

.sidebar .nav-link:hover {
    color: var(--perla-primary) !important;
    background-color: #f7f8fa;
}

.sidebar .nav-link.active {
    background-color: var(--perla-primary-soft) !important;
    color: var(--perla-primary) !important;
    border-left: 4px solid var(--perla-primary);
    border-radius: 0 8px 8px 0;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
}

.user-profile-hover {
    transition: background-color 0.2s;
}
.user-profile-hover:hover {
    background-color: #f7f8fa;
}

.logout-button { border: 0; background: transparent; font: inherit; }
.logout-button:hover { background-color: #f7f8fa; }
.logout-icon { color: #9ba3b0; font-size: 1.1rem; }

.bg-danger-subtle {
    background-color: var(--perla-primary-soft) !important;
}

.app-page .alert.bg-danger-subtle {
    background-color: #f1f6ff !important;
    border: 1px solid #dbeafe !important;
}

.bg-success-subtle {
    background-color: #d1e7dd !important;
}

.cursor-pointer {
    cursor: pointer;
}

.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.08) !important;
}

/* Login */
.login-page {
    min-height: 100vh;
    margin: 0;
    background: var(--perla-page) !important;
    color: #1f2937;
    font-family: "DM Sans", sans-serif;
}

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 47%) 1fr; }
.login-intro { position: relative; display: flex; flex-direction: column; padding: clamp(2rem, 5vw, 5rem); color: var(--perla-ink); overflow: hidden; background: #eaf2ff; }
.login-intro::before, .login-intro::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(37,99,235,.14); pointer-events: none; }
.login-intro::before { width: 530px; height: 530px; left: -230px; bottom: -250px; }
.login-intro::after { width: 420px; height: 420px; right: -240px; top: -120px; }
.brand-lockup, .mobile-brand { display: flex; align-items: center; gap: .75rem; font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 1.05rem; position: relative; z-index: 1; }
.brand-mark { width: 2.5rem; height: 2.5rem; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); color: white; font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 1.25rem; }
.login-intro .brand-mark { background: var(--perla-primary); border: 0; }
.intro-copy { max-width: 510px; margin: auto 0; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 .8rem; color: inherit; opacity: .72; font-size: .7rem; letter-spacing: .14em; font-weight: 700; }
.intro-copy h1, .login-heading h2 { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; letter-spacing: -.04em; }
.intro-copy h1 { max-width: 500px; margin-bottom: 1.25rem; font-size: clamp(2.4rem, 4vw, 4.35rem); line-height: 1.08; }
.intro-copy > p:last-child { max-width: 390px; margin: 0; color: var(--perla-muted); font-size: 1.08rem; line-height: 1.65; }
.login-intro .eyebrow { color: var(--perla-primary); opacity: 1; }
.intro-stat { position: relative; z-index: 1; display: flex; align-items: center; gap: .7rem; color: var(--perla-muted); font-size: .9rem; }
.intro-stat i { display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 10px; color: var(--perla-primary); background: rgba(255,255,255,.72); border: 1px solid #dbeafe; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.login-card { width: min(100%, 410px); }
.login-heading { margin-bottom: 2.3rem; }
.login-heading .eyebrow { color: var(--perla-primary); opacity: 1; }
.login-heading h2 { margin: 0 0 .7rem; font-size: 1.9rem; color: #18202e; }
.login-heading > p:last-child { margin: 0; color: #738092; line-height: 1.55; }
.login-card .form-label { margin-bottom: .5rem; color: #344054; font-size: .86rem; font-weight: 700; }
.field-wrap { position: relative; }
.field-icon { position: absolute; z-index: 2; top: 50%; left: 1rem; transform: translateY(-50%); color: #98a2b3; }
.login-card .form-control { height: 3.25rem; padding: .75rem 3rem .75rem 2.75rem; border: 1px solid #dbe1e8; border-radius: 10px; background: #fff; font-size: .95rem; box-shadow: none; }
.login-card .form-control::placeholder { color: #a6afbc; }
.login-card .form-control:focus { border-color: var(--perla-primary); box-shadow: 0 0 0 4px rgba(37,99,235,.11); }
.password-toggle { position: absolute; z-index: 2; top: 50%; right: .65rem; transform: translateY(-50%); width: 2.25rem; height: 2.25rem; border: 0; border-radius: 7px; color: #64748b; background: transparent; }
.password-toggle:hover { color: var(--perla-primary); background: #eff6ff; }
.login-submit { display: flex; align-items: center; justify-content: center; gap: .65rem; height: 3.25rem; border: 0; border-radius: 10px; color: white; background: var(--perla-primary); font-weight: 700; box-shadow: 0 8px 18px rgba(37,99,235,.22); transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease; }
.login-submit:hover, .login-submit:focus { color: white; background: var(--perla-primary-dark); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37,99,235,.28); }
.login-submit:disabled { background: #86a9ef; transform: none; box-shadow: none; }
.login-error { display: flex; align-items: center; justify-content: center; gap: .45rem; margin-top: 1rem; padding: .75rem 1rem; border-radius: 9px; color: #e11d48; background: #eff6ff; font-size: .85rem; font-weight: 600; }
.login-footer { margin: 2rem 0 0; color: #98a2b3; font-size: .75rem; text-align: center; }
.mobile-brand { display: none; color: #18202e; margin-bottom: 3rem; }
.mobile-brand .brand-mark { background: var(--perla-primary); border: 0; }

@media (max-width: 991.98px) {
    .login-shell { display: block; }
    .login-panel { min-height: 100vh; padding: 1.5rem; }
    .mobile-brand { display: flex; }
}

/* Mobile Sidebar */
@media (max-width: 767.98px) {
    html, body { overflow-x: hidden; }
    .app-page > .d-flex { height: auto !important; min-height: 100dvh; }
    .app-page > .d-flex > .flex-grow-1 { min-width: 0; min-height: 100dvh; overflow: visible !important; }
    .app-page .p-4.p-md-5 { padding: .75rem .75rem calc(1.5rem + env(safe-area-inset-bottom)) !important; }
    .app-page header { position: sticky; top: 0; padding: .8rem 1rem !important; z-index: 1030 !important; }
    .app-page header .gap-4 { gap: 1rem !important; }
    .app-page header { gap: .75rem; }
    .app-page header > :last-child:not(.mobile-header-main) { flex-shrink: 0; }
    .mobile-header-main { min-width: 0; gap: .75rem !important; flex: 1; }
    .mobile-page-heading { min-width: 0; overflow-wrap: anywhere; }
    .mobile-page-heading .mobile-page-eyebrow { font-size: .58rem; letter-spacing: .08em; color: var(--perla-primary); }
    .mobile-page-heading h1 { margin: 0; font-size: 1.05rem; line-height: 1.3; font-weight: 700; }
    .app-page.has-mobile-heading .page-toolbar > div:first-child { display: none !important; }
    .app-page.has-mobile-heading header .workspace-label { display: none !important; }
    #mobileSidebarToggle { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; }

    /* Page titles, search boxes, view toggles, and primary actions stack cleanly. */
    .app-page .d-flex.justify-content-between.align-items-end.mb-4,
    .app-page .d-flex.justify-content-between.align-items-end.mb-4 > .d-flex {
        align-items: stretch !important;
        flex-direction: column;
        gap: 1rem !important;
    }
    .app-page .d-flex.justify-content-between.align-items-end.mb-4 .btn,
    .app-page .d-flex.justify-content-between.align-items-end.mb-4 > .d-flex > * { width: 100%; }
    .app-page input[style*="min-width"] { min-width: 0 !important; width: 100%; }
    .app-page .btn-group { align-self: flex-start; width: auto !important; }
    .app-page .btn-group .btn { width: auto !important; }

    /* Explicit toolbar contracts prevent inline controls from being squeezed off-screen. */
    .app-page .page-toolbar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0 !important;
    }
    .app-page .management-toolbar {
        gap: 0 !important;
        margin-bottom: 0.5rem !important;
    }
    .app-page .page-toolbar > .btn,
    .app-page .page-toolbar > a.btn { width: 100% !important; }
    .app-page .page-toolbar-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        gap: .75rem !important;
    }
    .app-page .page-toolbar-actions .position-relative,
    .app-page .page-toolbar-actions .btn { width: 100% !important; }
    .app-page .page-toolbar-actions input { width: 100% !important; min-width: 0 !important; }
    .app-page .inventory-search-actions { flex-direction: row !important; align-items: center !important; flex-wrap: nowrap; }
    .app-page .inventory-search-actions > .input-group { flex: 1 1 0; min-width: 0; width: auto !important; }
    .app-page .inventory-search-actions > #btnScanQR { flex: 0 0 48px; width: 48px !important; }
    .app-page .management-toolbar .btn-group { display: none !important; }

    /* Every record list uses the same mobile field layout. */
    .app-page .mobile-detail-list {
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    .app-page .mobile-detail-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
    }
    .mobile-detail-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .mobile-detail-table tbody,
    .mobile-detail-table tbody tr { display: block; width: 100%; }
    .mobile-detail-table tbody tr {
        padding: .7rem 0;
        border-bottom: 1px solid #e8edf3;
    }
    .mobile-detail-table tbody tr:last-child { border-bottom: 0; }
    .mobile-detail-table td {
        display: grid !important;
        grid-template-columns: minmax(6.5rem, 31%) minmax(0, 1fr);
        align-items: start;
        gap: .75rem;
        width: 100%;
        padding: .45rem 1rem !important;
        border: 0 !important;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    .mobile-detail-table td[data-label]::before {
        content: attr(data-label);
        color: #667085;
        font-size: .68rem;
        font-weight: 700;
        letter-spacing: .04em;
        line-height: 1.5;
        text-transform: uppercase;
    }
    .mobile-detail-table td > *,
    .mobile-detail-table .mobile-field-value > * { min-width: 0; }
    .mobile-detail-table .mobile-field-value {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .mobile-detail-table .mobile-field-value .badge { white-space: normal; line-height: 1.4; }
    .mobile-detail-table td > .badge { justify-self: start; }
    .mobile-detail-table td .btn { width: auto !important; min-width: 44px; min-height: 44px; }
    .mobile-detail-table td[data-label="Actions"] .mobile-field-value { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
    .mobile-detail-table td.mobile-list-empty,
    .mobile-detail-table td[colspan] {
        display: block !important;
        padding: 2.5rem 1rem !important;
        text-align: center !important;
    }
    .mobile-detail-table td.mobile-list-empty::before,
    .mobile-detail-table td[colspan]::before { content: none; }

    /* Audit Trail mobile grid */
    .app-page .audit-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 0.5rem;
        padding: 1rem;
    }
    .app-page .audit-table td {
        display: flex !important;
        flex-direction: column !important;
        padding: 0.25rem 0 !important;
        grid-column: span 1;
        gap: 0.25rem !important;
    }
    .app-page .audit-table td[data-label="Action"] {
        grid-column: span 3;
    }
    .app-page .audit-table td[data-label="Timestamp"] {
        grid-column: span 2;
    }
    .app-page .audit-table td[data-label="Details"] {
        grid-column: span 1;
        align-items: flex-start;
    }
    .app-page .audit-table td[data-label]::before {
        margin-bottom: 0;
        line-height: 1.2;
    }
    /* Compact mode: fields wrap inline (label above value) to save vertical space. */
    .mobile-detail-table tbody tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .1rem .25rem; padding: .5rem .75rem; }
    .mobile-detail-table td {
        display: flex !important; flex-direction: column; gap: .1rem;
        width: auto; flex: 1 1 auto; min-width: 30%;
        padding: .2rem .25rem !important;
    }
    .mobile-detail-table td:first-child { flex: 1 1 100%; }
    .mobile-detail-table td[data-label]::before { font-size: .6rem; line-height: 1.2; }
    .mobile-detail-table td[data-label="Actions"] { flex: 0 0 auto; margin-left: auto; min-width: 0; }
    .mobile-detail-table td[data-label="Actions"]::before { display: none; }
    .mobile-detail-table td .btn { min-width: 36px; min-height: 36px; padding: .25rem .6rem; font-size: .8rem; }
    .mobile-detail-table td .rounded-circle { width: 28px !important; height: 28px !important; font-size: .7rem !important; }
    .mobile-detail-table .mobile-field-value, .mobile-detail-table td { font-size: .85rem; }
    .mobile-detail-table td .badge { font-size: .68rem; padding: .25rem .5rem; }
    #recentIssuances .recent-row { display: flex !important; flex-wrap: wrap; gap: .1rem .75rem; padding: .5rem 0 !important; }
    #recentIssuances .recent-row > * { display: flex !important; flex-direction: column; gap: .1rem; grid-template-columns: none; padding: .15rem 0; flex: 1 1 auto; }
    #recentIssuances .recent-row > *::before { font-size: .6rem; line-height: 1.2; }
    .dashboard-stats .stat-card { padding: .55rem 1rem !important; gap: .5rem; }

    /* Bootstrap modal becomes a modern bottom sheet on phones. */
    .app-page .modal-dialog {
        margin: 0;
        max-width: none;
        min-height: 100dvh;
        align-items: flex-end;
    }
    .app-page .modal.fade .modal-dialog { transform: translateY(100%); transition: transform .3s cubic-bezier(.32, .72, 0, 1); }
    .app-page .modal.show .modal-dialog { transform: none; }
    .app-page .modal-content {
        height: 85dvh;
        max-height: 85dvh;
        width: 100%;
        border-radius: 1.5rem 1.5rem 0 0 !important;
        box-shadow: 0 -12px 40px rgba(16, 24, 40, .2) !important;
    }
    .app-page .modal-content::before {
        content: "";
        display: block;
        flex: none;
        width: 40px;
        height: 4px;
        margin: .6rem auto 0;
        border-radius: 999px;
        background: #d0d5dd;
    }
    .app-page .modal-header { background: transparent !important; padding: .75rem 1.25rem .5rem !important; }
    .app-page .modal-title { font-size: 1.15rem; }
    .app-page .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
    .app-page .modal-body .tab-content { padding: 1rem 1.25rem 1.5rem !important; min-height: 0 !important; }
    .app-page .modal-body :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], .choices__input), select, textarea, .form-control, .form-select) {
        font-size: 1rem;
        min-height: 48px;
        border-radius: .85rem;
        border: 1px solid #e1e7ef;
        background-color: #f7f9fc;
    }
    .app-page .modal-body :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], .choices__input), select, textarea):focus {
        background-color: #fff;
        border-color: var(--perla-primary);
        box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .14);
    }
    /* Switches / checkboxes / radios: keep native proportions, aligned with label. */
    .app-page .modal-body .form-check {
        display: flex;
        align-items: center;
        gap: .75rem;
        min-height: 48px;
        margin: 0;
        padding: 0 .25rem;
    }
    .app-page .modal-body .form-check .form-check-input {
        flex: none;
        float: none;
        margin: 0;
        width: 2.75rem;
        height: 1.5rem;
        border: 1px solid #c9d1dd;
        background-color: #e4e9f0;
        cursor: pointer;
    }
    .app-page .modal-body .form-check:not(.form-switch) .form-check-input { width: 1.4rem; height: 1.4rem; }
    .app-page .modal-body .form-check .form-check-input:checked {
        background-color: var(--perla-primary);
        border-color: var(--perla-primary);
    }
    .app-page .modal-body .form-check .form-check-input:focus { box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .14); }
    .app-page .modal-body .form-check-label { margin: 0 !important; font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--perla-ink); }
    .app-page .modal-body .form-label { margin-bottom: .35rem; color: var(--perla-muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
    .app-page .modal-body .row { row-gap: .9rem; }
    .app-page .modal-body pre { white-space: pre-wrap; overflow-wrap: anywhere; }

    /* Tabstrip: underline tabs, swipeable, pinned to the top of the sheet. */
    .app-page .modal-body .nav-tabs {
        position: sticky;
        top: 0;
        z-index: 2;
        flex-wrap: nowrap;
        gap: 0;
        margin: 0;
        padding: 0 1.25rem !important;
        overflow-x: auto;
        scrollbar-width: none;
        background: #fff;
        border-bottom: 1px solid #e4e9f0;
    }
    .app-page .modal-body .nav-tabs::-webkit-scrollbar { display: none; }
    .app-page .modal-body .nav-tabs .nav-item { flex: 1 0 auto; margin: 0; }
    .app-page .modal-body .nav-tabs .nav-link {
        width: 100%;
        padding: .85rem .9rem;
        margin: 0 0 -1px;
        border: 0 !important;
        border-bottom: 3px solid transparent !important;
        border-radius: 0;
        background: transparent !important;
        color: var(--perla-muted) !important;
        font-size: .85rem;
        white-space: nowrap;
        transition: color .2s, border-color .2s;
    }
    .app-page .modal-body .nav-tabs .nav-link.active {
        border-bottom-color: var(--perla-primary) !important;
        color: var(--perla-primary) !important;
    }
    .app-page .modal-body .list-group-item { min-width: 0; gap: .75rem; }
    .app-page .modal-body .list-group-item a { min-width: 0; overflow-wrap: anywhere; white-space: normal; }

    .app-page .modal-footer {
        flex-wrap: nowrap;
        gap: .6rem;
        padding: .75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom)) !important;
        background: #fff !important;
        border-top: 1px solid #eef1f5 !important;
    }
    .app-page .modal-footer .btn { flex: 1 1 0; margin: 0; min-height: 48px; border-radius: 999px; font-weight: 700; }

    .dashboard-chart-toolbar { flex-direction: column; align-items: stretch !important; gap: 1rem; }
    /* Dashboard summary uses the same label/value list layout as record pages. */
    .dashboard-stats { --bs-gutter-x: 0; --bs-gutter-y: 0; margin: 0 0 1.5rem !important; padding: .5rem 0 !important; background: #fff; border-radius: 1rem; box-shadow: 0 .125rem .25rem rgba(0,0,0,.075); }
    .dashboard-stats > [class*="col-"] { padding: 0; border-bottom: 1px solid #e8edf3; }
    .dashboard-stats > [class*="col-"]:last-child { border-bottom: 0; }
    .dashboard-stats .stat-card { display: grid; grid-template-columns: minmax(6.5rem, 31%) minmax(0, 1fr); align-items: start; gap: .75rem; height: auto !important; padding: .9rem 1rem !important; border-radius: 0 !important; box-shadow: none !important; background: transparent; }
    .dashboard-stats .stat-card > div { display: none !important; }
    .dashboard-stats .stat-card > span { margin: 0 !important; color: #667085 !important; font-size: .68rem; font-weight: 700 !important; letter-spacing: .04em; line-height: 1.5; text-transform: uppercase; }
    .dashboard-stats .stat-card h3 { margin: 0; font-size: 1rem !important; overflow-wrap: anywhere; }
    #recentIssuances { overflow-wrap: anywhere; }
    #recentIssuances .recent-row { display: block !important; padding: .7rem 0 !important; }
    #recentIssuances .recent-row > * { display: grid !important; grid-template-columns: minmax(6.5rem, 31%) minmax(0, 1fr); gap: .75rem; padding: .35rem 0; }
    #recentIssuances .recent-row > *::before { content: attr(data-label); color: #667085; font-size: .68rem; font-weight: 700; letter-spacing: .04em; line-height: 1.5; text-transform: uppercase; }
    #depreciationAsset { width: 100%; max-width: none !important; min-width: 0; }
    #assetValueChart { max-height: 260px; }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        z-index: 1045;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        width: min(85vw, 300px) !important;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

@media (max-width: 379.98px) {
    .mobile-detail-table td { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}

@media (max-width: 991.98px) {
    .login-intro { display: none; }
}

/* ---------- Modern comboboxes (native selects + Choices.js), all pages ---------- */
.app-page .form-select {
    min-height: 48px;
    padding: .6rem 2.5rem .6rem 1rem;
    border: 1px solid #e1e7ef;
    border-radius: .85rem;
    background-color: #f7f9fc;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23667085' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-position: right 1rem center;
    background-size: 14px;
    color: var(--perla-ink);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.app-page .form-select:hover { border-color: #c9d6ea; }
.app-page .form-select:focus {
    background-color: #fff;
    border-color: var(--perla-primary);
    box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .14);
}
.app-page .form-select option { padding: .6rem; }

.app-page .choices { margin-bottom: 0; font-size: 1rem; }
.app-page .choices .choices__inner {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: .35rem 2.5rem .35rem 1rem;
    border: 1px solid #e1e7ef;
    border-radius: .85rem;
    background-color: #f7f9fc;
    font-size: 1rem;
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.app-page .choices:hover .choices__inner { border-color: #c9d6ea; }
.app-page .choices .choices__list--single { flex: 1; padding: 0; }
.app-page .choices .choices__list--single .choices__item { color: var(--perla-ink); }
.app-page .choices .choices__placeholder { color: #98a2b3; opacity: 1; }
.app-page .choices.is-focused .choices__inner,
.app-page .choices.is-open .choices__inner {
    background-color: #fff;
    border-color: var(--perla-primary);
    box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .14);
}
.app-page .choices.is-open .choices__inner { border-radius: .85rem; }
.app-page .choices[data-type*="select-one"]::after {
    width: 9px;
    height: 9px;
    margin-top: -6px;
    right: 1.1rem;
    border: 0;
    border-right: 2px solid #667085;
    border-bottom: 2px solid #667085;
    transform: rotate(45deg);
    transition: transform .2s;
}
.app-page .choices[data-type*="select-one"].is-open::after {
    margin-top: -2px;
    border-color: var(--perla-primary);
    transform: rotate(-135deg);
}
.app-page .choices__list--dropdown,
.app-page .choices__list[aria-expanded] {
    z-index: 20;
    margin-top: .4rem;
    border: 1px solid #e1e7ef;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
    overflow: hidden;
}
.app-page .choices.is-open .choices__list--dropdown { border-radius: 1rem; }
.app-page .choices__list--dropdown .choices__input {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: .6rem 1rem .6rem 2.4rem;
    border: 0 !important;
    border-bottom: 1px solid #eef1f5 !important;
    border-radius: 0 !important;
    background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%2398a2b3' d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3e%3c/svg%3e") no-repeat .85rem center / 14px;
    box-shadow: none !important;
    font-size: .95rem;
    outline: 0;
}
.app-page .choices__list--dropdown .choices__list { max-height: 240px; padding: .35rem; }
.app-page .choices__list--dropdown .choices__item--selectable {
    padding: .7rem .85rem;
    border-radius: .65rem;
    font-size: .95rem;
    color: var(--perla-ink);
}
.app-page .choices__list--dropdown .choices__item--selectable::after { display: none; }
.app-page .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--perla-primary-soft);
    color: var(--perla-primary-dark);
}
.app-page .choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: var(--perla-primary-soft);
    color: var(--perla-primary-dark);
    font-weight: 700;
}
.app-page .choices__list--dropdown .choices__placeholder { color: #98a2b3; }
.app-page .choices__list--dropdown .has-no-results,
.app-page .choices__list--dropdown .has-no-choices { padding: .8rem; color: var(--perla-muted); }

/* Custom combobox (js/combobox.js) - structural rules; look comes from the Choices styles above. */
.app-page .choices.cb { position: relative; }
.app-page .choices.cb .choices__inner { cursor: pointer; user-select: none; -webkit-user-select: none; }
.app-page .choices.cb .choices__inner:focus-visible { outline: 0; border-color: var(--perla-primary); box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .14); }
.app-page .choices.cb .choices__list { margin: 0; padding: 0; list-style: none; }
.app-page .choices.cb .choices__list--dropdown { display: none; position: absolute; top: 100%; left: 0; width: 100%; }
.app-page .choices.cb.is-open .choices__list--dropdown { display: block; }
.app-page .choices.cb .choices__list--dropdown .choices__list { overflow-y: auto; overscroll-behavior: contain; }
.app-page .choices.cb .choices__item { cursor: pointer; }
.app-page .choices.cb .choices__item--choice.is-disabled { opacity: .45; pointer-events: none; }
.app-page .choices.cb .choices__list--single .choices__item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-page .choices.cb.is-disabled .choices__inner { opacity: .6; cursor: not-allowed; }
.app-page .choices.cb.cb-no-search .choices__input { display: none; }
.app-page .choices.cb.cb-sm .choices__inner { min-height: 40px; font-size: .9rem; }
.app-page .choices[data-type*="select-one"]::after { content: ""; position: absolute; top: 50%; display: block; pointer-events: none; }
@media (max-width: 767.98px) {
    .dashboard-chart-toolbar .choices.cb { width: 100%; max-width: none !important; }
}

@media (max-width: 767.98px) {
    .app-page .dashboard-chart-toolbar { margin-bottom: 1rem !important; gap: .75rem; }
    .app-page .dashboard-chart-toolbar h6 { font-size: 1.1rem !important; }
    .app-page .card.p-4:has(#assetValueChart) { padding: 1.1rem !important; }
    .app-page .card:has(#assetValueChart) > div[style*="height"] { height: 260px !important; margin: 0 -.25rem; }
    .app-page #assetValueChart { max-height: none; }
    #dashboardContent > .dashboard-stats { margin-bottom: .75rem !important; }
    #dashboardContent > .dashboard-stats + .row.g-4 { margin-top: 0 !important; }
    .app-page .col-md-7, .app-page .col-md-5 { margin-top: 1rem; }
    .app-page .row.g-4 > .col-md-7:first-child { margin-top: 0; }
}

/* Employee list: compact one-line rows on phones (Code | Name | Status | Edit) */
.employee-assets-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    padding: .3rem .55rem;
    background: #fff1f2;
    color: #be123c;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}
.employee-assets-toggle:hover,
.employee-assets-toggle:focus-visible { background: #ffe4e6; color: #9f1239; }
.employee-assigned-badge { display: inline-flex; align-items: center; gap: .3rem; }
.employee-name-toggle,
.employee-name-toggle:hover,
.employee-name-toggle:focus-visible { padding: .15rem 0; background: transparent; color: #172033; text-align: left; }
.employee-name-toggle > span:first-child { min-width: 0; overflow: hidden; color: #172033; font-size: .92rem; text-overflow: ellipsis; }
.employee-name-toggle .employee-assigned-badge { flex: 0 0 auto; padding: .22rem .45rem; border-radius: 999px; background: #fff1f2; color: #be123c; font-size: .67rem; }
.employee-name-toggle .employee-assets-chevron { flex: 0 0 auto; }
.employee-name-label { font-weight: 700; white-space: nowrap; }
.employee-assets-panel[hidden],
.employee-assets-row[hidden] { display: none !important; }
.employee-assets-panel:not([hidden]) { display: block; }
.employee-assets-panel {
    padding: .75rem;
    border: 1px solid #e8edf3;
    border-radius: .9rem;
    background: #f8fafc;
}
.employee-assets-row > td { padding: .5rem 1rem 1rem !important; border: 0; }
.employee-assets-items { display: grid; gap: .5rem; }
.employee-asset-item {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .65rem;
    border: 1px solid #edf0f4;
    border-radius: .7rem;
    background: #fff;
}
.employee-asset-icon {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    place-items: center;
    border-radius: .65rem;
    background: #e0f2fe;
    color: #0369a1;
}
.employee-asset-copy { display: grid; min-width: 0; gap: .15rem; }
.employee-asset-copy strong { color: #172033; font-size: .85rem; overflow-wrap: anywhere; }
.employee-asset-copy span,
.employee-asset-copy small,
.employee-assets-empty,
.employee-assets-loading,
.employee-assets-error { color: #667085; font-size: .78rem; overflow-wrap: anywhere; }
.employee-assets-error { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.employee-card .employee-assets-toggle { max-width: 100%; }
.employee-page-size { width: auto; min-width: 4.25rem; border-radius: .6rem; }
.employee-pagination .btn:disabled { opacity: .5; }
.employee-table .employee-inactive-row {
    --bs-table-bg: #eef0f2;
    --bs-table-hover-bg: #e5e7eb;
    color: #667085;
}
.employee-table .employee-inactive-row > td { background-color: var(--bs-table-bg); }
.employee-table .employee-inactive-row:hover > td { background-color: var(--bs-table-hover-bg); }
.employee-table .employee-inactive-row .text-dark,
.employee-table .employee-inactive-row .text-muted { color: #667085 !important; }
.employee-card.employee-inactive { background-color: #f1f3f5; }
.employee-card.employee-inactive h5,
.employee-card.employee-inactive .text-dark { color: #667085 !important; }
.employee-table .employee-list-row { cursor: pointer; transition: background-color .16s ease, box-shadow .16s ease; }
.employee-table .employee-list-row:active { background-color: #fef2f2; }
.employee-table .employee-list-row.employee-row-selected > td {
    background-color: #fff1f2;
    box-shadow: inset 0 1px #fecdd3, inset 0 -1px #fecdd3;
}
.employee-table .employee-list-row.employee-row-selected > td:first-child { box-shadow: inset 3px 0 #f43f5e, inset 0 1px #fecdd3, inset 0 -1px #fecdd3; }
.employee-table .employee-inactive-row.employee-row-selected > td { background-color: #e5e7eb; }
.employee-table .employee-inactive-row.employee-row-selected > td:first-child { box-shadow: inset 3px 0 #98a2b3, inset 0 1px #d0d5dd, inset 0 -1px #d0d5dd; }
.mobile-detail-table tbody tr { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.asset-table tbody tr { cursor: default; }
.mobile-detail-table tbody tr.list-row-selected > td {
    background-color: #fff1f2;
    box-shadow: inset 0 1px #fecdd3, inset 0 -1px #fecdd3;
}
.mobile-detail-table tbody tr.list-row-selected > td:first-child {
    box-shadow: inset 3px 0 #f43f5e, inset 0 1px #fecdd3, inset 0 -1px #fecdd3;
}

@media (max-width: 767.98px) {
    .employee-pagination { justify-content: center !important; }
    .employee-pagination > div { justify-content: center; }
    .mobile-detail-table tbody tr.list-row-selected {
        background-color: #fff1f2;
        border-radius: .85rem;
        box-shadow: inset 3px 0 #f43f5e, 0 2px 8px rgba(16, 24, 40, .06);
    }
    .app-page .employee-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto 2.25rem;
        align-items: center;
        gap: .5rem;
        padding: .55rem .85rem;
        border-bottom: 1px solid #eef1f5;
        background-color: #fff;
        border-radius: .85rem;
        margin: .15rem .35rem;
        -webkit-tap-highlight-color: transparent;
    }
    .app-page .employee-table tbody tr.employee-row-selected { background-color: #fff1f2; box-shadow: inset 3px 0 #f43f5e, 0 2px 8px rgba(16, 24, 40, .06); }
    .app-page .employee-table tbody tr.employee-inactive-row.employee-row-selected { background-color: #e5e7eb; box-shadow: inset 3px 0 #98a2b3, 0 2px 8px rgba(16, 24, 40, .06); }
    .app-page .employee-table tbody tr.employee-inactive-row { background-color: #eef0f2; }
    .app-page .employee-table tbody td {
        display: block !important;
        width: auto;
        min-width: 0;
        padding: 0 !important;
        font-size: .85rem;
    }
    .app-page .employee-table td::before { display: none !important; content: none !important; }
    .app-page .employee-table td[data-label="Department"],
    .app-page .employee-table td[data-label="Branch"],
    .app-page .employee-table td[data-label="Code"] { display: none !important; }
    .app-page .employee-table td[data-label="Code"] { flex: none; }
    .app-page .employee-table td[data-label="Code"] .mobile-field-value {
        display: inline-block;
        padding: .2rem .45rem;
        border-radius: .45rem;
        background: var(--perla-primary-soft);
        color: var(--perla-primary-dark);
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .02em;
        white-space: nowrap;
    }
    .app-page .employee-table td[data-label="Full name"] .mobile-field-value { gap: .5rem !important; min-width: 0; }
    .app-page .employee-table td[data-label="Full name"] .employee-name-cell { flex-wrap: nowrap; }
    .app-page .employee-table td[data-label="Full name"] .employee-name-toggle { flex: 1 1 auto; gap: .25rem; min-width: 0; font-size: .64rem; }
    .app-page .employee-table td[data-label="Full name"] .employee-name-toggle > span:first-child { flex: 1 1 auto; font-size: .83rem; }
    .app-page .employee-table td[data-label="Full name"] .employee-name-toggle .employee-assigned-badge { padding: .2rem .35rem; font-size: .59rem; }
    .app-page .employee-assets-row { display: block !important; width: 100%; padding: 0 !important; }
    .app-page .employee-table tbody tr.employee-assets-row[hidden] { display: none !important; }
    .app-page .employee-assets-row > td { display: block !important; width: 100%; padding: .25rem .75rem .8rem !important; }
    .app-page .employee-table td[data-label="Full name"] .rounded-circle { width: 28px !important; height: 28px !important; font-size: .75rem; }
    .app-page .employee-table td[data-label="Full name"] .fw-bold {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .88rem;
    }
    .app-page .employee-table td[data-label="Status"] .badge { padding: .3rem .55rem !important; font-size: .65rem !important; }
    .app-page .employee-table td[data-label="Actions"] { margin: 0; text-align: right !important; }
    .app-page .employee-table td[data-label="Actions"] .btn { width: 32px !important; height: 32px !important; min-width: 0; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
}
@media (max-width: 767.98px) {
    .app-page .employee-table td[colspan] { grid-column: 1 / -1; padding: 2rem 1rem !important; text-align: center !important; }
}

/* Branch list: compact rows on phones - Code+Name | Status | Edit, address underneath */
@media (max-width: 767.98px) {
    .app-page .branch-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto 2.25rem;
        grid-template-areas: "name status edit" "addr addr addr";
        align-items: center;
        gap: .2rem .5rem;
        padding: .6rem .85rem;
        border-bottom: 1px solid #eef1f5;
    }
    .app-page .branch-table tbody td {
        display: block !important;
        width: auto;
        min-width: 0;
        padding: 0 !important;
        font-size: .85rem;
    }
    .app-page .branch-table td::before { display: none !important; content: none !important; }
    .app-page .branch-table td[data-label="Code"] { display: none !important; }
    .app-page .branch-table td[data-label="Branch name"] { grid-area: name; }
    .app-page .branch-table td[data-label="Status"] { grid-area: status; }
    .app-page .branch-table td[data-label="Actions"] { grid-area: edit; margin: 0; text-align: right !important; }
    .app-page .branch-table td[data-label="Address"] {
        grid-area: addr;
        padding-left: 2.1rem !important;
        font-size: .76rem;
        color: var(--perla-muted) !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap !important;
    }
    .app-page .branch-table td[data-label="Address"] .mobile-field-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .app-page .branch-table td[data-label="Branch name"] .mobile-field-value { gap: .5rem !important; min-width: 0; }
    .app-page .branch-table td[data-label="Branch name"] .rounded-circle { width: 28px !important; height: 28px !important; font-size: .75rem; }
    .app-page .branch-table td[data-label="Branch name"] .fw-bold {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .88rem;
    }
    .app-page .branch-table td[data-label="Status"] .badge { padding: .3rem .55rem !important; font-size: .65rem !important; }
    .app-page .branch-table td[data-label="Actions"] .btn {
        width: 32px; height: 32px; min-width: 0; min-height: 0; padding: 0;
        display: inline-flex; align-items: center; justify-content: center; font-size: 0;
    }
    .app-page .branch-table td[data-label="Actions"] .btn i { margin: 0 !important; font-size: .85rem; }
    .app-page .branch-table td[colspan] { grid-column: 1 / -1; padding: 2rem 1rem !important; text-align: center !important; }
}

@media (max-width: 767.98px) {
    .app-page .dashboard-stats {
        --bs-gutter-x: .7rem;
        --bs-gutter-y: .7rem;
        margin: 0 0 1.25rem !important;
        padding: 0 !important;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }
    .app-page .dashboard-stats > [class*="col-"] { padding: 0; border: 0; }
    .app-page .dashboard-stats .stat-card {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        grid-template-rows: auto auto;
        align-items: center;
        align-content: center;
        column-gap: .65rem;
        row-gap: .2rem;
        min-height: 76px;
        padding: .7rem .8rem !important;
        border: 1px solid #edf0f5 !important;
        border-radius: 1rem !important;
        background: #fff;
        box-shadow: 0 5px 16px rgba(24, 39, 75, .07) !important;
    }
    .app-page .dashboard-stats .stat-card > div {
        display: flex !important;
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 34px !important;
        height: 34px !important;
        margin: 0 !important;
        border-radius: 11px !important;
    }
    .app-page .dashboard-stats > .col:nth-child(1) .stat-card > div { color: #e11d48 !important; background: #fff1f2 !important; }
    .app-page .dashboard-stats > .col:nth-child(2) .stat-card > div { color: #059669 !important; background: #ecfdf5 !important; }
    .app-page .dashboard-stats > .col:nth-child(3) .stat-card > div { color: #2563eb !important; background: #eff6ff !important; }
    .app-page .dashboard-stats > .col:nth-child(4) .stat-card > div { color: #d97706 !important; background: #fffbeb !important; }
    .app-page .dashboard-stats .stat-card > span {
        grid-column: 2;
        grid-row: 1;
        margin: 0 !important;
        color: #667085 !important;
        font-size: .6rem !important;
        font-weight: 700 !important;
        letter-spacing: .055em;
        line-height: 1.3;
        text-transform: uppercase;
    }
    .app-page .dashboard-stats .stat-card h3 {
        grid-column: 2;
        grid-row: 2;
        max-width: 100%;
        margin: 0 !important;
        color: #182230;
        font-size: clamp(.9rem, 4vw, 1.05rem) !important;
        line-height: 1.2;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Primary "Add" action becomes a floating action button (FAB) on phones: 56px, bottom-right, thumb reach. */
@media (max-width: 767.98px) {
    .app-page .page-toolbar-actions .btn[id^="btnAdd"] {
        position: fixed;
        right: 1.1rem;
        bottom: calc(1.1rem + env(safe-area-inset-bottom));
        z-index: 1025;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 56px !important;
        height: 56px;
        min-width: 0;
        padding: 0 !important;
        border: 0;
        border-radius: 50% !important;
        font-size: 0 !important;            /* hide the text label, keep it for screen readers */
        line-height: 0;
        box-shadow: 0 8px 20px rgba(37, 99, 235, .4), 0 2px 6px rgba(16, 24, 40, .2) !important;
        transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    }
    .app-page .page-toolbar-actions .btn[id^="btnAdd"] i { margin: 0 !important; font-size: 1.5rem; line-height: 1; }
    .app-page .page-toolbar-actions .btn[id^="btnAdd"]:active { transform: scale(.92); }
    /* Keep the FAB out of the way of modals and the open navigation drawer. */
    body.modal-open .page-toolbar-actions .btn[id^="btnAdd"] { opacity: 0; pointer-events: none; transform: scale(.6); }
    /* Leave room so the last list row is never hidden behind the FAB. */
    .app-page .p-4.p-md-5 { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)) !important; }
}

/* Modernize html5-qrcode UI */
#qr-reader { border: none !important; border-radius: 1rem; overflow: hidden; }
#qr-reader select { border: 1px solid #e2e8f0 !important; border-radius: 0.5rem !important; padding: 0.6rem !important; margin-bottom: 1rem !important; width: 80% !important; max-width: 300px !important; font-family: inherit !important; background-color: #f8fafc !important; }
#qr-reader a { color: var(--perla-primary) !important; text-decoration: none !important; font-weight: 500 !important; }

.asset-qr-modal .modal-dialog { max-width: 460px; }
.asset-qr-modal .modal-content {
    height: auto;
    max-height: none;
    background: linear-gradient(145deg, #fff 0%, #f8faff 100%);
    box-shadow: 0 24px 70px rgba(20, 32, 56, .22) !important;
}
.asset-qr-modal .modal-content::before { display: none; }
.asset-qr-modal .modal-header { align-items: flex-start; }
.asset-qr-modal .modal-footer {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: .5rem;
}
.asset-qr-modal .modal-footer .btn {
    flex: 0 0 auto;
    min-width: 0;
    padding-right: .85rem;
    padding-left: .85rem;
    font-size: .82rem;
    white-space: nowrap;
}
.asset-qr-eyebrow { color: var(--perla-primary); font-size: .68rem; font-weight: 800; letter-spacing: .14em; }
.asset-qr-modal .modal-title { color: #172033; font-size: 1.2rem; }
.asset-qr-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 1px solid #e8edf5;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 12px 32px rgba(28, 45, 75, .08);
}
.asset-qr-card :is(canvas, img) { display: block; width: min(64vw, 240px); height: min(64vw, 240px); max-width: 100%; }
.asset-qr-reference-label { margin-top: 1.25rem; color: #7c8798; font-size: .65rem; font-weight: 800; letter-spacing: .13em; }
.asset-qr-reference { margin-top: .35rem; color: #172033; font-size: 1.05rem; font-weight: 750; overflow-wrap: anywhere; }

.app-dialog-overlay[hidden] { display: none !important; }
.app-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
    background: rgba(22, 28, 39, .34);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}
.app-dialog-card {
    width: min(100%, 360px);
    padding: 1.75rem 1.5rem 1.25rem;
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 18px 60px rgba(16, 24, 40, .2);
    text-align: center;
    animation: app-dialog-enter .22s ease-out;
}
.app-dialog-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    place-items: center;
    border-radius: 38% 48% 42% 50%;
    font-size: 2rem;
    transform: rotate(-8deg);
}
.app-dialog-icon i { transform: rotate(8deg); }
.app-dialog-success .app-dialog-icon { background: #c8f59b; color: #087443; }
.app-dialog-warning .app-dialog-icon { background: #fff0c2; color: #a15c00; }
.app-dialog-error .app-dialog-icon { background: #ffe0e4; color: #c5223d; }
.app-dialog-info .app-dialog-icon { background: #dbeafe; color: #175cd3; }
.app-dialog-title { margin: 0; color: #252b36; font-size: 1.25rem; font-weight: 700; }
.app-dialog-message { max-width: 270px; margin: .45rem auto 1.4rem; color: #6b7280; font-size: .82rem; }
.app-dialog-actions { display: flex; gap: .65rem; }
.app-dialog-actions-confirm-only { display: block; }
.app-dialog-cancel,
.app-dialog-confirm {
    width: 100%;
    min-height: 46px;
    border-radius: .8rem;
    font-weight: 700;
}
.app-dialog-cancel { border: 0; background: #f2f4f7; color: #344054; }
.app-dialog-confirm { border: 0; background: var(--perla-primary, #f43f5e); color: #fff; }
.app-dialog-warning .app-dialog-confirm { background: #d58a00; }
.app-dialog-error .app-dialog-confirm { background: #d92d45; }
.app-dialog-cancel[hidden] { display: none; }
.app-dialog-cancel:focus-visible,
.app-dialog-confirm:focus-visible { outline: 3px solid rgba(244, 63, 94, .35); outline-offset: 3px; }
body.app-dialog-open { overflow: hidden; }
@keyframes app-dialog-enter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
    .app-dialog-overlay { align-items: center; }
}

@media (max-width: 767.98px) {
    .asset-qr-modal .modal-dialog { min-height: 100dvh; }
    .asset-qr-modal .modal-content { height: auto; max-height: calc(100dvh - 1rem); border-radius: 1.5rem 1.5rem 0 0 !important; }
    .asset-qr-modal .modal-body { flex: 0 1 auto; overflow-y: auto; }
    .asset-qr-modal .modal-footer { gap: .25rem; padding-right: .5rem !important; padding-left: .5rem !important; }
    .asset-qr-modal .modal-footer .btn { flex: 1 1 0; min-height: 48px; padding-right: .2rem; padding-left: .2rem; font-size: .75rem; }
    .asset-qr-modal .modal-footer .btn i { margin-right: .25rem !important; }
    .asset-qr-download-png { display: none; }
    .app-dialog-overlay { padding: 0 .65rem max(.65rem, env(safe-area-inset-bottom)); }
    .app-dialog-card { width: 100%; max-width: 360px; padding: 1.5rem 1.25rem 1rem; }
}

@media (max-width: 767.98px) {
    .app-page .issuance-table tbody tr {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "reference date"
            "employee notes"
            "actions actions";
        align-items: center;
        gap: .55rem .8rem;
        margin: 0 .2rem .65rem;
        padding: .85rem .9rem .65rem;
        border: 1px solid #e8edf4 !important;
        border-radius: 1rem !important;
        background: #fff;
        box-shadow: 0 3px 10px rgba(20, 35, 65, .045);
    }
    .app-page .issuance-table tbody tr > td {
        display: flex !important;
        flex-direction: column;
        gap: .22rem;
        width: auto;
        min-width: 0;
        padding: .1rem !important;
    }
    .app-page .issuance-table tbody tr > td:first-child { flex: initial; }
    .app-page .issuance-table td[data-label="Reference Number"] { grid-area: reference; }
    .app-page .issuance-table td[data-label="Employee"] {
        grid-area: employee;
        grid-column: 1;
        grid-row: 2;
        align-items: flex-start;
        text-align: left !important;
    }
    .app-page .issuance-table td[data-label="Assigned Date"] {
        grid-area: date;
        grid-column: 2;
        grid-row: 1;
        align-items: flex-end;
        text-align: right !important;
    }
    .app-page .issuance-table td[data-label="Notes"] { grid-area: notes; }
    .app-page .issuance-table td[data-label="Actions"] { grid-area: actions; align-items: flex-end; }
    .app-page .issuance-table td[data-label]::before {
        color: #7a8496;
        font-size: .58rem;
        font-weight: 800;
        letter-spacing: .07em;
        line-height: 1.2;
    }
    .app-page .issuance-table td[data-label="Reference Number"] .mobile-field-value {
        color: #172033;
        font-size: .95rem;
        font-weight: 750;
        line-height: 1.25;
    }
    .app-page .issuance-table .issuance-reference-link {
        color: #172033;
        text-decoration: none;
        text-underline-offset: .2em;
        text-decoration-color: #fda4af;
    }
    .app-page .issuance-table .issuance-reference-link:active,
    .app-page .issuance-table .issuance-reference-link:focus-visible {
        color: #be123c;
        text-decoration: underline;
    }
    .app-page .issuance-table td[data-label="Employee"] .issuance-employee-name {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        max-width: 100%;
        color: #344054;
        line-height: 1.3;
    }
    .app-page .issuance-table .issuance-employee-name strong {
        max-width: 100%;
        color: #172033;
        font-size: .82rem;
        font-weight: 700;
        overflow-wrap: anywhere;
    }
    .app-page .issuance-table .issuance-employee-code {
        max-width: 100%;
        color: #8a94a6;
        font-size: .66rem;
        font-weight: 500;
        overflow-wrap: anywhere;
    }
    .app-page .issuance-table td[data-label="Assigned Date"] .mobile-field-value,
    .app-page .issuance-table td[data-label="Notes"] .mobile-field-value {
        color: #475467;
        font-size: .76rem;
    }
    .app-page .issuance-table td[data-label="Actions"] .btn {
        width: 38px !important;
        height: 38px !important;
        border-radius: 50% !important;
        background: #f7f8fb;
    }
    .app-page .issuance-table tbody tr.list-row-selected {
        border-color: #fecdd3 !important;
        background: #fff1f2;
    }
    .app-page .issuance-table tbody tr.list-row-selected > td { background: transparent !important; box-shadow: none !important; }

    .employee-page .employee-content {
        padding: .85rem .8rem calc(6.5rem + env(safe-area-inset-bottom)) !important;
        background: #f4f6fb;
    }
    .employee-page .management-toolbar {
        align-items: stretch !important;
        gap: .85rem !important;
        margin-bottom: 1rem !important;
        padding: .35rem .15rem 0;
    }
    .employee-page .management-toolbar > div:first-child > span { font-size: .65rem !important; letter-spacing: .13em !important; }
    .employee-page .management-toolbar h2 { margin: .15rem 0 .2rem !important; font-size: 1.55rem !important; letter-spacing: -.035em; }
    .employee-page .management-toolbar p { color: #7b8496 !important; font-size: .83rem; }
    .employee-page .page-toolbar-actions { gap: .7rem !important; }
    .employee-page .page-toolbar-actions > .input-group {
        height: 48px !important;
        border: 1px solid #e9edf4 !important;
        border-radius: 1rem !important;
        background: #fff !important;
        box-shadow: 0 3px 12px rgba(20, 35, 65, .055) !important;
    }
    .employee-page .page-toolbar-actions > .input-group .input-group-text { color: #8b95a7 !important; }
    .employee-page #employeeList {
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .employee-page #employeeList .mobile-detail-list { overflow: visible !important; }
    .employee-page .employee-table { display: block; }
    .employee-page .employee-table tbody {
        display: grid;
        gap: .58rem;
        padding: .1rem .1rem .35rem;
    }
    .employee-page .employee-table tbody tr.employee-list-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto 2.55rem;
        align-items: center;
        gap: .55rem;
        min-height: 68px;
        margin: 0;
        padding: .7rem .75rem;
        border: 1px solid #edf0f5;
        border-radius: 1.1rem;
        background: #fff;
        box-shadow: 0 3px 10px rgba(20, 35, 65, .045);
        transition: transform .14s ease, background-color .14s ease, box-shadow .14s ease;
    }
    .employee-page .employee-table tbody tr.employee-list-row:active { transform: scale(.985); }
    .employee-page .employee-table tbody tr.employee-list-row.employee-row-selected {
        border-color: #fecdd3;
        background: #fff1f2;
        box-shadow: inset 3px 0 #f43f5e, 0 4px 13px rgba(190, 24, 93, .08);
    }
    .employee-page .employee-table tbody tr.employee-list-row.employee-inactive-row {
        border-color: #e4e7ec;
        background: #eef0f2;
        box-shadow: 0 2px 8px rgba(20, 35, 65, .035);
    }
    .employee-page .employee-table tbody tr.employee-list-row.employee-inactive-row.employee-row-selected {
        border-color: #d0d5dd;
        background: #e5e7eb;
        box-shadow: inset 3px 0 #98a2b3, 0 4px 13px rgba(52, 64, 84, .08);
    }
    .employee-page .employee-table tbody tr.employee-list-row > td {
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .employee-page .employee-table td[data-label="Full name"] .employee-name-cell {
        gap: .65rem !important;
        min-width: 0;
    }
    .employee-page .employee-table td[data-label="Full name"] .rounded-circle {
        width: 38px !important;
        height: 38px !important;
        font-size: .9rem !important;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
    }
    .employee-page .employee-table td[data-label="Full name"] .fw-bold,
    .employee-page .employee-table td[data-label="Full name"] .employee-name-toggle > span:first-child {
        color: #202b3c !important;
        font-size: .88rem !important;
        font-weight: 700 !important;
        line-height: 1.25;
    }
    .employee-page .employee-table tr.employee-inactive-row td[data-label="Full name"] .fw-bold,
    .employee-page .employee-table tr.employee-inactive-row .employee-name-toggle > span:first-child { color: #667085 !important; }
    .employee-page .employee-table td[data-label="Full name"] .employee-name-toggle {
        justify-content: flex-start;
        gap: .35rem;
        padding: .15rem 0;
        border-radius: .6rem;
        background: transparent;
    }
    .employee-page .employee-table td[data-label="Full name"] .employee-name-toggle .employee-assigned-badge {
        padding: .22rem .42rem;
        background: #fff0e6;
        color: #b54708;
        font-size: .61rem;
        font-weight: 700;
    }
    .employee-page .employee-table td[data-label="Status"] .badge {
        padding: .34rem .58rem !important;
        border-radius: 999px !important;
        font-size: .65rem !important;
        font-weight: 700 !important;
        white-space: nowrap;
    }
    .employee-page .employee-table td[data-label="Actions"] .btn {
        width: 40px !important;
        height: 40px !important;
        border: 1px solid #edf0f5;
        border-radius: 50% !important;
        background: #f8f9fc;
        color: #455065;
        box-shadow: none !important;
    }
    .employee-page .employee-table td[data-label="Actions"] .btn:active { background: #ffe4e6; color: #be123c; }
    .employee-page .employee-table tbody tr.employee-assets-row {
        display: block;
        margin: -.42rem 0 .15rem;
        padding: 0 .35rem .25rem;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .employee-page .employee-table tbody tr.employee-assets-row > td { display: block !important; padding: 0 !important; }
    .employee-page .employee-table tbody tr.employee-assets-row .employee-assets-panel { border-radius: .9rem; }
    .employee-page .employee-pagination {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        gap: .75rem !important;
        margin: .8rem .1rem 0 !important;
        padding: .9rem;
        border: 1px solid #e9edf4;
        border-radius: 1rem;
        background: #fff;
        box-shadow: 0 4px 14px rgba(20, 35, 65, .055);
    }
    .employee-page .employee-pagination > div:first-child {
        justify-content: flex-start !important;
        gap: .45rem !important;
        min-width: 0;
    }
    .employee-page .employee-pagination label { font-size: .7rem !important; }
    .employee-page .employee-page-size {
        min-height: 38px;
        padding: .35rem 1.8rem .35rem .65rem;
        border-color: #e5e9f0;
        background-color: #f8f9fc;
        font-size: .8rem;
    }
    .employee-page #employeePageLabel {
        margin-left: auto !important;
        color: #475467 !important;
        font-size: .72rem !important;
        font-weight: 600;
        white-space: nowrap;
    }
    .employee-page .employee-pagination > div:last-child {
        grid-column: 1 / -1;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: .55rem !important;
    }
    .employee-page .employee-pagination .btn {
        min-height: 42px;
        border-radius: .8rem !important;
        font-size: .8rem;
        font-weight: 700;
    }
}
