@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

:root {
  --primary: #0D3D2E;
  --primary-light: #1a5c42;
  --accent: #00C896;
  --accent-dark: #00a07a;
  --accent-glow: rgba(0, 200, 150, 0.15);
  --danger: #FF4B4B;
  --warn: #F59E0B;
  --surface: #ffffff;
  --surface-2: #F4F7FA;
  --surface-3: #EEF2F7;
  --border: rgba(10, 37, 64, 0.1);
  --border-strong: rgba(10, 37, 64, 0.2);
  --text-1: #0A2540;
  --text-2: #4A6580;
  --text-3: #8AA0B8;
  --shadow-sm: 0 1px 3px rgba(10,37,64,0.08), 0 1px 2px rgba(10,37,64,0.04);
  --shadow-md: 0 4px 16px rgba(10,37,64,0.1), 0 2px 6px rgba(10,37,64,0.06);
  --shadow-lg: 0 12px 40px rgba(10,37,64,0.14), 0 4px 12px rgba(10,37,64,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Sidebar Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.logo-icon svg { width: 20px; height: 20px; }

.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.3px;
}

.logo-text span { color: var(--accent); }

.sidebar-role {
  padding: 12px 24px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.sidebar-nav { flex: 1; padding: 8px 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
.nav-item.active { background: rgba(0,200,150,0.15); color: var(--accent); }
.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; color: white; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ── Main Content ── */
.main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
}

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

.topbar-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.content { padding: 32px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
}

.stat-change {
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--accent-dark); }
.stat-change.down { color: var(--danger); }

.stat-accent { border-left: 3px solid var(--accent); }
.stat-accent-warn { border-left: 3px solid var(--warn); }
.stat-accent-blue { border-left: 3px solid #3B82F6; }
.stat-accent-purple { border-left: 3px solid #8B5CF6; }

/* ── Cards & Tables ── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

.card-body { padding: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--surface-2);
  padding: 10px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td { padding: 13px 20px; color: var(--text-1); vertical-align: middle; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

.badge-green { background: #ECFDF5; color: #065F46; }
.badge-green .badge-dot { background: #10B981; }
.badge-red { background: #FEF2F2; color: #991B1B; }
.badge-red .badge-dot { background: #EF4444; }
.badge-amber { background: #FFFBEB; color: #92400E; }
.badge-amber .badge-dot { background: #F59E0B; }
.badge-blue { background: #EFF6FF; color: #1E40AF; }
.badge-blue .badge-dot { background: #3B82F6; }
.badge-gray { background: #F3F4F6; color: #374151; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

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

.btn-outline {
  background: transparent;
  color: var(--text-1);
  border-color: var(--border-strong);
}

.btn-outline:hover { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: none;
  padding: 8px 12px;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

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

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; font-weight: 600; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-1);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select.form-control { cursor: pointer; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,37,64,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

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

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

.modal-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Notification ── */
.notif {
  display: none;
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--primary);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}

.notif.show { display: flex; align-items: center; gap: 10px; }
.notif-accent { width: 4px; height: 100%; background: var(--accent); position: absolute; left: 0; top: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Toggle Switch ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Chart placeholder ── */
.chart-wrap { padding: 20px 24px; }
.mini-bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 80px; }
.bar { flex: 1; background: var(--surface-3); border-radius: 4px 4px 0 0; transition: background 0.2s; cursor: default; position: relative; }
.bar:hover { background: var(--accent); }
.bar-label { font-size: 10px; text-align: center; color: var(--text-3); margin-top: 4px; }

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

/* ── Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
  gap: 6px;
}

/* ── Avatars ── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.1s; opacity: 0; }
.stagger-3 { animation-delay: 0.15s; opacity: 0; }
.stagger-4 { animation-delay: 0.2s; opacity: 0; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; font-weight: 500; color: var(--text-2); }
.empty-state-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ── Two column grid ── */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

@media (max-width: 900px) {
  .grid-2col, .grid-3col { grid-template-columns: 1fr; }
}

/* ── Search Input ── */
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 15px; height: 15px; }
.search-input { padding-left: 36px !important; }

/* ── Page transition ── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }
