@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

html {
    font-size: 14px; /* SaaS compact density baseline (~90% scale vs standard 16px) */
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

html[data-ui-scale="80"] { font-size: 12.8px !important; }
html[data-ui-scale="85"] { font-size: 13.5px !important; }
html[data-ui-scale="90"] { font-size: 14px !important; }
html[data-ui-scale="95"] { font-size: 15px !important; }
html[data-ui-scale="100"] { font-size: 16px !important; }
html[data-ui-scale="105"] { font-size: 16.8px !important; }
html[data-ui-scale="110"] { font-size: 17.5px !important; }
html[data-ui-scale="115"] { font-size: 18.4px !important; }

:root {
    /* ── Primary Brand & Slate Palette (Option 1: Modern SaaS) ───── */
    --primary: #4f46e5;            /* Indigo 600 */
    --primary-hover: #4338ca;      /* Indigo 700 */
    --primary-active: #3730a3;     /* Indigo 800 */
    --primary-light: #eef2ff;      /* Indigo 50 */
    --primary-dark: #0f172a;       /* Slate 900 for high-contrast titles */
    --accent-orange: #4f46e5;      /* Remapped from hazard orange to Indigo */
    --accent-navy: #1e293b;        /* Slate 800 */
    --accent-indigo: #4f46e5;
    
    /* ── Neutral Canvas & Surfaces ────────────────────────────── */
    --canvas-bg: #f8fafc;          /* Slate 50 */
    --light-gray: #f8fafc;
    --white: #ffffff;
    --border-color: #e2e8f0;       /* Slate 200 */
    --border-subtle: #f1f5f9;      /* Slate 100 */
    --border-focus: #6366f1;       /* Indigo 500 */
    
    /* ── Typography & Text ─────────────────────────────────────── */
    --text-primary: #0f172a;       /* Slate 900 */
    --text-secondary: #334155;     /* Slate 700 */
    --muted-text: #64748b;         /* Slate 500 */
    --text-subtle: #94a3b8;        /* Slate 400 */
    
    /* ── Semantic Status Tones ─────────────────────────────────── */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --success-border: #a7f3d0;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --warning-border: #fde68a;

    --info: #3b82f6;
    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --info-border: #bfdbfe;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --danger-border: #fecdd3;
    
    /* ── Shadows & Radius ─────────────────────────────────────── */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-color: rgba(15, 23, 42, 0.06);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--canvas-bg);
    color: var(--text-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Modern Enterprise Page Loader ──────────────────────────── */
.page-loader {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    z-index: 3000;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: all;
}

.page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader .loader-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    padding: 24px 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.loader-orbit {
    position: relative;
    width: 42px;
    height: 42px;
    border: 3px solid #e0e7ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: loader-spin 0.75s linear infinite;
}

@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

.loader-sparkles,
.kawaii-face,
.loader-dot,
.kawaii-eyes,
.kawaii-blush,
.kawaii-mouth {
    display: none !important;
}

.loader-bounce-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.bounce-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.3;
    animation: modern-pulse 1.2s ease-in-out infinite;
}

.bounce-dot.bd1 { animation-delay: 0s; }
.bounce-dot.bd2 { animation-delay: 0.2s; }
.bounce-dot.bd3 { animation-delay: 0.4s; }

@keyframes modern-pulse {
    0%, 100% { opacity: 0.2; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); }
}

