/* =============================================================
   PANELPRO — Admin Dashboard Template
   Design system: custom properties, Flex, Grid — no frameworks.
   ============================================================= */

/* ---------------------------------------------------------------
   1. TOKENS
--------------------------------------------------------------- */
:root {
  --navy: #1A1D3E;
  --navy-2: #232755;
  --indigo: #4F46E5;
  --indigo-dark: #4338CA;
  --emerald: #10B981;
  --emerald-dark: #059669;
  --slate: #64748B;
  --bg: #F1F5F9;
  --white: #FFFFFF;
  --red: #EF4444;
  --amber: #F59E0B;
  --ink: #0F172A;
  --muted: #94A3B8;
  --line: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-w: 260px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ---------------------------------------------------------------
   2. RESET & BASE
--------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: var(--indigo); text-decoration: none; transition: color 0.25s var(--ease); }
a:hover { color: var(--indigo-dark); }
ul { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.25;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

::selection { background: var(--indigo); color: #fff; }

/* ---------------------------------------------------------------
   3. SIDEBAR
--------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, #141633 100%);
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  z-index: 60;
  overflow: hidden;
  transition: width 0.3s var(--ease), transform 0.3s var(--ease);
}

/* Sidebar background accent — original dashboard screenshot */
.sidebar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 210px;
  background: url('../img/bootstrap-5-admin-template.jpg') center / cover no-repeat;
  opacity: 0.16;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, transparent 100%);
  mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, transparent 100%);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), #7C3AED);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
  flex-shrink: 0;
}

.sidebar-logo-name {
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo-name span { color: var(--emerald); }

.sidebar-nav {
  flex: 1;
  padding: 18px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.35);
  padding: 10px 12px 8px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

.sidebar-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(2px); }

.sidebar-link.active {
  background: linear-gradient(90deg, var(--indigo), var(--indigo-dark));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.sidebar-link .s-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  opacity: 0.9;
}

.sidebar-link .s-icon svg { width: 18px; height: 18px; }

.sidebar-link .s-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--emerald);
  object-fit: cover;
  flex-shrink: 0;
  padding: 1px;
  background: var(--navy-2);
}

.sidebar-user-info { overflow: hidden; }

.sidebar-user-name {
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11.5px;
  color: var(--emerald);
  font-weight: 500;
}

/* Sidebar collapsed */
body.sidebar-collapsed .sidebar { width: 76px; }
body.sidebar-collapsed .sidebar-logo { padding: 22px 19px; }
body.sidebar-collapsed .sidebar-logo-name,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-link span:not(.s-icon),
body.sidebar-collapsed .sidebar-link .s-badge,
body.sidebar-collapsed .sidebar-user-info {
  display: none;
}
body.sidebar-collapsed .sidebar-link { justify-content: center; padding: 12px; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 14px 12px; }
body.sidebar-collapsed .sidebar-nav { padding: 18px 10px; }
body.sidebar-collapsed .sidebar-logo { justify-content: center; padding-left: 0; padding-right: 0; }

/* ---------------------------------------------------------------
   4. MAIN CONTENT & TOPBAR
--------------------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s var(--ease);
}

body.sidebar-collapsed .main-content { margin-left: 76px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4.5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.sidebar-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: var(--navy);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.sidebar-toggle:hover { border-color: var(--indigo); background: #EEF2FF; }

.sidebar-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.sidebar-toggle.open span:nth-child(2) { opacity: 0; }
.sidebar-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.topbar-search {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.topbar-search .search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 0 16px 0 40px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.topbar-search input::placeholder { color: var(--muted); }

.topbar-search input:focus {
  border-color: var(--indigo);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease), background 0.25s var(--ease);
}

.topbar-btn:hover { border-color: var(--indigo); color: var(--indigo); background: #EEF2FF; }

.topbar-btn svg { width: 18px; height: 18px; }

.topbar-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.25s var(--ease);
}

.topbar-user:hover { background: var(--bg); }

.topbar-user img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--indigo);
}

.topbar-user-meta { line-height: 1.15; }

.topbar-user-name { font-weight: 600; font-size: 13px; color: var(--navy); }
.topbar-user-role { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------
   5. PAGE CONTENT
--------------------------------------------------------------- */
.page-content { flex: 1; padding: 26px 24px 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 26px;
  font-weight: 800;
}

.page-head .crumb {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.page-head .crumb a { color: var(--indigo); font-weight: 500; }

.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section { margin-bottom: 24px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--indigo), var(--emerald));
}

.section-link { font-size: 13.5px; font-weight: 600; }

/* ---------------------------------------------------------------
   6. BUTTONS
--------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--indigo); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); }
.btn--primary:hover { background: var(--indigo-dark); color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4); }

.btn--success { background: var(--emerald); color: #fff; box-shadow: 0 6px 16px rgba(16, 185, 129, 0.28); }
.btn--success:hover { background: var(--emerald-dark); color: #fff; }

.btn--outline { background: transparent; color: var(--indigo); border-color: var(--indigo); }
.btn--outline:hover { background: var(--indigo); color: #fff; }

.btn--ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--indigo); color: var(--indigo); }

.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover { background: #DC2626; color: #fff; }

.btn--sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn--lg { padding: 13px 26px; font-size: 15px; border-radius: 12px; }

.btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------
   7. KPI CARDS
--------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.kpi-card .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 22px; height: 22px; }

.kpi-icon-indigo { background: #EEF2FF; color: var(--indigo); }
.kpi-icon-emerald { background: #ECFDF5; color: var(--emerald); }
.kpi-icon-amber { background: #FFFBEB; color: var(--amber); }
.kpi-icon-red { background: #FEF2F2; color: var(--red); }

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.trend-up { background: #ECFDF5; color: var(--emerald-dark); }
.trend-down { background: #FEF2F2; color: #DC2626; }

.kpi-label {
  font-size: 13px;
  color: var(--slate);
  font-weight: 500;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 2px 0 4px;
}

.kpi-delta { font-size: 12.5px; color: var(--muted); }

.kpi-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--indigo), var(--emerald));
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.kpi-card:hover::after { opacity: 1; }

/* ---------------------------------------------------------------
   8. PANELS / CARDS
--------------------------------------------------------------- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 { font-size: 15.5px; font-weight: 700; }

.panel-body { padding: 20px; }

.chart-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

/* ---------------------------------------------------------------
   9. CHARTS (pure CSS placeholders)
--------------------------------------------------------------- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 250px;
  padding-top: 10px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  height: 100%;
  justify-content: flex-end;
}

.bar-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate);
  opacity: 0;
  transition: opacity 0.3s;
}

.bar-col:hover .bar-value { opacity: 1; }

.bar {
  width: 100%;
  max-width: 34px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #C7D2FE, var(--indigo));
  position: relative;
  transition: filter 0.25s var(--ease);
  cursor: default;
}

.bar:hover { filter: brightness(1.08); }

.bar--emerald { background: linear-gradient(180deg, #A7F3D0, var(--emerald)); }
.bar--amber { background: linear-gradient(180deg, #FDE68A, var(--amber)); }

.bar-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--slate);
  font-weight: 500;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Donut */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(
    var(--indigo) 0 42%,
    var(--emerald) 42% 68%,
    var(--amber) 68% 86%,
    #CBD5E1 86% 100%
  );
  position: relative;
  flex-shrink: 0;
}

.donut::before {
  content: "";
  position: absolute;
  inset: 26px;
  background: var(--white);
  border-radius: 50%;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 1;
}

.donut-center strong { font-size: 22px; font-weight: 800; color: var(--navy); display: block; line-height: 1.1; }
.donut-center span { font-size: 11px; color: var(--muted); }

/* H-bar list (traffic sources) */
.hbar-list { flex: 1; display: grid; gap: 14px; min-width: 200px; }

.hbar-item .hbar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 6px;
}

.hbar-item .hbar-label-row b { color: var(--slate); font-weight: 600; }

.hbar {
  height: 8px;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
}

.hbar > span {
  display: block;
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--indigo), #818CF8);
  animation: grow 1.1s var(--ease) both;
}

