:root {
  --sidebar-bg: #0f172a;
  --sidebar-width: 250px;
  --accent: #3b82f6;
  --accent-dark: #1d4ed8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-muted: #64748b;
}

/* ─── Layout ─────────────────────────────── */
body { font-family: 'Inter', system-ui, sans-serif; background: #f1f5f9; }

.app-shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: width .2s;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand .brand-name { color: #fff; font-weight: 700; font-size: 1.1rem; }
.sidebar-brand .brand-sub  { color: rgba(255,255,255,.4); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.sidebar nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.sidebar .nav-link {
  color: rgba(255,255,255,.65);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar .nav-link i { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar .nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: var(--accent); color: #fff; }
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ─── Main content ─────────────────────────── */
.content-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-weight: 600; font-size: 1rem; color: #1e293b; }
.page-body { padding: 24px; flex: 1; }

/* ─── KPI cards ────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #e2e8f0;
  transition: box-shadow .2s;
}
.kpi-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.07); }
.kpi-icon {
  width: 50px; height: 50px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.kpi-icon.blue   { background: #eff6ff; color: var(--accent); }
.kpi-icon.green  { background: #f0fdf4; color: var(--success); }
.kpi-icon.yellow { background: #fffbeb; color: var(--warning); }
.kpi-icon.red    { background: #fef2f2; color: var(--danger); }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1; color: #1e293b; }
.kpi-label { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Charts row ───────────────────────────── */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 20px;
}
.chart-card .card-title { font-size: .85rem; font-weight: 600; color: #1e293b; margin-bottom: 14px; }
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

/* ─── Revenue summary ──────────────────────── */
.rev-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }
.rev-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 18px 20px;
}
.rev-card .rev-period { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; }
.rev-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f1f5f9; font-size: .83rem; }
.rev-row:last-child { border-bottom: none; }
.rev-row .label { color: var(--text-muted); }
.rev-row .val   { font-weight: 600; color: #1e293b; }
@media (max-width: 768px) { .rev-grid { grid-template-columns: 1fr; } }

/* ─── Cards & tables ───────────────────────── */
.data-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.data-card .data-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.data-card .data-card-header h6 { margin: 0; font-weight: 600; font-size: .9rem; }
.data-card .data-card-body { padding: 0 8px 8px; }

/* ─── Plan comparison ──────────────────────── */
.plan-toggle { display: flex; gap: 0; border-radius: 50px; overflow: hidden; border: 2px solid var(--accent); width: fit-content; margin: 0 auto 24px; }
.plan-toggle button {
  padding: 8px 28px;
  border: none;
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.plan-toggle button.active { background: var(--accent); color: #fff; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.plan-card {
  background: #fff;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  padding: 24px;
  display: flex; flex-direction: column;
  transition: border-color .2s, box-shadow .2s;
}
.plan-card.recommended { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59,130,246,.08); }
.plan-card .plan-name  { font-weight: 700; font-size: .95rem; color: #1e293b; }
.plan-card .plan-price { font-size: 2rem; font-weight: 800; color: #1e293b; margin: 8px 0; }
.plan-card .plan-cycle { font-size: .75rem; color: var(--text-muted); }
.plan-card .feature-list { list-style: none; padding: 0; margin: 16px 0; flex: 1; }
.plan-card .feature-list li { display: flex; align-items: center; gap: 8px; font-size: .82rem; padding: 4px 0; color: #374151; }
.plan-card .feature-list li .tick { color: var(--success); }
.plan-card .feature-list li .cross { color: var(--danger); }

/* ─── Subscription detail ──────────────────── */
.sub-detail-header {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.sub-detail-header .plan-name-badge { font-size: 1.05rem; font-weight: 600; color: #1e293b; }
.sub-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 20px; }
.sub-info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: .88rem; }
.sub-info-row .si-label { color: var(--text-muted); }
.sub-info-row .si-val   { font-weight: 600; color: #1e293b; }

/* ─── Status badges ─────────────────────────── */
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-pending   { background: #fef9c3; color: #854d0e; }
.badge-inactive  { background: #f1f5f9; color: #64748b; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.status-badge    { padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }

/* ─── Login page ────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { width: 48px; height: 48px; background: var(--accent); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.login-logo i { color: #fff; font-size: 1.4rem; }

/* ─── Utilities ─────────────────────────────── */
.page-section { display: none; }
.page-section.active { display: block; }
.back-btn { font-size: .82rem; color: var(--accent); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 16px; }
.back-btn:hover { text-decoration: underline; }
.dt-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
table.dataTable thead th { background: #1e3a5f; color: #fff; font-weight: 600; font-size: .8rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--accent); color: #fff !important; border-radius: 6px; }
