:root {
  /* --- LIGHT MODE (Clean Enterprise) --- */
  --primary: #3b82f6;       /* Bright Blue */
  --secondary: #8b5cf6;     /* Violet */
  --accent: #10b981;        /* Emerald Green */
  --warn: #f59e0b; 
  --error: #ef4444;
  
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --text: #0f172a;           /* Slate 900 */
  --text-muted: #64748b;     /* Slate 500 */
  --text-light: #94a3b8;
  
  --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);
  --radius: 12px;
  --radius-sm: 8px;
}

body.dark {
  /* --- DARK MODE (High-End Tech Theme) --- */
  /* Background: Deep rich indigo-black */
  --bg: #0b0c15;            
  
  /* UI Elements: Dark Navy with a hint of purple */
  --bg-subtle: #151621;     
  --card: #151621;          
  
  /* Borders: Very subtle */
  --border: #232433;
  --border-strong: #2e3048;
  
  /* Typography: Stark White vs Cool Grey */
  --text: #ffffff;
  --text-muted: #8F9BB3;
  --text-light: #586386;
  
  /* Accents: "Electric" Cyberpunk colors */
  --primary: #3b82f6;       /* Electric Blue */
  --secondary: #a855f7;     /* Neon Purple */
  --accent: #f43f5e;        /* Hot Pink */
  
  /* Glows & Shadows */
  --primary-glow: rgba(59, 130, 246, 0.2);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.5);
  --shadow: 0 8px 30px rgba(0,0,0,0.5); /* Deep, soft shadow */
}

* { box-sizing: border-box; transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
html, body { height: 100%; margin: 0; padding: 0; overflow-x: hidden; }

body {
  padding: 32px;
  font-family: 'Plus Jakarta Sans', Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* --- Header & Controls --- */
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }

.header-controls { display: flex; gap: 12px; }

h1 {
  font-size: 26px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  background: linear-gradient(135deg, var(--text) 50%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.theme-toggle, .btn-secondary {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}
.theme-toggle:hover, .btn-secondary:hover { 
  border-color: var(--primary); 
  color: var(--primary); 
  background: var(--card);
}

/* --- EMPTY STATE --- */
.empty-state-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  height: 100%; min-height: 250px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; filter: grayscale(1); }
.empty-msg { font-size: 14px; font-weight: 500; margin-bottom: 16px; max-width: 250px; }
.btn-small {
  padding: 6px 12px; font-size: 12px; font-weight: 600; 
  background: var(--bg-subtle); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
}
.btn-small:hover { background: var(--border); }

/* --- Status Bar --- */
.status-bar { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 32px; flex-wrap: wrap; }
.status-item { 
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; 
  background: var(--card); border-radius: 100px;
  border: 1px solid var(--border); 
  box-shadow: var(--shadow-sm);
}
.status-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.status-indicator.success { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status-indicator.error { background: var(--error); }

/* --- Modern Tabs --- */
.tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 32px 0;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.tab-button:hover { color: var(--text); }
.tab-button.active {
  color: var(--primary);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* === THIS SECTION WAS MISSING === */
.tab-content { display: none; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-content.active { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* ================================ */

/* --- Layout Grid --- */
.section { margin-bottom: 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { 
  font-size: 14px; 
  font-weight: 700; 
  color: var(--text); 
  text-transform: uppercase; 
  letter-spacing: 0.05em; 
  display: flex; align-items: center; gap: 8px; 
}
.section-title::before { content:''; display: block; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.card:hover { 
  border-color: var(--border-strong); 
  box-shadow: var(--shadow);
}

.legend { 
  font-size: 11px; 
  color: var(--text-muted); 
  font-weight: 700; 
  text-transform: uppercase; 
  letter-spacing: 0.08em; 
  margin-bottom: 16px; 
}

/* --- KPIs --- */
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; justify-content: center;
  min-height: 120px;
  position: relative;
}
.kpi::after {
  content: ''; position: absolute; top: 0; left: 24px; right: 24px; height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi h3 { margin: 0 0 12px 0; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.kpi .val { font-size: 36px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.02em; }

/* --- Controls/Inputs --- */
.toolbar {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 24px;
  padding: 16px; background: var(--bg-subtle); border-radius: var(--radius); border: 1px solid var(--border);
}
.pill { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
select {
  appearance: none; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 36px 10px 14px; min-width: 160px; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-sm);
  background-image: 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='%2364748b' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: all 0.2s;
}
select:hover { border-color: var(--text-muted); }
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* --- List Styles --- */
.partners-list li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 16px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.partners-list li:hover { border-color: var(--primary); transform: translateX(4px); box-shadow: var(--shadow); background: var(--bg-subtle); }
.partners-list .name { font-weight: 600; color: var(--text); font-size: 14px; }
.partners-list .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.partners-list .meta a { 
  padding: 4px 10px; border-radius: 100px; background: var(--bg); color: var(--text); border: 1px solid var(--border); 
  text-decoration: none; font-weight: 600; transition: all 0.2s;
}
.partners-list .meta a:hover { border-color: var(--accent); color: var(--accent); }

/* --- Badges & Tables --- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 100px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge.us { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge.can { background: rgba(168, 85, 247, 0.15); color: var(--secondary); border: 1px solid rgba(168, 85, 247, 0.2); }
.badge.payment { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }
.badge.payment-employee-paid { background: rgba(37,99,235,0.1); color: #3b82f6; }
.badge.payment-employee-reimb { background: rgba(245,158,11,0.1); color: #f59e0b; }
.badge.payment-company-paid { background: rgba(16,185,129,0.1); color: #10b981; }

table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th { 
  text-align: left; padding: 12px 16px; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; color: var(--text-muted); 
  border-bottom: 1px solid var(--border);
}
td { padding: 16px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 14px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-subtle); }

/* --- Responsive --- */
@media(max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media(max-width: 768px) {
  body { padding: 16px; }
  h1 { font-size: 24px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .header { flex-direction: column; align-items: flex-start; }
  .tabs { width: 100%; margin: 0 0 24px 0; overflow-x: auto; display: flex; }
  .tab-button { flex: 1; text-align: center; }
  .kpi .val { font-size: 28px; }
  .partners-list li { grid-template-columns: 1fr; gap: 8px; }
  .partners-list .meta { justify-content: flex-start; flex-wrap: wrap; }
}