.hbar--emerald > span { background: linear-gradient(90deg, var(--emerald), #6EE7B7); }
.hbar--amber > span { background: linear-gradient(90deg, var(--amber), #FCD34D); }
.hbar--slate > span { background: linear-gradient(90deg, #64748B, #CBD5E1); }

@keyframes grow { from { width: 0; } }

/* Mini sparkline */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark i {
  flex: 1;
  border-radius: 3px 3px 1px 1px;
  background: var(--indigo);
  opacity: 0.75;
}

/* ---------------------------------------------------------------
   10. TABLES
--------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

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

.table thead th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.table tbody tr { transition: background 0.2s var(--ease); }
.table tbody tr:hover { background: #F8FAFC; }
.table tbody tr:last-child td { border-bottom: none; }

.cell-user {
  display: flex;
  align-items: center;
  gap: 11px;
}

.cell-user img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  flex-shrink: 0;
}

.cell-user strong { font-weight: 600; color: var(--navy); display: block; line-height: 1.2; font-size: 13.5px; }
.cell-user span { font-size: 12px; color: var(--muted); }

.table .num { font-weight: 700; color: var(--navy); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-paid, .badge-active, .badge-success { background: #ECFDF5; color: var(--emerald-dark); }
.badge-pending, .badge-warn { background: #FFFBEB; color: #B45309; }
.badge-cancel, .badge-banned { background: #FEF2F2; color: #DC2626; }
.badge-muted, .badge-inactive { background: var(--bg); color: var(--slate); }
.badge-indigo { background: #EEF2FF; color: var(--indigo); }

.cell-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--slate);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}

.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--indigo); border-color: var(--indigo); background: #EEF2FF; }
.icon-btn--danger:hover { color: var(--red); border-color: var(--red); background: #FEF2F2; }

/* ---------------------------------------------------------------
   11. ACTIVITY LIST
--------------------------------------------------------------- */
.activity-list { display: grid; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s var(--ease);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #F8FAFC; }

.activity-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--line);
}

.activity-body { flex: 1; min-width: 0; }

.activity-body p { font-size: 13.5px; color: var(--ink); line-height: 1.45; }
.activity-body p strong { color: var(--navy); font-weight: 600; }
.activity-body time { font-size: 12px; color: var(--muted); }

.activity-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.activity-icon svg { width: 18px; height: 18px; }
.activity-icon-indigo { background: #EEF2FF; color: var(--indigo); }
.activity-icon-emerald { background: #ECFDF5; color: var(--emerald); }
.activity-icon-amber { background: #FFFBEB; color: var(--amber); }
.activity-icon-red { background: #FEF2F2; color: var(--red); }

/* ---------------------------------------------------------------
   12. FILTER BAR
--------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar .search-field {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.filter-bar .search-field svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.filter-bar input, .filter-bar select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.filter-bar .search-field input { width: 100%; padding-left: 38px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

/* ---------------------------------------------------------------
   13. FORMS
--------------------------------------------------------------- */
.form { display: grid; gap: 20px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group { display: grid; gap: 7px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.form-label .req { color: var(--red); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }

.form-textarea { min-height: 110px; resize: vertical; }

.form-hint { font-size: 12px; color: var(--muted); }

.form-ok, .form-err {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.form-ok { background: #ECFDF5; color: var(--emerald-dark); border: 1px solid #A7F3D0; }
.form-err { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }

.form-ok.show, .form-err.show { display: flex; }

.form-ok svg, .form-err svg { width: 17px; height: 17px; flex-shrink: 0; }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.4;
}

.form-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--indigo);
  flex-shrink: 0;
}

.form-check small { display: block; color: var(--muted); font-size: 12px; }

.toggle {
  position: relative;
  width: 42px;
  height: 23px;
  border-radius: 30px;
  background: var(--line);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.25s var(--ease);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(15,23,42,0.25);
  transition: transform 0.25s var(--ease);
}

.toggle.on { background: var(--emerald); }
.toggle.on::after { transform: translateX(19px); }

/* ---------------------------------------------------------------
   14. 404
--------------------------------------------------------------- */
.error-404 {
  text-align: center;
  padding: 60px 20px 50px;
}

.error-404 .code {
  font-size: clamp(90px, 18vw, 170px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(135deg, var(--indigo), var(--emerald));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.error-404 h2 { font-size: 28px; font-weight: 800; margin: 6px 0 10px; }
.error-404 p { color: var(--slate); max-width: 460px; margin: 0 auto 26px; }
.error-404 .error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------
   15. FOOTER
--------------------------------------------------------------- */
.footer {
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 30px 24px 20px;
}

.footer-grid {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
}

.footer-brand h4 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand h4 .mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--indigo), #7C3AED);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.footer-brand p { font-size: 13.5px; color: var(--slate); max-width: 300px; }

.footer-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--navy);
  margin-bottom: 12px;
  font-weight: 700;
}

.footer-links { display: grid; gap: 8px; }
.footer-link { font-size: 13.5px; color: var(--slate); font-weight: 500; }
.footer-link:hover { color: var(--indigo); }

.footer-bottom {
  max-width: 1220px;
  margin: 26px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.footer-bottom .tagline { font-weight: 600; color: var(--indigo); }

/* ---------------------------------------------------------------
   16. BACK TO TOP
--------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--indigo);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s, background 0.25s var(--ease);
  z-index: 50;
  display: grid;
  place-items: center;
}

.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--indigo-dark); }

.back-to-top svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------------
   17. REVEAL
--------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible { opacity: 1; transform: none; }

.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }

/* ---------------------------------------------------------------
   18. RESPONSIVE
--------------------------------------------------------------- */
@media (max-width: 980px) {
  .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  body.sidebar-collapsed .sidebar-logo { padding: 22px 24px; }
  body.sidebar-collapsed .sidebar-logo-name,
  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-link span:not(.s-icon),
  body.sidebar-collapsed .sidebar-link .s-badge,
  body.sidebar-collapsed .sidebar-user-info { display: block; }
  body.sidebar-collapsed .sidebar-link { justify-content: flex-start; padding: 11px 12px; }
  body.sidebar-collapsed .sidebar-user { justify-content: flex-start; padding: 14px 16px; }
  body.sidebar-collapsed .sidebar-nav { padding: 18px 14px; }
  body.sidebar-collapsed .sidebar-logo { justify-content: flex-start; }

  .main-content, body.sidebar-collapsed .main-content { margin-left: 0; }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 55;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease), visibility 0.3s;
    backdrop-filter: blur(2px);
  }

  .sidebar-scrim.show { opacity: 1; visibility: visible; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .topbar-user-meta { display: none; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 22px 16px 50px; }
}

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .topbar-search { display: none; }
  .topbar-actions { gap: 6px; }
  .sidebar-toggle { width: 38px; height: 38px; }
}

/* ---------------------------------------------------------------
   19. REDUCED MOTION
--------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hbar > span { animation: none; width: auto; }
}
