/* ===================================================
   SetuSync Enterprise Design System
   High-performance, modern executive UI - Zero emojis, crisp vector icons

   =================================================== */

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

:root {
    /* Brand & Accent Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;

    --success: #059669;
    --success-hover: #047857;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;

    --warning: #d97706;
    --warning-hover: #b45309;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;

    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;

    --info: #0284c7;
    --info-light: #f0f9ff;
    --info-border: #bae6fd;

    /* Neutrals & Surfaces */
    --bg: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a; /* Sleek dark navy executive sidebar */
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;

    /* Typography */
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    /* Elevation & Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 0 3px rgba(37, 99, 235, 0.15);

    /* Dimensions & Radii */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --sidebar-width: 256px;
    --sidebar-collapsed-width: 68px;
    --header-height: 64px;

    /* Hardware-accelerated smooth transitions */
    --ease-snappy: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: all 0.15s var(--ease-snappy);
    --transition-transform: transform 0.15s var(--ease-snappy), box-shadow 0.15s var(--ease-snappy);
}

/* Collapsed Sidebar CSS Variable Override */
body.sidebar-collapsed,
html.sidebar-collapsed {
    --sidebar-width: var(--sidebar-collapsed-width);
}

/* --- Base & Reset with Smooth Dynamics --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 16px);
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: auto;
    text-rendering: geometricPrecision;
}

@view-transition {
    navigation: auto;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Consistent typography hierarchy */
h1, h2, h3, h4, h5, h6, .brand-name, .stat-value, .card-title {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.02em;
    font-weight: 700;
}

/* Smooth Page Load Animation without GPU blur */
@keyframes pageEntrance {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content {
    animation: pageEntrance 0.2s var(--ease-snappy);
}

/* Numeric tables with consistent digit widths */
.num, .stat-value, .tabular-nums, td:has(input[type="number"]), .total-row td {
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.18s var(--ease-snappy);
}

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

/* --- Icons System (Lucide & SVG) --- */
.icon, svg.icon, [data-lucide] {
    display: inline-block;
    width: 18px;
    height: 18px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
    flex-shrink: 0;
}

.icon-sm { width: 15px; height: 15px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 26px; height: 26px; }

/* --- App Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    background: var(--bg);
    overflow-x: hidden;
}

/* --- Executive Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 0.2s var(--ease-snappy), transform 0.25s var(--ease-snappy);
    overflow: hidden;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.sidebar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.sidebar-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: padding 0.2s var(--ease-snappy);
    overflow: hidden;
    height: var(--header-height);
}

.sidebar-brand .logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.sidebar-brand .logo:hover {
    transform: scale(1.05);
}

.sidebar-brand .brand-text {
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.25;
}

.sidebar-brand .brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-brand .brand-sub {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    display: block;
    margin-top: 1px;
}

.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    padding: 0;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

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

body.sidebar-collapsed .sidebar-brand,
html.sidebar-collapsed .sidebar-brand {
    padding: 14px 0 !important;
    justify-content: center !important;
    gap: 4px !important;
}

body.sidebar-collapsed .brand-text,
html.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-section-title,
html.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .sidebar-collapse-btn,
html.sidebar-collapsed .sidebar-collapse-btn,
body.sidebar-collapsed .nav-link span:not(.nav-icon),
html.sidebar-collapsed .nav-link span:not(.nav-icon),
body.sidebar-collapsed .sidebar-footer .nav-link span:not(.nav-icon),
html.sidebar-collapsed .sidebar-footer .nav-link span:not(.nav-icon) {
    display: none !important;
}

body.sidebar-collapsed .nav-link,
html.sidebar-collapsed .nav-link {
    justify-content: center !important;
    padding: 10px 0 !important;
    margin: 4px 8px !important;
}

/* Hover Tooltip when sidebar is collapsed */
body.sidebar-collapsed .nav-link:hover::after,
html.sidebar-collapsed .nav-link:hover::after {
    content: attr(data-title);
    position: fixed;
    left: calc(var(--sidebar-collapsed-width) + 8px);
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 1000;
    pointer-events: none;
    animation: fadeInTooltip 0.12s ease;
}

@keyframes fadeInTooltip {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

body.sidebar-collapsed .nav-section,
html.sidebar-collapsed .nav-section {
    margin-bottom: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.sidebar-nav::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.nav-section {
    margin-bottom: 12px;
}

.nav-section-title {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0 10px;
    margin-bottom: 3px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--bg-sidebar-active);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
}

.nav-link .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 10px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .nav-link {
    color: #ef4444;
}
.sidebar-footer .nav-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* --- Main Content Area & Widescreen Optimization --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
    transition: margin-left 0.2s var(--ease-snappy), max-width 0.2s var(--ease-snappy);
}

body.sidebar-collapsed .main-content,
html.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    max-width: calc(100vw - var(--sidebar-collapsed-width));
}

.page-header {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: var(--header-height);
}

.desktop-sidebar-toggle {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.desktop-sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--text);
    border-color: var(--border-dark);
}

.page-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-header .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-body {
    padding: 20px 24px;
    max-width: 100%;
    min-width: 0;
    flex: 1;
}

