:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --blue-bg: #e0f2fe;
  --blue-text: #0369a1;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 18px; }

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; gap: 12px; flex-wrap: wrap; padding: 8px 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #0284c7);
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 16px;
}
.brand-title { font-weight: 800; font-size: 18px; display: block; color: var(--text); }
.brand-sub { color: var(--muted); font-size: 12px; display: block; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Language Switcher */
.lang-switch {
  display: inline-flex; background: #f1f5f9; padding: 3px; border-radius: 8px; border: 1px solid var(--border);
}
.lang-btn {
  border: none; background: transparent; padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.lang-btn.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; padding: 10px 16px; font-size: 14px; transition: 0.15s;
}
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-dark { background: #0f172a; color: #fff; }
.btn-amber { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.btn-ghost { background: transparent; color: var(--muted); }
.link-btn { background: none; border: none; color: var(--primary); font-weight: 600; font-size: 12px; cursor: pointer; text-decoration: underline; }

/* Status Strip */
.status-strip { background: #ecfdf5; border-bottom: 1px solid #a7f3d0; padding: 10px 0; }
.status-strip-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.student-switcher { display: flex; align-items: center; gap: 10px; }
.avatar-badge {
  width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 700;
  display: grid; place-items: center; font-size: 15px;
}
.student-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.student-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; }
.mini-select { padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); font-size: 12px; }
.sub-status-pill { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill-active { background: #d1fae5; color: #065f46; }
.pill-free { background: #fef3c7; color: #92400e; }
.pill-free a { color: #b45309; font-weight: 700; }
.guest-banner { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; flex-wrap: wrap; font-size: 14px; font-weight: 500; }

/* Main Content & Grade Tabs */
.main-content { padding: 26px 18px 60px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; }
.page-desc { color: var(--muted); font-size: 14px; }

.grade-tabs {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 24px;
}
@media (max-width: 900px) { .grade-tabs { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .grade-tabs { grid-template-columns: repeat(2, 1fr); } }

.grade-tab {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 12px 10px; text-align: center; cursor: pointer; transition: 0.15s;
}
.grade-tab .grade-num { display: block; font-weight: 700; font-size: 14px; color: var(--text); }
.grade-tab small { color: var(--muted); font-size: 11px; font-weight: 600; }
.grade-tab.active { border-color: var(--primary); background: #f0fdfa; }
.grade-tab.active .grade-num { color: var(--primary); }

/* Subjects Grid */
.subjects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px;
}
.subject-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between;
}
.subject-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #f1f5f9; }
.subject-title { font-size: 17px; font-weight: 700; }
.subject-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: #fff; }

.topic-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px;
  background: #fafafa; transition: 0.15s;
}
.topic-item:hover { border-color: var(--primary); background: #fff; }
.topic-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.topic-title { font-weight: 700; font-size: 14px; color: var(--text); }
.topic-comp { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.topic-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge-free { background: #dbeafe; color: #1e40af; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.badge-lock { background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.badge-done { background: #dcfce7; color: #166534; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }

/* Pricing */
.pricing-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.pricing-head { text-align: center; max-width: 640px; margin: 0 auto 24px; }
.pricing-head h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.pricing-head p { color: var(--muted); font-size: 14px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }
.plan-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; position: relative; box-shadow: var(--shadow);
}
.plan-card.featured { border: 2px solid var(--primary); }
.plan-badge {
  position: absolute; top: -11px; right: 16px; background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.plan-price { font-size: 26px; font-weight: 800; color: var(--primary); margin: 10px 0 14px; }
.plan-features { list-style: none; margin-bottom: 18px; font-size: 13.5px; color: var(--muted); }
.plan-features li { margin-bottom: 7px; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal-dialog {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-lg { max-width: 820px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 1px solid var(--border); gap: 10px;
}
.modal-header h2 { font-size: 18px; font-weight: 800; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.modal-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--primary); }
.close-btn { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-tabs { display: flex; border-bottom: 1px solid var(--border); background: #f8fafc; }
.mtab {
  flex: 1; padding: 12px; border: none; background: transparent; font-weight: 700;
  font-size: 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent;
}
.mtab.active { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }
.modal-body { padding: 20px; }

/* Lesson & Quiz Content */
.competency-box { background: #f0fdfa; border-left: 4px solid var(--primary); padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.lesson-article { font-size: 15.5px; color: #1e293b; margin-bottom: 16px; white-space: pre-line; }
.example-box { background: #eff6ff; border-left: 4px solid #0284c7; padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.activity-box { background: #fefce8; border-left: 4px solid #ca8a04; padding: 12px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.lesson-footer-cta { margin-top: 18px; display: flex; justify-content: flex-end; }

.quiz-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: #fff; }
.quiz-q { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.quiz-opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; cursor: pointer; font-size: 14px;
}
.quiz-opt:hover { background: #f8fafc; }
.quiz-exp { margin-top: 10px; padding: 10px; border-radius: 8px; font-size: 13px; background: #f1f5f9; }
.quiz-result { padding: 16px; border-radius: 10px; background: #ecfdf5; border: 1px solid #6ee7b7; margin-top: 14px; font-weight: 600; }

/* Forms & Checkout */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .form-row-2 { grid-template-columns: 1fr; } }
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.network-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.net-option {
  display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.ussd-panel { text-align: center; padding: 18px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 12px; }
.ussd-icon { font-size: 36px; margin-bottom: 8px; }
.ussd-ref { margin: 12px 0; font-size: 14px; background: #fff; padding: 8px; border-radius: 6px; border: 1px dashed var(--primary); }

/* Admin Styles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.kpi-card span { display: block; font-size: 12.5px; color: var(--muted); }
.kpi-card strong { font-size: 22px; font-weight: 800; color: var(--primary); }
.admin-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 920px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.admin-card h2 { font-size: 17px; margin-bottom: 14px; }
.alert-success { background: #dcfce7; color: #166534; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
.badge-paid { background: #dcfce7; color: #166534; padding: 2px 7px; border-radius: 6px; font-weight: 700; font-size: 11px; }
.badge-pending { background: #fef3c7; color: #92400e; padding: 2px 7px; border-radius: 6px; font-weight: 700; font-size: 11px; }

.footer { border-top: 1px solid var(--border); background: #fff; padding: 20px 0; text-align: center; color: var(--muted); font-size: 13px; }
