:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --sidebar-width: 240px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--gray-50); color: var(--gray-900); line-height: 1.6;
}
.sidebar {
    position: fixed; left: 0; top: 0; width: var(--sidebar-width); height: 100vh;
    background: var(--gray-900); color: white; z-index: 100; display: flex; flex-direction: column;
}
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.sidebar-brand span { font-size: 12px; color: var(--gray-500); }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    color: var(--gray-300); text-decoration: none; border-radius: 8px;
    font-size: 14px; margin-bottom: 2px; transition: all .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: white; }
.sidebar-nav a.active { background: var(--primary); color: white; }
.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }
.main { margin-left: var(--sidebar-width); min-height: 100vh; }
.page-header {
    background: white; padding: 20px 32px; border-bottom: 1px solid var(--gray-200);
    display: flex; justify-content: space-between; align-items: center;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-body { padding: 24px 32px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .value.profit { color: var(--success); }
.stat-card .value.revenue { color: var(--primary); }
.stat-card .value.cost { color: var(--danger); }
.stat-card .trend { font-size: 12px; margin-top: 4px; }
.stat-card .trend.up { color: var(--success); }
.stat-card .trend.down { color: var(--danger); }
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
th {
    background: var(--gray-50); font-weight: 600; color: var(--gray-700);
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
}
tr:hover { background: var(--gray-50); }
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    border: none; border-radius: 8px; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300);
    border-radius: 8px; font-size: 14px; transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
select.form-control {
    appearance: none;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white; border-radius: var(--radius); width: 90%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-500); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--gray-200);
    display: flex; justify-content: flex-end; gap: 8px;
}
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.chart-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--gray-700); }
.chart-card canvas { width: 100% !important; }
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar select, .filter-bar input { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; }
.amount-positive { color: var(--success); font-weight: 600; }
.amount-negative { color: var(--danger); font-weight: 600; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: var(--gray-200); color: var(--gray-700); }
.toast {
    position: fixed; top: 20px; right: 20px; padding: 12px 20px;
    border-radius: 8px; color: white; font-size: 14px; z-index: 999;
    opacity: 0; transform: translateY(-10px); transition: all .3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .charts-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
