/* ==========================================================================
   MY PAYROLL — COMPACT ENTERPRISE SAAS THEME
   Framework: Bootstrap 5 + Vanilla CSS Variables (Zero jQuery)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
    /* Fonts */
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Compact Layout Tokens */
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
    --header-height: 52px;
    --content-padding: 16px;
    --card-padding: 14px;
    --control-height: 34px;
    --table-cell-padding-y: 6px;
    --table-cell-padding-x: 10px;

    /* Compact Typography Scale */
    --font-size-title: 21px;       /* Page title: 20-22px */
    --font-size-section: 15px;     /* Section title: 15-17px */
    --font-size-body: 13.5px;      /* Body text: 13-14px */
    --font-size-table: 12.5px;     /* Table text: 12-13px */
    --font-size-label: 12.5px;     /* Labels: 12-13px */
    --font-size-sidebar: 13px;     /* Sidebar text: 13px */
    --font-size-badge: 11.5px;     /* Badges */

    /* Professional SaaS Color Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --primary-glow: rgba(37, 99, 235, 0.12);

    /* Backgrounds & Borders */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --border-color: #e2e8f0;
    --border-subtle: #edf2f7;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Sidebar Light Enterprise Accordion Theme (Desktop ERP) */
    --sidebar-bg: #f5f6f8;
    --sidebar-border: #d0d7de;
    --sidebar-text: #475467;
    --sidebar-text-hover: #0b63ce;
    --sidebar-active-bg: #edf4fe;
    --sidebar-active-text: #0d6efd;
    --sidebar-group-bg: linear-gradient(180deg, #fcfdfe 0%, #ebeef2 100%);
    --sidebar-group-hover: linear-gradient(180deg, #f7f9fa 0%, #e2e6eb 100%);
    --sidebar-group-active: linear-gradient(180deg, #f0f3f7 0%, #dee3ea 100%);
    --sidebar-heading-color: #64748b;

    /* Semantic Statuses */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --info: #0284c7;
    --info-bg: #f0f9ff;
    --info-text: #0369a1;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Application Shell Layout (Fixed Sidebar + Sticky Header + Independent Scroll)
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-main);
    position: relative;
}

/* Fixed Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width, transform;
}

/* Sidebar Header */
.sidebar-header {
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f0f3f6 100%);
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: #0f172a;
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: -0.01em;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.brand-logo:hover {
    color: #2563eb;
    text-decoration: none;
}

.brand-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.brand-logo-img {
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.25));
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-logo:hover .brand-logo-img {
    transform: scale(1.08) translateY(-1px);
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.01em;
    color: #0f172a;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.brand-title {
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.brand-badge {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 1.5px 5.5px;
    border-radius: 4px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.18);
    text-transform: uppercase;
}

/* Sidebar Scroll Container (Independent scrolling) */
.sidebar-scroll-container {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 0;
    background-color: var(--sidebar-bg);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.sidebar-scroll-container::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
.sidebar-scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

/* Sidebar Footer */
.sidebar-footer {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    background: linear-gradient(180deg, #fbfcfd 0%, #edf1f5 100%);
    font-size: 11px;
    color: #656d76;
}

/* Sidebar Headings (Hidden for seamless desktop accordion look) */
.sidebar-heading {
    display: none !important;
}

/* Single Links (e.g. Dashboard) */
.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    color: #3b424a;
    background: linear-gradient(180deg, #fcfdfe 0%, #ebeef2 100%);
    border: none;
    border-top: 1px solid #ffffff;
    border-bottom: 1px solid #d5d9de;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    border-radius: 0;
    margin-bottom: 0;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 32px;
}

.nav-link-custom i {
    font-size: 13px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    color: #555e69;
}

.nav-link-custom span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link-custom:hover {
    color: #1e242b;
    background: linear-gradient(180deg, #f7f9fa 0%, #e2e6eb 100%);
}

.nav-link-custom.active {
    color: #0d6efd;
    background: linear-gradient(180deg, #f0f3f7 0%, #dee3ea 100%);
    font-weight: 700;
    border-left: 3px solid #0d6efd;
    padding-left: 9px;
    box-shadow: none;
}

/* Expandable Menu Groups — Classic Enterprise Accordion */
.menu-group {
    margin-bottom: 0;
}

.menu-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    color: #3b424a;
    background: linear-gradient(180deg, #fcfdfe 0%, #ebeef2 100%);
    border: none;
    border-top: 1px solid #ffffff;
    border-bottom: 1px solid #d5d9de;
    border-radius: 0;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    min-height: 32px;
}

.menu-group-toggle i.group-icon {
    display: none;
}

.menu-group-toggle span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-group-toggle i.group-arrow {
    font-size: 10px;
    color: #555e69;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    opacity: 0.9;
}

.menu-group-toggle:hover {
    color: #1e242b;
    background: linear-gradient(180deg, #f7f9fa 0%, #e2e6eb 100%);
}

.menu-group-toggle.active,
.menu-group-toggle[aria-expanded="true"] {
    color: #1f2328;
    background: linear-gradient(180deg, #f0f3f7 0%, #dee3ea 100%);
    border-bottom: 1px solid #cfd5dc;
}

.menu-group-toggle[aria-expanded="true"] i.group-arrow {
    transform: rotate(180deg);
}

.menu-sub-items {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: none;
    margin-left: 0;
    background-color: #ffffff;
    border-bottom: 1px solid #d5d9de;
}

.nav-sub-link {
    display: flex;
    align-items: center;
    padding: 6px 14px 6px 22px;
    color: #495057;
    text-decoration: none;
    font-size: 12.5px;
    border-radius: 0;
    border-bottom: 1px solid #f0f2f5;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 28px;
    background-color: #ffffff;
}

.nav-sub-link:hover {
    color: #0b63ce;
    background-color: #f1f5fa;
}

.nav-sub-link.active {
    color: #0d6efd;
    background-color: #edf4fe;
    font-weight: 600;
    border-left: 3px solid #0d6efd;
    padding-left: 19px;
}

/* Sidebar Advanced Features */
.sidebar-search-container {
    padding: 6px 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search-input {
    width: 100%;
    height: 28px;
    font-size: 11.5px;
    padding: 3px 24px 3px 26px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    background: #ffffff;
    color: #1f2328;
    transition: all 0.15s ease;
}

.sidebar-search-input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.15);
}

.sidebar-search-icon {
    position: absolute;
    left: 8px;
    font-size: 11px;
    color: #656d76;
    pointer-events: none;
}

.sidebar-search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    padding: 0;
    color: #8c959f;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
}

.sidebar-search-clear:hover {
    color: #cf222e;
}

.sidebar-category-label {
    padding: 10px 12px 4px 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #656d76;
    text-transform: uppercase;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.sidebar-category-label:first-of-type {
    border-top: none;
}

.nav-sub-link i {
    font-size: 12px;
    width: 16px;
    text-align: center;
    margin-right: 7px;
    flex-shrink: 0;
    color: #656d76;
    transition: color 0.15s ease;
}

.nav-sub-link:hover i,
.nav-sub-link.active i {
    color: #0969da;
}

.sidebar-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1.5px 5px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    margin-left: auto;
    text-transform: uppercase;
}

.sidebar-badge-ai {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.sidebar-badge-live {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ==========================================================================
   Collapsed Sidebar State (Desktop)
   ========================================================================== */
body.sidebar-collapsed {
    --sidebar-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-logo .brand-text,
body.sidebar-collapsed .sidebar-heading,
body.sidebar-collapsed .sidebar-search-container,
body.sidebar-collapsed .sidebar-category-label,
body.sidebar-collapsed .nav-link-custom span,
body.sidebar-collapsed .menu-group-toggle span,
body.sidebar-collapsed .menu-group-toggle i.group-arrow,
body.sidebar-collapsed .sidebar-footer span {
    display: none !important;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0 4px;
}

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

body.sidebar-collapsed .nav-link-custom,
body.sidebar-collapsed .menu-group-toggle {
    justify-content: center;
    padding: 6px 0;
}

body.sidebar-collapsed .nav-link-custom i,
body.sidebar-collapsed .menu-group-toggle i.group-icon {
    display: inline-block !important;
    width: auto;
    font-size: 16px;
    color: #475467;
}

body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .menu-sub-items {
    display: none !important;
}

/* ==========================================================================
   Main Shell & Compact Header
   ========================================================================== */
.app-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-topbar {
    height: var(--header-height);
    min-height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1020;
    background: linear-gradient(180deg, #ffffff 0%, #f0f3f6 100%);
    border-bottom: 1px solid #d0d7de;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Header Toggle Buttons */
.btn-sidebar-toggle {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    color: #495057;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-sidebar-toggle:hover {
    background-color: #f1f3f6;
    color: #1f2328;
    border-color: #b0b8c4;
}

/* Compact Tenant Badge */
.tenant-badge {
    background-color: #ffffff;
    color: #3b424a;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d0d7de;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

/* Compact Company Selector */
.company-selector-btn {
    background-color: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #24292f;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-selector-btn:hover {
    border-color: #a5b0bf;
    background-color: #fafbfc;
}

#notifBellBtn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    color: #495057;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#notifBellBtn:hover {
    background-color: #f1f3f6;
    color: #1f2328;
    border-color: #b0b8c4;
}

/* Compact User Profile Menu */
.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #24292f;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #d0d7de;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

.user-profile-menu:hover {
    background-color: #f6f8fa;
    border-color: #b0b8c4;
}

.user-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
}

/* Content Area */
.app-content {
    flex: 1 1 auto;
    padding: var(--content-padding);
    width: 100%;
}

/* Mobile Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.45);
    z-index: 1035;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s ease;
}

.sidebar-backdrop.show {
    display: block;
}

/* ==========================================================================
   Typography Scale (Compact Enterprise)
   ========================================================================== */
h1, .h1, .page-title {
    font-size: var(--font-size-title) !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

h2, .h2, .section-title {
    font-size: var(--font-size-section) !important;
    font-weight: 600 !important;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

h3, .h3 {
    font-size: 14.5px !important;
    font-weight: 600 !important;
}

h4, .h4 { font-size: 13.5px !important; }
h5, .h5 { font-size: 12.5px !important; }
h6, .h6 { font-size: 11.5px !important; }

.fs-sm { font-size: 12.5px !important; }
.fs-xs { font-size: 11px !important; }

.text-muted {
    color: var(--text-muted) !important;
}

/* ==========================================================================
   Compact Cards & Dashboard Widgets
   ========================================================================== */
.card, .card-enterprise {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    margin-bottom: 12px;
}

.card-header, .card-header-enterprise {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
}

.card-title, .card-title-enterprise {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-body, .card-body-enterprise {
    padding: var(--card-padding);
}

.card-footer {
    padding: 8px 14px;
    background-color: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
}

/* Compact KPI Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.stat-icon-wrapper {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-success { background: var(--success-bg); color: var(--success); }
.stat-icon-warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon-danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon-info { background: var(--info-bg); color: var(--info); }

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Compact Data Tables
   ========================================================================== */
.table, .table-enterprise {
    width: 100%;
    margin-bottom: 0;
    font-size: var(--font-size-table);
    vertical-align: middle;
    color: var(--text-primary);
}

.table thead th, .table-enterprise thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    border-bottom: 1px solid var(--border-color);
    border-top: none;
    white-space: nowrap;
}

.table tbody td, .table-enterprise tbody td {
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-table);
    color: var(--text-primary);
}

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

.table-responsive {
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    min-height: 260px;
}

.card:has(.table-responsive) {
    overflow: visible !important;
}

.table-responsive .dropdown-menu {
    z-index: 1065 !important;
}

/* Status Badges */
.badge, .badge-status {
    padding: 2px 7px;
    font-size: var(--font-size-badge);
    font-weight: 600;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
}

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

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

.badge-status-suspended, .badge-status-danger, .badge-danger {
    background-color: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

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

.badge-status-draft, .badge-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

/* ==========================================================================
   Compact Form Controls
   ========================================================================== */
.form-label {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    display: inline-block;
}

.form-control, .form-select {
    height: var(--control-height);
    min-height: var(--control-height);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.25rem 0.65rem;
    font-size: 13px;
    color: var(--text-primary);
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-control-sm, .form-select-sm {
    height: 28px;
    min-height: 28px;
    padding: 0.2rem 0.5rem;
    font-size: 12px;
    border-radius: 5px;
}

textarea.form-control {
    height: auto;
    min-height: 70px;
}

/* Compact Buttons */
.btn {
    font-size: 13px;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    height: var(--control-height);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    line-height: 1;
}

.btn-sm {
    height: 28px;
    padding: 0.2rem 0.6rem;
    font-size: 12px;
    border-radius: 5px;
}

.btn-xs {
    height: 24px;
    padding: 0.15rem 0.45rem;
    font-size: 11px;
    border-radius: 4px;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

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

.btn-secondary, .btn-light {
    background-color: #f1f5f9;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover, .btn-light:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

/* Page Toolbar & Action Bars */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-toolbar {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-custom {
    pointer-events: auto;
    min-width: 280px;
    max-width: 400px;
    background: #ffffff;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 3px solid var(--primary);
    font-size: 13px;
    animation: toastSlideIn 0.25s ease forwards;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: 240px;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .btn-sidebar-toggle-desktop {
        display: none !important;
    }

    .btn-sidebar-toggle-mobile {
        display: inline-flex !important;
    }

    .app-topbar {
        padding: 0 10px;
    }

    .app-content {
        padding: 10px;
    }
}

@media (min-width: 992px) {
    .btn-sidebar-toggle-mobile {
        display: none !important;
    }

    .btn-sidebar-toggle-desktop {
        display: inline-flex !important;
    }
}

/* Bootstrap Icons Font & Alignment Normalization */
.bi, [class^="bi-"], [class*=" bi-"] {
    display: inline-block;
    vertical-align: -0.125em;
    line-height: 1;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.btn .bi {
    vertical-align: -0.125em;
    line-height: 1;
}

.btn.btn-sm .bi {
    font-size: 0.95rem;
}

/* ==========================================================================
   ENTERPRISE ERP WINDOW & DATA GRID THEME (Unified across all pages)
   ========================================================================== */
.erp-window {
    background: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}

.erp-title-bar {
    background-color: #3b424a !important;
    color: #ffffff !important;
    padding: 7px 14px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 2px 2px 0 0;
}

.erp-title-bar a, 
.erp-title-bar span,
.erp-title-bar h1,
.erp-title-bar h2,
.erp-title-bar h3,
.erp-title-bar h4,
.erp-title-bar h5 {
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
}

.erp-title-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.erp-title-icons button,
.erp-title-icons a {
    color: #cbd5e1;
    background: transparent;
    border: none;
    padding: 0 5px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.erp-title-icons button:hover,
.erp-title-icons a:hover {
    color: #ffffff;
}

.erp-toolbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.erp-toolbar-left,
.erp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.erp-toolbar-btn {
    background: transparent;
    border: none;
    color: #475569;
    padding: 3px 8px;
    font-size: 15px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.erp-toolbar-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ==========================================================================
   Enterprise Action Buttons (.erp-btn, .erp-btn-primary, etc.)
   ========================================================================== */
.erp-btn, 
a.erp-btn, 
button.erp-btn, 
input[type="submit"].erp-btn, 
input[type="button"].erp-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: #334155 !important;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 3px !important;
    text-decoration: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease-in-out;
    vertical-align: middle;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.erp-btn:hover,
a.erp-btn:hover,
button.erp-btn:hover {
    color: #0f172a !important;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%) !important;
    border-color: #94a3b8 !important;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.erp-btn:active,
.erp-btn:focus,
a.erp-btn:active,
button.erp-btn:active {
    background: #e2e8f0 !important;
    border-color: #64748b !important;
    color: #0f172a !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    outline: none;
}

/* Primary Button (Solid Blue) */
.erp-btn-primary,
a.erp-btn-primary,
button.erp-btn-primary {
    color: #ffffff !important;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%) !important;
    border-color: #1e40af !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3) !important;
    font-weight: 600;
}

.erp-btn-primary:hover,
a.erp-btn-primary:hover,
button.erp-btn-primary:hover {
    color: #ffffff !important;
    background: linear-gradient(180deg, #2563eb 0%, #1e40af 100%) !important;
    border-color: #172554 !important;
}

/* Success Button (Green) */
.erp-btn-success,
a.erp-btn-success,
button.erp-btn-success,
.erp-btn.text-success,
a.erp-btn.text-success,
button.erp-btn.text-success {
    color: #15803d !important;
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border-color: #86efac !important;
    font-weight: 600;
}

.erp-btn-success:hover,
a.erp-btn-success:hover,
button.erp-btn-success:hover,
.erp-btn.text-success:hover,
a.erp-btn.text-success:hover,
button.erp-btn.text-success:hover {
    color: #166534 !important;
    background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%) !important;
    border-color: #4ade80 !important;
}

/* Danger Button (Red) */
.erp-btn-danger,
a.erp-btn-danger,
button.erp-btn-danger,
.erp-btn.text-danger,
a.erp-btn.text-danger,
button.erp-btn.text-danger {
    color: #b91c1c !important;
    background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%) !important;
    border-color: #fca5a5 !important;
    font-weight: 600;
}

.erp-btn-danger:hover,
a.erp-btn-danger:hover,
button.erp-btn-danger:hover,
.erp-btn.text-danger:hover,
a.erp-btn.text-danger:hover,
button.erp-btn.text-danger:hover {
    color: #991b1b !important;
    background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%) !important;
    border-color: #f87171 !important;
}

/* Warning Button (Gold / Yellow) */
.erp-btn-warning,
a.erp-btn-warning,
button.erp-btn-warning,
.erp-btn.text-warning,
a.erp-btn.text-warning,
button.erp-btn.text-warning {
    color: #854d0e !important;
    background: linear-gradient(180deg, #fefce8 0%, #fef9c3 100%) !important;
    border-color: #fde047 !important;
    font-weight: 600;
}

.erp-btn-warning:hover,
a.erp-btn-warning:hover,
button.erp-btn-warning:hover {
    color: #713f12 !important;
    background: linear-gradient(180deg, #fef9c3 0%, #fef08a 100%) !important;
    border-color: #eab308 !important;
}

/* Info Button (Cyan) */
.erp-btn-info,
a.erp-btn-info,
button.erp-btn-info,
.erp-btn.text-info,
a.erp-btn.text-info,
button.erp-btn.text-info {
    color: #0369a1 !important;
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border-color: #7dd3fc !important;
    font-weight: 600;
}

.erp-btn-info:hover,
a.erp-btn-info:hover,
button.erp-btn-info:hover {
    color: #075985 !important;
    background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%) !important;
    border-color: #38bdf8 !important;
}

/* Sizes */
.erp-btn-sm,
.erp-table .erp-btn {
    padding: 2px 8px !important;
    font-size: 11.5px !important;
    line-height: 1.3 !important;
    border-radius: 2px !important;
}

.erp-btn i {
    font-size: 13px;
    line-height: 1;
}

.erp-btn-sm i,
.erp-table .erp-btn i {
    font-size: 11px;
    line-height: 1;
}

.erp-tabs {
    background: #ffffff;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    padding: 0 14px;
    font-size: 13px;
    overflow-x: auto;
}

.erp-tab {
    padding: 8px 18px;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.erp-tab.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    font-weight: 600;
}

.erp-tab:hover:not(.active) {
    color: #1e293b;
}

.erp-criteria-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 2px;
    padding: 16px 24px;
    margin: 14px auto 16px auto;
    max-width: 860px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.erp-kpi-bar {
    margin: 14px 14px 10px 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.erp-kpi-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 10px 16px;
    border-radius: 2px;
}

.erp-table-container {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    margin: 0 14px 20px 14px;
    overflow-x: auto;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: #1e293b;
    margin-bottom: 0;
}

.erp-table th,
.table thead th,
.table thead.table-light th {
    background-color: #d8dee4 !important;
    border: 1px solid #b8c2cc !important;
    color: #1e293b !important;
    font-weight: 600;
    text-align: center;
    padding: 6px 8px;
    white-space: nowrap;
    vertical-align: middle;
}

.erp-table td,
.table tbody td {
    border: 1px solid #e2e8f0;
    padding: 6px 8px;
    font-size: 12.5px;
    vertical-align: middle;
}

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

.erp-counter-footer {
    background: #d8dee4;
    border-top: 1px solid #b8c2cc;
    padding: 5px 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ERP Table Compact Pagination */
.erp-pagination {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.erp-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #334155;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1;
}

.erp-page-btn:hover:not(.disabled):not(.active) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.erp-page-btn.active {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    cursor: default;
    font-weight: 700;
}

.erp-page-btn.disabled {
    color: #94a3b8;
    background: #e2e8f0;
    border-color: #cbd5e1;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

.erp-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 24px;
    font-size: 11px;
    color: #64748b;
    user-select: none;
    font-weight: 700;
}

.erp-pagination-select {
    height: 24px;
    font-size: 11px;
    padding: 1px 22px 1px 6px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    color: #334155;
    font-weight: 600;
    cursor: pointer;
}

.erp-pagination-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* Universal Enterprise Card & Header Styling */
.card {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) {
    background-color: #3b424a !important;
    color: #ffffff !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    padding: 8px 14px !important;
    border-radius: 3px 3px 0 0 !important;
}

.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) h1,
.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) h2,
.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) h3,
.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) h4,
.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) h5,
.card-header:not(.bg-white):not(.modal-header):not(.bg-transparent):not(.bg-light) h6 {
    color: #ffffff !important;
    margin-bottom: 0 !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
}

.form-control, .form-select {
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    font-size: 12.5px;
}

.form-control:focus, .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

