/* ═══════════════════════════════════════════════════════════
   MintFee Admin Portal — styles.css
   Light Theme | Google Material Design 3 Inspired
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-primary:   #1A73E8;
  --brand-secondary: #0D47A1;
  --brand-accent:    #4285F4;
  --brand-light:     #E8F0FE;

  /* Semantic */
  --success:   #1E8E3E;
  --success-bg:#E6F4EA;
  --warning:   #F9AB00;
  --warning-bg:#FEF7E0;
  --danger:    #D93025;
  --danger-bg: #FCE8E6;
  --info:      #1A73E8;
  --info-bg:   #E8F0FE;

  /* Neutrals */
  --bg:        #F8F9FA;
  --surface:   #FFFFFF;
  --surface-2: #F1F3F4;
  --border:    #DADCE0;
  --border-2:  #E8EAED;
  --text-1:    #202124;
  --text-2:    #5F6368;
  --text-3:    #9AA0A6;

  /* Sidebar */
  --sidebar-w:     248px;
  --sidebar-bg:    #FFFFFF;
  --sidebar-border:#E8EAED;
  --nav-active-bg: #E8F0FE;
  --nav-active:    #1A73E8;
  --nav-text:      #5F6368;
  --nav-hover:     #F1F3F4;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);

  /* Spacing */
  --topbar-h: 64px;
  --radius-sm:  8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-mid:  0.25s ease;
  --t-slow: 0.4s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Layout ───────────────────────────────────────────────── */
.app-root {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 50;
  transition: transform var(--t-mid);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 20px 20px;
  border-bottom: 1px solid var(--border-2);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px;
  background: var(--brand-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.brand-icon .material-icons-outlined { font-size: 20px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 15px; color: var(--text-1); line-height: 1.2; }
.brand-sub  { font-size: 11px; color: var(--text-3); font-weight: 500; }

.sidebar-close {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-2); padding: 4px;
}

/* Nav Groups */
.nav-group { padding: 12px 8px 4px; }
.nav-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.08em;
  padding: 0 8px 8px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--nav-hover); color: var(--text-1); }
.nav-link.active { background: var(--nav-active-bg); color: var(--nav-active); }
.nav-link.active .nav-icon { color: var(--nav-active); }

.nav-icon { font-size: 20px; color: var(--text-3); transition: color var(--t-fast); }
.nav-text { flex: 1; }

.nav-count {
  font-size: 11px; font-weight: 700;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 2px 7px;
  border-radius: 20px;
}
.nav-link.active .nav-count { background: var(--brand-light); color: var(--brand-primary); }

.nav-badge {
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  display: none;
}
.nav-badge.show { display: block; }

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border-2);
}
.admin-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.admin-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.admin-info { flex: 1; display: flex; flex-direction: column; }
.admin-name  { font-size: 13px; font-weight: 600; }
.admin-status { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.online { background: var(--success); }

/* ── Main Wrapper ─────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 40;
  box-shadow: var(--shadow-xs);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-2); padding: 8px;
  border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--surface-2); }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-1);
}
.bc-icon { font-size: 18px; color: var(--text-2); }

.search-wrap {
  flex: 1; max-width: 400px;
  position: relative;
  display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 12px;
  color: var(--text-3); font-size: 18px;
  pointer-events: none;
}
#globalSearch {
  width: 100%;
  padding: 8px 12px 8px 40px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-family: inherit; font-size: 13px;
  background: var(--surface-2);
  color: var(--text-1);
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
#globalSearch:focus {
  border-color: var(--brand-primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}

.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  max-height: 300px;
  overflow-y: auto;
}
.search-dropdown.open { display: block; }
.search-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--surface-2); }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-btn {
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  position: relative;
  transition: background var(--t-fast);
}
.topbar-btn:hover { background: var(--surface-2); color: var(--text-1); }
.topbar-btn .material-icons-outlined { font-size: 20px; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
  display: none;
}
.notif-dot.show { display: block; }

.topbar-divider {
  width: 1px; height: 24px;
  background: var(--border);
  margin: 0 4px;
}
.last-updated { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ── Page Container ───────────────────────────────────────── */
.page-container {
  flex: 1;
  padding: 28px 32px;
  max-width: 1600px;
  width: 100%;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-title  { font-size: 24px; font-weight: 700; color: var(--text-1); line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── KPI Grid ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t-mid), transform var(--t-mid);
  cursor: default;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card::before {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card.blue::before   { background: #1A73E8; }
.kpi-card.green::before  { background: #1E8E3E; }
.kpi-card.purple::before { background: #9C27B0; }
.kpi-card.orange::before { background: #F57C00; }
.kpi-card.teal::before   { background: #00897B; }
.kpi-card.red::before    { background: #D93025; }
.kpi-card.indigo::before { background: #3949AB; }
.kpi-card.amber::before  { background: #F9AB00; }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon .material-icons-outlined { font-size: 22px; }
.kpi-icon.blue   { background: #E8F0FE; color: #1A73E8; }
.kpi-icon.green  { background: #E6F4EA; color: #1E8E3E; }
.kpi-icon.purple { background: #F3E5F5; color: #9C27B0; }
.kpi-icon.orange { background: #FFF3E0; color: #F57C00; }
.kpi-icon.teal   { background: #E0F2F1; color: #00897B; }
.kpi-icon.red    { background: #FCE8E6; color: #D93025; }
.kpi-icon.indigo { background: #E8EAF6; color: #3949AB; }
.kpi-icon.amber  { background: #FEF7E0; color: #F9AB00; }

.kpi-value { font-size: 26px; font-weight: 800; color: var(--text-1); line-height: 1; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.kpi-trend {
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 3px;
}
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }

/* Skeleton loader */
.kpi-skeleton {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 140px;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%  { background: var(--surface-2); }
  50% { background: var(--surface);   }
  100%{ background: var(--surface-2); }
}

/* ── Charts ───────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.chart-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.chart-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.chart-body  { position: relative; height: 220px; }
.chart-body.chart-doughnut { height: 180px; }

.chart-legend {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-2);
}
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.legend-dot.blue  { background: #1A73E8; }
.legend-dot.green { background: #1E8E3E; }

.doughnut-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  justify-content: center; padding-top: 12px;
  font-size: 12px;
}

/* ── Breakdown Row ────────────────────────────────────────── */
.breakdown-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.bc-title { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 16px; }

/* Shard Grid */
.shard-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.shard-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}
.shard-chip.error { border-color: var(--danger); background: var(--danger-bg); }
.shard-chip.warn  { border-color: var(--warning); background: var(--warning-bg); }
.shard-num  { font-size: 10px; color: var(--text-3); font-weight: 600; }
.shard-val  { font-size: 14px; font-weight: 700; color: var(--text-1); }
.shard-label{ font-size: 10px; color: var(--text-3); }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  color: var(--text-1);
  transition: all var(--t-fast);
}
.quick-btn:hover {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.quick-btn .material-icons-outlined { font-size: 18px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn .material-icons-outlined { font-size: 16px; }
.btn-primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 1px 3px rgba(26,115,232,.3);
}
.btn-primary:hover {
  background: var(--brand-secondary);
  box-shadow: 0 2px 6px rgba(26,115,232,.4);
  transform: translateY(-1px);
}
.btn-outline {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #B71C1C; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.icon-btn-sm {
  width: 32px; height: 32px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background var(--t-fast);
}
.icon-btn-sm:hover { background: var(--surface-2); color: var(--text-1); }
.icon-btn-sm .material-icons-outlined { font-size: 18px; }

/* ── Teachers Page ────────────────────────────────────────── */
.teachers-stats {
  display: flex; gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tstat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-2);
}
.tstat-chip .dot { flex-shrink: 0; }

/* Table Card */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-2);
  gap: 12px;
  flex-wrap: wrap;
}
.table-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  min-width: 260px;
}
.table-search .material-icons-outlined { font-size: 16px; color: var(--text-3); }
.table-search input {
  border: none; background: none; outline: none;
  font-family: inherit; font-size: 13px; color: var(--text-1);
  width: 100%;
}
.table-controls {
  display: flex; align-items: center; gap: 8px;
}
.check-all-wrap {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2); cursor: pointer;
}

.filter-group { display: flex; gap: 8px; }
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12px;
  color: var(--text-1); background: var(--surface);
  outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--brand-primary); }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
  background: var(--surface);
  position: sticky; top: 0;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text-1); }
.sort-icon { font-size: 10px; }
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-2);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .col-check { width: 40px; }
.data-table .col-actions { white-space: nowrap; }

/* Status Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.badge-premium { background: #FEF7E0; color: #F57C00; }
.badge-free     { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-active   { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--warning-bg); color: var(--warning); }
.badge-killed   { background: var(--danger-bg); color: var(--danger); }
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* Action buttons in table */
.action-cell { display: flex; align-items: center; gap: 4px; }
.action-icon-btn {
  width: 28px; height: 28px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.action-icon-btn:hover { background: var(--surface-2); color: var(--text-1); }
.action-icon-btn .material-icons-outlined { font-size: 15px; }
.action-icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* Table footer */
.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-2);
  font-size: 12px; color: var(--text-2);
}
.pagination { display: flex; gap: 4px; }
.page-btn {
  width: 28px; height: 28px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover, .page-btn.active {
  background: var(--brand-light); color: var(--brand-primary);
  border-color: var(--brand-primary);
}

/* Loading state */
.table-loading {
  text-align: center; padding: 40px;
  color: var(--text-3); font-size: 13px;
}

/* ── Teacher profile in table ─────────────────────────────── */
.teacher-cell { display: flex; align-items: center; gap: 10px; }
.teacher-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-primary);
  color: white; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.teacher-info .t-name { font-weight: 600; font-size: 13px; }
.teacher-info .t-id   { font-size: 10px; color: var(--text-3); font-family: monospace; }
.contact-cell .t-email  { font-size: 12px; color: var(--text-2); }
.contact-cell .t-mobile { font-size: 11px; color: var(--text-3); }

/* ── Plans Page ───────────────────────────────────────────── */
.plans-grid {
  display: grid;
  grid-template-columns: 320px 320px 1fr;
  gap: 20px;
  align-items: start;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
}
.plan-card.featured {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px var(--brand-primary), var(--shadow-md);
}
.plan-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.plan-badge.free    { background: var(--surface-2); color: var(--text-2); }
.plan-badge.premium { background: #FEF7E0; color: #F57C00; }
.plan-name  { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.plan-price {
  font-size: 36px; font-weight: 800;
  color: var(--brand-primary); margin-bottom: 20px;
}
.plan-price span { font-size: 14px; color: var(--text-2); font-weight: 400; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.plan-features li {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-1);
}
.plan-features .material-icons-outlined { font-size: 18px; }
.plan-features .material-icons-outlined:first-child { color: var(--success); }

.plan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.ps-item { display: flex; flex-direction: column; gap: 2px; }
.ps-value { font-size: 22px; font-weight: 700; }
.ps-label { font-size: 11px; color: var(--text-3); }

.stats-card { display: flex; flex-direction: column; }
.conversion-stats {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12px;
}

/* ── Notifications Page ───────────────────────────────────── */
.notif-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
.compose-card, .history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.compose-title { font-size: 15px; font-weight: 600; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-input, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; color: var(--text-1);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t-fast);
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.form-textarea { resize: vertical; min-height: 100px; }
.char-count { font-size: 11px; color: var(--text-3); float: right; margin-top: 4px; }

.type-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.type-chip input { display: none; }
.type-chip span {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}
.type-chip input:checked + span {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.type-chip span .material-icons-outlined { font-size: 15px; }

.target-options { display: flex; flex-direction: column; gap: 8px; }
.target-opt {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer;
}
.target-opt input { accent-color: var(--brand-primary); }

.template-shortcuts {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.template-label { font-size: 11px; color: var(--text-3); font-weight: 600; }
.tmpl-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  transition: all var(--t-fast);
}
.tmpl-btn:hover {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.compose-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 4px;
}

.send-preview {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px; color: var(--text-2);
  margin-bottom: 16px;
}

.history-list { display: flex; flex-direction: column; gap: 10px; max-height: 500px; overflow-y: auto; }
.history-item {
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.hi-title { font-size: 13px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.hi-msg   { font-size: 12px; color: var(--text-2); margin-bottom: 6px; line-height: 1.4; }
.hi-meta  { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }

.selected-teachers-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 36px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: 8px;
}
.teacher-tag {
  display: flex; align-items: center; gap: 4px;
  background: var(--brand-light);
  color: var(--brand-primary);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.teacher-tag button {
  background: none; border: none; cursor: pointer;
  color: inherit; font-size: 14px; line-height: 1;
}

/* ── System Health ────────────────────────────────────────── */
.health-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--success-bg);
  border: 1px solid #34A853;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 13px; font-weight: 500; color: var(--success);
  margin-bottom: 20px;
}
.health-banner.warning { background: var(--warning-bg); border-color: var(--warning); color: #E65100; }
.health-banner.error   { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.health-time { margin-left: auto; font-size: 11px; opacity: 0.7; }

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.sc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-2);
}
.sc-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
}
.sc-title .material-icons-outlined { color: var(--text-2); font-size: 20px; }
.sc-meta { display: flex; gap: 20px; font-size: 12px; color: var(--text-2); }
.sc-meta strong { color: var(--text-1); }

/* Shards Detail Grid */
.shards-detail-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
.shard-detail {
  padding: 16px 20px;
  border-right: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
  transition: background var(--t-fast);
}
.shard-detail:hover { background: var(--surface-2); }
.shard-detail:nth-child(5n) { border-right: none; }
.shard-detail:nth-child(n+6) { border-bottom: none; }
.sd-header { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.sd-num {
  font-size: 11px; font-weight: 700;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 2px 6px; border-radius: 4px;
}
.sd-status { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; }
.sd-status.healthy { background: var(--success); }
.sd-status.error   { background: var(--danger); }

.shard-bar { height: 4px; background: var(--border-2); border-radius: 2px; margin-bottom: 8px; overflow: hidden; }
.shard-bar-fill { height: 100%; border-radius: 2px; background: var(--brand-primary); transition: width 0.6s ease; }
.shard-bar-fill.warn { background: var(--warning); }
.shard-bar-fill.danger { background: var(--danger); }

.sd-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.sd-row { font-size: 11px; }
.sd-row .label { color: var(--text-3); }
.sd-row .val   { font-weight: 600; color: var(--text-1); }

/* R2 Stats */
.r2-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-2);
}
.r2-stat { text-align: center; padding: 8px; }
.r2-val { font-size: 22px; font-weight: 700; color: var(--text-1); }
.r2-lbl { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.r2-chart-wrap { padding: 16px 24px; }

/* Limits Grid */
.limits-grid { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.limit-item {}
.limit-label { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.limit-bar {
  height: 6px; background: var(--surface-2);
  border-radius: 3px; overflow: hidden; margin-bottom: 4px;
}
.limit-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.8s ease;
}
.limit-fill.blue   { background: var(--brand-primary); }
.limit-fill.green  { background: var(--success); }
.limit-fill.purple { background: #9C27B0; }
.limit-fill.orange { background: var(--warning); }
.limit-val { font-size: 11px; color: var(--text-3); text-align: right; }

/* ── Audit Logs Page ──────────────────────────────────────── */
.audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.audit-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-2);
  gap: 12px;
}
.audit-timeline {
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 600px; overflow-y: auto;
}
.audit-entry {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
  position: relative;
}
.audit-entry::before {
  content: '';
  position: absolute;
  left: 22px; top: 36px; bottom: -4px;
  width: 2px;
  background: var(--border-2);
}
.audit-entry:last-child::before { display: none; }
.audit-entry:hover { background: var(--surface-2); }
.ae-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-3);
  border: 2px solid var(--surface);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative; z-index: 1;
}
.ae-dot.action { background: var(--brand-primary); }
.ae-dot.warn   { background: var(--warning); }
.ae-dot.danger { background: var(--danger); }
.ae-body { flex: 1; }
.ae-action { font-size: 13px; color: var(--text-1); font-weight: 500; }
.ae-meta   { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Analytics Page ───────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.chart-card.wide { grid-column: 1 / -1; }

.stats-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.mini-table-wrap { overflow-x: auto; max-height: 320px; overflow-y: auto; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-2);
  position: sticky; top: 0; background: var(--surface);
}
.mini-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}
.mini-table tbody tr:last-child td { border-bottom: none; }
.mini-table tbody tr:hover { background: var(--surface-2); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(32,33,36,.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-mid);
}
.modal-backdrop.open {
  opacity: 1; pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  max-height: 90vh;
  width: 90%;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--t-mid);
  overflow: hidden;
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-sm { max-width: 440px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title-wrap {
  display: flex; align-items: center; gap: 10px;
}
.modal-title-wrap .material-icons-outlined { font-size: 22px; color: var(--brand-primary); }
.modal-title-wrap.danger .material-icons-outlined { color: var(--danger); }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Teacher audit modal specifics */
.teacher-profile-strip {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tps-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tps-info { flex: 1; }
.tps-name   { font-size: 16px; font-weight: 700; }
.tps-email  { font-size: 12px; color: var(--text-2); }
.tps-mobile { font-size: 12px; color: var(--text-3); }
.tps-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tps-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-3); }

.audit-stat-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.asc-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.asc-val { font-size: 20px; font-weight: 700; color: var(--text-1); }
.asc-lbl { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Modal Tabs */
.modal-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.modal-tab {
  padding: 10px 20px;
  border: none; background: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t-fast);
}
.modal-tab:hover { color: var(--text-1); background: var(--surface-2); }
.modal-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Activity log in modal */
.activity-log { display: flex; flex-direction: column; gap: 8px; }
.al-item {
  display: flex; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.al-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-primary);
  flex-shrink: 0; margin-top: 4px;
}
.al-action { font-size: 13px; color: var(--text-1); }
.al-time   { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Plan change bar in modal footer */
.plan-change-bar {
  display: flex; align-items: center; gap: 10px;
  flex: 1; font-size: 13px;
  flex-wrap: wrap;
}
.plan-change-bar .material-icons-outlined { color: var(--warning); }
.pc-label { color: var(--text-2); font-weight: 500; }
.pc-current { font-weight: 700; color: var(--text-1); }
.pc-actions { display: flex; gap: 6px; margin-left: auto; }

/* Kill warning */
.kill-warning {
  font-size: 13px; color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--danger);
}

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  min-width: 280px; max-width: 400px;
}
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { background: var(--success-bg); color: var(--success); border: 1px solid #34A853; }
.toast.error   { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.toast.info    { background: var(--brand-light); color: var(--brand-primary); border: 1px solid var(--brand-primary); }
.toast.warning { background: var(--warning-bg); color: #E65100; border: 1px solid var(--warning); }
.toast .material-icons-outlined { font-size: 18px; flex-shrink: 0; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-3); font-size: 13px;
}
.empty-state .material-icons-outlined { font-size: 40px; display: block; margin-bottom: 8px; opacity: 0.4; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1280px) {
  .plans-grid        { grid-template-columns: 1fr 1fr; }
  .plans-grid .stats-card { grid-column: 1 / -1; }
  .audit-stat-cards  { grid-template-columns: repeat(3, 1fr); }
  .shards-detail-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 1024px) {
  .charts-row         { grid-template-columns: 1fr; }
  .breakdown-row      { grid-template-columns: 1fr; }
  .notif-layout       { grid-template-columns: 1fr; }
  .analytics-grid     { grid-template-columns: 1fr; }
  .shards-detail-grid { grid-template-columns: repeat(3, 1fr); }
  .r2-stats           { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-248px);
    width: 248px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .hamburger { display: flex; }
  .main-wrapper { margin-left: 0; }
  .page-container { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .plans-grid { grid-template-columns: 1fr; }
  .audit-stat-cards { grid-template-columns: repeat(2, 1fr); }
  .shards-detail-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; }
  .page-actions { width: 100%; }
  .modal { width: 95%; }
  .modal-xl, .modal-lg { max-width: 95%; }
}

/* ── KILL MODAL ────────────────────────────────────────────────── */
.kill-warning { margin-bottom: 16px; color: var(--text-2); line-height: 1.5; font-size: 14px; }
.kill-warning strong { color: var(--text-1); font-weight: 600; }

/* ── LOGIN OVERLAY ───────────────────────────────────────────── */
.login-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-1);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-card {
  background: #fff;
  padding: 48px 40px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  text-align: center;
  width: 100%; max-width: 400px;
}
.login-card h2 {
  font-size: 24px; color: var(--text-1); margin-top: 16px; font-weight: 700;
}

/* ── Utility ──────────────────────────────────────────────── */
.text-muted { color: var(--text-3); }
.text-small { font-size: 12px; }
.fw-600     { font-weight: 600; }
.mono       { font-family: 'Courier New', monospace; font-size: 11px; }