.loader-text {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.loader-subtext {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .loader-orbit,
    .bounce-dot {
        animation: none;
    }
}



h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand,
.section-title {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-weight: 700;
}

.section-container {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.card-box {
    background-color: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.app-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.app-navbar .navbar-nav {
    row-gap: 0.35rem;
}

.app-navbar .nav-item {
    display: flex;
    align-items: center;
}

.app-navbar .nav-link {
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.15s ease;
}

.app-navbar .nav-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.icon-interactive {
    width: 1rem;
    text-align: center;
}

.brand-wrap {
    gap: 0.75rem;
}

.brand-logo {
    height: 36px;
    width: 36px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.brand-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-copy strong {
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
}

.brand-copy small {
    font-size: 0.72rem;
    color: var(--muted-text);
    font-weight: 600;
}

.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    color: var(--muted-text);
    background: #ffffff;
    font-size: 0.875rem;
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.site-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.hero-shell {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 60%, #eef2ff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.hero-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 9999px;
    padding: 0.3rem 0.75rem;
}

.hero-title {
    font-size: clamp(1.75rem, 2.75vw, 2.5rem);
    line-height: 1.15;
    color: var(--text-primary);
    font-weight: 800;
}

.hero-text {
    color: var(--muted-text);
    max-width: 54ch;
    font-size: 1rem;
    line-height: 1.6;
}

.highlight-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.highlight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.highlight-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card p {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card h3 {
    margin: 0.4rem 0 0;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.feature-chip {
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    gap: 0.65rem;
    align-items: center;
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.feature-chip i {
    color: var(--primary);
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.table {
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 0;
    color: var(--text-secondary);
    vertical-align: middle;
}

.table thead th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border-color) !important;
    border-top: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.62rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.825rem;
    color: var(--text-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #ffffff;
}

.table-striped tbody tr:nth-of-type(even) {
    background-color: #fafbfc;
}

.table-hover tbody tr:hover {
    background-color: #f1f5f9 !important;
}

.table a:not(.btn):not(.badge) {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.table a:not(.btn):not(.badge):hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Ensure buttons inside tables and across views retain proper contrast and colors */
.table .btn, .table a.btn {
    text-decoration: none !important;
}

.btn-success, .table .btn-success, .table a.btn-success {
    background-color: var(--success, #10b981) !important;
    border-color: var(--success, #10b981) !important;
    color: #ffffff !important;
}

.btn-success:hover, .btn-success:focus,
.table .btn-success:hover, .table a.btn-success:hover,
.table .btn-success:focus, .table a.btn-success:focus {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #ffffff !important;
}

.btn-success i, .btn-success span,
.table .btn-success i, .table a.btn-success i,
.table .btn-success span, .table a.btn-success span {
    color: #ffffff !important;
}

.btn-outline-success, .table .btn-outline-success, .table a.btn-outline-success {
    color: #059669 !important;
    border-color: #10b981 !important;
    background-color: #ffffff !important;
}

.btn-outline-success:hover, .btn-outline-success:focus,
.table .btn-outline-success:hover, .table a.btn-outline-success:hover,
.table .btn-outline-success:focus, .table a.btn-outline-success:focus {
    color: #ffffff !important;
    background-color: var(--success, #10b981) !important;
    border-color: var(--success, #10b981) !important;
}

.btn-outline-success i, .table .btn-outline-success i {
    color: inherit !important;
}
.btn-outline-success:hover i, .table .btn-outline-success:hover i {
    color: #ffffff !important;
}

.table .btn-primary, .table a.btn-primary {
    color: #ffffff !important;
}
.table .btn-primary i, .table a.btn-primary i {
    color: #ffffff !important;
}

.table .btn-danger, .table a.btn-danger {
    color: #ffffff !important;
}
.table .btn-danger i, .table a.btn-danger i {
    color: #ffffff !important;
}

.table .btn-outline-primary, .table a.btn-outline-primary {
    color: var(--primary) !important;
}
.table .btn-outline-primary:hover, .table a.btn-outline-primary:hover {
    color: #ffffff !important;
    background-color: var(--primary) !important;
}
.table .btn-outline-primary i, .table a.btn-outline-primary i {
    color: inherit !important;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff !important;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-secondary) !important;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary) !important;
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: #c7d2fe;
    color: var(--primary);
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
    transform: translateY(-1px);
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32em 0.7em;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
    line-height: 1.25;
    border: 1px solid transparent;
}

.badge-pending {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    border-color: var(--warning-border) !important;
}

.badge-info {
    background-color: var(--info-bg) !important;
    color: var(--info-text) !important;
    border-color: var(--info-border) !important;
}

.badge-success {
    background-color: var(--success-bg) !important;
    color: var(--success-text) !important;
    border-color: var(--success-border) !important;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: #cbd5e1;
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18) !important;
    background-color: #ffffff;
}

/* ── ERP Custom Autocomplete Dropdown ────────────────────────── */
.erp-autocomplete-dropdown {
    position: fixed;
    z-index: 10055;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.22), 0 8px 10px -6px rgba(15, 23, 42, 0.12);
    max-height: 290px;
    overflow-y: auto;
    font-size: 0.83rem;
    animation: erpDropdownFadeIn 0.12s ease-out;
}
@keyframes erpDropdownFadeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}
.erp-autocomplete-list {
    background: #ffffff;
    background-color: #ffffff;
}
.erp-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    background-color: #ffffff;
    transition: background-color 0.12s ease;
}
.erp-autocomplete-item:hover,
.erp-autocomplete-item.active {
    background-color: #f0f7ff !important;
}
.erp-autocomplete-item.selected {
    background-color: #f8fafc !important;
}
.erp-autocomplete-item:last-child {
    border-bottom: none;
}
.erp-autocomplete-empty {
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-size: 0.82rem;
}
.erp-autocomplete-footer {
    position: sticky;
    bottom: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 6px 8px;
    z-index: 5;
}
.erp-autocomplete-footer button {
    font-size: 0.8rem;
    font-weight: 500;
}


.form-check-input {
    border-color: #cbd5e1;
    border-radius: 4px;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-section {
    border-right: 1px solid var(--border-color);
    padding-right: 2rem;
}

.main-content {
    padding-left: 2rem;
}

@media (max-width: 768px) {
    .form-section {
        border-right: none;
        padding-right: 0;
        margin-bottom: 2rem;
    }
}

.form-floating>label {
    color: var(--muted-text);
    opacity: 0.9;
    font-size: 0.875rem;
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label {
    color: var(--primary);
    opacity: 1;
    transform: scale(0.82) translateY(-0.5rem) translateX(0.15rem);
}

.section-title {
    font-weight: 700;
    color: var(--text-primary);
    border-left: 3px solid var(--primary);
    padding-left: 0.65rem;
    letter-spacing: -0.02em;
}

.sticky-header table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.accordion-item {
    border-color: var(--border-color);
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.accordion-button {
    font-weight: 600;
    color: var(--text-primary);
    background-color: #ffffff;
    font-size: 0.9375rem;
}

.accordion-button:not(.collapsed) {
    color: var(--primary);
    background-color: var(--primary-light);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    border-color: var(--border-focus);
}

.accordion-button .badge {
    font-size: 0.75rem;
    padding: 0.3em 0.65em;
    border-radius: 9999px;
}

.gap-2 {
    gap: 0.5rem;
}

/* ==========================================================================
   APP LAYOUT & SIDEBAR NAVIGATION
   ========================================================================== */

/* ── App Layout Wrapper ──────────────────────────────────────── */
:root {
    --sidebar-expanded-width: 240px;
    --sidebar-collapsed-width: 64px;
    --sidebar-label-max-width: 148px;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.app-main {
    flex: 1;
}

.app-workspace {
    width: 100%;
    max-width: 1640px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 768px) {
    .app-workspace {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ── Guest Topbar (Unauthenticated) ─────────────────────────── */
.guest-topbar {
    background: #ffffff;
    border-bottom: 1px solid #e8ecf3;
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 10px rgba(11, 31, 58, 0.03);
}

.guest-topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guest-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary-dark);
}

.guest-topbar-brand:hover {
    color: var(--primary-dark);
}

.guest-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.guest-topbar-link {
    color: var(--muted-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.guest-topbar-link:hover {
    color: var(--accent-orange);
}

/* ── Authenticated Sidebar ───────────────────────────────────── */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-expanded-width);
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
    border-right: 1px solid #e5eaf3;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    overflow: visible;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 2px 0 15px rgba(15, 23, 42, 0.03);
}

/* ── Brand Section ───────────────────────────────────────────── */
.sidebar-brand {
    padding: 1.15rem 1rem 1.15rem 1.25rem;
    border-bottom: 1px solid #f0f4f9;
    min-height: 68px;
    display: flex;
    align-items: center;
}

.sidebar-brand-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-brand-link {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary-dark);
    min-width: 0;
    overflow: hidden;
}

.sidebar-desktop-toggle {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.sidebar-desktop-toggle:hover,
.sidebar-desktop-toggle:focus {
    background: #ede9fe;
    color: var(--primary);
    border-color: #c7d2fe;
    box-shadow: 0 1px 4px rgba(79, 70, 229, 0.12);
}

.sidebar-desktop-toggle .sidebar-collapse-icon {
    display: block;
}

.sidebar-desktop-toggle .sidebar-expand-icon {
    display: none;
}

.sidebar-brand-logo {
    height: 38px;
    width: 38px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-brand-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.sidebar-brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    max-width: var(--sidebar-label-max-width);
    opacity: 1;
    transform: translateX(0);
    transition: max-width 0.28s ease, opacity 0.18s ease, transform 0.28s ease;
}

.sidebar-brand-copy strong {
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.sidebar-brand-copy small {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Main Navigation ─────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 1rem;
    color: var(--muted-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.925rem;
    border-radius: 8px;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    /* invisible left border for layout stability */
    width: 100%;
    background: transparent;
    text-align: left;
    overflow: hidden;
}

.sidebar-link i {
    width: 1.25rem;
    text-align: center;
    font-size: 1.05rem;
    color: #94a3b8;
    transition: color 0.15s ease;
}

.sidebar-link-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    max-width: var(--sidebar-label-max-width);
    opacity: 1;
    transform: translateX(0);
}

.sidebar-link:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.sidebar-link:hover i {
    color: var(--primary);
}

.sidebar-link.active {
    background: var(--primary-light);
    /* highlight bg */
    color: var(--primary);
    border-left-color: var(--primary);
    /* left side highlight */
    font-weight: 700;
}

.sidebar-link.active i {
    color: var(--primary);
}

/* ── Sub-menu (Inventory accordion) ──────────────────────────── */
.sidebar-group-toggle {
    cursor: pointer;
    justify-content: space-between;
}

.sidebar-group-toggle span {
    flex: 1;
}

.sidebar-chevron {
    font-size: 0.8rem !important;
    flex-shrink: 0;
    max-width: 1rem;
    opacity: 1;
    transform: rotate(0deg) translateX(0);
    transition: transform 0.3s ease !important, opacity 0.18s ease, max-width 0.25s ease !important;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.sidebar-group-toggle[aria-expanded="true"] {
    background: #f8fafc;
}

.sidebar-submenu {
    list-style: none;
    padding: 0.25rem 0 0.5rem 0;
    margin: 0;
    overflow: hidden;
    transition: max-height 0.28s ease, opacity 0.18s ease, padding 0.28s ease;
}

/* Indent sub-links and style differently */
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem 0.5rem 2.85rem;
    /* left indent */
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 0 8px 8px 0;
}

.sidebar-sublink i {
    font-size: 0.85rem;
    color: #cbd5e1;
    transition: color 0.2s;
}

/* Tree line connecting sub items */
.sidebar-sublink::before {
    content: "";
    position: absolute;
    left: 1.6rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e2e8f0;
}

.sidebar-sublink:hover {
    color: var(--text-primary);
    background: #f8fafc;
}

.sidebar-sublink:hover i {
    color: var(--primary);
}

.sidebar-sublink.active {
    color: var(--primary);
    font-weight: 600;
    background: transparent;
}

.sidebar-sublink.active i {
    color: var(--primary);
}

.sidebar-sublink.active::before {
    background: var(--primary);
    width: 2px;
}

/* ── Sidebar Footer & User Profile Dropup (Option A) ────────── */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid #f0f4f9;
    background: #fff;
    margin-top: auto;
    position: relative;
}

.dropup.user-profile-dropup {
    position: relative;
    width: 100%;
}

.sidebar-user-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-user-trigger:hover,
.sidebar-user-trigger:focus,
.sidebar-user-trigger[aria-expanded="true"] {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.sidebar-user-trigger .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.sidebar-user-trigger .user-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar-user-trigger .user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-trigger .user-org {
    font-size: 0.75rem;
    color: var(--muted-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-trigger .user-caret {
    font-size: 0.72rem;
    color: var(--muted-text);
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-user-trigger[aria-expanded="true"] .user-caret {
    transform: rotate(180deg);
}

/* User Profile Dropup Menu (Image 1) */
.dropup.user-profile-dropup .user-profile-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 100%;
    min-width: 250px;
    margin: 0;
    padding: 0.55rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.05);
    z-index: 1060;
}

.user-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0.35rem 0.55rem;
    font-size: 0.8rem;
}

.user-menu-email {
    color: var(--muted-text);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.user-menu-logout {
    color: #ef4444 !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.78rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.user-menu-logout:hover {
    color: #dc2626 !important;
    background: rgba(239, 68, 68, 0.08);
}

.user-menu-section.organizations-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.55rem;
}

.user-menu-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-text);
    margin-bottom: 0.2rem;
}

.user-menu-org-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-menu-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-menu-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.12s ease;
}

.user-menu-link i {
    width: 16px;
    font-size: 0.85rem;
    color: var(--muted-text);
    text-align: center;
}

.user-menu-link:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

/* ── Sidebar Floating Tooltip (Collapsed Mode) ─────────────────── */
.sidebar-floating-tooltip {
    position: fixed;
    z-index: 1099;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.775rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
    transition: opacity 0.1s ease, transform 0.1s ease;
    white-space: nowrap;
}

.sidebar-floating-tooltip.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.sidebar-floating-tooltip::before {
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #0f172a;
}

/* ── Mobile Topbar (for authenticated users) ─────────────────── */
.sidebar-topbar {
    display: none;
    /* hidden on desktop */
    align-items: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e8ecf3;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 10px rgba(11, 31, 58, 0.03);
}

.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    margin-right: 1rem;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus {
    background: #f1f5f9;
    color: var(--primary);
}

.sidebar-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ── Mobile Backdrop ─────────────────────────────────────────── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1030;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ── Desktop Layout Rules (≥ 768px) ──────────────────────────── */
@media (min-width: 768px) {
    .app-layout.has-sidebar {
        margin-left: var(--sidebar-expanded-width);
    }

    html.sidebar-collapsed body .app-layout.has-sidebar,
    body.sidebar-collapsed .app-layout.has-sidebar {
        margin-left: var(--sidebar-collapsed-width);
    }

    html.sidebar-collapsed body .app-sidebar,
    body.sidebar-collapsed .app-sidebar {
        width: var(--sidebar-collapsed-width);
    }

    /* Transitions ONLY active during explicit user interaction (toggle button / shortcut) */
    body.sidebar-transitioning .app-sidebar {
        transition: width 0.24s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease, box-shadow 0.3s ease !important;
    }

    body.sidebar-transitioning .app-layout.has-sidebar {
        transition: margin-left 0.24s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    body.sidebar-transitioning .sidebar-brand-copy,
    body.sidebar-transitioning .sidebar-user-name,
    body.sidebar-transitioning .sidebar-link-label,
    body.sidebar-transitioning .sidebar-logout-label,
    body.sidebar-transitioning .sidebar-rail-toggle-label {
        transition: max-width 0.22s ease, opacity 0.15s ease, transform 0.22s ease !important;
    }

    .sidebar-collapsed .sidebar-brand {
        padding: 0.85rem 0.5rem;
        justify-content: center;
    }

    .sidebar-collapsed .sidebar-brand-head {
        justify-content: center;
        gap: 0;
        width: 100%;
    }

    .sidebar-collapsed .sidebar-brand-link,
    .sidebar-collapsed .sidebar-brand-logo,
    .sidebar-collapsed .sidebar-brand-copy {
        display: none !important;
    }

    .sidebar-collapsed .sidebar-desktop-toggle {
        display: inline-flex !important;
        margin: 0 auto;
        width: 36px;
        height: 36px;
    }

    .sidebar-collapsed .sidebar-desktop-toggle .sidebar-collapse-icon {
        display: none !important;
    }

    .sidebar-collapsed .sidebar-desktop-toggle .sidebar-expand-icon {
        display: block !important;
    }

    html.sidebar-collapsed body .sidebar-brand-copy,
    html.sidebar-collapsed body .sidebar-user-name,
    html.sidebar-collapsed body .sidebar-scale-btn,
    html.sidebar-collapsed body .sidebar-chevron,
    html.sidebar-collapsed body .sidebar-link-label,
    html.sidebar-collapsed body .sidebar-logout-label,
    html.sidebar-collapsed body .sidebar-rail-toggle-label,
    html.sidebar-collapsed body .sidebar-kbd,
    body.sidebar-collapsed .sidebar-brand-copy,
    body.sidebar-collapsed .sidebar-user-name,
    body.sidebar-collapsed .sidebar-scale-btn,
    body.sidebar-collapsed .sidebar-chevron,
    body.sidebar-collapsed .sidebar-link-label,
    body.sidebar-collapsed .sidebar-logout-label,
    body.sidebar-collapsed .sidebar-rail-toggle-label,
    body.sidebar-collapsed .sidebar-kbd {
        max-width: 0 !important;
        opacity: 0 !important;
        transform: translateX(-8px) !important;
        margin: 0 !important;
        padding: 0 !important;
        display: none !important;
    }

    html.sidebar-collapsed body .sidebar-nav,
    body.sidebar-collapsed .sidebar-nav {
        padding: 0.85rem 0.5rem;
    }

    html.sidebar-collapsed body .sidebar-menu,
    body.sidebar-collapsed .sidebar-menu {
        gap: 0.35rem;
        align-items: center;
    }

    html.sidebar-collapsed body .sidebar-link,
    body.sidebar-collapsed .sidebar-link {
        width: 44px;
        height: 44px;
        padding: 0;
        margin: 0 auto;
        justify-content: center;
        align-items: center;
        border-radius: 8px;
        border-left: 1px solid transparent;
    }

    html.sidebar-collapsed body .sidebar-link i,
    body.sidebar-collapsed .sidebar-link i {
        width: auto;
        margin: 0;
        font-size: 1.15rem;
    }

    html.sidebar-collapsed body .sidebar-link.active,
    body.sidebar-collapsed .sidebar-link.active {
        background: var(--primary-light);
        color: var(--primary);
        border: 1px solid #c7d2fe;
    }

    html.sidebar-collapsed body .sidebar-submenu,
    body.sidebar-collapsed .sidebar-submenu {
        display: none !important;
    }

    .sidebar-collapsed .sidebar-footer {
        padding: 0.75rem 0.4rem;
        display: flex;
        justify-content: center;
    }

    .sidebar-collapsed .sidebar-user-trigger {
        justify-content: center !important;
        padding: 0 !important;
        width: 42px !important;
        height: 42px !important;
        margin: 0 auto !important;
        border-radius: 8px !important;
    }

    .sidebar-collapsed .sidebar-user-trigger .user-avatar {
        margin: 0 auto !important;
    }

    .sidebar-collapsed .sidebar-user-trigger .user-info,
    .sidebar-collapsed .sidebar-user-trigger .user-caret {
        display: none !important;
    }

    .sidebar-collapsed .dropup.user-profile-dropup .user-profile-menu {
        position: fixed !important;
        left: 68px !important;
        bottom: 12px !important;
        width: 260px !important;
        margin: 0 !important;
    }
}

/* ── Mobile Layout Rules (< 768px) ───────────────────────────── */
@media (max-width: 767.98px) {
    .sidebar-desktop-toggle {
        display: none !important;
    }

    .sidebar-topbar {
        display: flex;
    }

    .app-sidebar {
        transform: translateX(-100%);
        /* hide offscreen */
        box-shadow: none;
    }

    body.sidebar-open {
        overflow: hidden;
        /* prevent body scroll when drawer is open */
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(15, 23, 42, 0.15);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }
}

body.inventory-workspace .inventory-shell-sidebar-col {
    display: none !important;
}

body.inventory-workspace .inventory-shell-main-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}

body.inventory-workspace .section-container {
    border-radius: 12px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.sidebar-return-link {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.sidebar-return-link:hover {
    background: #f1f5f9;
    color: var(--primary);
    border-color: #cbd5e1;
}

.sidebar-return-link i {
    color: #64748b;
}

.sidebar-return-link:hover i {
    color: var(--primary);
}

.sidebar-menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.4rem 0.5rem;
}

html.sidebar-collapsed body .sidebar-menu-divider,
body.sidebar-collapsed .sidebar-menu-divider {
    width: 28px;
    margin: 0.35rem auto;
}

.staff-head-shell {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.staff-search-form {
    width: 100%;
    max-width: 560px;
}

.staff-search-shell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #ffffff;
    padding: 0.45rem 0.55rem 0.45rem 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease-in-out;
}

.staff-search-shell:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.staff-search-shell .form-control {
    min-width: 0;
    box-shadow: none;
    border: none;
    padding-left: 0;
}

@media (max-width: 768px) {
    .staff-head-shell {
        flex-direction: column;
        align-items: stretch;
    }

    .staff-search-form {
        max-width: none;
    }
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-badge--completed {
    background: var(--success-bg) !important;
    color: var(--success-text) !important;
    border-color: var(--success-border) !important;
}

.status-badge--closed {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

.status-badge--ready {
    background: #fefce8 !important;
    color: #854d0e !important;
    border-color: #fef08a !important;
}

.status-badge--repairing {
    background: var(--info-bg) !important;
    color: var(--info-text) !important;
    border-color: var(--info-border) !important;
}

.status-badge--pending {
    background: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    border-color: var(--warning-border) !important;
}

.status-badge--default {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: #c7d2fe !important;
}

.inventory-shell {
    --inventory-sidebar-expanded-width: 15.5rem;
    --inventory-sidebar-collapsed-width: 64px;
    align-items: flex-start;
}

.inventory-shell-sidebar-col,
.inventory-shell-main-col {
    min-width: 0;
}

.inventory-sidebar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 0.65rem;
    top: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: padding 0.32s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.inventory-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.65rem;
}

.inventory-sidebar-copy {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 14rem;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0);
    transition: max-width 0.28s ease, opacity 0.18s ease, transform 0.28s ease;
}

.inventory-sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.inventory-sidebar-badge {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.inventory-sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.inventory-sidebar-subtitle {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
    display: block;
}

.inventory-sidebar-toggle {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.inventory-sidebar-toggle:hover,
.inventory-sidebar-toggle:focus {
    background: #ede9fe;
    color: var(--primary);
    border-color: #c7d2fe;
}

.inventory-sidebar-return-wrap {
    margin-bottom: 0.65rem;
}

.inventory-sidebar-return-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    overflow: hidden;
}

.inventory-sidebar-return-link:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.inventory-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.inventory-sidebar-nav .inventory-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    color: #475569;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 8px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    text-decoration: none;
    background: transparent;
    overflow: hidden;
    transition: all 0.15s ease;
}

.inventory-sidebar-icon {
    width: 1.15rem;
    text-align: center;
    font-size: 0.95rem;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.inventory-sidebar-link-label {
    overflow: hidden;
    white-space: nowrap;
    max-width: 12rem;
    opacity: 1;
    transform: translateX(0);
    transition: max-width 0.28s ease, opacity 0.18s ease, transform 0.28s ease;
}

.inventory-sidebar-nav .inventory-nav-link:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.inventory-sidebar-nav .inventory-nav-link:hover .inventory-sidebar-icon {
    color: var(--primary);
}

.inventory-sidebar-nav .inventory-nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 700;
}

.inventory-sidebar-nav .inventory-nav-link.active .inventory-sidebar-icon {
    color: var(--primary);
}

.inventory-nav-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0.35rem 0.5rem;
}

.inventory-hero {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.inventory-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.inventory-hero-title {
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.inventory-hero-subtitle {
    color: #64748b;
    font-size: 0.875rem;
}

.inventory-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.775rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
}

.inventory-hero-actions {
    flex-shrink: 0;
}

.inventory-kpi {
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 12px;
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.inventory-kpi:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.inventory-kpi-label {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.inventory-kpi-value {
    color: #0f172a;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.inventory-kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.inventory-kpi-subtext {
    font-size: 0.75rem;
    font-weight: 500;
}

.inventory-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.inventory-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.inventory-table tbody tr:hover {
    background-color: #f8fafc;
}

.inventory-movement {
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.inventory-movement-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    transition: all 0.15s ease;
}

.inventory-movement-item:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.inventory-movement-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

/* Color utilities for badges & KPI icons */
.bg-indigo-light { background: #eef2ff !important; }
.bg-sky-light { background: #f0f9ff !important; }
.bg-emerald-light { background: #ecfdf5 !important; }
.bg-purple-light { background: #faf5ff !important; }
.bg-amber-light { background: #fffbeb !important; }
.bg-slate-light { background: #f8fafc !important; }
.text-purple { color: #9333ea !important; }
.btn-emerald { background: #10b981; color: #fff; border-color: #10b981; }
.btn-emerald:hover { background: #059669; color: #fff; border-color: #059669; }

.inventory-action-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.inventory-action-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.inventory-watch-card {
    border: 1px solid #e3e9f5;
}

.inventory-watchlist {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.1rem;
}

.inventory-watch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    border: 1px solid #e5ebf6;
    background: #fdfefe;
    border-radius: 10px;
    padding: 0.55rem 0.6rem;
}

.inventory-watch-name {
    font-weight: 700;
    color: #15355e;
    line-height: 1.2;
}

.inventory-watch-meta {
    color: #6a7b94;
    font-size: 0.78rem;
}

.inv-entry-type {
    display: inline-block;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border: 1px solid transparent;
}

.inv-entry-type--purchase {
    color: #0a6839;
    background: #e9f8ef;
    border-color: #b6e8c8;
}

.inv-entry-type--purchase_return {
    color: #8a4a00;
    background: #fff6e8;
    border-color: #f5d7a8;
}

.inv-entry-type--sale {
    color: #0f4e92;
    background: #ebf4ff;
    border-color: #bed7f5;
}

.inv-entry-type--sale_return {
    color: #6f2e86;
    background: #f6edfb;
    border-color: #dfc5ec;
}

.inv-entry-type--opening_stock {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.quick-pop-modal .modal-dialog {
    transform: translateY(-18px) scale(0.98);
    transition: transform 0.18s ease-out;
}

.quick-pop-modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

.quick-pop-modal .modal-content {
    border-radius: 14px;
    border: 1px solid #dbe5f4;
    box-shadow: 0 16px 40px rgba(11, 31, 58, 0.2);
}

@media (max-width: 991.98px) {
    .inventory-hero {
        flex-direction: column;
    }

    .inventory-hero-actions {
        width: 100%;
    }

    .inventory-hero-actions .btn {
        flex: 1 1 auto;
    }

    .inventory-sidebar {
        position: static !important;
    }

    .inventory-sidebar-toggle {
        display: none;
    }

    .inventory-sidebar-nav {
        flex-direction: row !important;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.15rem;
    }

    .inventory-sidebar-nav .nav-link {
        min-width: max-content;
    }
}

@media (min-width: 992px) {
    .inventory-shell {
        flex-wrap: nowrap;
    }

    .inventory-shell-sidebar-col {
        flex: 0 0 var(--inventory-sidebar-expanded-width);
        width: var(--inventory-sidebar-expanded-width);
        max-width: var(--inventory-sidebar-expanded-width);
        transition: flex-basis 0.34s cubic-bezier(0.4, 0, 0.2, 1), width 0.34s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .inventory-shell-main-col {
        flex: 1 1 0%;
        width: auto;
        max-width: none;
        transition: flex-basis 0.34s cubic-bezier(0.4, 0, 0.2, 1), width 0.34s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .inventory-shell.inventory-shell-collapsed .inventory-shell-sidebar-col {
        flex-basis: var(--inventory-sidebar-collapsed-width);
        width: var(--inventory-sidebar-collapsed-width);
        max-width: var(--inventory-sidebar-collapsed-width);
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar {
        padding: 0.75rem 0.35rem;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-head {
        justify-content: center;
        border-bottom: none;
        margin-bottom: 0.4rem;
        padding-bottom: 0;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-copy {
        max-width: 0 !important;
        opacity: 0;
        display: none !important;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-toggle {
        margin-inline: auto;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-return-wrap {
        margin-bottom: 0.35rem;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-return-link {
        width: 44px;
        height: 44px;
        padding: 0;
        margin: 0 auto;
        justify-content: center;
        border-radius: 8px;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-nav {
        gap: 0.25rem !important;
        align-items: center;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-nav .inventory-nav-link {
        width: 44px;
        height: 44px;
        padding: 0;
        margin: 0 auto;
        justify-content: center;
        align-items: center;
        border-radius: 8px;
        border: 1px solid transparent;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-nav .inventory-nav-link.active {
        background: var(--primary-light);
        color: var(--primary);
        border: 1px solid #c7d2fe;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-link-label {
        max-width: 0 !important;
        opacity: 0;
        display: none !important;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-sidebar-icon {
        margin: 0;
        font-size: 1.15rem;
    }

    .inventory-shell.inventory-shell-collapsed .inventory-nav-divider {
        display: none;
    }
}

/* ── Display Scale Customizer ────────────────────────────────── */
.scale-option-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color) !important;
    background: #ffffff;
}

.scale-option-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1 !important;
    box-shadow: var(--shadow-md);
}

.scale-option-card.active,
.scale-option-card[data-active="true"] {
    border-color: var(--primary) !important;
    background: var(--primary-light) !important;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2) !important;
}

.sidebar-scale-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sidebar-scale-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: #f8fafc;
}

/* ── Searchable Combobox Component ───────────────────────────── */
.searchable-combobox-shell {
    position: relative;
    width: 100%;
}

.searchable-combobox-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.searchable-combobox-search-icon {
    position: absolute;
    left: 0.85rem;
    color: #94a3b8;
    font-size: 0.825rem;
    pointer-events: none;
    z-index: 3;
}

.searchable-combobox-input {
    padding-left: 2.35rem !important;
    padding-right: 3.5rem !important;
    cursor: text;
    background-color: #ffffff;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm, 8px);
    border: 1px solid #cbd5e1;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.searchable-combobox-input:focus {
    border-color: var(--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.searchable-combobox-controls {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 0.2rem;
    z-index: 4;
}

.searchable-combobox-clear-btn {
    background: transparent;
    border: none;
    padding: 0.2rem 0.35rem;
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    display: none;
    transition: color 0.15s ease;
}

.searchable-combobox-clear-btn:hover {
    color: #ef4444;
}

.searchable-combobox-toggle-btn {
    background: transparent;
    border: none;
    padding: 0.2rem 0.35rem;
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    transition: color 0.15s ease, transform 0.2s ease;
}

.searchable-combobox-toggle-btn:hover {
    color: var(--primary, #4f46e5);
}

.searchable-combobox-shell.open .searchable-combobox-toggle-btn {
    transform: rotate(180deg);
    color: var(--primary, #4f46e5);
}

.searchable-combobox-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
    z-index: 1060;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.35rem;
    display: none;
}

.searchable-combobox-shell.open .searchable-combobox-menu {
    display: block;
}

.searchable-combobox-item {
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.searchable-combobox-item:hover,
.searchable-combobox-item.highlighted {
    background-color: #f1f5f9;
    color: #0f172a;
}

.searchable-combobox-item.selected {
    background-color: var(--primary-light, #eef2ff);
    color: var(--primary, #4f46e5);
    font-weight: 600;
}

.searchable-combobox-item i {
    width: 1.1rem;
    text-align: center;
    font-size: 0.825rem;
    flex-shrink: 0;
}

.searchable-combobox-item-empty {
    padding: 0.85rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.825rem;
}



