/* ============================================================
   Porhim — custom stylesheet (Phase 1)
   Palette derived from the attached dashboard figure:
     - maroon headers / accents   #6a1b2a (deep maroon)
     - teal secondary accent      #0f766e
     - green progress / success    #16a34a
     - page background             #f7f6f3 (warm light gray)
     - card background             #ffffff
   ============================================================ */

:root {
  --maroon: #6a1b2a;
  --maroon-dark: #4d121d;
  --teal: #0f766e;
  --teal-dark: #0c5e58;
  --green: #16a34a;
  --green-dark: #15803d;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f6f3;
  --card: #ffffff;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 8px 24px -12px rgba(17, 24, 39, .12);
  --shadow-hover: 0 4px 12px rgba(17, 24, 39, .10), 0 18px 40px -16px rgba(17, 24, 39, .22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", "Noto Sans Assamese", "Noto Sans Bengali", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

/* Language toggle in navbar */
.lang-toggle { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; }
.lang-toggle a { color: var(--muted); font-weight: 600; padding: .15rem .3rem; border-radius: 4px; }
.lang-toggle a:hover { text-decoration: none; background: var(--bg); }
.lang-toggle a.active { color: var(--maroon); background: var(--bg); }

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--maroon); margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

img { max-width: 100%; display: block; }

.container { width: min(1140px, 92%); margin: 0 auto; }

/* ---------- Navbar ---------- */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar .inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .8rem 1rem;
  padding: .6rem 0;
}
.brand {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--maroon);
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 12px; height: 12px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
}
.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a { color: var(--ink); font-weight: 500; white-space: nowrap; }
.nav-links a:hover { color: var(--teal-dark); text-decoration: none; }
.nav-spacer { flex: 1 1 0; min-width: 0; }

/* Admin dropdown */
.dropdown { position: relative; }
.dropdown-toggle { cursor: default; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  list-style: none;
  margin: .3rem 0 0;
  padding: .3rem 0;
  min-width: 150px;
  z-index: 100;
  flex-direction: column;
  gap: 0;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu { display: flex; }
.dropdown-menu li { margin: 0; }
.dropdown-menu a {
  display: block;
  padding: .5rem 1rem;
  font-weight: 500;
  font-size: .9rem;
  white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--bg); color: var(--teal-dark); }
