/*
Theme Name: 2LAMARKETING SaaS
Theme URI: https://www.2lamarketing.com
Author: 2LAMARKETING
Author URI: https://www.2lamarketing.com
Description: Complete SaaS invoicing and business management platform for 2LAMARKETING. Includes dashboard, clients, estimates, invoices, purchase orders, credit notes, receipts, delivery notes, transactions, products & services, suppliers, and company settings.
Version: 1.0.0
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: 2lamarketing-saas
Tags: saas, invoicing, business-management, dashboard
*/

/* ========================================
   CSS RESET & BASE
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy: #172136;
    --blue: #1870fe;
    --blue-hover: #1560d6;
    --blue-light: rgba(24, 112, 254, 0.1);
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --transition: 0.2s ease;
    --radius: 0.625rem;
    --radius-sm: 0.375rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
    --font: 'Montserrat', sans-serif;
}

/* Dark mode variables */
body.dark-mode {
    --white: #1e293b;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color var(--transition);
}

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

/* ========================================
   APP LAYOUT
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 64px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

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

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: all var(--transition);
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-item.active {
    background: rgba(24, 112, 254, 0.15);
    color: var(--blue);
    border-left-color: var(--blue);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item .nav-icon svg {
    width: 20px;
    height: 20px;
}

.sidebar.collapsed .nav-item .nav-label {
    display: none;
}

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

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    background: none;
    border: none;
    width: 100%;
    transition: color var(--transition);
    white-space: nowrap;
}

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

.sidebar.collapsed .logout-btn .nav-label {
    display: none;
}

/* ========================================
   MAIN AREA
   ======================================== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-area {
    margin-left: var(--sidebar-collapsed);
}

/* ========================================
   TOPBAR
   ======================================== */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

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

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--gray-600);
}

.hamburger-btn svg {
    width: 24px;
    height: 24px;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

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

.lang-toggle,
.currency-select,
.dark-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lang-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
}

.lang-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.lang-btn:hover:not(.active) {
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.currency-select select {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    font-family: var(--font);
}

.dark-toggle button {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.375rem;
    cursor: pointer;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.dark-toggle button:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.dark-toggle button svg {
    width: 18px;
    height: 18px;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 0.5rem;
    display: none;
    z-index: 200;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: var(--font);
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--gray-100);
}

/* ========================================
   CONTENT AREA
   ======================================== */
.content-area {
    flex: 1;
    padding: 1.5rem;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.card-body {
    padding: 1.25rem;
}

/* ========================================
   KPI CARDS
   ======================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

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

.kpi-icon.blue { background: var(--blue-light); color: var(--blue); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.orange { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }

.kpi-icon svg {
    width: 24px;
    height: 24px;
}

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

.kpi-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

.kpi-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

/* ========================================
   CHARTS
   ======================================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.chart-card .card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.chart-card .card-body {
    padding: 1rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 200px;
    padding-top: 1rem;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    height: 100%;
    justify-content: flex-end;
}

.bar-fill {
    width: 100%;
    max-width: 40px;
    background: var(--blue);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    min-height: 4px;
}

.bar-label {
    font-size: 0.6875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.bar-amount {
    font-size: 0.625rem;
    color: var(--gray-400);
    font-weight: 600;
}

.pie-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

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

/* ========================================
   TABLES
   ======================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

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

thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--gray-50);
}

/* ========================================
   STATUS BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-sent { background: var(--info-bg); color: var(--info); }
.badge-paid { background: var(--success-bg); color: var(--success); }
.badge-overdue { background: var(--danger-bg); color: var(--danger); }
.badge-cancelled { background: var(--gray-100); color: var(--gray-400); }
.badge-accepted { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-partial { background: var(--warning-bg); color: var(--warning); }
.badge-income { background: var(--success-bg); color: var(--success); }
.badge-expense { background: var(--danger-bg); color: var(--danger); }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
    line-height: 1.5;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

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

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-800);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24, 112, 254, 0.15);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

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

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.show .modal {
    transform: translateY(0);
}

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

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

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

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

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

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    display: flex;
}

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

/* ========================================
   SEARCH & FILTER BAR
   ======================================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font);
    color: var(--gray-800);
}

.search-box input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24, 112, 254, 0.15);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-500);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ========================================
   LINE ITEMS TABLE
   ======================================== */
.line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.line-items-table th {
    text-align: left;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    border-bottom: 1px solid var(--gray-200);
}

.line-items-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

.line-items-table .form-input {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
}

.line-item-total {
    text-align: right;
    font-weight: 600;
}

.totals-section {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.totals-table {
    width: 280px;
}

.totals-table tr td {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.totals-table tr td:last-child {
    text-align: right;
    font-weight: 600;
}

.totals-table tr.grand-total td {
    border-top: 2px solid var(--gray-300);
    padding-top: 0.75rem;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--gray-900);
}

/* ========================================
   QUICK ACTIONS
   ======================================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.quick-action-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    box-shadow: var(--shadow-md);
}

.quick-action-btn svg {
    width: 20px;
    height: 20px;
    color: var(--blue);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    .sidebar.collapsed.mobile-open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .sidebar.collapsed ~ .main-area {
        margin-left: 0;
    }

    .hamburger-btn {
        display: flex;
    }

    .sidebar-toggle {
        display: none;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .user-name {
        display: none;
    }

    .modal {
        width: 95%;
        max-height: 85vh;
    }

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

@media (max-width: 480px) {
    .topbar-right {
        gap: 0.5rem;
    }

    .lang-btn {
        padding: 0.125rem 0.375rem;
        font-size: 0.6875rem;
    }

    .currency-select select {
        font-size: 0.75rem;
        padding: 0.25rem;
    }

    .kpi-value {
        font-size: 1.25rem;
    }
}

/* ========================================
   MOBILE SIDEBAR OVERLAY
   ======================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

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

/* ========================================
   LOADING SPINNER
   ======================================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

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

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ========================================
   ACTIONS COLUMN
   ======================================== */
.actions-cell {
    display: flex;
    gap: 0.25rem;
}

.action-btn {
    padding: 0.25rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.action-btn.edit:hover { color: var(--blue); }
.action-btn.delete:hover { color: var(--danger); }
.action-btn.view:hover { color: var(--success); }

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1rem;
}

.pagination button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: var(--font);
    transition: all var(--transition);
}

.pagination button:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pagination button.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   DETAIL VIEW
   ======================================== */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-field-value {
    font-size: 0.9375rem;
    color: var(--gray-800);
    font-weight: 500;
}

/* ========================================
   TABS
   ======================================== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font);
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

/* ========================================
   MOBILE SIDEBAR OVERLAY
   ======================================== */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.mobile-overlay.show {
    display: block;
}

/* ========================================
   SKELETON LOADER
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ========================================
   CONFIRM DIALOG
   ======================================== */
.confirm-dialog {
    text-align: center;
    padding: 1rem 0;
}

.confirm-dialog svg {
    width: 48px;
    height: 48px;
    color: var(--warning);
    margin-bottom: 1rem;
}

.confirm-dialog h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.confirm-dialog p {
    font-size: 0.875rem;
    color: var(--gray-500);
}
