/* Invoice Management System - Custom Styles */
:root {
    --primary: #1e40af;
    --primary-hover: #1e3a8a;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-sidebar: #e2e8f0;
    
    --border-color: #e2e8f0;
    --border-radius: 0.5rem;
    
    --sidebar-width: 260px;
    --header-height: 60px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 0.875rem;
}

/* Smaller fonts for Tabulator tables */
.tabulator {
    font-size: 0.8125rem;
}

.tabulator .tabulator-header {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tabulator .tabulator-header .tabulator-col-title {
    white-space: normal;
    word-wrap: break-word;
}

.tabulator-footer {
    font-size: 0.8125rem;
}

/* Stat card enhancements */
.stat-card-lg {
    min-width: 180px;
}

.stat-card-lg .stat-value {
    font-size: 1.1rem;
}

/* Calendar Dropdown Styles */
.calendar-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.calendar-trigger {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-trigger:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.calendar-popover {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    display: none;
    min-width: 520px;
    margin-top: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
}

.calendar-popover.show {
    display: block;
}

.calendar-dropdown-wrapper:hover .calendar-popover,
.calendar-popover:hover {
    display: block;
}

.calendar-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.calendar-month {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    min-width: 220px;
}

.calendar-month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.calendar-month-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.25rem;
    text-transform: uppercase;
}

.calendar-day {
    text-align: center;
    padding: 0.35rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.calendar-day:hover {
    background-color: var(--bg-body);
}

.calendar-day.other-month {
    color: var(--text-muted);
}

.calendar-day.today {
    font-weight: 700;
    border: 1px solid var(--primary);
}

.calendar-day.selected {
    background-color: var(--primary);
    color: white;
}

.calendar-day.in-range {
    background-color: #dbeafe;
}

.calendar-day.range-start {
    background-color: var(--primary);
    color: white;
    border-radius: 4px 0 0 4px;
}

.calendar-day.range-end {
    background-color: var(--primary);
    color: white;
    border-radius: 0 4px 4px 0;
}

.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.login-logo i {
    font-size: 2rem;
    color: white;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Main Layout */
#main-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: width 0.2s ease;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 60px;
    overflow: hidden;
}

.sidebar.collapsed:hover {
    width: var(--sidebar-width);
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .sidebar-fy-selector,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-footer button {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.sidebar.collapsed:hover .sidebar-logo span,
.sidebar.collapsed:hover .sidebar-fy-selector,
.sidebar.collapsed:hover .nav-link span,
.sidebar.collapsed:hover .nav-section-title,
.sidebar.collapsed:hover .user-details,
.sidebar.collapsed:hover .sidebar-footer button {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed .sidebar-header {
    padding: 1.25rem 0.75rem;
}

.sidebar.collapsed:hover .sidebar-header {
    padding: 1.25rem 1.5rem;
}

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

.sidebar.collapsed:hover .sidebar-logo {
    justify-content: flex-start;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.sidebar.collapsed:hover .sidebar-nav .nav-link {
    justify-content: flex-start;
    padding: 0.75rem 1rem;
}

.main-content.sidebar-collapsed {
    margin-left: 60px;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 1rem;
    right: -12px;
    width: 24px;
    height: 24px;
    background: var(--bg-sidebar);
    border: 2px solid var(--bg-sidebar-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    color: var(--text-sidebar);
    transition: transform 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-sidebar-hover);
}

.sidebar.collapsed .sidebar-toggle-btn {
    transform: rotate(180deg);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: #60a5fa;
}

.sidebar-fy-selector {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-fy-selector .form-label {
    color: var(--text-muted);
}

.sidebar-fy-selector .form-select {
    background-color: var(--bg-sidebar-hover);
    border-color: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-fy-selector .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(30, 64, 175, 0.25);
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-item {
    margin: 0.125rem 0.75rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-sidebar-hover);
}

.sidebar-nav .nav-link.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav .nav-link i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-nav .nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 1rem 1.5rem 0.5rem;
    margin-top: 0.5rem;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar i {
    font-size: 2rem;
    color: var(--text-muted);
}

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

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Month Grid */
.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.month-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.month-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.month-card.current {
    border-color: var(--primary);
    border-width: 2px;
}

.month-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.month-name {
    font-weight: 600;
    font-size: 1rem;
}

.month-year {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.month-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.month-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.month-metric-label {
    color: var(--text-secondary);
}

.month-metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

/* Forecast Widgets */
.forecast-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.forecast-card {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    color: white;
    text-align: center;
}

.forecast-period {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.forecast-amount {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.25rem;
}

.forecast-count {
    font-size: 0.8125rem;
    opacity: 0.8;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 1rem 1.25rem;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
}

.card-header h5,
.card-header h6 {
    margin: 0;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--bg-body);
}

.table tfoot td,
.table tfoot th {
    font-weight: 600;
    background: var(--bg-body);
}

/* Forms */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    border-radius: var(--border-radius);
    border-color: var(--border-color);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.15);
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease;
}

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

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
}

.badge-status-paid {
    background-color: #dcfce7;
    color: #166534;
}

.badge-status-unpaid {
    background-color: #fef2f2;
    color: #991b1b;
}

.badge-status-part_paid {
    background-color: #fef3c7;
    color: #92400e;
}

/* Totals Row */
.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.totals-row.grand-total {
    font-size: 1.125rem;
    font-weight: 600;
    padding-top: 0.75rem;
}

.gst-breakdown {
    background: var(--bg-body);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    margin: 0.5rem 0;
}

.gst-breakdown .totals-row {
    font-size: 0.8125rem;
    padding: 0.25rem 0;
}

/* Invoice Form */
.invoice-form .sticky-top {
    z-index: 10;
}

/* Receipts List */
.receipts-list {
    max-height: 400px;
    overflow-y: auto;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.receipt-item:last-child {
    border-bottom: none;
}

.receipt-info {
    flex: 1;
}

.receipt-date {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.receipt-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.receipt-mode {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.receipt-actions {
    display: flex;
    align-items: center;
}

/* Client Cards */
.client-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 100%;
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.client-name {
    font-weight: 600;
    font-size: 1.0625rem;
    margin-bottom: 0.25rem;
}

.client-gstin {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.client-contacts {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.client-contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.client-contact i {
    color: var(--text-muted);
    width: 1rem;
}

/* Invoice Item Row */
.invoice-item-row td {
    vertical-align: middle;
}

.invoice-item-row input,
.invoice-item-row select {
    font-size: 0.875rem;
}

/* Contact Row */
.contact-row {
    background: var(--bg-body);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.contact-row .row {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

.contact-row input {
    font-size: 0.875rem;
}

/* Terms Template Item */
.terms-template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-body);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 767.98px) {
    .main-content {
        padding: 1rem;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .month-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .forecast-widgets {
        grid-template-columns: 1fr;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-body) 25%, #e2e8f0 50%, var(--bg-body) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h5 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Toast Customization */
.toast {
    border: none;
    box-shadow: var(--shadow-lg);
}

/* Print Styles */
@media print {
    .sidebar,
    .page-actions,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
}

/* Hide admin-only elements for viewers */
body.role-viewer .admin-only {
    display: none !important;
}

/* ==================== REFRENS-STYLE ENHANCEMENTS ==================== */

/* Modern Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge-paid {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
}

.status-badge-partial {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
}

.status-badge-unpaid {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.status-badge-overdue {
    background: linear-gradient(135deg, #fecdd3 0%, #fda4af 100%);
    color: #be123c;
}

.status-badge-draft {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #4b5563;
}

.status-badge i {
    font-size: 0.625rem;
}

/* Modern Quick Action Buttons */
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

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

.quick-action-btn i {
    font-size: 1.125rem;
}

/* Dashboard Stats Cards - Enhanced */
.stats-card-modern {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stats-card-modern:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.stats-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    border-radius: 1rem 1rem 0 0;
}

.stats-card-modern.success::before {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.stats-card-modern.warning::before {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.stats-card-modern.danger::before {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

.stats-card-modern.info::before {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.stats-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stats-card-icon.primary {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.stats-card-icon.success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

.stats-card-icon.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.stats-card-icon.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.stats-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stats-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.stats-card-trend.up {
    background: #dcfce7;
    color: #16a34a;
}

.stats-card-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

/* Alert Cards */
.alert-card {
    border-radius: 0.75rem;
    border: none;
    padding: 1rem 1.25rem;
}

.alert-card-overdue {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #ef4444;
}

.alert-card-upcoming {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
}

.alert-card-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
}

/* Document Type Badges */
.doc-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-type-invoice {
    background: #dbeafe;
    color: #1e40af;
}

.doc-type-proforma {
    background: #e0e7ff;
    color: #3730a3;
}

.doc-type-quotation {
    background: #f3e8ff;
    color: #6b21a8;
}

/* Invoice Table Enhancements */
.invoice-table-modern {
    border-radius: 0.75rem;
    overflow: hidden;
}

.invoice-table-modern th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.875rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.invoice-table-modern td {
    padding: 1rem;
    vertical-align: middle;
}

.invoice-table-modern tbody tr {
    transition: background-color 0.15s ease;
}

.invoice-table-modern tbody tr:hover {
    background: #f8fafc;
}

/* Quick Filters */
.quick-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: white;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-chip .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.filter-chip.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.activity-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary);
}

.activity-item.success::before {
    border-color: #16a34a;
    background: #16a34a;
}

.activity-item.warning::before {
    border-color: #d97706;
    background: #d97706;
}

.activity-item-content {
    font-size: 0.875rem;
}

.activity-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dashboard Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    border-radius: 1rem;
    padding: 2rem;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -50px;
    top: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.welcome-banner h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.welcome-banner p {
    opacity: 0.9;
    margin-bottom: 0;
}

/* Animated Number Counter */
.animate-number {
    transition: all 0.5s ease;
}

/* Modern Empty State */
.empty-state-modern {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(180deg, #f8fafc 0%, white 100%);
    border-radius: 1rem;
    border: 2px dashed var(--border-color);
}

.empty-state-modern-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.empty-state-modern-icon i {
    font-size: 2rem;
    color: #4f46e5;
}

.empty-state-modern h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state-modern p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Convert Document Button */
.convert-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.convert-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    color: white;
}

.convert-btn i {
    font-size: 0.875rem;
}

/* Tooltip Enhancements */
.tooltip-modern {
    position: relative;
}

.tooltip-modern:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
}

/* Progress Bar for Payment Status */
.payment-progress {
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    overflow: hidden;
    margin-top: 0.5rem;
}

.payment-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.payment-progress-bar.complete {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.payment-progress-bar.partial {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.payment-progress-bar.unpaid {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

/* Sales Register Month-wise Styles */
.sales-month-row {
    transition: background-color 0.15s ease;
}

.sales-month-row:hover {
    background-color: #fff3cd !important;
}

.sales-month-expanded {
    background-color: #ffc107 !important;
    color: #000;
}

.sales-month-expanded:hover {
    background-color: #ffc107 !important;
}

.sales-month-row-empty td {
    color: #94a3b8;
}

.sales-expand-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.sales-month-detail td {
    padding: 0 !important;
    background-color: #f8f9fa;
}

.sales-month-detail table {
    border-left: 3px solid var(--primary);
}

.sales-invoice-row:hover {
    background-color: #e8f0fe !important;
}

/* Sales Bar Chart */
.sales-chart-container {
    display: flex;
    height: 100%;
    gap: 8px;
}

.sales-chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    padding-bottom: 24px;
    min-width: 60px;
}

.sales-chart-y-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1;
}

.sales-chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    border-left: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 8px;
    height: 100%;
}

.sales-chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.sales-chart-bar {
    width: 70%;
    max-width: 60px;
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}

.sales-chart-bar:hover {
    opacity: 0.85;
}

.sales-chart-bar-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: center;
}
