/* =====================================================
   AWAMI ERP - Modern Corporate Dashboard Styles
   ===================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --dark: #0f172a;
    --dark-secondary: #16233c;
    --light: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f1f5f9;
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark) 0%, var(--dark-secondary) 100%);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-icon {
    font-size: 26px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
}

.logo-icon.logo-image {
    padding: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    width: 72px;
    height: 48px;
    flex: 0 0 72px;
}

.logo-icon.logo-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.logo-text {
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-sub {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px; /* SIZE-FIX 2026-10-20 */
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 15px;
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    transition: var(--transition);
    font-size: 14px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Sub-items under a head link (e.g. Expenses -> Electricity / LPG / Gas / Rent / Other) */
.nav-item.nav-sub {
    padding-left: 34px;
    font-size: 14px; /* SIZE-FIX 2026-10-20: same size as main items */
    padding-top: 7px;
    padding-bottom: 7px;
    margin-bottom: 1px;
    color: rgba(255, 255, 255, 0.55);
    border-left-color: rgba(255, 255, 255, 0.12);
}

.nav-item.nav-sub .nav-icon {
    font-size: 17px; /* SIZE-FIX 2026-10-20: same size as main icons */
    width: 18px;
}

body.sidebar-collapsed .nav-item.nav-sub {
    padding-left: 15px;
}


.nav-icon {
    font-size: 17px;
    width: 24px;
    text-align: center;
    opacity: 0.95;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 14px 10px;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: var(--white);
    font-size: 14px; /* SIZE-FIX 2026-10-20 */
    font-weight: 500;
}

.user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px; /* SIZE-FIX 2026-10-20 */
}

.logout-btn {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 15px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(220, 38, 38, 0.2);
}

