:root {
    --primary: #0ea5e9; /* 亮蓝色 */
    --primary-hover: #0284c7;
    --secondary: #1e293b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --light: #f9fafb;
    --dark: #0f172a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    
    --sidebar-width: 260px;
    --sidebar-bg: #374151; /* 极简深灰黑 */
    --sidebar-text: #f3f4f6;
    --sidebar-active: #1f2937;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-700);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s;
}

.logo {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.logo h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    text-align: center;
}

.nav-links {
    flex: 1;
    padding: 1.5rem 0.75rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-links a i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-links a.active {
    background-color: var(--primary);
    color: white;
}

.system-info {
    padding: 1.25rem;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: 64px;
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-container {
    max-width: 400px;
    width: 100%;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
}

.search-box i {
    color: var(--gray-400);
    margin-right: 0.5rem;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.875rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

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

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

/* Page Content */
.page-content {
    padding: 1rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 1rem;
    overflow: hidden;
}

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

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

.card-body {
    padding: 1.5rem;
}

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

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

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-1 .stat-icon { background-color: #e0e7ff; color: #4338ca; }
.stat-2 .stat-icon { background-color: #d1fae5; color: #059669; }
.stat-3 .stat-icon { background-color: #fee2e2; color: #dc2626; }
.stat-4 .stat-icon { background-color: #fef3c7; color: #d97706; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

th {
    background-color: var(--gray-50);
    padding: 0.5rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

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

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

.profit-high { background-color: #d1fae5; color: #065f46; }
.profit-medium { background-color: #fef3c7; color: #92400e; }
.profit-low { background-color: #fee2e2; color: #991b1b; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    gap: 0.5rem;
    text-decoration: none;
}

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

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

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

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

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

.btn-outline:hover {
    background-color: var(--gray-50);
}

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

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

.form-group {
    margin-bottom: 1.25rem;
}

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

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Table inputs compact */
td .form-control {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

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

/* Login Page specific */
.login-page {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: white;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
}

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

.login-header i {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
}

.login-error {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-hint {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .top-bar {
        padding: 0 1rem;
    }
    
    .search-container {
        display: none;
    }
    
    .page-content {
        padding: 1rem;
    }
}

/* Alert Message */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success { background-color: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.alert-error { background-color: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }
