@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* ===== DESIGN TOKENS ===== */
:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #ffffff;
  --bg-page: linear-gradient(135deg, rgba(237,233,254,0.3), rgba(243,232,255,0.3), rgba(224,231,255,0.3));
  --foreground: #0f172a;
  --muted-foreground: #64748b;
  --card: #ffffff;
  --border: rgba(0,0,0,0.1);
  --input-bg: #f3f3f5;
  --muted-bg: #ececf0;
  --accent-bg: #e9ebef;
  --destructive: #d4183d;
  --destructive-fg: #ffffff;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --sidebar-width: 256px;
  /* Gradients */
  --gradient-primary: linear-gradient(to right, #8b5cf6, #9333ea);
  --gradient-primary-hover: linear-gradient(to right, #7c3aed, #7e22ce);
  --gradient-violet-purple: linear-gradient(135deg, #8b5cf6, #9333ea);
  --gradient-amber-orange: linear-gradient(135deg, #f59e0b, #ea580c);
  --gradient-blue-cyan: linear-gradient(135deg, #3b82f6, #06b6d4);
  --gradient-green-emerald: linear-gradient(135deg, #22c55e, #059669);
  --gradient-indigo-blue: linear-gradient(135deg, #6366f1, #3b82f6);
  --gradient-pink-rose: linear-gradient(135deg, #ec4899, #f43f5e);
  --gradient-red-rose: linear-gradient(135deg, #ef4444, #f43f5e);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-family);
  color: var(--foreground);
  background: var(--bg-page);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: 1.5rem; font-weight: 500; line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 500; line-height: 1.4; }
h3 { font-size: 1.125rem; font-weight: 500; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 500; line-height: 1.5; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; font-weight: 500; }
.text-muted { color: var(--muted-foreground); }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* ===== LAYOUT: SIDEBAR (Desktop) ===== */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 30;
}
.sidebar-brand {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.sidebar-logo {
  width: 48px; height: 48px;
  background: var(--gradient-violet-purple);
  border-radius: var(--radius-xl);
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo svg { width: 24px; height: 24px; color: #fff; }
.sidebar-title { font-size: 1rem; font-weight: 500; }
.sidebar-role { font-size: 0.875rem; color: var(--muted-foreground); margin-top: 4px; }

.sidebar-nav {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  transition: all 0.2s;
}
.nav-link:hover { background: var(--accent-bg); color: var(--foreground); }
.nav-link.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.nav-link.logout { color: var(--destructive); }
.nav-link.logout:hover { background: rgba(212,24,61,0.1); }

/* ===== LAYOUT: MAIN CONTENT ===== */
.main-pane {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}
.main-content {
  padding: 32px;
  max-width: 1280px;
  margin: 0 auto;
}

/* ===== LAYOUT: MOBILE HEADER ===== */
.mobile-header {
  display: none;
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.mobile-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
}
.mobile-brand { display: flex; align-items: center; gap: 12px; }
.mobile-logo {
  width: 40px; height: 40px;
  background: var(--gradient-violet-purple);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.mobile-logo svg { width: 20px; height: 20px; color: #fff; }
.mobile-brand-text h2 { font-size: 0.875rem; }
.mobile-brand-text p { font-size: 0.75rem; color: var(--muted-foreground); }

.hamburger-btn {
  padding: 8px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  transition: background 0.2s;
}
.hamburger-btn:hover { background: var(--accent-bg); }
.hamburger-btn svg { width: 24px; height: 24px; }

.mobile-menu {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.mobile-menu .nav-link { font-size: 0.9375rem; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 32px; }
.page-header h1 { margin-bottom: 4px; }
.page-header p { color: var(--muted-foreground); }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 24px; }
.card-body-compact { padding: 16px; }

/* ===== KPI CARDS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-card-inner { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-card-content { flex: 1; }
.kpi-label { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 4px; }
.kpi-value { font-size: 1.875rem; font-weight: 500; margin-top: 8px; }
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 24px; height: 24px; color: #fff; }
.kpi-icon.violet { background: var(--gradient-violet-purple); }
.kpi-icon.amber { background: var(--gradient-amber-orange); }
.kpi-icon.blue { background: var(--gradient-blue-cyan); }
.kpi-icon.green { background: var(--gradient-green-emerald); }
.kpi-icon.indigo { background: var(--gradient-indigo-blue); }
.kpi-icon.pink { background: var(--gradient-pink-rose); }
.kpi-icon.red { background: var(--gradient-red-rose); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-bg); }
.btn-primary {
  border: none;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--gradient-primary-hover);
  box-shadow: var(--shadow-md);
}
.btn-success {
  border: none;
  background: #22c55e;
  color: #fff;
}
.btn-success:hover { background: #16a34a; }
.btn-danger {
  border: none;
  background: var(--destructive);
  color: var(--destructive-fg);
}
.btn-danger:hover { background: #b91c1c; }
.btn-blue {
  border: none;
  background: #3b82f6;
  color: #fff;
}
.btn-blue:hover { background: #2563eb; }
.btn-amber {
  border: none;
  background: #f59e0b;
  color: #fff;
}
.btn-amber:hover { background: #d97706; }
.btn-ghost {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  padding: 8px;
}
.btn-ghost:hover { background: var(--accent-bg); }
.btn-muted {
  border: none;
  background: var(--muted-bg);
  color: var(--foreground);
}
.btn-muted:hover { opacity: 0.8; }
.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }
.btn-full { width: 100%; }
.btn-lg { padding: 12px 24px; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: all 0.2s;
  background: transparent;
  color: inherit;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.btn-icon:hover { background: rgba(0,0,0,0.05); }
.btn-icon-sm { padding: 4px; }
.btn-icon-sm svg { width: 14px; height: 14px; }

/* ===== FORMS ===== */
label.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--foreground);
}
.form-input,
.form-select {
  width: 100%;
  padding: 10px 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  color: var(--foreground);
  transition: all 0.2s;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}
.form-input::placeholder { 
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }
.form-input-sm { padding: 8px 12px; font-size: 0.875rem; }

.form-group { margin-bottom: 16px; }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 639px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.form-checkbox-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
}
.form-checkbox {
  width: 16px; height: 16px;
  border-radius: 4px;
  accent-color: #8b5cf6;
}

/* ===== FILTER CHIPS ===== */
.chip-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  background: var(--muted-bg);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { opacity: 0.8; }
.chip.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.chip.active-green { background: #22c55e; color: #fff; box-shadow: var(--shadow-md); }
.chip.active-red { background: #ef4444; color: #fff; box-shadow: var(--shadow-md); }
.chip.active-gray { background: #6b7280; color: #fff; box-shadow: var(--shadow-md); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.badge-violet { background: #f5f3ff; color: #6d28d9; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #f0fdf4; color: #15803d; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-pink { background: #fdf2f8; color: #be185d; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-gray { background: #f9fafb; color: #4b5563; }
.badge-green-outline { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-amber-outline { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-red-outline { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ===== TABLES ===== */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--muted-bg); border-bottom: 1px solid var(--border); }
th {
  padding: 12px 24px;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}
th.text-center { text-align: center; }
th.text-right { text-align: right; }
td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}
td.text-center { text-align: center; }
td.text-right { text-align: right; }
td.text-muted { color: var(--muted-foreground); font-size: 0.875rem; }
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(233,235,239,0.5); }
.action-cell { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== RESPONSIVE UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted-foreground); }
.text-sm { font-size: 0.875rem; }
.mt-4 { margin-top: 16px; }

/* ===== REVENUE & DATA VIZ ===== */
.revenue-totals { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
@media(min-width: 768px) { .revenue-totals { grid-template-columns: repeat(3, 1fr); } }
.revenue-total-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.revenue-value { font-size: 2rem; font-weight: 700; margin-top: 8px; }

.charts-grid, .tables-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 32px; }
@media(min-width: 1024px) {
  .charts-grid, .tables-grid { grid-template-columns: repeat(2, 1fr); }
}

.flow-row { margin-bottom: 16px; }
.flow-label { font-size: 0.875rem; font-weight: 500; margin-bottom: 8px; }
.flow-bar-wrap { display: flex; align-items: center; gap: 12px; }
.flow-bar { height: 16px; border-radius: 8px; min-width: 8px; transition: width 0.3s ease; }
.flow-value { font-size: 0.875rem; font-weight: 500; white-space: nowrap; }

/* ===== PACKAGE CARDS (Admin) ===== */
.pkg-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}
.pkg-card:hover { border-color: #c4b5fd; }
.pkg-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.pkg-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pkg-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
}
.pkg-actions { display: flex; gap: 8px; }
.pkg-meta { font-size: 0.875rem; color: var(--muted-foreground); }

/* ===== SUBSCRIBER FORM AREA (Admin) ===== */
.sub-mgmt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 1023px) { .sub-mgmt-grid { grid-template-columns: 1fr; } }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  transition: border-color 0.2s;
}
.upload-zone:hover { border-color: #c4b5fd; }
.upload-icon { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--muted-foreground); }
.upload-icon svg { width: 48px; height: 48px; }

/* ===== ATTENDANCE ===== */
.attendance-card-mobile { display: none; }

/* ===== DATABASE PAGE ===== */
.db-grid {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: 24px;
}
@media (max-width: 1023px) { .db-grid { grid-template-columns: 1fr; } }

.search-input-wrap { position: relative; }
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px;
  color: var(--muted-foreground);
  pointer-events: none;
}
.search-input-wrap .form-input { padding-left: 40px; }

.subscriber-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.subscriber-item {
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
}
.subscriber-item:hover { border-color: #c4b5fd; background: var(--accent-bg); }
.subscriber-item.selected { border-color: #8b5cf6; background: #f5f3ff; }

.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 639px) { .profile-detail-grid { grid-template-columns: 1fr; } }
.profile-detail-item .detail-label { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 4px; }

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
@media (max-width: 639px) { .profile-actions { grid-template-columns: 1fr; } }

.empty-state {
  padding: 48px;
  text-align: center;
  color: var(--muted-foreground);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--muted-foreground); }

.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-item {
  padding: 12px;
  background: rgba(233,235,239,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ===== CURRENT DATABASE ===== */
.summary-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 639px) { .summary-grid-3 { grid-template-columns: 1fr; } }

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.summary-card-inner { display: flex; align-items: center; gap: 12px; }
.summary-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.summary-icon svg { width: 24px; height: 24px; color: #fff; }

.mobile-cards { display: none; }

.stat-box {
  padding: 12px;
  background: rgba(233,235,239,0.3);
  border-radius: var(--radius-lg);
}
.stat-box .stat-label { font-size: 0.75rem; color: var(--muted-foreground); margin-bottom: 4px; }

/* ===== REVENUE ===== */
.revenue-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 767px) {
  .revenue-totals {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 8px 4px 16px;
    margin: -8px -4px 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .revenue-totals::-webkit-scrollbar { display: none; }
  .revenue-total-card {
    flex: 0 0 88%;
    scroll-snap-align: center;
    padding: 20px !important;
  }
}

.revenue-total-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.revenue-value {
  font-size: 1.875rem;
  font-weight: 500;
  margin-top: 8px;
}
.revenue-value.gradient-violet {
  background: linear-gradient(to right, #7c3aed, #9333ea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.revenue-value.gradient-pink {
  background: linear-gradient(to right, #db2777, #e11d48);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.revenue-value.gradient-blue {
  background: linear-gradient(to right, #2563eb, #0891b2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 1023px) { .charts-grid { grid-template-columns: 1fr; } }

.flow-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.flow-row:last-child { border-bottom: none; }
.flow-label { min-width: 140px; font-size: 0.875rem; flex-shrink: 0; }
.flow-bar-wrap {
  flex: 1;
  height: 24px;
  background: var(--muted-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.flow-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}
.flow-bar.gradient-violet { background: linear-gradient(90deg, #8b5cf6, #a855f7); }
.flow-bar.gradient-pink { background: linear-gradient(90deg, #ec4899, #f43f5e); }
.flow-value {
  position: absolute;
  right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 1023px) { .tables-grid { grid-template-columns: 1fr; } }

.subscriber-mini-list { margin: 8px 0 0; padding-left: 20px; font-size: 0.875rem; }
.subscriber-mini-list li { margin-bottom: 4px; }

/* ===== PROGRESS BAR ===== */
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--muted-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(to right, #22c55e, #059669);
  transition: width 0.3s;
}
.progress-fill.violet { background: linear-gradient(to right, #8b5cf6, #9333ea); }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-content {
  background: var(--card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-content-lg { max-width: 900px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* ===== DELETE CONFIRMATION ===== */
.confirm-panel {
  padding: 16px;
  background: rgba(212,24,61,0.05);
  border: 1px solid rgba(212,24,61,0.2);
  border-radius: var(--radius-lg);
  margin-top: 16px;
}
.confirm-panel-inner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.confirm-panel-inner svg { width: 20px; height: 20px; color: var(--destructive); flex-shrink: 0; margin-top: 2px; }
.confirm-actions { display: flex; gap: 8px; }

/* ===== WEEKLY SCHEDULE GRID ===== */
.weekly-grid { overflow-x: auto; }
.weekly-grid table { border-collapse: collapse; }
.weekly-grid th, .weekly-grid td {
  padding: 8px;
  border: 1px solid var(--border);
  text-align: center;
  font-size: 0.875rem;
}
.weekly-grid th { background: var(--muted-bg); min-width: 60px; }
.weekly-grid td { cursor: pointer; transition: background 0.2s; }
.weekly-grid td:hover { background: var(--accent-bg); }
.day-toggle {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  transition: all 0.2s;
  background: var(--muted-bg);
  font-size: 0.875rem;
}
.day-toggle.active {
  background: var(--gradient-violet-purple);
  color: #fff;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh; width: 100%;
  background: linear-gradient(135deg, #f5f3ff, #faf5ff, #eef2ff);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%; max-width: 448px;
  background: var(--card);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
  padding: 32px 40px;
}
.login-logo {
  width: 64px; height: 64px;
  background: var(--gradient-violet-purple);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo svg { width: 32px; height: 32px; color: #fff; }
.login-title { text-align: center; font-size: 1.5rem; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--muted-foreground); margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-md);
}
.login-btn:hover {
  background: var(--gradient-primary-hover);
  box-shadow: 0 10px 25px rgba(139,92,246,0.3);
}
.login-error {
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  color: #b91c1c;
  font-size: 0.875rem;
}

/* ===== POPUPS/TOAST ===== */
.popup-host {
  position: fixed; top: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000;
}
.popup-item {
  opacity: 0; transform: translateY(-6px);
  transition: all 0.18s;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: #1e293b;
  color: #fff;
  max-width: 360px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
}
.popup-item.show { opacity: 1; transform: translateY(0); }

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 639px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.space-y-8 > * + * { margin-top: 32px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.border-t { border-top: 1px solid var(--border); }
.pt-4 { padding-top: 16px; }
.flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .mobile-header { display: block; }
  .main-pane { margin-left: 0; }
  .main-content { padding: 16px; }

  /* Table → cards on mobile */
  .desktop-table { display: none; }
  .mobile-cards { display: block; }
  .attendance-card-mobile { display: block; }

  .db-grid { grid-template-columns: 1fr; }
  .sub-mgmt-grid { grid-template-columns: 1fr; }
  .profile-actions { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
}

@media (min-width: 768px) {
  .mobile-header { display: none; }
  .sidebar { display: flex; }
  .desktop-table { display: block; }
  .mobile-cards { display: none; }
  .attendance-card-mobile { display: none; }
}
