*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:      #1a56db;
  --brand-dk:   #1241a5;
  --brand-lt:   #eff6ff;
  --accent:     #f59e0b;
  --bg:         #f8fafc;
  --card-bg:    #ffffff;
  --text:       #1e293b;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --success:    #16a34a;
  --danger:     #dc2626;
  --warn:       #d97706;
  --sidebar-w:  240px;
  --topbar-h:   60px;
  --radius:     8px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ─── PUBLIC TOP BAR ─── */
.topbar-public {
  background: var(--brand);
  color: #fff;
  height: var(--topbar-h);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.logo { font-size: 1.3rem; font-weight: 800; letter-spacing: .5px; color: #fff; text-decoration: none; }
.logo span { color: var(--accent); }

.topbar-nav { display: flex; gap: 1.5rem; list-style: none; align-items: center; }
.topbar-nav a { color: rgba(255,255,255,.88); text-decoration: none; font-size: .9rem; font-weight: 500; }
.topbar-nav a:hover { color: #fff; }

.btn-login-top {
  background: rgba(255,255,255,.15);
  padding: .3rem 1rem;
  border-radius: 20px;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.3);
}
.btn-login-top:hover { background: rgba(255,255,255,.28) !important; }

/* ─── AUTHENTICATED TOPBAR ─── */
.topbar-app {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem 0 calc(var(--sidebar-w) + 1.5rem);
  z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  color: var(--text);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 1.25rem; }

/* notification bell */
.notif-btn {
  position: relative;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--muted);
  line-height: 1;
}
.notif-btn:hover { color: var(--text); }
.badge-dot {
  position: absolute;
  top: 0; right: 0;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* profile dropdown */
.profile-menu { position: relative; }
.profile-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: var(--radius);
  transition: background .15s;
  color: var(--text);
}
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:hover { background: var(--bg); }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-info { text-align: left; }
.profile-name { font-size: .85rem; font-weight: 600; line-height: 1.2; color: var(--text); }
.profile-role { font-size: .72rem; color: var(--muted); }
.profile-menu ul {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  list-style: none;
  min-width: 210px;
  overflow: hidden;
  z-index: 300;
}
.dropdown-header {
  padding: .75rem 1rem;
  background: var(--brand-lt);
  border-bottom: 1px solid var(--border);
}
.dropdown-header strong { font-size: .88rem; display: block; }
.dropdown-header p { font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.profile-menu ul li a {
  display: block;
  padding: .55rem 1rem;
  font-size: .87rem;
  color: var(--text);
  text-decoration: none;
}
.profile-menu ul li a:hover { background: var(--bg); }
.profile-menu ul .divider { border-top: 1px solid var(--border); margin: .25rem 0; }
.profile-menu ul .dropdown-divider { border-top: 1px solid var(--border); margin: .25rem 0; }
.logout-link { color: var(--danger) !important; }

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #1e293b;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 201;
}
.sidebar-logo {
  padding: 0 1.25rem;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  flex-shrink: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .4px;
}
.sidebar-logo span { color: var(--accent); }
.sidebar-section-label {
  padding: 1.25rem 1.25rem .4rem;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.35);
  display: block;
}
.sidebar-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: .6rem 1.25rem .2rem;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  position: relative;
  transition: background .15s, color .15s;
}
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active {
  background: var(--brand);
  color: #fff;
}
.sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.sidebar a.sidebar-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.sidebar-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-divider { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: .4rem 1rem; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.nav-badge.green { background: var(--success); }

/* nav-item / nav-sub-item — explicit class aliases for sidebar links */
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.nav-item.sidebar-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.nav-sub-item {
  display: flex;
  align-items: center;
  padding: .45rem 1rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .83rem;
  font-weight: 400;
  transition: background .15s, color .15s;
}
.nav-sub-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-sub-item.active { color: #fff; font-weight: 600; }

.summary-arrow {
  margin-left: auto;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  transition: transform .15s;
}
details[open] .summary-arrow { transform: rotate(180deg); }

/* ─── SIDEBAR SUBMENU ─── */
.sidebar-submenu {
  display: block;
}
.sidebar-submenu summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.72);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar-submenu summary::-webkit-details-marker { display: none; }
.sidebar-submenu summary:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-submenu summary.active {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.sidebar-sub-items {
  padding-left: .75rem;
  border-left: 2px solid rgba(255,255,255,.1);
  margin: 0 0 .25rem 1.25rem;
}
.sidebar-sub-items a {
  padding: .5rem 1rem;
  font-size: .83rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: rgba(255,255,255,.55);
  font-size: .82rem;
  text-decoration: none;
  padding: .4rem 0;
  transition: color .15s;
}
.sidebar-footer a:hover { color: #fff; }

/* profile dropdown divider */
.profile-menu ul .dropdown-divider { border-top: 1px solid var(--border); margin: .3rem 0; }

/* ─── APP CONTENT ─── */
.app-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.page-body { padding: 2rem; max-width: 1200px; }
.page-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.5rem; }

/* ─── STAT ROW / CARDS ─── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.stat-card-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat-card-value { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1.2; margin: .25rem 0 .1rem; }
.stat-card-sub   { font-size: .78rem; color: var(--muted); }
.stat-card.red   .stat-card-value { color: var(--danger); }
.stat-card.amber .stat-card-value { color: var(--warn); }
.stat-card.green .stat-card-value { color: var(--success); }

/* ─── ALERTS ─── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ─── HERO (public) ─── */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, #0f3fa8 100%);
  color: #fff;
  padding: 5rem 2rem 4.5rem;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: .25rem .85rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.15; max-width: 700px; margin: 0 auto .8rem; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.15rem; color: rgba(255,255,255,.82); max-width: 560px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: .65rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: filter .15s, transform .1s;
  cursor: pointer;
  border: none;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary  { background: var(--accent); color: #1a1a1a; }
.btn-outline  { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.6); }
.btn-outline:hover { background: rgba(255,255,255,.1); }
.btn-blue { background: var(--brand); color: #fff; }

/* ─── STATS BAR ─── */
.stats-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 4rem;
  padding: 1.25rem 2rem;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--brand); }
.stat-label { font-size: .75rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }

/* ─── CARDS ─── */
.cards { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; max-width: 1100px; margin: 0 auto; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  width: 310px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-3px); }
.card-icon {
  font-size: 1.8rem;
  background: #eff6ff;
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.card p  { font-size: .88rem; color: var(--muted); }
.card-link { display: inline-block; margin-top: .85rem; font-size: .83rem; font-weight: 600; color: var(--brand); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ─── SUMMARY CARDS (dashboard) ─── */
.summary-cards { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  flex: 1 1 160px;
  min-width: 160px;
}
.summary-card .num { font-size: 2rem; font-weight: 800; color: var(--brand); }
.summary-card .label { font-size: .78rem; color: var(--muted); font-weight: 500; text-transform: uppercase; }
.summary-card.highlight { border-color: var(--accent); }
.summary-card.highlight .num { color: var(--accent); }

/* ─── HOW IT WORKS ─── */
.steps-bg { background: #f1f5f9; }
.steps-list { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; max-width: 960px; margin: 0 auto; }
.step { flex: 1 1 180px; text-align: center; max-width: 220px; }
.step-num {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .75rem;
}
.step h3 { font-size: .95rem; font-weight: 700; margin-bottom: .3rem; }
.step p  { font-size: .83rem; color: var(--muted); }

/* ─── QUIZ GRID ─── */
.quiz-grid { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; max-width: 900px; margin: 0 auto; }
.quiz-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 260px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .2s, transform .2s;
}
.quiz-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-3px); }
.quiz-topic-icon { font-size: 2rem; margin-bottom: .5rem; }
.quiz-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.quiz-card p  { font-size: .78rem; color: var(--muted); margin-bottom: .5rem; }
.quiz-sizes { display: flex; gap: .4rem; margin-bottom: .75rem; flex-wrap: wrap; }
.quiz-size-pill {
  font-size: .7rem;
  font-weight: 700;
  background: #eff6ff;
  color: var(--brand);
  padding: .1rem .45rem;
  border-radius: 20px;
}
.cert-badge-pass { font-size: .75rem; font-weight: 700; color: var(--success); }
.cert-badge-fail { font-size: .75rem; font-weight: 700; color: var(--danger); }
.cert-badge-none { font-size: .75rem; font-weight: 700; color: var(--muted); }