.nav-search {
  display: flex; align-items: center; gap: .4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .9rem;
  max-width: 100%;
}
.nav-search input {
  border: none; background: transparent; outline: none;
  font-size: .9rem; width: 140px; max-width: 100%; color: var(--ink);
}
@media (max-width: 768px) {
  .nav-search input { width: 90px; }
}
.avatar-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; color: var(--ink);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--maroon); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600; font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--maroon); color: #fff; }
.btn-primary:hover { background: var(--maroon-dark); color: #fff; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-dark); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-outline {
  background: transparent; color: var(--maroon);
  border-color: var(--maroon);
}
.btn-outline:hover { background: var(--maroon); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; }
.btn-google {
  background: #fff; color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.btn-google:hover { background: #fafafa; }

/* ---------- Hero ---------- */
.hero {
  background:
    linear-gradient(135deg, rgba(106,27,42,.92), rgba(15,118,110,.85)),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.12), transparent 40%);
  color: #fff;
  padding: 4.5rem 0;
  text-align: center;
}
.hero h1 { color: #fff; font-size: 2.6rem; margin-bottom: .5rem; }
.hero p { color: rgba(255,255,255,.9); font-size: 1.15rem; max-width: 640px; margin: 0 auto 1.6rem; }
.hero .search-box {
  display: flex; gap: .5rem; justify-content: center;
  max-width: 560px; margin: 0 auto;
}
.hero .search-box input {
  flex: 1; padding: .9rem 1.1rem; border-radius: var(--radius-sm);
  border: none; font-size: 1rem;
}

/* ---------- Section headings ---------- */
.section { padding: 3rem 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.6rem; flex-wrap: wrap; gap: .5rem;
}
.section-head h2 { margin: 0; }
.muted { color: var(--muted); }

/* ---------- Filters / chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.6rem; }
.chip {
  padding: .4rem .9rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-size: .88rem; font-weight: 500;
}
.chip.active { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.chip:hover { text-decoration: none; }

/* ---------- Course grid + cards ---------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
}
@media (max-width: 900px) { .course-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .course-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card-cover {
  height: 160px;
  background: var(--maroon);
  background-size: cover; background-position: center;
  position: relative;
}
.card-cover .free-tag {
  position: absolute; top: 10px; left: 10px;
  background: var(--green); color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.card-cover .price-tag {
  position: absolute; top: 10px; left: 10px;
  background: var(--maroon); color: #fff;
  font-size: .8rem; font-weight: 800;
  padding: .2rem .6rem; border-radius: 999px;
}
.card-body { padding: 1.1rem 1.2rem 1.3rem; flex: 1; display: flex; flex-direction: column; }
.card-body h3 {
  color: var(--ink); margin: 0 0 .35rem;
  font-size: 1.08rem; font-weight: 700;
}
.card-body .desc {
  color: var(--muted); font-size: .92rem; margin: 0 0 1rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .82rem; color: var(--muted); margin-bottom: .9rem;
}

/* ---------- Progress bar (the figure's signature element) ---------- */
.progress-row {
  display: flex; align-items: center; gap: .6rem;
  margin-top: auto;
}
.progress {
  flex: 1; height: 8px; background: #e6e6e6; border-radius: 999px; overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: var(--green); border-radius: 999px;
}
.progress-badge {
  min-width: 42px; text-align: right;
  font-size: .82rem; font-weight: 700; color: var(--green-dark);
}
.progress-badge.zero { color: var(--muted); }

/* ---------- Course detail ---------- */
.detail-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-aside {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem;
  position: sticky; top: 90px;
}
.detail-cover {
  height: 280px; border-radius: var(--radius);
  background: var(--maroon); background-size: cover; background-position: center;
  margin-bottom: 1.5rem;
}
.stat-row { display: flex; gap: 1.4rem; color: var(--muted); font-size: .9rem; margin-bottom: 1.2rem; }
.stat-row span { display: inline-flex; align-items: center; gap: .35rem; }
.curriculum-item {
  list-style: none; padding: .8rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .6rem; color: var(--ink); font-size: .95rem;
}
.curriculum-item:last-child { border-bottom: none; }
.curriculum-item .mime { color: var(--teal); font-weight: 700; font-size: .8rem; }

/* ---------- Lesson player layout ---------- */
.learn-grid {
  display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start;
}
@media (max-width: 900px) { .learn-grid { grid-template-columns: 1fr; } }
.learn-main { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; }
.learn-main .placeholder {
  height: 380px; border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(106,27,42,.9), rgba(15,118,110,.85));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 600; margin-bottom: 1.3rem;
}
.lesson-sidebar { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 0; max-height: 75vh; overflow: auto; }
.lesson-sidebar h4 { padding: 0 1.1rem .5rem; color: var(--maroon); }
.lesson-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1.1rem; color: var(--ink);
  border-left: 3px solid transparent;
}
.lesson-link:hover { background: var(--bg); text-decoration: none; }
.lesson-link.active { background: var(--bg); border-left-color: var(--maroon); font-weight: 600; }
.lesson-link .check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: .7rem;
}
.lesson-link.completed .check { background: var(--green); border-color: var(--green); }

/* ---------- Forms / auth ---------- */
.auth-wrap { max-width: 440px; margin: 3rem auto; }
.auth-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.auth-divider {
  display: flex; align-items: center; gap: .8rem;
  color: var(--muted); font-size: .85rem; margin: 1.3rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }
.field input, .field select {
  width: 100%; padding: .65rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .95rem; font-family: inherit;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,118,110,.15);
}
.error-text { color: var(--danger); font-size: .82rem; margin-top: .3rem; }

/* ---------- Flash messages ---------- */
.flashes { list-style: none; padding: 0; margin: 1rem 0; }
.flashes li {
  padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: .6rem;
  font-weight: 500; font-size: .92rem;
}
.flashes li.success { background: #dcfce7; color: #14532d; }
.flashes li.info    { background: #e0f2fe; color: #075985; }
.flashes li.warning { background: #fef3c7; color: #78350f; }
.flashes li.danger  { background: #fee2e2; color: #7f1d1d; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line); background: var(--card);
  padding: 2rem 0; margin-top: 3rem; color: var(--muted); font-size: .9rem;
}
.footer .inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Misc helpers ---------- */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: .5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-green { background: #dcfce7; color: #14532d; }
.badge-teal  { background: #ccfbf1; color: #134e4a; }
.badge-gray  { background: #f3f4f6; color: #374151; }
.badge-maroon { background: #fde2e6; color: var(--maroon-dark); }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ---------- Tables ---------- */
.table-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
table.porhim {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
table.porhim th, table.porhim td {
  text-align: left; padding: .85rem 1.1rem; vertical-align: middle;
}
table.porhim thead th {
  background: var(--bg); color: var(--muted);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 700; border-bottom: 1px solid var(--line);
}
table.porhim tbody tr { border-bottom: 1px solid var(--line); }
table.porhim tbody tr:last-child { border-bottom: none; }
code.code-pill {
  background: var(--maroon); color: #fff;
  padding: .18rem .5rem; border-radius: 6px; font-weight: 700;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .82rem;
  letter-spacing: .03em;
}
.link-box {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .45rem .7rem;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .82rem;
  word-break: break-all;
}
.link-box code { color: var(--ink); }
.stats-row { display: flex; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 130px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}
.stat-card .num { font-size: 1.7rem; font-weight: 800; color: var(--maroon); }
.stat-card .lbl { color: var(--muted); font-size: .82rem; }

/* ---------- Lesson player: real rendering ---------- */
.video-frame {
  position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
  border-radius: var(--radius); overflow: hidden;
  background: #000; margin-bottom: 1.3rem;
}
.video-frame iframe,
.video-frame video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0;
}
.file-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.4rem;
  margin-bottom: 1.3rem;
}
.file-card .file-icon { font-size: 2rem; }
.file-card > div { flex: 1; }

/* ---------- Markdown body ---------- */
.markdown { line-height: 1.7; color: var(--ink); }
.markdown > *:first-child { margin-top: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  color: var(--maroon); margin: 1.4em 0 .5em;
}
.markdown h1 { font-size: 1.5rem; }
.markdown h2 { font-size: 1.25rem; }
.markdown h3 { font-size: 1.1rem; }
.markdown p { margin: 0 0 1em; }
.markdown ul, .markdown ol { margin: 0 0 1em; padding-left: 1.4em; }
.markdown li { margin-bottom: .3em; }
.markdown a { color: var(--teal-dark); text-decoration: underline; }
.markdown code {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 4px; padding: .1em .35em; font-size: .88em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.markdown pre {
  background: var(--ink); color: #f1f5f9;
  border-radius: var(--radius-sm); padding: 1rem; overflow: auto;
  margin: 0 0 1em;
}
.markdown pre code { background: none; border: none; padding: 0; color: inherit; }
.markdown blockquote {
  border-left: 4px solid var(--teal); margin: 0 0 1em; padding: .3em 1em;
  color: var(--muted); background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown table { border-collapse: collapse; margin: 0 0 1em; width: 100%; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: .5em .7em; text-align: left; }
.markdown th { background: var(--bg); }
.markdown img { max-width: 100%; border-radius: var(--radius-sm); }
.markdown hr { border: none; border-top: 1px solid var(--line); margin: 1.6em 0; }

/* ---------- Tutor builder ---------- */
.builder-module {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}
.builder-module-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line);
}
.builder-lessons { list-style: none; margin: .8rem 0; padding: 0; }
.builder-lessons li {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .2rem; border-bottom: 1px dashed var(--line);
  font-size: .94rem;
}
.builder-lessons li:last-child { border-bottom: none; }
.builder-lessons .mime {
  background: var(--bg); color: var(--teal-dark);
  font-weight: 700; font-size: .7rem; letter-spacing: .04em;
  padding: .15rem .45rem; border-radius: 4px;
}
.builder-lessons .lesson-title { flex: 1; }
details.add-lesson {
  margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line);
}
details.add-lesson summary {
  cursor: pointer; color: var(--teal-dark); font-weight: 600; font-size: .9rem;
}
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--muted); transition: transform .1s; }
details[open] > summary::before { content: "▾ "; }

/* ---------- Phase 3: assessments ---------- */
.mime-quiz { background: #ede9fe !important; color: #5b21b6 !important; }
.mime-asgn { background: #fef3c7 !important; color: #92400e !important; }

/* Quiz taking */
.quiz-question {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.4rem;
  margin-bottom: 1rem; box-shadow: var(--shadow);
}
.quiz-q-head { font-weight: 700; font-size: 1.02rem; margin-bottom: .9rem; color: var(--ink); }
.quiz-options { display: flex; flex-direction: column; gap: .5rem; }
.quiz-option {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .9rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s, border-color .12s;
  background: var(--card); margin: 0;
}
.quiz-option:hover { background: var(--bg); border-color: var(--teal); }
.quiz-option input[type="radio"] { accent-color: var(--teal); width: 18px; height: 18px; }
.quiz-option-mark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  font-size: .75rem; font-weight: 700; color: #fff;
}
/* Review mode (results page) */
.quiz-options.review .quiz-option { cursor: default; }
.quiz-options.review .quiz-option:hover { background: var(--card); border-color: var(--line); }
.quiz-option.correct { background: #dcfce7; border-color: var(--green); }
.quiz-option.correct .quiz-option-mark { background: var(--green); border-color: var(--green); }
.quiz-option.incorrect { background: #fee2e2; border-color: var(--danger); }
.quiz-option.incorrect .quiz-option-mark { background: var(--danger); border-color: var(--danger); }

/* Score banner (big pass/fail) */
.score-banner {
  display: flex; align-items: center; gap: 1.4rem;
  padding: 1.5rem 1.8rem; border-radius: var(--radius);
  margin: 1rem 0;
}
.score-banner.passed { background: linear-gradient(135deg, var(--green), var(--green-dark)); }
.score-banner.failed { background: linear-gradient(135deg, var(--danger), #b91c1c); }
.score-badge {
  font-size: 2.4rem; font-weight: 800; color: #fff;
  background: rgba(255,255,255,.2); border-radius: var(--radius);
  padding: .5rem 1.2rem; min-width: 100px; text-align: center;
}

/* Passed check on the lesson sidebar */
.lesson-link .check.is-passed { background: var(--green); border-color: var(--green); }

/* Inline grading input */
.grade-input { width: 80px; }

/* ---------- Phase 9: tutor student management ---------- */
.credentials-card {
  background: linear-gradient(180deg, #f0fdf4, #fff);
  border: 2px solid var(--green);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.6rem;
}

/* ---------- Phase 7: polish ---------- */
.sort-form select {
  padding: .4rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: .9rem;
  background: var(--card); color: var(--ink);
}

/* ---------- Phase 6: forum / messages / notifications ---------- */

/* Navbar icons (bell + envelope) */
.nav-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; font-size: 1.1rem;
  color: var(--ink); text-decoration: none;
}
.nav-icon:hover { background: var(--bg); text-decoration: none; }
.nav-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center;
  line-height: 1;
}

/* Forum */
.forum-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.2rem;
  margin-bottom: .7rem; box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.forum-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); text-decoration: none; }
.post-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.3rem;
  margin-bottom: .8rem; box-shadow: var(--shadow);
}
.post-card.op { border-left: 4px solid var(--maroon); }
.post-card.best-answer {
  border: 2px solid var(--green);
  background: linear-gradient(180deg, #f0fdf4, #fff);
}
.best-banner {
  background: var(--green); color: #fff;
  font-size: .78rem; font-weight: 700; padding: .25rem .6rem;
  border-radius: 999px; display: inline-block;
  margin-bottom: .6rem;
}
.post-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .7rem; }
.post-head > div { flex: 1; }
.post-actions { display: flex; align-items: center; gap: .4rem; }
.upvote-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .3rem .55rem;
  font-size: .85rem; font-weight: 700; color: var(--muted);
  cursor: pointer;
}
.upvote-btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.upvote-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.upvote-btn.active .count, .upvote-btn .count { font-weight: 700; }

/* Messages */
.msg-row {
  display: flex; align-items: center; gap: .9rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1.1rem;
  margin-bottom: .6rem; box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink);
}
.msg-row:hover { text-decoration: none; box-shadow: var(--shadow-hover); }
.msg-row.unread { border-left: 4px solid var(--maroon); background: #fef9f9; }
.msg-thread {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem;
  display: flex; flex-direction: column; gap: .6rem;
  max-height: 55vh; overflow-y: auto;
}
.msg-bubble {
  max-width: 75%; padding: .6rem .9rem; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  align-self: flex-start;
}
.msg-bubble.mine {
  align-self: flex-end;
  background: var(--maroon); color: #fff; border-color: var(--maroon);
}
.msg-bubble.mine .muted { color: rgba(255,255,255,.7) !important; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; }

/* Notifications */
.notif-row {
  display: flex; align-items: flex-start; gap: .9rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1.1rem;
  margin-bottom: .55rem; box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink);
}
.notif-row:hover { text-decoration: none; box-shadow: var(--shadow-hover); }
.notif-row.unread { border-left: 4px solid var(--maroon); background: #fef9f9; }
.notif-icon { font-size: 1.3rem; }
.notif-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); flex-shrink: 0;
  margin-top: 6px;
}

/* Phase 4: certificates */
.card-cover .completed-tag {
  position: absolute; top: 10px; right: 10px;
  background: var(--green); color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: 999px;
  letter-spacing: .02em;
}
.cert-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff; border-radius: var(--radius);
  padding: 1.2rem 1.6rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.cert-banner p { color: rgba(255,255,255,.9); }
