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

:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --primary-dark: #0f172a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #6b7280;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-800: #f3f4f6;
    --gray-900: #f9fafb;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 14px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== LAYOUT ==================== */

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    padding: 24px 0;
    position: relative;
}

[data-theme="dark"] .sidebar {
    background: var(--gray-100);
    border-right-color: var(--gray-300);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    position: relative;
}

.theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 16px;
    border-radius: 8px;
    background: white;
    border: 2px solid var(--gray-200);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    z-index: 100;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 12px;
}

[data-theme="dark"] .theme-switcher {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.theme-switcher:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--gray-50);
}

/* ==================== NAVIGATION ==================== */

.nav-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

[data-theme="dark"] .nav-header {
    border-bottom-color: var(--gray-300);
}

.nav-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: var(--gray-600);
    border-left: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
    border-left-color: var(--primary);
}

[data-theme="dark"] .nav-link:hover {
    background: var(--gray-200);
}

.nav-link.active {
    background: var(--gray-100);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] .nav-link.active {
    background: transparent;
}

/* ==================== HEADERS & CARDS ==================== */

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 14px;
}

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .card {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

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

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.summary-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .summary-card {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translate(0, 0); }
    50% { transform: translate(10px, 10px); }
    100% { transform: translate(0, 0); }
}

.summary-card-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-card-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.summary-card-change {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 500;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ==================== FORMS & INPUTS ==================== */

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

[data-theme="dark"] label {
    color: var(--gray-300);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: var(--gray-800);
    transition: all 0.3s ease;
    font-family: inherit;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--gray-200);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

/* Checkout input styling */
.checkout-input {
    width: 60px !important;
    padding: 4px !important;
    border: 1px solid var(--gray-300) !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    text-align: right;
}

[data-theme="dark"] .checkout-input {
    background: var(--gray-200) !important;
    border-color: var(--gray-400) !important;
    color: var(--gray-900) !important;
}

.checkout-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1) !important;
}

[data-theme="dark"] .checkout-input:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1) !important;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: white;
}

[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(30, 58, 138, 0.3);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.2);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

[data-theme="dark"] .btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-400);
}

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

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* ==================== TABLES ==================== */

.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
}

[data-theme="dark"] .table-container {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

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

thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

[data-theme="dark"] thead {
    background: var(--gray-200);
    border-bottom-color: var(--gray-400);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
    position: sticky;
    top: 0;
    z-index: 1;
}

[data-theme="dark"] th {
    color: var(--gray-300);
    background: var(--gray-200);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

[data-theme="dark"] td {
    border-bottom-color: var(--gray-300);
}

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

[data-theme="dark"] tbody tr:hover {
    background: var(--gray-300);
}

/* ==================== SEARCH & FILTER ==================== */

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
}

.filter-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group select {
    width: auto;
    min-width: 150px;
}

/* ==================== MODAL ==================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 28px;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .modal-content {
    background: var(--gray-100);
}

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

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--gray-300);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

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

[data-theme="dark"] .modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--gray-300);
}

/* ==================== PAGINATION ==================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.pagination a,
.pagination span,
.pagination .pagination-link {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

[data-theme="dark"] .pagination a,
[data-theme="dark"] .pagination span {
    border-color: var(--gray-400);
    color: var(--gray-300);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .active,
.pagination .pagination-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    cursor: default;
}

/* ==================== UTILITY CLASSES ==================== */

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

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

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.hidden {
    display: none !important;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-300);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1024px) {
    .main-content {
        padding: 20px 24px;
    }
    
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        border-bottom: 1px solid var(--gray-200);
        border-right: none;
        padding: 12px 0;
        display: block;
        overflow-x: visible;
        overflow-y: visible;
    }
    
    .nav-header {
        padding: 0 16px 12px;
        border-bottom: 1px solid var(--gray-200);
        margin-bottom: 12px;
    }
    
    .nav-title {
        font-size: 16px;
    }
    
    .nav-menu {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        padding: 0 8px;
    }
    
    .nav-item {
        margin-bottom: 0;
    }
    
    .nav-link {
        padding: 10px 12px;
        font-size: 13px;
        white-space: normal;
        text-align: center;
    }
    
    .main-content {
        padding: 12px 16px;
        flex: 1;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .summary-card {
        padding: 16px;
    }
    
    .summary-card-value {
        font-size: 22px;
    }
    
    .card {
        padding: 16px;
        border-radius: 10px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn, .btn-primary, .btn-secondary, .btn-success, .btn-danger {
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .search-bar {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .filter-group input,
    .filter-group select {
        width: 100%;
    }
    
    /* Checkout grid layout for mobile */
    [style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="position: sticky"] {
        position: static !important;
    }
    
    .modal-content {
        max-width: calc(100% - 20px);
        width: 100%;
        padding: 20px;
        border-radius: 10px;
    }
    
    .modal-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .pagination a,
    .pagination span {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 32px;
    }
    
    h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 8px 0;
    }
    
    .nav-header {
        padding: 0 12px 8px;
    }
    
    .nav-menu {
        grid-template-columns: 1fr;
        padding: 0 4px;
        gap: 2px;
    }
    
    .nav-link {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .main-content {
        padding: 10px 12px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .summary-card {
        padding: 14px;
    }
    
    .summary-card-value {
        font-size: 20px;
    }
    
    .summary-card-label {
        font-size: 11px;
    }
    
    .card {
        padding: 12px;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .modal-content {
        padding: 16px;
    }
}
