/* ========== DESIGN TOKENS ========== */
:root {
  --blue: #2563EB;
  --blue-hover: #1D4ED8;
  --blue-light: rgba(37, 99, 235, 0.08);
  --blue-subtle: rgba(37, 99, 235, 0.04);
  --green: #059669;
  --green-light: rgba(5, 150, 105, 0.08);
  --red: #DC2626;
  --red-light: rgba(220, 38, 38, 0.08);
  --amber: #D97706;
  --amber-light: rgba(217, 119, 6, 0.08);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  --bg-page: #F8FAFC;
  --bg-white: #FFFFFF;
  --bg-subtle: #F1F5F9;

  --sidebar-bg: #0F172A;
  --sidebar-text: rgba(255,255,255,0.6);
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(37, 99, 235, 0.2);
  --sidebar-active-text: #fff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.08);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-h: 60px;
  --sidebar-w: 250px;
  --content-pad: 2rem;

  font-size: 15px;
}

/* ========== RESET ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== LOGIN ========== */
.login-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.login-overlay.hidden { display: none; }
.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem 2.5rem;
  width: 400px; max-width: 90vw;
  box-shadow: 0 25px 80px rgba(0,0,0,0.15);
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 1.25rem;
  background: conic-gradient(#8B5CF6, #3B82F6, #06B6D4, #10B981, #FACC15, #F97316, #EC4899, #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: #fff;
}
.login-card h1 { font-size: 1.15rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.25rem; }
.login-card .subtitle { font-size: 0.8rem; color: var(--text-tertiary); margin-bottom: 2rem; }
.login-card .form-group { text-align: left; margin-bottom: 1.25rem; }
.login-card label { font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); display: block; margin-bottom: 0.3rem; }
.login-card input {
  width: 100%; padding: 0.65rem 0;
  font-size: 0.9rem; border: none;
  border-bottom: 1.5px solid var(--border); outline: none;
  background: transparent; color: var(--text-primary);
  transition: border-color 0.2s;
}
.login-card input:focus { border-bottom-color: var(--blue); }
.login-card input::placeholder { color: #CBD5E1; }
.login-btn {
  width: 100%; padding: 0.75rem; margin-top: 0.75rem;
  background: var(--blue); color: #fff; border: none;
  border-radius: 40px; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.login-btn:hover { background: var(--blue-hover); box-shadow: 0 4px 14px rgba(37,99,235,0.35); }
.login-btn:active { transform: scale(0.98); }
.login-error { color: var(--red); font-size: 0.78rem; margin-top: 0.75rem; display: none; }
.login-error.show { display: block; }

/* ========== LAYOUT ========== */
.wrapper { display: flex; min-height: 100vh; }

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
  position: fixed; top: 0; left: 0;
  height: 100vh; overflow-y: auto; z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.03);
}
.sidebar::after {
  content: '';
  position: fixed; bottom: 0; left: 0;
  width: var(--sidebar-w); height: 200px;
  background: linear-gradient(0deg, rgba(37,99,235,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.sidebar-header {
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex; align-items: center; gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  min-height: var(--header-h);
}
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: conic-gradient(#8B5CF6, #3B82F6, #06B6D4, #10B981, #FACC15, #F97316, #EC4899, #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}
.sidebar-header .brand-text h5 { margin: 0; font-size: 0.88rem; font-weight: 650; color: #fff; letter-spacing: -0.01em; }
.sidebar-header .brand-text small { font-size: 0.63rem; opacity: 0.35; display: block; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.nav-section {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 0.6rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: rgba(255,255,255,0.25); font-weight: 600;
}
.sidebar .nav { list-style: none; padding: 0.25rem 0; }
.sidebar .nav-link {
  color: var(--sidebar-text);
  padding: 0.55rem 1.25rem;
  margin: 0.1rem 0.5rem;
  display: flex; align-items: center; gap: 0.7rem;
  font-size: 0.8rem; font-weight: 450;
  text-decoration: none; border-radius: 8px;
  transition: all 0.15s; cursor: pointer;
  position: relative;
}
.sidebar .nav-link:hover { color: var(--sidebar-active-text); background: var(--sidebar-hover); }
.sidebar .nav-link.active {
  color: var(--sidebar-active-text);
  background: linear-gradient(90deg, rgba(37,99,235,0.2) 0%, transparent 100%);
  border-left: 2.5px solid var(--blue);
}
.sidebar .nav-link i { font-size: 1rem; width: 20px; text-align: center; opacity: 0.5; transition: opacity 0.15s; }
.sidebar .nav-link:hover i { opacity: 0.8; }
.sidebar .nav-link.active i { opacity: 1; color: var(--blue); }
.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.65rem; color: rgba(255,255,255,0.25);
  text-align: center;
}

/* ========== MAIN ========== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ========== TOPBAR ========== */
.navbar-top {
  background: var(--bg-white);
  height: var(--header-h);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 999;
}
.navbar-left { display: flex; align-items: center; gap: 1rem; }
.navbar-top .page-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.3rem; color: var(--text-secondary); cursor: pointer; padding: 0; }
.user-info { display: flex; align-items: center; gap: 0.75rem; }
.user-info .user-name { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.user-info .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: conic-gradient(#8B5CF6, #3B82F6, #06B6D4, #10B981, #FACC15, #F97316, #EC4899, #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 0.7rem;
}

/* ========== PAGE CONTENT ========== */
.page-content {
  padding: var(--content-pad);
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.page { display: none; }
.page.active { display: block; }

.page-title-section { margin-bottom: 1.5rem; }
.page-title-section h2 { font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.page-title-section p { font-size: 0.8rem; color: var(--text-tertiary); margin: 0.2rem 0 0; }

/* ========== DASHBOARD ========== */
.dash-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.dash-header h2 { font-size: 1.35rem; font-weight: 650; color: var(--text-primary); margin: 0; letter-spacing: -0.01em; }
.dash-header .dash-subtitle { font-size: 0.82rem; color: var(--text-tertiary); margin: 0.1rem 0 0; }
.dash-header-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* DATE FILTER */
.dash-date-filter {
  display: flex; align-items: flex-end; gap: 0.5rem;
  background: var(--bg-white); padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.date-field { display: flex; flex-direction: column; gap: 0.15rem; }
.date-field label { font-size: 0.62rem; font-weight: 500; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }
.date-field input {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.3rem 0.5rem; font-size: 0.78rem;
  font-family: var(--font); color: var(--text-primary);
  background: var(--bg-page); outline: none;
  transition: border-color 0.15s;
  min-width: 130px;
}
.date-field input:focus { border-color: var(--blue); }

/* PULSE */
.dash-pulse {
  margin-bottom: 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.pulse-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem; border-radius: 10px;
  font-size: 0.8rem; font-weight: 450; line-height: 1.4;
  flex: 1 1 auto; min-width: 220px;
}
.pulse-item i { font-size: 1rem; flex-shrink: 0; }
.pulse-item.success { background: #ECFDF5; color: #065F46; }
.pulse-item.warning { background: #FFFBEB; color: #92400E; }
.pulse-item.danger { background: #FEF2F2; color: #991B1B; }
.pulse-item.info { background: #EFF6FF; color: #1E40AF; }

/* ===== DASH-INSIGHTS ===== */
.dash-insights-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.client-item, .day-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem; font-size: 0.78rem;
  transition: background 0.1s;
}
.client-item:hover, .day-item:hover { background: var(--blue-subtle); }
.client-item .name, .day-item .name { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-item .value, .day-item .value { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.client-item .sub, .day-item .sub { font-size: 0.65rem; color: var(--text-tertiary); margin-top: 0.05rem; }
.day-bar { height: 6px; border-radius: 3px; background: var(--blue-light); margin-top: 0.2rem; width: 100%; overflow: hidden; }
.day-bar-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width 0.3s; }

/* CHART PERIOD BADGE */
.dash-chart-period-badge {
  font-size: 0.65rem; color: var(--text-tertiary);
  background: var(--bg-subtle); padding: 0.15rem 0.5rem;
  border-radius: 20px; font-weight: 450;
}

/* STATUS BAR */
.dash-status-bar {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 0.65rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.78rem; color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.dash-status-bar .status-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.dash-status-bar .status-item i { font-size: 0.85rem; opacity: 0.6; }
.dash-status-bar .status-item b { font-weight: 600; color: var(--text-primary); }
.dash-status-bar .status-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-tertiary); opacity: 0.3; display: inline-block; margin: 0 0.5rem; }
.dash-status-bar .text-success { color: var(--green); }
.dash-status-bar .text-warning { color: var(--amber); }
.dash-status-bar .text-muted { color: var(--text-tertiary); }

/* KPI ROW */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--bg-white); border-radius: var(--radius-lg); padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-light);
}
.kpi-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  transform: translateY(-3px);
  border-color: rgba(37,99,235,0.1);
}
.kpi-primary {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #fff;
  border-color: transparent;
}
.kpi-primary .kpi-label { color: rgba(255,255,255,0.7); }
.kpi-primary .kpi-value { color: #fff; }
.kpi-primary .kpi-trend { color: rgba(255,255,255,0.85); }
.kpi-primary .kpi-icon { background: rgba(255,255,255,0.15); color: #fff; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--blue-light); color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
}
.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.7rem; font-weight: 500; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; display: block; }
.kpi-value { font-size: 1.45rem; font-weight: 700; color: var(--text-primary); display: block; line-height: 1.25; margin-top: 0.1rem; letter-spacing: -0.01em; }
.kpi-trend { font-size: 0.7rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.15rem; margin-top: 0.2rem; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.neutral { color: var(--text-tertiary); }

/* MAIN ROW */
.dash-main-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.dash-chart-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.dash-chart-header {
  padding: 1.1rem 1.5rem 0;
  display: flex; align-items: center; justify-content: space-between;
}
.dash-chart-title { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); }
.dash-chart-legend { display: flex; gap: 1rem; align-items: center; }
.dash-chart-legend .legend-item {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.7rem; color: var(--text-tertiary); cursor: pointer;
}
.dash-chart-legend .legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.dash-chart-body { padding: 0.5rem 1.25rem 1rem; }
.dash-chart-body canvas { width: 100% !important; height: 340px !important; }

/* Alerts */
.dash-alerts { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.dash-alert {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1rem; border-radius: 10px;
  font-size: 0.78rem; font-weight: 450; line-height: 1.4;
}
.dash-alert i { font-size: 1rem; flex-shrink: 0; }
.dash-alert.danger { background: #FEF2F2; color: #991B1B; }
.dash-alert.warning { background: #FFFBEB; color: #92400E; }
.dash-alert.info { background: #EFF6FF; color: #1E40AF; }
.dash-alert span { flex: 1; }

/* Side panel */
.dash-side-col { display: flex; flex-direction: column; gap: 0.85rem; }
.side-card {
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 0;
  border: 1px solid var(--border-light);
}
.side-card-header {
  padding: 0.75rem 1rem 0.65rem;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}
.side-card-body { padding: 0.35rem 0; }
.side-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 1rem; font-size: 0.78rem;
  transition: background 0.1s;
}
.side-item:hover { background: var(--blue-subtle); }
.side-item .name { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .value { font-weight: 600; color: var(--text-primary); margin-left: 0.5rem; white-space: nowrap; font-size: 0.8rem; }
.side-item .sub { font-size: 0.65rem; color: var(--text-tertiary); margin-top: 0.05rem; }

/* Secondary metrics */
.dash-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--bg-white); border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-light);
}
.metric-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  transform: translateY(-3px);
  border-color: rgba(37,99,235,0.1);
}
.metric-credits {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  color: #fff;
  border-color: transparent;
}
.metric-credits .metric-label { color: rgba(255,255,255,0.55); }
.metric-credits .metric-value { color: #fff; }
.metric-credits .metric-sub { color: rgba(255,255,255,0.45); }
.metric-credits .metric-icon { background: rgba(255,255,255,0.1); color: #fff; }
.metric-dark {
  background: var(--bg-white);
  border-color: var(--border-light);
}
.metric-dark .metric-label { color: var(--text-tertiary); }
.metric-dark .metric-value { color: var(--text-primary); }
.metric-dark .metric-sub { color: var(--text-tertiary); }
.metric-dark .metric-icon { background: var(--blue-light); color: var(--blue); }
.metric-dark:hover { border-color: rgba(37,99,235,0.1); }
.metric-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--blue-light); color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.metric-body { flex: 1; min-width: 0; }
.metric-label { font-size: 0.68rem; font-weight: 500; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; display: block; }
.metric-value { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); display: block; line-height: 1.25; }
.metric-sub { font-size: 0.68rem; color: var(--text-tertiary); display: block; margin-top: 0.05rem; }

/* ========== CARDS ========== */
.card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--bg-white);
  margin-bottom: 1.25rem;
  transition: all 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,0.08); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.card-body { padding: 1.25rem; }

/* ========== TABLES ========== */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.table th {
  font-weight: 500; font-size: 0.68rem;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.7rem 1rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap; text-align: left;
}
.table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-secondary);
}
.table tbody tr:hover { background: var(--blue-subtle); }
.table tbody tr:last-child td { border-bottom: none; }

/* ========== BADGES ========== */
.badge {
  font-weight: 450; padding: 0.2em 0.55em;
  font-size: 0.7rem; border-radius: 20px; display: inline-block;
}
.bg-success { background: #D1FAE5; color: #065F46; }
.bg-danger { background: #FEE2E2; color: #991B1B; }
.bg-warning { background: #FEF3C7; color: #92400E; }
.bg-info, .bg-primary { background: #DBEAFE; color: #1E40AF; }
.bg-secondary { background: var(--bg-subtle); color: var(--text-tertiary); }

/* ========== BUTTONS ========== */
.btn {
  border-radius: 40px; font-weight: 500; font-size: 0.8rem;
  padding: 0.45rem 1.2rem; border: none;
  cursor: pointer; transition: all 0.2s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-outline {
  background: transparent; border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 0.3rem 0.9rem; font-size: 0.73rem; }

/* ========== TABS ========== */
.nav-tabs {
  display: flex; gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}
.nav-tabs .nav-link {
  border: none; color: var(--text-tertiary);
  font-weight: 500; font-size: 0.8rem;
  padding: 0.55rem 1rem; cursor: pointer;
  background: none; position: relative;
  transition: color 0.2s;
}
.nav-tabs .nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: transparent;
  transition: background 0.2s;
}
.nav-tabs .nav-link.active { color: var(--blue); }
.nav-tabs .nav-link.active::after { background: var(--blue); }
.nav-tabs .nav-link:hover { color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ========== PAGINATION ========== */
.pagination { display: flex; gap: 0.25rem; align-items: center; justify-content: center; margin-top: 1rem; }
.pagination .page-item { list-style: none; }
.pagination .page-link {
  padding: 0.3rem 0.65rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: 0.75rem; text-decoration: none; transition: all 0.2s;
}
.pagination .page-link:hover { border-color: var(--blue); color: var(--blue); }
.pagination .active .page-link { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ========== FOOTER ========== */
.footer {
  text-align: center; padding: 1rem 2rem;
  color: var(--text-tertiary); font-size: 0.7rem;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
}

/* ========== GRID ========== */
.row { display: flex; flex-wrap: wrap; margin: 0 -0.625rem; }
.row > * { padding: 0 0.625rem; box-sizing: border-box; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-8 { flex: 0 0 66.6667%; max-width: 66.6667%; }

/* ========== UTILITIES ========== */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }
.p-0 { padding: 0; }
.fw-bold { font-weight: 700; }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.hidden { display: none !important; }

/* ========== RESPONSIVE ========== */
@media (min-width: 1600px) {
  :root { --content-pad: 2.5rem; font-size: 16px; }
  .dash-chart-body canvas { height: 400px !important; }
  .dash-kpi-row { gap: 1.5rem; }
  .dash-metrics-row { gap: 1.5rem; }
  .dash-main-row { gap: 1.5rem; }
  .main-content { max-width: 100%; }
  .page-content { max-width: 1560px; }
}

@media (max-width: 1200px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-metrics-row { grid-template-columns: repeat(2, 1fr); }
  .dash-main-row { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
  :root { --content-pad: 1.25rem; }
  .dash-side-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .side-card { margin-bottom: 0; }
}

@media (max-width: 992px) {
  .dash-insights-row { grid-template-columns: 1fr; }
  .dash-date-filter { width: 100%; }
  .date-field { flex: 1; }
  .date-field input { min-width: 0; width: 100%; }
}

@media (max-width: 768px) {
  :root { --content-pad: 1rem; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar.show + .sidebar-backdrop,
  .sidebar-backdrop.show {
    opacity: 1; pointer-events: auto;
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .navbar-top { padding: 0 1rem; }

  .dash-kpi-row { grid-template-columns: 1fr; gap: 0.75rem; }
  .dash-metrics-row { grid-template-columns: 1fr; gap: 0.75rem; }
  .dash-main-row { grid-template-columns: 1fr; gap: 0.75rem; }
  .dash-side-col { grid-template-columns: 1fr; gap: 0.75rem; }
  .dash-insights-row { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; gap: 0.75rem; }
  .dash-date-filter { flex-wrap: wrap; }
  .dash-chart-body canvas { height: 260px !important; }
  .kpi-card { padding: 1rem 1.15rem; }
  .kpi-value { font-size: 1.2rem; }

  .col-md-3, .col-md-4, .col-md-6, .col-md-8 { flex: 0 0 100%; max-width: 100%; }
}

@media (max-width: 480px) {
  :root { --content-pad: 0.75rem; font-size: 14px; }
  .navbar-top { padding: 0 0.75rem; }
  .period-btn { padding: 0.35rem 0.7rem; font-size: 0.7rem; }
}
