* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --info-color: #4895ef;
    --dark-color: #1b263b;
    --light-color: #f8f9fa;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f5f7fb;
    color: #333;
    line-height: 1.6;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    min-height: 600px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.login-box {
    flex: 1;
    padding: 60px 40px;
    background: white;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-header .logo i {
    font-size: 40px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-info {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 40px;
    color: white;
    display: flex;
    align-items: center;
}

.info-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    font-weight: 600;
}

.info-content p {
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.9;
}

.features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.feature i {
    font-size: 20px;
}

/* ==================== LOGIN FORM ==================== */
.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.login-form label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 14px;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.password-input {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.login-footer {
    margin-top: 40px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

.login-footer .version {
    margin-top: 5px;
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: #fee;
    color: var(--danger-color);
    border: 1px solid #fcc;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* ==================== APP LAYOUT ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: var(--box-shadow);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .user-details,
.sidebar.collapsed .footer-link span {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #edf2f7;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 24px;
    color: var(--primary-color);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-color);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: #f0f4f8;
    color: var(--primary-color);
}

.user-info {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #edf2f7;
}

.user-avatar i {
    font-size: 48px;
    color: var(--primary-color);
}

.user-details {
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 3px;
}

.user-role {
    font-size: 12px;
    color: #666;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    margin: 5px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #64748b;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.nav-link i:first-child {
    width: 20px;
    margin-right: 10px;
    font-size: 18px;
}

.nav-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.submenu-icon {
    font-size: 12px;
    transition: var(--transition);
}

.has-submenu.open .submenu-icon {
    transform: rotate(90deg);
}

.nav-item.active > .nav-link {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(63, 55, 201, 0.1));
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.submenu {
    list-style: none;
    padding-left: 45px;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
}

.has-submenu.open .submenu {
    max-height: 300px;
}

.submenu li {
    margin: 5px 0;
}

.submenu a {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    border-radius: 8px;
    transition: var(--transition);
    gap: 8px;
}

.submenu a i {
    font-size: 6px;
    color: #94a3b8;
}

.submenu a:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.submenu li.active a {
    color: var(--primary-color);
    font-weight: 500;
}

.submenu li.active a i {
    color: var(--primary-color);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #edf2f7;
    display: flex;
    gap: 10px;
}

.footer-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 13px;
}

.footer-link:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.footer-link.logout:hover {
    background: #fee;
    color: var(--danger-color);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    background: #f5f7fb;
    min-height: 100vh;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.content-header {
    height: var(--header-height);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    box-shadow: var(--box-shadow);
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary-color);
}

.date-display {
    color: #666;
    font-size: 14px;
}

.date-display i {
    margin-right: 8px;
    color: var(--primary-color);
}

/* ==================== DASHBOARD CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 24px;
    color: white;
}

.stat-details h3 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 3px;
}

.stat-label {
    font-size: 12px;
    color: #999;
}

/* ==================== CHARTS ==================== */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    padding: 0 30px 30px;
}

.chart-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
}

.btn-icon {
    width: 35px;
    height: 35px;
    border: none;
    background: #f0f4f8;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
}

.card-body {
    height: 250px;
}

/* ==================== TABLES ==================== */
.tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    padding: 0 30px 30px;
}

.table-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-link:hover {
    text-decoration: underline;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #edf2f7;
}

.data-table td {
    padding: 12px 10px;
    font-size: 14px;
    border-bottom: 1px solid #edf2f7;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
}

.data-table a:hover {
    color: var(--primary-color);
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.status-in_progress {
    background: #e3f2fd;
    color: #1976d2;
}

.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-estimation {
    background: #fff3e0;
    color: #f57c00;
}

.status-archived {
    background: #f5f5f5;
    color: #616161;
}

.status-sent {
    background: #e3f2fd;
    color: #1976d2;
}

.status-paid {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-overdue {
    background: #ffebee;
    color: #c62828;
}

.status-draft {
    background: #f5f5f5;
    color: #616161;
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
    padding: 0 30px 30px;
}

.quick-actions h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 15px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--dark-color);
    transition: var(--transition);
    box-shadow: var(--box-shadow);
    gap: 10px;
}

.action-btn i {
    font-size: 24px;
    color: var(--primary-color);
}

.action-btn span {
    font-size: 13px;
    font-weight: 500;
}

.action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    background: var(--primary-color);
    color: white;
}

.action-btn:hover i {
    color: white;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .login-container {
        flex-direction: column;
        margin: 20px;
    }
    
    .login-box {
        padding: 40px 20px;
    }
    
    .stats-grid,
    .charts-row,
    .tables-row,
    .quick-actions {
        padding: 20px;
    }
    
    .charts-row,
    .tables-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-header {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
        gap: 10px;
        align-items: flex-start;
    }
    
    .login-container {
        margin: 10px;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}