/* =====================================================
   FacturePro - Invoice Management System
   CSS Stylesheet v2
   ===================================================== */

/* CSS Variables */
:root {
    /* Colors */
    --bg-default: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --overlay: rgba(15, 23, 42, 0.5);
    
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;
    
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #DBEAFE;
    
    --success: #10B981;
    --success-bg: #D1FAE5;
    --success-text: #065F46;
    
    --warning: #DC2626;
    --warning-bg: #FEE2E2;
    --warning-text: #FFFFFF;
    
    --danger: #EF4444;
    --danger-bg: #FEE2E2;
    --danger-text: #991B1B;
    
    --purple: #8B5CF6;
    --purple-bg: #EDE9FE;
    --purple-text: #5B21B6;
    
    --border: #E2E8F0;
    --border-focus: #94A3B8;
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 72px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition: all 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-default);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

.hidden {
    display: none !important;
}

/* =====================================================
   Loading Screen with Rotating Arcs
   ===================================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.loader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.loader-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid transparent;
}

.loader-ring.ring-1 {
    width: 70px;
    height: 70px;
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: rotate 1s linear infinite;
}

.loader-ring.ring-2 {
    width: 90px;
    height: 90px;
    border-right-color: rgba(255, 255, 255, 0.7);
    animation: rotate 1.5s linear infinite reverse;
}

.loader-ring.ring-3 {
    width: 110px;
    height: 110px;
    border-bottom-color: rgba(255, 255, 255, 0.5);
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.loader-text {
    margin-top: 2rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* =====================================================
   Page Skeleton Loaders
   ===================================================== */
.page-skeleton {
    padding: 1.5rem;
}

.skeleton-header {
    margin-bottom: 1.5rem;
}

