:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.09);
  --text: #1a1a2e;
  --muted: #6b7280;
  --accent: #E94560;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: rgba(255,255,255,0.7);
  --sidebar-active: #ffffff;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: var(--bg); color: var(--text); }

/* Layout */
body { display: flex; min-height: 100vh; }
.sidebar { width: 220px; min-height: 100vh; background: var(--sidebar-bg); display: flex; flex-direction: column; padding: 1.25rem 0; position: fixed; top: 0; left: 0; bottom: 0; }
.main-content { margin-left: 220px; flex: 1; padding: 2rem; max-width: 1100px; }

/* Sidebar */
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 0 1.25rem 1.25rem; font-weight: 600; font-size: 15px; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 0.75rem; }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 0.75rem 1.25rem; font-size: 13px; color: var(--sidebar-text); border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 0.5rem; }
.nav-links { list-style: none; flex: 1; }
.nav-links li a { display: flex; align-items: center; gap: 10px; padding: 10px 1.25rem; color: var(--sidebar-text); text-decoration: none; font-size: 13px; transition: all 0.15s; }
.nav-links li a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-links li a.active { color: var(--sidebar-active); background: rgba(255,255,255,0.1); border-right: 2px solid var(--accent); }
.nav-links li a svg { width: 16px; height: 16px; flex-shrink: 0; }
.logout-btn { display: flex; align-items: center; gap: 8px; padding: 10px 1.25rem; color: rgba(255,255,255,0.4); text-decoration: none; font-size: 12px; margin-top: auto; }
.logout-btn svg { width: 14px; height: 14px; }
.logout-btn:hover { color: #fff; }

/* Page */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }

/* Metrics */
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 1.5rem; }
.metric-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.metric-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.metric-value { font-size: 18px; font-weight: 600; }

/* Two column */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }

/* Section title */
.section-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }

/* Partner card */
.partner-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 10px; }
.partner-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.partner-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.partner-stats > div { font-size: 12px; }
.partner-stats > div span { color: var(--muted); display: block; }
.partner-stats > div strong { font-size: 13px; }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 10px; flex-shrink: 0; }

/* Car cards */
.car-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 10px; }
.car-stats { display: flex; gap: 1rem; margin-top: 8px; flex-wrap: wrap; }
.car-stats > div { font-size: 12px; }
.car-stats > div span { color: var(--muted); display: block; }
.car-full-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 12px; }
.car-full-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.car-financials { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--border); }
.fin-item { font-size: 13px; }
.fin-item span { display: block; font-size: 11px; color: var(--muted); }
.notes-box { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; line-height: 1.6; }
.profit-split { margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--border); }
.exp-sub-list { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--border); }
.exp-sub-row { display: grid; grid-template-columns: 100px 1fr 80px 80px; gap: 8px; font-size: 12px; padding: 4px 0; color: var(--muted); border-bottom: 0.5px solid var(--border); }
.exp-sub-row:last-child { border-bottom: none; }

/* Filter bar */
.filter-bar { display: flex; gap: 6px; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-btn { padding: 5px 14px; border-radius: 20px; border: 0.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12px; color: var(--muted); }
.filter-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

/* Progress */
.progress-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 0.5px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 0.5px solid var(--border); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* Buttons */
.btn { padding: 7px 16px; border-radius: var(--radius-sm); border: 0.5px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; font-family: inherit; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { opacity: 0.88; background: var(--text); }
.btn-danger { color: var(--color-danger); border-color: rgba(220,38,38,0.3); }
.btn-danger:hover { background: rgba(220,38,38,0.05); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-full { width: 100%; text-align: center; padding: 10px; }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 20px; }
.badge-success { background: rgba(22,163,74,0.1); color: #16a34a; }
.badge-warning { background: rgba(217,119,6,0.1); color: #d97706; }
.badge-info { background: rgba(37,99,235,0.1); color: #2563eb; }
.tag { background: var(--bg); padding: 2px 8px; border-radius: 4px; font-size: 12px; color: var(--muted); }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 13px; }
.alert-success { background: rgba(22,163,74,0.08); color: #15803d; border: 0.5px solid rgba(22,163,74,0.2); }
.alert-danger { background: rgba(220,38,38,0.07); color: #b91c1c; border: 0.5px solid rgba(220,38,38,0.2); }
.alert-warning { background: rgba(217,119,6,0.08); border: 0.5px solid rgba(217,119,6,0.3); color: var(--text); display: flex; gap: 12px; align-items: flex-start; padding: 14px; }
.alert-big { border-radius: var(--radius); margin-bottom: 1.5rem; }
.alert-warning svg { flex-shrink: 0; color: #d97706; margin-top: 1px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; display: none; align-items: center; justify-content: center; padding: 1rem; cursor: default; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-head h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 0.5px solid var(--border); }

/* Pos / Neg */
.pos { color: var(--color-success); }
.neg { color: var(--color-danger); }

/* Empty */
.empty-state { text-align: center; padding: 2.5rem; color: var(--muted); font-size: 13px; }
.empty-state a { color: var(--accent); text-decoration: none; }

/* Login */
.login-page { background: var(--bg); display: block; }
.login-wrap { max-width: 380px; margin: 80px auto; padding: 1rem; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 2rem; }
.login-title { font-size: 18px; font-weight: 600; }
.login-sub { font-size: 12px; color: var(--muted); }
.login-form { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.login-hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 10px; }
.login-hint code { background: var(--bg); padding: 1px 5px; border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-height: auto; position: relative; flex-direction: row; flex-wrap: wrap; padding: 0.75rem; }
  .main-content { margin-left: 0; padding: 1rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .nav-links { display: flex; flex: none; width: 100%; overflow-x: auto; }
  .nav-links li a { padding: 8px 12px; white-space: nowrap; }
  .sidebar-logo, .sidebar-user { padding: 8px 12px; }
  .logout-btn { padding: 8px 12px; margin-top: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .exp-sub-row { grid-template-columns: 1fr 1fr; }
}