.alert {
    border-radius: 14px;
    padding: 14px 16px;
    margin: 0 0 16px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-secondary { background: #e2e8f0; color: #334155; }

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* =====================================================
   UNIVERSAL ERP STICKY HEADER (MATCHES SIDEBAR EXACTLY)
   ===================================================== */
.top-bar,
.customer-header-sticky,
.vendor-header-sticky,
.money-header-sticky,
.fi-sticky-header,
.yarn-sticky-header,
.knit-sticky-header-wrap > .top-bar,
.ps-sticky-header-wrap,
.ps-sticky-header-wrap .top-bar,
.fs-header-sticky,
#fsTopBar,
#gcTopStickyHeader,
#empTopStickyHeader,
#cslTopStickyHeader,
#piTopStickyHeader {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 990 !important;
    background: linear-gradient(135deg, var(--header-dark, var(--dark)) 0%, var(--header-dark-secondary, var(--dark-secondary)) 100%) !important;
    border-bottom: 2px solid var(--header-dark-secondary, #1e293b) !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.28) !important;
    color: var(--header-text, #ffffff) !important;
}

/* =====================================================
   UNIVERSAL THEAD / TABLE HEADER DARK THEME (MATCHES SIDEBAR)
   ===================================================== */
.data-table thead th,
.xls-table thead th,
.cl-dir-table thead th,
table.data-table thead th,
table.xls-table thead th,
#customerTable thead th,
#customerTableMain thead th,
#ledgerTable thead th,
#allLedgerTable thead th,
#vendorTable thead th,
#vendorXlsTable thead th,
#vendorLedgerTable thead th,
#catTable thead th,
#popupLedgerTable thead th {
    background: #e0e5ec !important;
    color: #1a202c !important;
    border-color: #a3b1c6 !important;
}

.data-table thead th a,
.xls-table thead th a {
    color: #1a202c !important;
}

/* Row index column in thead */
table.xls-table thead th.xls-row-idx,
.data-table thead th.xls-row-idx {
    background: #e0e5ec !important;
    color: #94a3b8 !important;
    border-color: #a3b1c6 !important;
}

.top-bar {
    min-height: 48px;
    height: auto;
    display: flex;
    align-items: center;
    padding: 6px 20px;
    gap: 12px;
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.top-bar .page-title,
.top-bar h1,
.top-bar h2,
.top-bar h3,
.top-bar .title {
    color: #1a202c !important;
    font-size: 16px;
    font-weight: 700;
}

.top-bar .date-display,
.top-bar small,
.top-bar .sub-title,
.top-bar p {
    color: #94a3b8 !important;
}

.menu-toggle {
    display: none !important;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    font-size: 20px;
    cursor: pointer;
    color: #1a202c !important;
    padding: 4px 8px;
    border-radius: 6px;
}

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.top-bar a:not(.btn) {
    color: #cbd5e1;
}

.top-bar a:not(.btn):hover {
    color: #ffffff;
}

.top-bar .btn-secondary,
.top-bar .btn-outline {
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.top-bar .btn-secondary:hover,
.top-bar .btn-outline:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #1a202c !important;
}

.date-display {
    color: #94a3b8;
    font-size: 13px;
}

.sidebar-collapse-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

/* =====================================================
   SIDEBAR COLLAPSE (wide-area sheets)
   Toggled from the sidebar menu button above; adds a body class.
   Desktop only (>992px) so mobile overlay behaviour is
   untouched.
   ===================================================== */
@media (min-width: 993px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed);
    }
    body.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-collapsed);
    }
    body.sidebar-collapsed .sidebar-header {
        justify-content: center;
        padding: 20px 8px;
    }
    body.sidebar-collapsed .logo-icon,
    body.sidebar-collapsed .logo-text,
    body.sidebar-collapsed .logo-sub {
        display: none;
    }
    body.sidebar-collapsed .sidebar-collapse-btn {
        margin-left: 0;
    }
    body.sidebar-collapsed .sidebar-nav {
        padding: 15px 6px;
    }
    body.sidebar-collapsed .nav-item {
        justify-content: center;
        padding: 11px 6px;
        gap: 0;
    }
    body.sidebar-collapsed .nav-item .nav-text {
        display: none;
    }
    body.sidebar-collapsed .nav-divider {
        margin: 14px 4px;
    }
    body.sidebar-collapsed .sidebar-footer {
        justify-content: center;
        padding: 15px 6px;
    }
    body.sidebar-collapsed .user-details {
        display: none;
    }
    body.sidebar-collapsed .sidebar-toggle-hint,
    body.sidebar-collapsed .nav-item[title] {
        position: relative;
    }
    body.sidebar-collapsed .nav-item:hover:after {
        content: attr(data-label);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        background: var(--dark);
        color: #fff;
        padding: 5px 10px;
        border-radius: 6px;
        font-size: 12px;
        white-space: nowrap;
        margin-left: 10px;
        z-index: 1200;
        box-shadow: var(--shadow-md);
    }
}

/* =====================================================
   KPI CARDS
   ===================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 25px;
}

.kpi-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-top: 4px solid transparent;
}

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

.kpi-grey { border-top-color: var(--secondary); }
.kpi-dyeing { border-top-color: var(--info); }
.kpi-finished { border-top-color: var(--success); }
.kpi-sales { border-top-color: var(--primary); }
.kpi-outstanding { border-top-color: var(--warning); }
.kpi-customers { border-top-color: var(--dark); }

.kpi-icon {
    font-size: 30px;
    opacity: 0.9;
}

.kpi-content h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.kpi-value small {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* =====================================================
   SECTION CARDS
   ===================================================== */
.section-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin: 0 25px 25px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.section-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

/* =====================================================
   QUICK ACTIONS
   ===================================================== */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    padding: 20px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 15px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.quick-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.qa-icon {
    font-size: 26px;
}

.qa-text {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

/* =====================================================
   DASHBOARD GRID
   ===================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    padding: 0 25px 25px;
}

/* =====================================================
   TABLES
   ===================================================== */
.table-responsive {
    overflow-x: auto;
}

.table-scroll {
    max-height: 68vh;
    overflow-y: auto;
}

.table-scroll .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
}

.table-scroll .data-table tbody tr:last-child td {
    border-bottom: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--light);
    color: var(--text-secondary);
    padding: 12px 15px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--primary);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

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