/* --- Enterprise Cards with Smooth Lift --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    transition: transform 0.22s var(--ease-snappy), box-shadow 0.22s var(--ease-snappy), border-color 0.2s ease;
    overflow: hidden;
    max-width: 100%;
}

.card:hover {
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.07), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.card-header h2, .card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* --- Executive KPI Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.22s var(--ease-snappy), box-shadow 0.22s var(--ease-snappy), border-color 0.2s ease;
    position: relative;
}

.stat-card:hover {
    box-shadow: 0 12px 24px -4px rgba(15, 23, 42, 0.09), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
    transform: translateY(-3px);
    border-color: #cbd5e1;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.25s var(--ease-snappy), background-color 0.2s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.08) rotate(3deg);
}

.stat-icon.blue { background: #eff6ff; color: #2563eb; border: 1px solid #dbeafe; }
.stat-icon.green { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.stat-icon.amber { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.stat-icon.red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.stat-icon.cyan { background: #f0f9ff; color: #0284c7; border: 1px solid #bae6fd; }

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 23px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Tactile Smooth Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s var(--ease-snappy);
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    outline: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.96) translateY(0);
}

.btn:focus-visible {
    box-shadow: var(--shadow-glow);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
    border-color: var(--success);
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}
.btn-success:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
    transform: translateY(-1px);
}

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

.btn-outline {
    background: #ffffff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
    background: #f8fafc;
    color: var(--text);
    border-color: var(--border-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 5px 10px;
}
.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    line-height: 1.2;
}

.btn-lg {
    padding: 11px 22px;
    font-size: 14.5px;
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 8px;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* --- Form Controls --- */
.form-group {
    margin-bottom: 14px;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: #ffffff;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-light);
}

/* --- Crisp Professional Data Tables --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow-xs);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

.table-wrapper::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
    background: #f8fafc;
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

thead th {
    background: #f8fafc;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

tbody tr {
    transition: background-color 0.1s ease;
}

tbody tr:hover {
    background-color: #f1f5f9;
}

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

/* Dense & Compact Table Layout (Fits comfortably without scrolling) */
.dense-table th {
    padding: 8px 6px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
}

.dense-table td {
    padding: 5px 4px !important;
    font-size: 12.5px !important;
}

.dense-table .cell-input {
    width: 100%;
    padding: 3px 5px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
    font-family: inherit;
    font-size: 12px !important;
    background: #ffffff !important;
    transition: var(--transition);
}

.dense-table .cell-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-glow) !important;
}

.dense-table .cell-select {
    padding: 3px 4px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    font-family: inherit;
    font-size: 11.5px !important;
    cursor: pointer;
    transition: var(--transition);
}

.dense-table .cell-select:focus {
    outline: none;
    border-color: var(--primary) !important;
}

/* --- Badges & Status Indicators --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    transition: var(--transition);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Primary / Synced (Blue) */
.badge-blue,
.badge-primary,
.badge-synced {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Success / Cash / Validated (Green) */
.badge-green,
.badge-success,
.badge-cash {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* Warning / Advance (Amber) */
.badge-amber,
.badge-warning,
.badge-advance {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

/* Danger / Error / Due (Red) */
.badge-red,
.badge-danger,
.badge-error,
.badge-due,
.badge-k1 {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Neutral / Gray / Pending */
.badge-gray,
.badge-neutral,
.badge-pending {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* --- Upload Dropzone --- */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8fafc;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-zone .upload-icon-box {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 14px;
    transition: var(--transition);
}

.upload-zone:hover .upload-icon-box {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-zone h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.upload-zone p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* --- Processing Spinner Overlay --- */
.processing-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

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

.processing-box {
    background: #ffffff;
    padding: 30px 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

.processing-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.processing-sub {
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* --- Empty States --- */
.empty-state {
    text-align: center;
    padding: 44px 20px;
    color: var(--text-secondary);
}

.empty-state .empty-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto;
}

/* --- Alerts & Toasts --- */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid var(--info-border); }

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: toastSlideUp 0.25s var(--ease-snappy);
    display: none;
    align-items: center;
    gap: 10px;
}

.toast.show { display: flex; }

@keyframes toastSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Filter Bars & Toolbars --- */
.filter-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    padding: 12px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    transition: var(--transition);
}

.filter-bar:hover {
    border-color: var(--border-dark);
}

.filter-bar form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-input,
.filter-bar .form-select {
    width: auto;
    min-width: 160px;
    height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}

.filter-bar .filter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin: 0;
}

/* --- Total Row --- */
.total-row {
    font-weight: 700;
    background: #f8fafc !important;
}

.total-row td {
    border-top: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
}

/* --- Mobile Menu & Responsive --- */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    color: var(--text);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .desktop-sidebar-toggle {
        display: none;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
    .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
    }
    .page-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .page-body {
        padding: 14px;
    }
    .menu-toggle {
        display: inline-flex;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .form-input,
    .filter-bar .form-select {
        width: 100%;
    }
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 14px;
    }
    .page-header h1 {
        font-size: 18px;
    }
    .card-header {
        padding: 12px 14px;
    }
    .card-body {
        padding: 14px;
    }
}

/* --- Dynamic Animations & Micro-Interactions --- */
@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

.badge-dot {
    animation: pulseDot 2s infinite ease-in-out;
}

.card {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.08);
}

.btn {
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:active {
    transform: scale(0.98);
}

tbody tr {
    transition: background-color 0.1s ease;
}

.table-wrapper {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.table-wrapper::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Utility Classes --- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }

