:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 1px 0 15px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

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

.logo-icon {
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

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

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.sidebar-nav a i {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.sidebar-nav a:hover i {
    transform: scale(1.1);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.sidebar-nav a.active i {
    color: white;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    background: rgba(255, 255, 255, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}

.user-profile img {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

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

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.top-header {
    height: 80px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    z-index: 5;
}

.header-search {
    display: flex;
    align-items: center;
    background: white;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-full);
    width: 350px;
    border: 1px solid var(--border);
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    width: 400px;
}

.header-search i {
    color: var(--text-muted);
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
}

.header-search input::placeholder {
    color: #94a3b8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.content-wrapper {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

/* Typography & Core UI */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.5s ease-out;
}

.page-title h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(79, 70, 229, 0.05);
}

.btn-icon {
    background: white;
    color: var(--text-muted);
    padding: 0.6rem;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Metrics Grid Settings */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s ease-out backwards;
    animation-delay: 0.1s;
}

.metric-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 1);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card:nth-child(1)::before {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}

.metric-card:nth-child(2)::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.metric-card:nth-child(3)::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.metric-card:nth-child(4)::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.bg-indigo {
    background: #e0e7ff;
    color: #4f46e5;
}

.bg-blue {
    background: #dbeafe;
    color: #2563eb;
}

.bg-emerald {
    background: #d1fae5;
    color: #059669;
}

.bg-rose {
    background: #ffe4e6;
    color: #e11d48;
}

.metric-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin: 0.5rem 0;
    letter-spacing: -0.02em;
}

.metric-trend {
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    background: var(--background);
    width: fit-content;
}

.metric-trend.up {
    color: var(--success);
    background: #d1fae5;
}

.metric-trend.down {
    color: var(--danger);
    background: #ffe4e6;
}

/* Pre-designed Dashboard specific elements */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    animation: fadeInUp 0.6s ease-out backwards;
    animation-delay: 0.2s;
}

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

/* Tables */
.section-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.section-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.5);
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 1.25rem 2rem;
    text-align: left;
}

.data-table th {
    background-color: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    background: transparent;
    font-size: 0.95rem;
}

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

.data-table tr:hover td {
    background-color: rgba(248, 250, 252, 0.8);
}

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

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.font-medium {
    font-weight: 600;
}

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

.mt-2 {
    margin-top: 1rem;
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.badge-draft {
    background: #f1f5f9;
    color: #475569;
}

.badge-sent {
    background: #eff6ff;
    color: #2563eb;
}

.badge-paid {
    background: #ecfdf5;
    color: #059669;
}

.badge-overdue {
    background: #fef2f2;
    color: #dc2626;
}

/* Helpers & Utilities */
.customer-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.bg-indigo-light {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4f46e5;
    border: 2px solid white;
}

.empty-state {
    padding: 5rem 2rem !important;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.3;
}

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

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: white;
}

.form-row {
    display: flex;
    gap: 2rem;
}

.form-col {
    flex: 1;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animation-fade-in {
    animation: fadeInUp 0.4s ease-out;
}

/* Dashboard Specific Layout Additions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
}

.action-card i {
    font-size: 1.5rem;
    color: var(--primary);
    background: #e0e7ff;
    padding: 0.75rem;
    border-radius: var(--radius-md);
}

.action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Print/View Invoice specific */
.invoice-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 4rem;
    margin: 0 auto;
    max-width: 900px;
    border-top: 8px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 2px solid var(--border);
}

.invoice-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.05em;
    text-transform: uppercase;
}