/* ============================================================
   Hamza Foods FMS — Design System
   Colors: #FF6B2B (saffron), #FFB800 (golden), #FFF8F0 (cream), #2D2D2D (dark)
   Font: Poppins
============================================================ */
:root {
    --primary: #FF6B2B;
    --primary-light: #FF8C54;
    --primary-dark: #E55A1E;
    --golden: #FFB800;
    --golden-light: #FFC93D;
    --cream: #FFF8F0;
    --dark: #2D2D2D;
    --dark-light: #3D3D3D;
    --sidebar-bg: #1E1E2E;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== DARK MODE THEME ===== */
[data-theme="dark"] {
    --gray-50: #121212;
    --gray-100: #1E1E1E;
    --gray-200: #2D2D2D;
    --gray-300: #3D3D3D;
    --gray-500: #9CA3AF;
    --gray-700: #E5E7EB;
    --dark: #F3F4F6;
    --dark-light: #D1D5DB;
    --sidebar-bg: #0D0D0D;
    --cream: #1A120B;
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body {
    background: #121212;
    color: #F3F4F6;
}

[data-theme="dark"] .topbar {
    background: #181818 !important;
    border-bottom-color: #2D2D2D !important;
}

[data-theme="dark"] .topbar-title,
[data-theme="dark"] .topbar-toggle,
[data-theme="dark"] .topbar-btn {
    color: #fff !important;
}

[data-theme="dark"] .topbar-search input {
    background: #252525 !important;
    border-color: #333 !important;
    color: #fff !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .alerts-panel,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .modal-box,
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .qa-btn {
    background: #1E1E1E !important;
    border-color: #333 !important;
    color: #F3F4F6 !important;
}

[data-theme="dark"] .toast-msg {
    background: #2D2D2D !important;
    color: #fff !important;
    border: 1px solid #444 !important;
}

[data-theme="dark"] .table-container table thead {
    background: #262626 !important;
}

[data-theme="dark"] .table-container table thead th {
    color: #fff !important;
}

[data-theme="dark"] .table-container table tbody tr {
    border-bottom-color: #333 !important;
}

[data-theme="dark"] .table-container table tbody tr:hover {
    background: #222 !important;
}

[data-theme="dark"] .notif-panel {
    background: #1E1E1E !important;
    border: 1px solid #333 !important;
}

[data-theme="dark"] .notif-header {
    border-bottom-color: #333 !important;
    border-top-color: #333 !important;
}

[data-theme="dark"] .alert-row {
    border-bottom-color: #222 !important;
}

/* Ensure table content is visible in dark mode */
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .table-container,
[data-theme="dark"] table,
[data-theme="dark"] tbody tr,
[data-theme="dark"] td {
    background: #1e1e1e !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .table-container table thead th {
    background: #262626 !important;
    color: #fff !important;
}

/* Form elements in dark mode */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #2D2D2D !important;
    color: #F3F4F6 !important;
    border-color: #444 !important;
}

[data-theme="dark"] input::placeholder {
    color: #777 !important;
}

[data-theme="dark"] .badge-success {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #10B981 !important;
}

[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #F59E0B !important;
}

[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #EF4444 !important;
}

/* MODAL & COMPOSITE FORMS IN DARK MODE */
[data-theme="dark"] .modal {
    background: #1e1e1e !important;
    color: #f3f4f6 !important;
    border: 1px solid #333 !important;
}

[data-theme="dark"] .modal-header {
    background: #1e1e1e !important;
    border-bottom: 1px solid #333 !important;
    color: #fff !important;
}

[data-theme="dark"] .modal-header h3 {
    color: #fff !important;
}

[data-theme="dark"] .modal-footer {
    background: #1e1e1e !important;
    border-top: 1px solid #333 !important;
}

[data-theme="dark"] .modal-close {
    color: #999 !important;
}

[data-theme="dark"] .modal-close:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Specific form sections like legends and labels in sales/products */
[data-theme="dark"] .form-section-title {
    color: #fff !important;
}

[data-theme="dark"] label {
    color: #aaa !important;
}

[data-theme="dark"] h4,
[data-theme="dark"] h5 {
    color: #fff !important;
}

[data-theme="dark"] .variant-row,
[data-theme="dark"] .item-row {
    border-bottom: 1px solid #333 !important;
}

[data-theme="dark"] legend {
    color: #fff !important;
}

/* Dashboard Trends visibility in Dark Mode */
[data-theme="dark"] #trendsContent .card {
    background: #2D2D2D !important;
    border: 1px solid #444 !important;
    color: #F3F4F6 !important;
}

[data-theme="dark"] .topbar-search input {
    background: #1e1e1e !important;
    color: #fff !important;
    border-color: #444 !important;
}

[data-theme="dark"] .nav-section-label {
    color: #9ca3af !important;
}

[data-theme="dark"] .notif-panel {
    background: #1e1e1e !important;
    border-color: #333 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .notif-item {
    border-bottom: 1px solid #333 !important;
}

[data-theme="dark"] .notif-item:hover {
    background: #2D2D2D !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--gray-50);
    color: var(--dark);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ===== LAYOUT ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo .logo-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo .logo-text h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #FFB800;
}

.sidebar-logo .logo-text p {
    font-size: 0.7rem;
    color: #888;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #555;
    padding: 12px 22px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-label {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 22px;
    cursor: pointer;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255, 107, 43, 0.25), rgba(255, 107, 43, 0.05));
    border-right: 3px solid var(--primary);
}