.skeleton-title {
    width: 200px;
    height: 32px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.skeleton-subtitle {
    width: 300px;
    height: 16px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-actions {
    width: 150px;
    height: 40px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.skeleton-card {
    height: 120px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.skeleton-chart-large {
    height: 350px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-chart-small {
    height: 350px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-filters {
    height: 60px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.skeleton-table {
    height: 400px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-calendar {
    height: 500px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.skeleton-client-card {
    height: 200px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.skeleton-chart {
    height: 300px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.skeleton-settings-card {
    height: 150px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

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

@media (max-width: 1200px) {
    .skeleton-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .skeleton-kpi-grid {
        grid-template-columns: 1fr;
    }
    .skeleton-charts {
        grid-template-columns: 1fr;
    }
    .skeleton-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   Login Page (old overridden - see bottom)
   ===================================================== */

/* =====================================================
   Forms
   ===================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.combo-add {
    display: flex;
    gap: 0.5rem;
}

.combo-add select {
    flex: 1;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

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

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

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-default);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #DC2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-default);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    padding: 0.625rem;
    min-width: 40px;
}

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

/* =====================================================
   App Layout
   ===================================================== */
.app {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.logo-icon-small {
    width: 180px;
    height: 56px;
    flex-shrink: 0;
}

.logo-icon-small img {
    display: block;
    max-width: 180px;
    max-height: 56px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.sidebar-header .logo span {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.nav-section-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.nav-item:hover {
    background: var(--bg-default);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* Sidebar mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 45;
}

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


.btn-logout {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger-bg);
}

.btn-logout:hover {
    background: var(--danger-bg);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
        padding-bottom: 60px;
        
}

/* Header */
.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 30;
    max-width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-default);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    min-width: 280px;
}

.search-box i {
    color: var(--text-muted);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.currency-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.currency-selector label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.currency-selector select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.notifications {
    position: relative;
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: -80px;
    width: 360px;
    max-height: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-xl);
    z-index: 100;
    overflow: hidden;
}

.notifications-dropdown.open {
    display: block;
}

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

.notif-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.notif-count-label {
    font-size: 0.75rem;
    color: var(--danger);
    font-weight: 600;
    background: var(--danger-bg);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

.notif-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border);
}

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

.notif-item:hover {
    background: var(--bg-default);
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.notif-icon.overdue { background: var(--danger-bg); color: var(--danger); }
.notif-icon.soon { background: var(--warning-bg); color: var(--warning); }
.notif-icon.upcoming { background: var(--primary-light); color: var(--primary); }

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.notif-amount {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--danger);
    white-space: nowrap;
}

.notif-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 480px) {
    .notifications-dropdown {
        width: calc(100vw - 2rem);
        right: -120px;
    }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-profile span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Page Container */
.page-container {
    flex: 1;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-content {
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
    overflow-x: hidden;
}

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

.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;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* =====================================================
   Dashboard
   ===================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.kpi-icon.unpaid {
    background: var(--danger-bg);
    color: var(--danger);
}

.kpi-icon.paid {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-icon.overdue {
    background: var(--warning-bg);
    color: var(--warning);
}

.kpi-icon.reminder {
    background: var(--primary-light);
    color: var(--primary);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.kpi-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card,
.summary-card,
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    overflow: hidden;
    max-width: 100%;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.chart-container {
    height: 280px;
    position: relative;
}

/* Summary */
.summary-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-default);
    border-radius: 8px;
}

.summary-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.summary-dot.paid {
    background: var(--success);
}

.summary-dot.unpaid {
    background: var(--danger);
}

.summary-dot.pending, .summary-dot.partial {
    background: var(--warning);
}

.summary-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.summary-value {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
}

/* Statistics Page */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   Filters
   ===================================================== */
.filters-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filters-row:last-of-type {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-group input,
.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filters-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   Tables
   ===================================================== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

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

.data-table th {
    background: var(--bg-default);
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--text-primary);
}

.data-table th.sortable i {
    margin-left: 0.5rem;
    font-size: 0.625rem;
}

.data-table td {
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    transition: var(--transition);
}

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

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

/* Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-pages {
    display: flex;
    gap: 0.25rem;
}

.pagination-pages button {
    min-width: 32px;
    height: 32px;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-paid {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-unpaid {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-pending, .badge-partial {
    background: var(--warning);
    color: #FFFFFF;
}

.badge-reminder {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-total {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-final {
    background: var(--purple-bg);
    color: var(--purple-text);
}

/* Payment method badges */
.badge-method {
    background: var(--bg-default);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--bg-default);
    color: var(--text-primary);
}

.action-btn.view:hover {
    color: var(--primary);
}

.action-btn.edit:hover {
    color: var(--warning);
}

.action-btn.delete:hover {
    color: var(--danger);
}

.action-btn.payment:hover {
    color: var(--success);
}

.action-btn.reminder:hover {
    color: var(--purple);
}

/* =====================================================
   Calendar
   ===================================================== */
.calendar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-default);
    border-bottom: 1px solid var(--border);
}

.calendar-day-name {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
}

.calendar-day-name:last-child {
    border-right: none;
}

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

.calendar-day {
    min-height: 120px;
    padding: 0.5rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    transition: var(--transition);
    cursor: pointer;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

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

.calendar-day.other-month {
    background: var(--bg-default);
}

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

.calendar-day.today {
    background: var(--primary-light);
}

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

.day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-chip {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid transparent;
}

.event-chip:hover {
    transform: scale(1.02);
}

.event-chip.unpaid {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: #FCA5A5;
}

.event-chip.paid {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #6EE7B7;
}

.event-chip.partial {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: #FCD34D;
}

.event-chip.reminder {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #93C5FD;
}

.calendar-legend {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.unpaid {
    background: var(--danger);
}

.legend-dot.paid {
    background: var(--success);
}

.legend-dot.partial {
    background: var(--warning);
}

.legend-dot.reminder {
    background: var(--primary);
}

.current-month {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
    min-width: 160px;
    text-align: center;
}

/* Drag and Drop */
.calendar-day.drag-over {
    background: var(--primary-light);
    border: 2px dashed var(--primary);
}

.event-chip.dragging {
    opacity: 0.5;
}

/* =====================================================
   Clients
   ===================================================== */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.client-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
}

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

.client-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.client-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.client-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.client-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.client-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.client-stat {
    text-align: center;
}

.client-stat-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.client-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.client-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   Settings
   ===================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.settings-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.settings-card h3 i {
    color: var(--primary);
}

.settings-card select,
.settings-card input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.settings-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

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

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: var(--transition);
    border-radius: 28px;
}

.slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider::before {
    transform: translateX(24px);
}

/* =====================================================
   Modals
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-sm {
    max-width: 400px;
}

.modal-lg {
    max-width: 700px;
}

.modal-xl {
    max-width: 900px;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-default);
    color: var(--text-primary);
}

.modal form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* Payment Invoice Info */
.payment-invoice-info {
    background: var(--bg-default);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.payment-invoice-info h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.payment-invoice-info .invoice-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.payment-invoice-info .info-item {
    display: flex;
    justify-content: space-between;
}

.payment-invoice-info .info-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.payment-invoice-info .info-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Invoice Details Modal */
.invoice-details-content {
    padding: 1.5rem;
}

.invoice-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.invoice-number-large {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.invoice-amount-large {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.invoice-details-section {
    margin-bottom: 1.5rem;
}

.invoice-details-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.client-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-default);
    border-radius: 8px;
}

.client-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.client-profile-info h5 {
    font-weight: 600;
    color: var(--text-primary);
}

.client-profile-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    padding: 1rem;
    background: var(--bg-default);
    border-radius: 8px;
}

.detail-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-item-value {
    font-weight: 600;
    color: var(--text-primary);
}

.payment-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payment-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-default);
    border-radius: 8px;
}

.payment-history-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.payment-history-amount {
    font-weight: 600;
    color: var(--success);
}

.invoice-details-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* File Viewer Modal */
.file-viewer-content {
    padding: 0;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-default);
}

.file-viewer-content iframe {
    width: 100%;
    height: 100%;
}

.file-viewer-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Calendar Invoice Modal */
.calendar-invoice-content {
    padding: 1.5rem;
}

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

.edit-due-date-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.edit-due-date-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* =====================================================
   Dropzone
   ===================================================== */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: var(--bg-default);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

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

.dropzone-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.browse-link {
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
}

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

.dropzone-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.dropzone-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.dropzone-file i {
    font-size: 1.5rem;
    color: var(--danger);
}

.dropzone-file span {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-view-file {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

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

.remove-file {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    cursor: pointer;
    transition: var(--transition);
}

.remove-file:hover {
    background: var(--danger);
    color: white;
}

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

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

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.toast.success .toast-icon {
    background: var(--success-bg);
    color: var(--success);
}

.toast.error .toast-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.toast.warning .toast-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.toast.info .toast-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .search-box {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }
    
    .header-right {
        gap: 1rem;
    }
    
    .currency-selector label {
        display: none;
    }
    
    .user-profile span {
        display: none;
    }
    
    .search-box {
        display: none;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-actions {
        width: 100%;
    }
    
    .page-actions .btn {
        flex: 1;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   COMPREHENSIVE RESPONSIVE - Mobile Android
   ===================================================== */

/* Tablet */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 50;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .header {
        padding: 0 0.75rem;
        height: 56px;
    }
    
    .header-right {
        gap: 0.75rem;
    }
    
    .search-box {
        display: none;
    }
    
    .currency-selector label {
        display: none;
    }
    
    .user-profile span {
        display: none;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .page-actions .btn {
        flex: 1;
        min-width: 120px;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .kpi-card {
        padding: 1rem;
    }
    
    .kpi-value {
        font-size: 1.2rem;
    }
    
    .kpi-label {
        font-size: 0.7rem;
    }
    
    .chart-card,
    .table-card,
    .filters-card,
    .summary-card {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filters-actions {
        flex-direction: column;
    }
    
    .filters-actions .btn {
        width: 100%;
    }
    
    .modal {
        margin: 0.5rem;
        padding: 1.25rem;
        max-height: calc(100vh - 1rem);
        border-radius: 12px;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .calendar-card {
        padding: 0.5rem;
    }
    
    .calendar-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .calendar-grid .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }
    
    .calendar-event {
        font-size: 0.65rem;
        padding: 0.15rem 0.25rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .table-pagination {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* Supplier cards */
    .clients-grid {
        grid-template-columns: 1fr !important;
    }
    
    .client-card {
        padding: 1rem;
    }
    
    /* Settings */
    .settings-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Theme controls on login */
    .theme-controls {
        top: 0.75rem;
        right: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Small Mobile (Android) */
@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-card {
        padding: 0.875rem;
    }
    
    .page-content {
        padding: 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.1rem;
    }
    
    .login-container {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .login-logo .logo-icon {
        width: 56px;
        height: 56px;
    }
    
    .login-header h1 {
        font-size: 1.2rem;
    }
    
    .btn-login {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    .action-btns .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    
    .data-table th,
    .data-table td {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .calendar-grid .calendar-day {
        min-height: 50px;
        font-size: 0.75rem;
    }
    
    .calendar-days-header span {
        font-size: 0.65rem;
    }
    
    .modal {
        margin: 0.25rem;
        padding: 1rem;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .sidebar,
    .header,
    .page-actions,
    .action-btns,
    .filters-card,
    .table-pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-content {
        padding: 0;
    }
}

/* =====================================================
   DARK THEME
   ===================================================== */
[data-theme="dark"] {
    --bg-default: #0f172a;
    --bg-surface: #1e293b;
    --bg-sidebar: #1e293b;
    --overlay: rgba(0, 0, 0, 0.7);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #FFFFFF;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.15);
    
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --success-text: #4ade80;
    
    --warning: #DC2626;
    --warning-bg: rgba(220, 38, 38, 0.15);
    --warning-text: #FFFFFF;
    
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-text: #f87171;
    
    --purple: #8b5cf6;
    --purple-bg: rgba(139, 92, 246, 0.15);
    --purple-text: #a78bfa;
    
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 255, 255, 0.2);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* =====================================================
   CLASSIC STYLE OVERRIDES
   ===================================================== */
[data-style="classic"] {
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'IBM Plex Sans', 'Georgia', serif;
}

[data-style="classic"] .btn {
    border-radius: 4px;
}

[data-style="classic"] .modal {
    border-radius: 8px;
}

[data-style="classic"] .sidebar {
    border-radius: 0;
}

[data-style="classic"] .form-group input,
[data-style="classic"] .form-group select,
[data-style="classic"] .form-group textarea {
    border-radius: 4px;
}

[data-style="classic"] .kpi-card,
[data-style="classic"] .chart-card,
[data-style="classic"] .table-card,
[data-style="classic"] .summary-card,
[data-style="classic"] .filters-card,
[data-style="classic"] .settings-card,
[data-style="classic"] .client-card {
    border-radius: 4px;
}

[data-style="classic"] .badge {
    border-radius: 4px;
}

[data-style="classic"] .calendar-card {
    border-radius: 4px;
}

/* =====================================================
   PRELOADER - GSAP 3 Spinning Arcs
   ===================================================== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.preloader-image-container {
    position: relative;
    width: 80vw;
    max-width: 200px;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-grid {
    position: absolute;
    inset: 0;
}

.preloader-tile {
    position: absolute;
    background-repeat: no-repeat;
    opacity: 0;
}

.preloader-loader-circle {
    position: absolute;
    inset: -20%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.preloader-arc {
    position: absolute;
    border-radius: 50%;
    border: 4px solid transparent;
    will-change: transform;
}

.preloader-arc1 {
    width: 80%;
    height: 80%;
    border-top: 8px solid #DC2626;
}

.preloader-arc2 {
    width: 88%;
    height: 88%;
    border-top: 6px solid #DC2626;
    opacity: 0.7;
}

.preloader-arc3 {
    width: 96%;
    height: 96%;
    border-top: 4px solid #DC2626;
    opacity: 0.4;
}

.preloader-logo-center {
    position: relative;
    width: 200px;
    height: 200px;
    z-index: 2;
}

.preloader-logo-center .logo-svg {
    width: 100%;
    height: 100%;
}

.preloader-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}

.preloader-brand {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.preloader-tagline {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: rgba(220, 38, 38, 0.6);
    letter-spacing: 0.05em;
}

.preloader-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.preloader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffffff, #e5e7eb);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s ease;
}

@media (max-width: 640px) {
    .preloader-image-container {
        width: 60vw;
        max-width: 160px;
    }
    .preloader-brand {
        font-size: 1.2rem;
    }
    .preloader-arc1 { border-top-width: 6px; }
    .preloader-arc2 { border-top-width: 5px; }
    .preloader-arc3 { border-top-width: 3px; }
}

/* =====================================================
   LOGIN PAGE - Split Screen with Illustration
   ===================================================== */
.login-page {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: url('../img/prima-bg.jpg') center center / cover no-repeat fixed;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 0;
}

.login-page.hidden {
    display: none;
}

.login-split {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Illustration Panel - Hidden (background image used instead) */
.login-illustration {
    display: none;
}

.illustration-content {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.finance-illustration {
    width: 100%;
    max-width: 480px;
    height: auto;
}

/* Floating animations */
.float-el-1 { animation: floatA 6s ease-in-out infinite; }
.float-el-2 { animation: floatB 5s ease-in-out infinite; }
.float-el-3 { animation: floatC 7s ease-in-out infinite; }
.float-el-4 { animation: floatD 8s ease-in-out infinite; }
.float-el-5 { animation: floatE 5.5s ease-in-out infinite; }

@keyframes floatA { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes floatB { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes floatC { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes floatD { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes floatE { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

.illustration-text {
    text-align: center;
    color: var(--text-primary);
}

.illustration-text h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.illustration-text p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.illustration-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 0 auto;
    width: fit-content;
}

.illust-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.illust-feature i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
}

/* Form Panel - Centered over background */
.login-form-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
}

.theme-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    z-index: 10;
}

.theme-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    color: #e2e8f0;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.style-selector {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.style-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-body);
}

.style-btn.active {
    background: var(--primary);
    color: white;
}

.style-btn:hover:not(.active) {
    background: var(--bg-default);
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    color: #e2e8f0;
}

.login-container .login-logo .logo-brand,
.login-container h1,
.login-container .login-title {
    color: #ffffff;
}

.login-container .login-subtitle,
.login-container p,
.login-container .logo-subtitle {
    color: #94a3b8;
}

.login-container label {
    color: #cbd5e1;
}

.login-container .input-wrapper input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.login-container .input-wrapper input::placeholder {
    color: #64748b;
}

.login-container .input-wrapper input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
}

.login-container .input-icon {
    color: #64748b;
}

.login-container .security-info {
    color: #94a3b8;
}

.login-container .security-features span {
    color: #94a3b8;
}

.login-container .login-footer {
    color: #64748b;
}

[data-style="classic"] .login-container {
    border-radius: 8px;
}

/* PO Invoice Row */
.po-invoice-row {
    border-left: 3px solid var(--primary) !important;
}


/* Toggle Switch for Rights */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 22px;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Tab active style */
.tab-btn.active {
    border-bottom-color: var(--primary) !important;
    color: var(--primary) !important;
}


/* Responsive: mobile */
@media (max-width: 900px) {
    .login-split {
        padding: 1rem;
    }
    .login-illustration {
        display: none;
    }
    .login-form-panel {
        max-width: 100%;
        padding: 1rem;
    }
    .login-container {
        padding: 1.2rem 1.5rem;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    .login-split {
        padding: 0.5rem;
    }
    .login-container {
        padding: 1rem 1.2rem;
        border-radius: 12px;
    }
    .login-logo .logo-icon {
        width: 60px;
        height: 60px;
    }
    .login-logo .logo-brand {
        font-size: 1.2rem;
    }
    .login-form .form-group {
        margin-bottom: 0.5rem;
    }
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.logo-icon {
    width: 80px;
    height: 80px;
}

.logo-svg-main {
    width: 100%;
    height: 100%;
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-brand {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

.logo-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.login-form .form-group {
    margin-bottom: 0.6rem;
}

.login-form .form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.login-form .form-group label i {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 0.7rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-default);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

[data-style="classic"] .input-wrapper input {
    border-radius: 4px;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light), inset 0 1px 3px rgba(0,0,0,0.04);
    background: var(--bg-surface);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    opacity: 0;
    transition: var(--transition);
}

.input-wrapper input:valid:not(:placeholder-shown) ~ .input-icon {
    opacity: 1;
}

.input-error {
    display: block;
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.375rem;
    min-height: 1rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-options .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-options .checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-options .checkbox-wrapper .checkmark {
    display: none;
}

.forgot-password {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
    transition: var(--transition);
}

.forgot-password:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-login {
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

[data-style="classic"] .btn-login {
    border-radius: 4px;
}

.btn-login .btn-arrow {
    transition: transform 0.3s ease;
}

.btn-login:hover .btn-arrow {
    transform: translateX(4px);
}

.login-attempts-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--warning-text);
    margin-bottom: 1rem;
}

.security-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--danger-text);
    margin-bottom: 1rem;
}

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

.login-demo p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.login-demo code {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--bg-default);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--primary);
    font-family: 'IBM Plex Mono', monospace;
}

.security-info {
    text-align: center;
    margin-top: 1.5rem;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.security-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.security-features span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.security-features span i {
    color: var(--success);
    font-size: 0.6rem;
}

.login-footer {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.honeypot-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* =====================================================
   MODERNIZED FORMS - Shadows & Borders
   ===================================================== */
.form-group input,
.form-group select,
.form-group textarea {
    border: 2px solid var(--border);
    border-radius: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.25s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light), inset 0 1px 3px rgba(0,0,0,0.04);
}

[data-style="classic"] .form-group input,
[data-style="classic"] .form-group select,
[data-style="classic"] .form-group textarea {
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

.filters-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

[data-style="classic"] .filters-card {
    border-radius: 4px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-group input,
.filter-group select {
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.25s ease;
}

[data-style="classic"] .filter-group input,
[data-style="classic"] .filter-group select {
    border-radius: 4px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.filters-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   TABLE FIXES - No Wrap, Aligned Buttons
   ===================================================== */
.data-table {
    table-layout: auto;
    min-width: 900px;
}

.data-table th,
.data-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.data-table td .action-btns {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
}

.data-table td .badge {
    white-space: nowrap;
}

/* Sidebar Theme Toggle */
.sidebar-theme-toggle {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.theme-toggle-sidebar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-default);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-sidebar:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

[data-style="classic"] .kpi-card {
    border-radius: 4px;
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kpi-icon.debt {
    background: var(--danger-bg);
    color: var(--danger);
}

.kpi-icon.paid {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-icon.overdue {
    background: var(--warning-bg);
    color: var(--warning);
}

.kpi-icon.reminder {
    background: var(--primary-light);
    color: var(--primary);
}

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

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card,
.summary-card,
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

[data-style="classic"] .chart-card,
[data-style="classic"] .summary-card,
[data-style="classic"] .table-card {
    border-radius: 4px;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-default);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Summary */
.summary-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-default);
    border-radius: 10px;
}

.summary-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.summary-dot.paid { background: var(--success); }
.summary-dot.unpaid { background: var(--danger); }
.summary-dot.partial { background: var(--warning); }

.summary-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.summary-value {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Style options */
.theme-options,
.style-options {
    display: flex;
    gap: 0.5rem;
}

.theme-option,
.style-option {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.theme-option.active,
.style-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.theme-option:hover:not(.active),
.style-option:hover:not(.active) {
    border-color: var(--text-muted);
}

/* Scrollbar for dark theme */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-default);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--text-muted);
}

/* Logo theme switching */
.logo-dark { display: none; }
.logo-light { display: block; }
[data-theme="dark"] .logo-dark { display: block; }
[data-theme="dark"] .logo-light { display: none; }

/* Login logo theme switching */
.login-logo .logo-icon .logo-light-login { display: block; }
.login-logo .logo-icon .logo-dark-login { display: none; }
[data-theme="dark"] .login-logo .logo-icon .logo-light-login { display: none; }
[data-theme="dark"] .login-logo .logo-icon .logo-dark-login { display: block; }

/* =====================================================
   Utility
   ===================================================== */
.hidden {
    display: none !important;
}

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


/* =====================================================
   BADGES, FORM HELPERS, NEW COMPONENTS
   ===================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-primary { background: rgba(30,64,175,0.15); color: #1E40AF; }
.badge-success { background: rgba(16,185,129,0.15); color: #059669; }
.badge-danger { background: rgba(239,68,68,0.15); color: #DC2626; }
.badge-warning { background: rgba(220,38,38,0.15); color: #DC2626; }
.badge-info { background: rgba(59,130,246,0.15); color: #2563EB; }
.badge-secondary { background: rgba(107,114,128,0.15); color: #6B7280; }

[data-theme="dark"] .badge-primary { background: rgba(59,130,246,0.2); color: #93C5FD; }
[data-theme="dark"] .badge-success { background: rgba(16,185,129,0.2); color: #6EE7B7; }
[data-theme="dark"] .badge-danger { background: rgba(239,68,68,0.2); color: #FCA5A5; }
[data-theme="dark"] .badge-warning { background: rgba(220,38,38,0.2); color: #FCA5A5; }
[data-theme="dark"] .badge-info { background: rgba(59,130,246,0.2); color: #93C5FD; }

.form-error {
    padding: 10px 14px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    color: #DC2626;
    font-size: 13px;
    margin: 8px 0;
}
.form-success {
    padding: 10px 14px;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: 8px;
    color: #059669;
    font-size: 13px;
    margin: 8px 0;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}
.btn-full {
    width: 100%;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}
.help-text {
    font-size: 12px;
    color: var(--muted, #999);
    margin-top: 4px;
}
.setting-item {
    margin: 12px 0;
}
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    vertical-align: middle;
    margin-left: 8px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}
.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}
.switch input:checked + .slider { background-color: #1E40AF; }
.switch input:checked + .slider:before { transform: translateX(22px); }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; }
    .settings-grid .settings-card[style*="grid-column"] { grid-column: auto !important; }
}
.permissions-grid { margin: 12px 0; }
.permissions-grid table { font-size: 13px; }
.permissions-grid td, .permissions-grid th { padding: 8px 12px; }

.modal-description {
    font-size: 14px;
    color: var(--muted, #666);
    margin-bottom: 16px;
}
.input-icon-wrapper {
    position: relative;
}
.input-icon-wrapper input {
    padding-right: 40px;
}
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted, #999);
}
.login-link a {
    color: var(--primary, #1E40AF);
    text-decoration: none;
}
.login-link a:hover { text-decoration: underline; }
.app-footer {
    text-align: center;
    padding: 16px 30px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-surface);
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 10;
}

.sidebar-collapsed ~ main .app-footer {
    left: var(--sidebar-collapsed-width);
}

@media (max-width: 768px) {
    .app-footer {
        left: 0;
    }
}