/* ─── TABLES ─── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
th { background: var(--brand); color: #fff; padding: .65rem 1rem; text-align: left; font-size: .82rem; font-weight: 600; }
td { padding: .6rem 1rem; font-size: .85rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

/* ─── FORMS ─── */
.form-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
textarea { resize: vertical; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: .5rem .75rem; }
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-weight: 400;
  cursor: pointer;
}
.form-footer { text-align: center; margin-top: 1.25rem; font-size: .85rem; color: var(--muted); }
.form-footer a { color: var(--brand); text-decoration: none; }

/* ─── CTA BAND ─── */
.cta-band {
  background: linear-gradient(90deg, #1a56db, #0f3fa8);
  color: #fff;
  text-align: center;
  padding: 3.5rem 2rem;
}
.cta-band h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: .5rem; }
.cta-band p  { color: rgba(255,255,255,.8); margin-bottom: 1.5rem; }

/* ─── SECTION ─── */
section { padding: 4rem 2rem; }
.section-title { text-align: center; margin-bottom: 2.5rem; }
.section-title h2 { font-size: 1.9rem; font-weight: 800; }
.section-title p { color: var(--muted); margin-top: .4rem; }

/* ─── SECTION HEADING ─── */
.section-heading {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ─── FOOTER ─── */
footer {
  background: #1e293b;
  color: rgba(255,255,255,.6);
  padding: 2rem;
  text-align: center;
  font-size: .82rem;
}
footer a { color: rgba(255,255,255,.7); text-decoration: none; margin: 0 .5rem; }
footer a:hover { color: #fff; }
.footer-links { margin-bottom: .6rem; }