.nav-item .nav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.nav-item .nav-label {
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 100px;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-section-label {
    opacity: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--golden));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-details {
    white-space: nowrap;
    overflow: hidden;
}

.user-details .uname {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}

.user-details .urole {
    font-size: 0.7rem;
    color: #888;
}

.sidebar.collapsed .user-details {
    opacity: 0;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 150;
    display: none;
    backdrop-filter: blur(2px);
    transition: var(--transition);
}

.sidebar-overlay.active {
    display: block;
}

/* ===== TOPBAR ===== */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.main.expanded {
    margin-left: var(--sidebar-collapsed);
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}

.topbar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 8px;
    color: var(--dark);
    transition: var(--transition);
}

.topbar-toggle:hover {
    background: var(--gray-100);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    flex: 1;
}

.topbar-search {
    flex: 1;
    max-width: 360px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    padding: 9px 16px 9px 40px;
    border: 2px solid var(--gray-200);
    border-radius: 100px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
    background: var(--gray-50);
}

.topbar-search input:focus {
    border-color: var(--primary);
    background: #fff;
}

.topbar-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 0.9rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--gray-100);
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ===== CONTENT AREA ===== */
.content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.page-header p {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 3px;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
}

.card-body {
    padding: 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--kpi-color, var(--primary));
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--kpi-bg, rgba(255, 107, 43, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.kpi-info .kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
}

.kpi-info .kpi-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 5px;
    font-weight: 500;
}

.kpi-info .kpi-sub {
    font-size: 0.72rem;
    margin-top: 4px;
    font-weight: 600;
}

/* ===== CHARTS ===== */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.chart-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
}

.chart-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 18px;
}

canvas {
    max-height: 240px;
}

/* ===== TABLES ===== */
.table-wrap {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table-toolbar {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.table-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.table-search input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.table-search input:focus {
    border-color: var(--primary);
}

.table-search .i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
}

thead th {
    padding: 12px 18px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

tbody td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
    color: var(--dark);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 107, 43, 0.03);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    outline: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--golden));
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 43, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #0DA271;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 8px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 0.73rem;
    font-weight: 700;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-primary {
    background: rgba(255, 107, 43, 0.12);
    color: var(--primary-dark);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 640px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-lg {
    max-width: 1100px;
}

.modal-xl {
    max-width: 1300px;
}

@media (max-width: 1340px) {
    .modal-xl {
        max-width: 95vw;
    }
}

@media (max-width: 1140px) {
    .modal-lg {
        max-width: 95vw;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
    color: var(--gray-500);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--dark);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
}

.modal-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== FORMS ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-row.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row.cols-1 {
    grid-template-columns: 1fr;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 15px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    transition: var(--transition);
    outline: none;
    color: var(--dark);
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #93C5FD;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--gray-500);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab:hover:not(.active) {
    color: var(--dark);
}

/* ===== NOTIFICATIONS PANEL ===== */
.notif-panel {
    position: absolute;
    top: 52px;
    right: 0;
    width: 360px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gray-200);
    z-index: 500;
    display: none;
    overflow: hidden;
}

.notif-panel.active {
    display: block;
}

.notif-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-icon {
    font-size: 1.1rem;
}

.notif-text {
    font-size: 0.82rem;
    color: var(--dark);
    line-height: 1.5;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-100);
}

.page-btn {
    width: 34px;
    height: 34px;
    border: 2px solid var(--gray-200);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn.active,
.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
}

.page-info {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-left: auto;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state .es-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ===== DASHBOARD ALERTS PANEL ===== */
.alerts-panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.alerts-panel .panel-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alerts-panel .panel-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.alert-row {
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.83rem;
}

.alert-row:last-child {
    border-bottom: none;
}

.alert-row .ar-icon {
    font-size: 1rem;
}

.alert-row.warning {
    border-left: 3px solid var(--warning);
}

.alert-row.danger {
    border-left: 3px solid var(--danger);
}

.alert-row.info {
    border-left: 3px solid var(--info);
}

/* ===== LOADING SPINNER ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 107, 43, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.qa-btn {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

.qa-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 43, 0.15);
}

/* ===== INVOICE PRINT ===== */
@media print {

    .sidebar,
    .topbar,
    .btn,
    .modal-footer,
    .table-toolbar {
        display: none !important;
    }

    .main {
        margin-left: 0 !important;
    }

    .content {
        padding: 0 !important;
    }

    .invoice-wrap {
        box-shadow: none !important;
    }
}

/* ===== RESPONSIVE ===== */
@media(max-width:1024px) {
    :root {
        --sidebar-width: var(--sidebar-collapsed);
    }

    .sidebar .nav-label,
    .sidebar .nav-badge,
    .sidebar .nav-section-label,
    .sidebar .logo-text,
    .sidebar .user-details {
        opacity: 0;
        pointer-events: none;
    }
}

@media(max-width:768px) {
    .sidebar {
        left: -100%;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    }

    .sidebar.mobile-open {
        left: 0;
        width: 280px;
    }

    .sidebar.mobile-open~.sidebar-overlay {
        display: block;
    }

    .sidebar.mobile-open .nav-label,
    .sidebar.mobile-open .logo-text,
    .sidebar.mobile-open .user-details {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        margin-left: 0 !important;
    }

    .topbar {
        padding: 0 12px;
        height: 60px;
    }

    .topbar-title {
        font-size: 0.9rem;
    }

    .topbar-search {
        display: none;
    }

    .content {
        padding: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .page-header .btn-group,
    .page-header div:last-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-header .btn {
        flex: 1;
        justify-content: center;
        padding: 10px;
        font-size: 0.8rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kpi-card {
        padding: 15px;
    }

    .kpi-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .kpi-value {
        font-size: 1.1rem;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 15px;
        border-radius: 12px;
    }

    /* Table Responsive Tweak */
    .table-container {
        margin: 0 -15px;
        padding: 0 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .table-container::after {
        content: "Scroll ➔";
        position: absolute;
        right: 20px;
        bottom: 5px;
        font-size: 0.65rem;
        color: var(--primary);
        opacity: 0.6;
        pointer-events: none;
    }

    table {
        min-width: 650px;
        /* Ensure content doesn't squash too much */
    }

    th,
    td {
        padding: 12px 10px;
        font-size: 0.8rem;
    }

    /* Smaller spacing for mobile list items */
    .notif-item {
        padding: 10px 15px;
    }

    .page-btn {
        width: 38px;
        height: 38px;
    }

    .table-toolbar {
        flex-direction: column;
        gap: 12px;
    }

    .search-box {
        width: 100% !important;
    }
}

@media(max-width:480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .modal-box {
        width: 95% !important;
        max-height: 90vh;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 12px 15px;
    }

    .topbar-actions {
        gap: 4px;
    }

    .topbar-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}