.data-table td.num,
.data-table th.num {
    text-align: right;
}

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--light);
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 110px;
    text-align: center;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.badge-success { background: var(--success-light); color: #166534; border-color: #bbf7d0; }
.badge-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.badge-danger { background: var(--danger-light); color: #991b1b; border-color: #fecaca; }
.badge-info { background: var(--info-light); color: #155e75; border-color: #a5f3fc; }
.badge-secondary { background: #e2e8f0; color: #475569; border-color: #cbd5e1; }

.vendor-ledger-link {
    color: #0070c0;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.vendor-ledger-link:hover {
    color: #ff5722;
    text-decoration: underline;
}

/* =====================================================
   STAT BOXES (summary cards inside ledgers)
   ===================================================== */
.stat-box {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 25px;
    margin: 25px;
    box-shadow: var(--shadow-sm);
}

.form-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.form-header h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.form-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-control:disabled {
    background: var(--light);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-inline {
    display: flex;
    align-items: center;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #475569;
}

.btn-info {
    background: var(--info);
    color: var(--white);
}

.btn-info:hover {
    background: #0e7490;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    gap: 4px;
    border-radius: 5px;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert-success {
    background: var(--success-light);
    color: #14532d;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: var(--danger-light);
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #78350f;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--info-light);
    color: #164e63;
    border: 1px solid #a5f3fc;
}

/* =====================================================
   FILTERS BAR
   ===================================================== */
.filters-bar {
    background: var(--white);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--white);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* =====================================================
   REPORT STYLES
   ===================================================== */
.report-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 30px;
    text-align: center;
}

.report-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.report-header p {
    opacity: 0.9;
    font-size: 14px;
}

.report-filters {
    background: var(--white);
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.report-content {
    padding: 20px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-item {
    background: var(--light);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.summary-item .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.summary-item .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 5px;
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .sidebar, .top-bar, .quick-actions-grid, .btn, .filters-bar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    body {
        background: #ffffff;
    }

    .report-header {
        background: #1d4ed8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .data-table th {
        background: #1d4ed8 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .section-card,
    .form-card {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1001;
        transform: translateX(-100%);
        box-shadow: none;
        transition: transform 0.25s ease;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: inline-flex !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .top-bar {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 950 !important;
        height: auto !important;
        min-height: 44px !important;
        padding: 6px 10px !important;
        gap: 6px 8px !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .menu-toggle {
        padding: 6px 8px;
        flex-shrink: 0;
    }

    .page-title {
        font-size: 15px !important;
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-actions {
        width: 100% !important;
        height: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 5px !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }

    .top-actions > span,
    .top-actions > div {
        display: inline-flex !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }

    .top-actions .btn,
    .top-actions button,
    .top-actions a.btn {
        width: auto !important;
        padding: 5px 9px !important;
        font-size: 11px !important;
        line-height: 1.25 !important;
        height: auto !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
    }

    .date-display {
        display: none;
    }

    .kpi-grid {
        padding: 12px 10px 0;
        gap: 10px;
    }

    .kpi-card {
        padding: 12px;
        gap: 10px;
    }

    .kpi-icon {
        font-size: 22px;
    }

    .kpi-value {
        font-size: 18px;
    }

    .section-card {
        margin: 0 10px 12px;
    }

    .section-header {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .section-header h2 {
        font-size: 14px;
    }

    .quick-actions-grid {
        padding: 12px;
        gap: 10px;
    }

    .quick-action-btn {
        padding: 12px 10px;
    }

    .dashboard-grid {
        padding: 0 10px 12px;
        gap: 12px;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .form-card {
        margin: 10px;
        padding: 15px;
    }

    .form-control {
        padding: 8px 10px;
    }

    .form-inline {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .form-inline .form-control {
        min-width: 0;
        flex: 1 1 auto;
    }

    .btn {
        padding: 7px 12px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .top-bar {
        height: auto !important;
        min-height: 46px !important;
        padding: 6px 8px !important;
    }

    .page-title {
        font-size: 14px !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px;
        gap: 10px;
    }

    .kpi-card {
        padding: 12px;
        gap: 8px;
        border-radius: var(--radius-sm);
    }

    .kpi-icon {
        font-size: 20px;
    }

    .kpi-content h3 {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .kpi-value {
        font-size: 16px;
    }

    .kpi-value small {
        font-size: 11px;
    }

    .kpi-sub {
        font-size: 10px;
    }

    .section-card {
        margin: 0 12px 12px;
    }

    .section-header {
        padding: 12px;
    }

    .section-header h2 {
        font-size: 13px;
    }

    .section-header .form-control {
        width: 100%;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px;
        gap: 10px;
    }

    .quick-action-btn {
        padding: 14px 8px;
    }

    .qa-icon {
        font-size: 24px;
    }

    .qa-text {
        font-size: 12px;
    }

    .badge {
        padding: 2px 8px;
        font-size: 10px;
    }

    .empty-state {
        padding: 24px 15px;
    }

    .empty-icon {
        font-size: 36px;
    }
}

@media (max-width: 400px) {
    .kpi-value {
        font-size: 14px;
    }

    .kpi-icon {
        font-size: 18px;
    }

    .kpi-card {
        padding: 10px;
    }

    .quick-action-btn {
        padding: 12px 6px;
    }

    .qa-icon {
        font-size: 22px;
    }

    .qa-text {
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.kpi-card, .section-card {
    animation: fadeIn 0.3s ease-out;
}

/* =====================================================
   LOADING SPINNER
   ===================================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

/* ---- Persons hub: compact row actions + payment menu (2026-08-24) ---- */
.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
    border: 1px solid var(--border, #e2e8f0);
    background: #fff;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.act-btn:hover { filter: brightness(0.95); }
.act-btn.danger { color: var(--danger, #d9534f); }
.pmenu-wrap { position: relative; display: inline-block; }
.pmenu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    min-width: 210px;
    z-index: 70;
    display: none;
    overflow: hidden;
}
.pmenu.open { display: block; }
.pmenu a, .pmenu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 13px;
    font-size: 13px;
    color: var(--text, #1e293b);
    text-decoration: none;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.pmenu a:hover, .pmenu button:hover { background: rgba(148, 163, 184, 0.14); }
.ptabbar { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tighter buttons inside data tables across the app */
.data-table .btn-sm { padding: 2px 7px; font-size: 11px; }

/* Mobile: readable tables + bigger touch targets */
@media (max-width: 640px) {
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 6px 7px; }
    .act-btn { width: 34px; height: 34px; font-size: 16px; }
    .btn-sm { padding: 6px 11px; font-size: 12px; }
    .ptabbar { padding-left: 12px !important; padding-right: 12px !important; }
}

/* ---- Gorgeous Top PWA Download Button ---- */
.top-pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md, 8px);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(2, 132, 199, 0.2);
    transition: all 0.2s ease;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.top-pwa-install-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3), 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.top-pwa-install-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.2);
}

.top-pwa-icon {
    font-size: 15px;
}

/* On medium and small screens, make it compact */
@media (max-width: 768px) {
    .top-pwa-install-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* On very small screens, show only the icon to save space */
@media (max-width: 480px) {
    .top-pwa-install-btn {
        padding: 6px 8px;
    }
    .top-pwa-text {
        display: none;
    }
}


@media (min-width: 993px) {
    /* Collapsed sidebar (icon rail): keep the PWA download button compact so it does not disturb the layout */
    body.sidebar-collapsed .sidebar-pwa-banner {
        padding: 6px 8px !important;
    }
    body.sidebar-collapsed .pwa-install-nav-btn {
        padding: 6px 0 !important;
        gap: 0 !important;
    }
    body.sidebar-collapsed .pwa-install-nav-btn .pwa-icon {
        font-size: 15px;
        line-height: 1;
    }
    body.sidebar-collapsed .pwa-install-nav-btn .pwa-label,
    body.sidebar-collapsed .pwa-install-nav-btn .pwa-badge {
        display: none;
    }

    /* Collapsed sidebar: keep the footer (Settings / Logout) to icons only */
    body.sidebar-collapsed .sidebar-footer {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 10px 4px;
    }
    body.sidebar-collapsed .user-details {
        display: none;
    }
    body.sidebar-collapsed .logout-btn {
        padding: 7px !important;
        font-size: 14px !important;
    }
    body.sidebar-collapsed .logout-btn .btn-text {
        display: none;
    }
}

/* =====================================================
   UNIVERSAL ERP STICKY TABLE HEADERS (THEAD TH)
   ===================================================== */
.ledger-page .xls-table-wrap,
.ledger-page .cl-ledger-table-wrap,
.ledger-page .table-responsive,
.vendor-page .xls-table-wrap {
    overflow: visible !important;
}

/* Window-scrolled tables (where outer page scrolls) */
.xls-table thead th,
.cl-dir-table thead th,
#customerTableMain thead th,
#ledgerTable thead th,
#allLedgerTable thead th,
#vendorXlsTable thead th {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: var(--module-sticky-top, var(--awami-sticky-top, var(--pi-sticky-top, 98px))) !important;
    z-index: 100 !important;
    background: #e0e5ec !important;
    color: #1a202c !important;
    border: 1px solid #1e3a5f !important;
    border-bottom: 2px solid #a3b1c6 !important;
}

/* Container-scrolled sheets (Progress Sheet grids and modal popups) MUST stick to top: 0 */
.progress-sheet-page .sheet-entry-scroll,
.progress-sheet-page .table-scroll,
.progress-sheet-page .ps-sheet-ledger-wrap {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

#sheetGrid thead th,
#sheetGrid.sheet-entry-grid th,
#sheetGrid th,
#sheetLedgerTable thead th,
#progressTable thead th,
.table-scroll #progressTable thead th,
.table-scroll #piTable thead th,
.table-scroll #piTable th,
.table-scroll .data-table thead th,
.table-scroll #employeesTable thead th,
.table-scroll #payrollTable thead th,
.table-scroll #attDailyTable thead th,
.table-scroll .att-matrix thead th,
.popup-sheet-table thead th,
.modal-body thead th,
.modal-body .data-table thead th,
.modal-body table thead th {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    background: #e0e5ec !important;
    color: #1a202c !important;
    border-right: 1px solid #d0d7e3 !important;
    border-bottom: 2px solid #a3b1c6 !important;
}






/* =====================================================
   COLLAPSED SIDEBAR PRO FIX 2026-10-21
   Wider rail (84px), bigger centred icons, no clipped
   theme shadows, tidy footer. Desktop only (>992px);
   mobile drawer behaviour is untouched.
   ===================================================== */
@media (min-width: 993px) {
    :root { --sidebar-collapsed: 84px; }
    body.sidebar-collapsed .sidebar { width: 84px !important; }
    body.sidebar-collapsed .main-content { margin-left: 84px !important; }
    body.sidebar-collapsed #sidebar .sidebar-header {
        justify-content: center !important;
        padding: 16px 6px !important;
    }
    body.sidebar-collapsed #sidebar .logo-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
    }
    body.sidebar-collapsed #sidebar .sidebar-nav {
        padding: 12px 8px !important;
        scrollbar-width: none;
    }
    body.sidebar-collapsed #sidebar .sidebar-nav::-webkit-scrollbar { display: none; }
    body.sidebar-collapsed #sidebar .sidebar-nav .nav-item {
        margin: 5px 4px !important;
        padding: 12px 0 !important;
        min-height: 48px !important;
        justify-content: center !important;
        gap: 0 !important;
        border-radius: 12px !important;
        box-shadow: 0 1px 4px rgba(2, 6, 23, 0.10) !important;
    }
    body.sidebar-collapsed #sidebar .sidebar-nav .nav-item .nav-icon {
        font-size: 21px !important;
        width: 30px !important;
        line-height: 1 !important;
        text-align: center;
    }
    body.sidebar-collapsed #sidebar .sidebar-nav .nav-item .submenu-arrow { display: none !important; }
    body.sidebar-collapsed #sidebar .sidebar-footer {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 12px 6px !important;
    }
    body.sidebar-collapsed #sidebar .user-profile {
        justify-content: center !important;
        padding: 0 !important;
    }
}
