/* Palette/fonts ported from the static quran-halaqah.github.io site */
:root {
  --bg: #fbf7ef;
  --bg-alt: #f3ecdd;
  --surface: #ffffff;
  --text: #2e2a24;
  --text-muted: #6b6258;
  --accent: #2f6f4f;
  --accent-dark: #234f39;
  --ok: #2f6f4f;
  --ok-dark: #234f39;
  --gold: #c8a24a;
  --level-1: #548235;
  --level-2: #2683c5;
  --level-3: #c07529;
  --itqan: #8795a5;
  /* the Arabic course: a carmine of its own, apart from every green and blue (2026-11-25) */
  --nahw: #a1122b;
  --border: #e6dcc8;
  --danger: #b54034;
  --late: #93a63c;
  --danger-bg: #fbe9e7;
  --shadow: 0 2px 10px rgba(46, 42, 36, 0.06);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

/* A text box keeps the size the page gives it — nobody drags it larger. */
textarea {
  resize: none;
}

/* Layout rules like display:flex would otherwise beat the hidden attribute. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

/* The off-canvas drawer overflows the viewport, so the whole page could be
   dragged sideways. `clip` (not `hidden`) trims it without turning the root
   into a scroll container — `hidden` on html+body breaks vertical
   scrolling. */
html {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  direction: rtl;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  height: 52px;
  width: auto;
  display: block;
}

/* The slot beside the logo: the user's name on the home page, the course's
   name inside a course, nothing anywhere else. */
.header-context {
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The halaqah's running dawra, a smaller second line under its name. */
.header-dawra {
  display: block;
  font-size: 0.72em;
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* One nav, two shapes: an inline link row in the desktop header, a fixed
   bottom tab bar on smaller screens (the media query below). */
.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 2px;
  margin-inline-start: auto;
  min-width: 0;
}

.main-nav .nav-link,
.main-nav form button,
.main-nav .nav-more {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 500;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.main-nav .nav-link:hover,
.main-nav form button:hover,
.main-nav .nav-more:hover {
  background: var(--bg-alt);
  color: var(--accent-dark);
}

.main-nav .nav-link[aria-current="page"] {
  background: var(--bg-alt);
  color: var(--accent-dark);
  font-weight: 700;
}


.main-nav [data-lucide] {
  width: 17px;
  height: 17px;
  stroke-width: 1.75;
  flex-shrink: 0;
}

/* Attention badges in the navigation: a count for things waiting on the
   teacher, a bare dot for unread announcements. */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 999px;
  /* The familiar notification red, not the muted danger tone. */
  background: #ff3b30;
  color: #fff;
  /* System font: Tajawal's digits sit off-centre in their em box. */
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.nav-badge--dot {
  min-width: 8px;
  width: 8px;
  height: 8px;
  padding: 0;
}

.grading-form .checkbox-label,
.checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.grading-form .checkbox-label input {
  min-width: 0;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
}

.feedback-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.feedback-item:last-child { border-bottom: none; }

.feedback-item.is-handled { opacity: 0.6; }

.absence-form .btn {
  height: 40px;
}

.notice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rafiq-sessions {
  text-align: start;
  margin-top: 10px;
}

.rafiq-sessions .session-entry {
  padding: 8px 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.rafiq-sessions .session-entry-date {
  min-width: 0;
}

.rafiq-widget .rafiq-name {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

/* The juz grid (#60): 30 buttons, right-to-left like the mushaf. */
.juz-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  /* Every row as tall as the tallest — cells with a تم/pages line must
     not make their row thicker than the bare ones. */
  grid-auto-rows: 1fr;
  gap: 8px;
}

.juz-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px;
  /* Room for the تم/pages line, so rows without one stay the same height. */
  min-height: 60px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
}

.juz-cell .juz-num {
  font-weight: 700;
  color: var(--text);
}

.juz-cell .juz-pages {
  font-size: 0.72rem;
}

.juz-cell.is-partial {
  border-color: var(--gold);
  background: rgba(200, 162, 74, 0.12);
}

.juz-cell.is-complete {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}

.juz-cell.is-complete .juz-num {
  color: #fff;
}

@media (max-width: 640px) {
  .juz-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* The inbox bell sits in the header on every page, at the far inline end —
   right beside the burger when there is one. */
.header-bell {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--text);
  padding: 8px;
  border-radius: 10px;
  margin-inline-start: auto;
}

/* The first icon's auto margin does the pushing; a second auto margin on
   its neighbour or the nav would strand them halfway. */
.header-bell + .header-bell,
.header-bell ~ .main-nav,
.header-bell ~ .header-back {
  margin-inline-start: 0;
}

.header-back {
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

@media (min-width: 1024px) {
  /* on desktop the burger sits in the row and already pushes */
  .main-nav ~ .header-back {
    margin-inline-start: 0;
  }
}

.header-bell:hover {
  background: var(--bg-alt);
  color: var(--accent-dark);
}

.header-bell [data-lucide] {
  width: 20px;
  height: 20px;
}

.header-bell .nav-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 4px;
}

.announcement-list > .card + .card {
  margin-top: 0;
}

.card.notification {
  padding: 12px 16px;
  border-radius: 10px;
}

.bell-tasks {
  margin-bottom: 20px;
}

.bell-task {
  text-decoration: none;
  border-color: var(--accent);
}

.bell-task .notification-text {
  color: var(--accent-dark);
  font-weight: 700;
}

.notification {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.notification-text {
  font-weight: 500;
  color: var(--text);
}

.notification.is-new .notification-text {
  font-weight: 700;
}

.notification-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.notification-meta .badge {
  margin-top: 0;
}

/* Group separators exist for the drawer only — the bars never show them. */
.main-nav .nav-sep {
  display: none;
}

.sidebar .nav-sep {
  display: block;
  margin: 12px 4px 4px;
  padding: 10px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

@media (min-width: 1024px) {
  /* The desktop header carries no link row any more — just the burger
     that opens the drawer (owner decision 2026-10-04). The links return
     as the tab bar on phones. */
  .main-nav .nav-link,
  .main-nav form {
    display: none;
  }

  .main-nav .nav-more {
    padding: 9px;
  }

  .main-nav .nav-more > span:not(.nav-badge) {
    display: none;
  }

  .main-nav .nav-more [data-lucide] {
    width: 24px;
    height: 24px;
    stroke-width: 1.75;
  }
}

@media (max-width: 1023.98px) {
  /* iOS Safari force-zooms into any control whose font is under 16px; give
     touch devices exactly 16px so tapping a field never zooms the page. The
     !important is deliberate: this is a device-wide floor that must beat
     every more specific form rule. */
  input, select, textarea {
    font-size: 16px !important;
  }

  .brand-logo {
    height: 42px;
  }

  .main-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    margin: 0;
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(46, 42, 36, 0.07);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  /* The bar holds only the primary destinations; everything else waits in
     the drawer behind "المزيد". */
  .main-nav .nav-link:not(.is-primary),
  .main-nav form,
  .main-nav .nav-xl {
    display: none;
  }

  .main-nav .nav-link,
  .main-nav .nav-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    padding: 4px 2px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
  }

  .main-nav .nav-link[aria-current="page"] {
    background: none;
    color: var(--accent-dark);
    font-weight: 700;
  }

  .main-nav [data-lucide] {
    width: 21px;
    height: 21px;
  }

  /* On the tab bar the badge sits on the item's shoulder instead of inline,
     so the icon+label column keeps its shape. */
  .main-nav .nav-link,
  .main-nav .nav-more {
    position: relative;
  }

  .main-nav .nav-badge {
    position: absolute;
    top: 0;
    inset-inline-start: 50%;
    margin-inline-start: 8px;
  }

  .has-app-nav main {
    padding-bottom: 96px;
  }
}

/* Public landing page */
body.landing-page {
  touch-action: pan-y;
}

.landing-page main {
  padding: 0;
}

.landing-page main > .container {
  max-width: none;
  padding: 0;
}

/* The hero fills the first screen; everything after it scrolls normally. It
   stays light because the logo's calligraphy is dark green and would sink
   into a dark background. */
.landing-hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 28px;
  padding: 32px 16px 64px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(200, 162, 74, 0.22), transparent 58%),
    radial-gradient(circle at 12% 88%, rgba(47, 111, 79, 0.20), transparent 52%),
    linear-gradient(170deg, var(--bg) 0%, var(--bg-alt) 100%);
}

.landing-hero::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent));
}

.landing-section {
  padding: 96px 20px;
}

.landing-section--alt {
  background: var(--bg-alt);
}

.landing-block {
  max-width: 60rem;
  margin: 0 auto;
}

.landing-block h2 {
  margin: 0 0 24px;
  font-size: clamp(2rem, 4.5vw, 2.6rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.landing-block h2::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--gold);
}

.landing-block p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 1.12rem;
  line-height: 2;
}

.landing-section-lead {
  margin-bottom: 34px;
}

.landing-statement {
  margin: 0 0 18px;
  font-size: clamp(1.25rem, 2.6vw, 1.65rem);
  font-weight: 500;
  color: var(--text);
  line-height: 2.05;
}


/* The counter band: four boxes that count up as they scroll in. */
.landing-section--stats {
  padding: 56px 20px;
  background: var(--bg-alt);
}

.landing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-num {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.ring-legend--row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.pillar-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pillar-card [data-lucide] {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex-shrink: 0;
}

.pillar-card h4 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
}

/* The landing's category switch above the offer cards. */
.offer-tabs {
  position: relative;
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.offer-tab {
  position: relative;
  z-index: 1;
  padding: 9px 26px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.offer-tab.is-active {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

/* With JS, the dark pill is this slider gliding between the buttons; the
   active button itself goes transparent so the glide stays visible. */
.offer-tabs.has-slider .offer-tab.is-active {
  background: transparent;
  border-color: transparent;
}

.offer-tab-slider {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent-dark);
  border-radius: 8px;
  transition: left 0.3s ease, width 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .offer-tab-slider {
    transition: none;
  }
}

.offer-grid {
  display: grid;
  /* Every card the same height — the tallest content sets the row. */
  grid-auto-rows: 1fr;
  gap: 24px;
}

.offer-card[hidden] {
  display: none;
}

/* The ⓘ dots: a tap opens a small explanation card (info.js). */
.info {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-inline-start: 4px;
}

.info-dot {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.info-dot [data-lucide] {
  width: 16px;
  height: 16px;
}

.info-pop {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: -12px;
  z-index: 40;
  /* A plain width — Safari shrinks sized absolute boxes to a sliver when
     the size comes from min(). */
  width: 270px;
  max-width: 78vw;
  padding: 12px 14px;
  text-align: start;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.9;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.info-pop.is-open {
  display: block;
}

.info-pop .ring-legend {
  margin: 10px 0 0;
}

/* The first-login tour (tour.js): a spotlight ring, a click shield and
   the step card. */
.tour-blocker {
  position: fixed;
  inset: 0;
  z-index: 1290;
}

/* The dim is four plain panels around the spotlight hole — giant borders
   and box-shadows stop painting in Chrome, simple rectangles never do.
   tour.js sets the background inline a frame later: painted properties
   styled in the insertion frame can stay invisible. */
.tour-dim {
  position: fixed;
  z-index: 1291;
  pointer-events: none;
  transition: all 0.3s ease;
}

.tour-card {
  position: fixed;
  z-index: 1292;
  width: min(340px, 90vw);
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tour-text {
  margin: 0 0 14px;
  line-height: 1.9;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-skip {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* One offering per row: a quarter picture panel, the rest information —
   on phones the media query below stacks them instead. */
.offer-card {
  display: grid;
  grid-template-columns: 1fr 3fr;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* One panel for every course, in the site's gold — a course is told by its
   icon and its name, not by a colour of its own. */
.offer-media {
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #a8822d, var(--gold));
}

.offer-media [data-lucide] {
  width: 90px;
  height: 90px;
  color: rgba(255, 255, 255, 0.92);
  stroke-width: 1.25;
}

/* A card's single action, pushed to the row's far end (left in RTL). */
.btn-row-end {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* The request decision row: buttons exactly as tall as the level select,
   whichever of the two steps is showing. */
.decision-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.decision-actions .btn {
  height: 2.5rem;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
}

/* The Tajweed ladder on the course card: mini medals for finished levels,
   and the teacher's level tiles in the levels' metal colors. */
.course-medals {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
}

.course-medal {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
}

.course-medal [data-lucide] {
  width: 14px;
  height: 14px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: auto;
}

.level-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}

.level-tile:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(35, 79, 57, 0.28);
}

.level-tile [data-lucide] {
  width: 18px;
  height: 18px;
}

/* Inside a course with a colour of its own — a Tajweed level, the Arabic
   course — the whole page takes it (`Course.theme`): the
   accents darkened until text on and in them reads clearly, the backgrounds
   and borders as tints far enough apart to tell page, tile and edge. */
.theme-level-1 { --level: var(--level-1); }
.theme-level-2 { --level: var(--level-2); }
.theme-level-3 { --level: var(--level-3); }
.theme-itqan { --level: var(--itqan); }
.theme-nahw { --level: var(--nahw); }
.theme-level-1, .theme-level-2, .theme-level-3, .theme-itqan, .theme-nahw {
  --accent: color-mix(in srgb, var(--level) 70%, black);
  --accent-dark: color-mix(in srgb, var(--level) 45%, black);
  --accent-light: color-mix(in srgb, var(--level) 26%, white);
  --bg: color-mix(in srgb, var(--level) 4%, white);
  --bg-alt: color-mix(in srgb, var(--level) 17%, white);
  --border: color-mix(in srgb, var(--level) 42%, white);
}

[class*="theme-"] header.site-header {
  border-bottom: 3px solid var(--level);
}

[class*="theme-"] .header-context {
  color: var(--accent-dark);
}

[class*="theme-"] .hub-btn [data-lucide] {
  color: var(--accent);
}

.course-medal--level-1, .level-tile--level-1 { background: linear-gradient(150deg, color-mix(in srgb, var(--level-1) 78%, black), var(--level-1)); }
.course-medal--level-2, .level-tile--level-2 { background: linear-gradient(150deg, color-mix(in srgb, var(--level-2) 78%, black), var(--level-2)); }
.course-medal--level-3, .level-tile--level-3 { background: linear-gradient(150deg, color-mix(in srgb, var(--level-3) 78%, black), var(--level-3)); }
.course-medal--itqan, .level-tile--itqan { background: linear-gradient(150deg, #5d6b7a, var(--itqan)); }

/* The account page's miniature of the offer cards: same panel colors and
   icons, shrunk to a chip of symbol + name + status. */
.course-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.course-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.12s ease;
}

.course-chip:hover {
  border-color: var(--accent);
}

/* Arriving from an account chip: the student's row is lit up. */
.student-list li:target {
  background: rgba(200, 162, 74, 0.14);
}

.course-chip .chip-media {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.course-chip .chip-media [data-lucide] {
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.9);
  stroke-width: 1.5;
}

.course-chip .chip-media--plain {
  background: linear-gradient(150deg, #a8822d, var(--gold));
}

.chip-name {
  display: block;
  font-weight: 700;
}

.chip-status {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.offer-body {
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
}

.offer-body h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  color: var(--accent-dark);
}

.offer-body > p {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.95;
}

.offer-facts {
  list-style: none;
  /* The flexible gap sits above the facts: text stays up top, the
     where/when/conditions block and the button stay together at the
     bottom. */
  margin: auto 0 20px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.offer-facts li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.8;
}

.offer-facts [data-lucide] {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  color: var(--accent);
  flex-shrink: 0;
}

.offer-body .landing-card-btn {
  margin-top: 0;
  align-self: center;
}

@media (max-width: 720px) {
  /* Stacked cards share equal heights; the fixed rows pin every spare
     pixel into the info block, so title and text sit right under the
     picture and the facts stay down by the button. */
  .offer-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .offer-media {
    height: 170px;
    min-height: 0;
  }
}

/* A tile that is not itself a link — it carries its own action. */
.hub-card {
  cursor: default;
}

.hub-card form {
  margin-top: 12px;
}

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge--open {
  background: rgba(47, 111, 79, 0.12);
  color: var(--accent-dark);
}

.badge--closed {
  background: var(--bg-alt);
  color: var(--text-muted);
}

.badge--teacher {
  background: rgba(200, 162, 74, 0.18);
  color: #8a6a23;
}

.badge--alert {
  background: var(--danger-bg);
  color: var(--danger);
}

/* A completed course is an achievement: gold with a medal. */
.badge--done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(200, 162, 74, 0.18);
  color: #8a6a23;
}

.badge--done [data-lucide] {
  width: 12px;
  height: 12px;
}

/* The accounts overview: enrollment badges at the row's end, wrapping on
   narrow screens. */
.account-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.account-badges .badge {
  margin-top: 0;
}

/* الإعلانات — one card per notice, its meta line under the text. */
.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.announcement-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}

.announcement-title .badge {
  margin-top: 0;
}

.announcement-body {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.announcement-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.announcement-meta .badge {
  margin-top: 0;
}

.announcement-meta form {
  margin: 0;
  margin-inline-start: auto;
}

.announce-body-field {
  flex: 1;
}

.announce-body-field textarea,
.grading-form .announce-body-field textarea {
  width: 100%;
  height: auto;
  min-height: 110px;
}

.announce-title-field {
  flex: 1;
}

.announce-title-field input {
  width: 100%;
}

.material-add {
  margin-bottom: 18px;
}

.member-meta {
  color: var(--text-muted);
  margin: 4px 0;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.member-actions form {
  margin: 0;
}

/* One row per course on the account page: the course, then its labeled
   role/status selects and the save button, bottom-aligned with them. */
.account-enrol-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.account-enrol-row + .account-enrol-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.account-enrol-course {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  align-self: center;
}

.account-enrol-row .btn {
  height: 2.5rem;
}

.enrollment-row {
  align-items: center;
}

.member-meta + .enrollment-row {
  margin-top: 12px;
}

.enrollment-row .badge {
  margin-top: 0;
}

.hub-role {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.landing-subject + .landing-subject {
  margin-top: 48px;
}

.landing-subject-title {
  margin: 0 0 18px;
  font-size: 1.5rem;
  color: var(--surface);
  opacity: 0.92;
}

.landing-subject-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 22px;
  align-items: stretch;
}

.landing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(20, 45, 33, 0.22);
  padding: 30px 28px;
  /* A floor, not a lock: cards in a row already stretch to match, this keeps
     a short one from looking stunted next to the group above it. */
  min-height: 17rem;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}

.landing-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  transform: scaleX(0.28);
  transform-origin: right;
  transition: transform .3s ease;
}

.landing-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 44px rgba(20, 45, 33, 0.3);
}

.landing-card:hover::before {
  transform: scaleX(1);
}

.landing-card h4 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  color: var(--accent-dark);
}

.landing-card p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.9;
}

.landing-card-note {
  margin-top: 14px !important;
  font-size: 0.95rem;
  color: #8a6d20;
}

.landing-card-btn {
  display: inline-block;
  margin-top: auto;
  align-self: center;
  text-align: center;
}

/* Closed courses keep the button's shape so the cards stay level, but it is
   plainly not something you can press. */
.landing-card-btn.is-disabled {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
}

/* A completed course shows its medal where the button would be. */
.landing-card-btn--done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(200, 162, 74, 0.18);
  border-color: #e5d5a5;
  color: #8a6a23;
  cursor: default;
  pointer-events: none;
}

.landing-card-btn--done [data-lucide] {
  width: 18px;
  height: 18px;
}

.landing-card-btn,
.landing-cta .btn {
  transition: transform .2s ease, box-shadow .2s ease;
}

.landing-card-btn:hover,
.landing-cta .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(35, 79, 57, 0.28);
}

.landing-faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--gold);
  border-radius: 14px;
  margin-bottom: 12px;
  padding: 2px 22px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.landing-faq details[open] {
  border-inline-start-color: var(--accent);
  box-shadow: var(--shadow);
}

.landing-faq summary {
  cursor: pointer;
  padding: 18px 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--accent-dark);
  list-style: none;
}

.landing-faq summary::-webkit-details-marker {
  display: none;
}

.landing-faq summary::after {
  content: "+";
  float: left;
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
  transition: transform .2s ease;
}

.landing-faq details[open] summary::after {
  content: "\2212";
  transform: rotate(180deg);
}

.landing-faq details p {
  margin: 0 0 16px;
}

.landing-footer {
  background: var(--accent-dark);
  color: var(--surface);
  text-align: center;
  padding: 40px 20px;
}

.landing-footer p {
  margin: 0;
}


/* Only hidden once the script says it can reveal them, so without JS the
   page is simply all there. */
.rq-reveal .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .6s ease, transform .6s ease;
}

.rq-reveal .reveal.is-in {
  opacity: 1;
  transform: none;
}

.landing-cards .reveal:nth-child(2) { transition-delay: .08s; }
.landing-cards .reveal:nth-child(3) { transition-delay: .16s; }
.landing-cards .reveal:nth-child(4) { transition-delay: .24s; }
.landing-cards .reveal:nth-child(5) { transition-delay: .32s; }

@media (prefers-reduced-motion: reduce) {
  .rq-reveal .reveal,
  .landing-card,
  .landing-card::before,
  .landing-card-btn,
  .landing-cta .btn {
    transition: none;
  }

  .landing-card:hover {
    transform: none;
  }
}

/* The logo is portrait, so cap the width by viewport height too. */
.landing-logo {
  width: min(300px, 64vw, 34vh);
  height: auto;
  animation: landing-logo-in .9s cubic-bezier(.2, .8, .3, 1) both;
}

.landing-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: landing-cta-in .5s ease .6s both;
}

.landing-cta--inline {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 28px;
}

@keyframes landing-logo-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: none; }
}

@keyframes landing-cta-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .landing-logo,
  .landing-cta {
    animation: none;
  }
}

.landing-cta .btn {
  min-width: 240px;
  padding: 12px 26px;
  font-size: 1.05rem;
}

.dawra-select {
  margin: 0;
}

.dawra-select select {
  height: 2.1rem;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 0.85rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.sidebar-overlay.is-visible {
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  /* Slides in from the left (owner decision 2026-10-04). */
  inset-inline-end: 0;
  bottom: 0;
  width: 280px;
  max-width: 84vw;
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 2px;
  overflow-y: auto;
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-close {
  align-self: flex-start;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  margin-bottom: 8px;
  border-radius: 6px;
}

.sidebar-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.sidebar-user {
  font-weight: 700;
  font-size: 1rem;
  padding: 8px 12px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  color: var(--text);
}

.sidebar a,
.sidebar form button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  width: 100%;
  text-decoration: none;
}

.sidebar a [data-lucide],
.sidebar form button [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.sidebar a:hover,
.sidebar form button:hover {
  background: var(--bg-alt);
  color: var(--accent-dark);
}

.sidebar form {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.05s ease;
}

.btn [data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.btn:hover {
  background: var(--bg-alt);
  border-color: #d8cdb6;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(35, 79, 57, 0.18);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(35, 79, 57, 0.24);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(143, 51, 40, 0.18);
}

.btn-danger:hover {
  background: #8f3328;
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(143, 51, 40, 0.24);
}

.btn-warning {
  background: var(--gold);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(160, 124, 46, 0.18);
}

.btn-warning:hover {
  background: #a07c2e;
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(160, 124, 46, 0.24);
}

.btn-sm {
  padding: 7px 15px;
  font-size: 0.85rem;
}

main {
  /* Top gap = the 24px gap between two offer cards (owner decision). */
  padding: 24px 0 60px;
}

/* Every stacked box on a page keeps the same gap the lists use. */
.card + .card,
.card + .session-list,
.session-list + .card,
.session-list + .session-list,
.card + .session-entry--add,
.session-entry--add + .card,
.session-entry--add + .task-list,
.card + .task-list,
.task-list + .card,
.card + .note-rows,
.section-label + .task-list,
.card + form,
.session-list + form {
  margin-top: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  list-style: none;
}
.card > summary::-webkit-details-marker { display: none; }
.card > summary::marker { display: none; }
.card > summary::after {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-inline-start: auto;
  background-color: var(--text-muted);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: transform 0.15s ease;
}

details.card[open] > summary::after {
  transform: rotate(-90deg);
}

.nav-chevron {
  display: inline-block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  background-color: var(--text-muted);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.card > summary + * {
  margin-top: 14px;
}

.card + .card {
  margin-top: 8px;
}

.page-header {
  margin-bottom: 22px;
}

.page-header h2 {
  margin: 0;
}

.page-header > p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.section-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* «السابقة» under this week's list: the house gap, not glued to it. */
.session-list + .section-label,
.task-list + .section-label {
  margin-top: 14px;
}

/* Dashboard sections */
.dashboard-section {
  margin-top: 28px;
}

/* The 28px separates consecutive sections; the first one on a page keeps
   the global 24px top gap (the toast list is fixed, so it may sit before
   the first section in the DOM). */
main .container > .dashboard-section:first-child,
main .container > .messages + .dashboard-section {
  margin-top: 0;
}

.add-student {
  margin-top: 28px;
}

.teacher-hub {
  display: grid;
  /* Always two per row, so a tile never grows past half the width. */
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.hub-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 16px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
  transition: background 0.12s ease;
}

.hub-btn:hover {
  background: var(--accent-light, #fbf1d8);
}

/* The certificate card at the foot of a student's page: a gold medal, a
   word of context, and the (not yet wired) issue button. */
.certificate-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.certificate-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(200, 162, 74, 0.18);
  color: #8a6a23;
  flex-shrink: 0;
}

.certificate-icon [data-lucide] {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}

.certificate-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-inline-end: auto;
}

.certificate-title {
  font-weight: 700;
  color: var(--accent-dark);
}

.certificate-card .btn:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 640px) {
  .certificate-card {
    flex-direction: column;
    text-align: center;
  }

  .certificate-text {
    align-items: center;
    margin-inline-end: 0;
  }
}

/* Placeholder tiles: the feature exists on the map, not yet behind it. */
.hub-btn--soon {
  position: relative;
  overflow: hidden;
  opacity: 0.55;
}

/* The diagonal قريبًا band across the tile's top-left corner. */
.hub-ribbon {
  position: absolute;
  top: 12px;
  left: -30px;
  transform: rotate(-45deg);
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 34px;
}

/* A counter or a dot sits beside the tile's label, on its line — the tile
   keeps its height whatever it has to say. */
.hub-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hub-label .todo-dot {
  margin-inline-start: 0;
}

.hub-btn [data-lucide] {
  width: 36px;
  height: 36px;
  stroke-width: 1.5;
}

.soon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 20px;
  text-align: center;
}

.soon-card > [data-lucide] {
  width: 48px;
  height: 48px;
  stroke-width: 1.4;
  color: var(--accent);
}

.soon-title {
  margin: 8px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.alpha-group {
  margin-top: 20px;
}

.alpha-letter {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 4px;
  margin-bottom: 0;
}

/* Always the first thing in its box or section — the heading brings no
   top margin of its own, the container's padding/margin is the gap. */
.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

/* A heading's one action sits at the row's far end (left in RTL). */
.section-heading-action {
  margin-inline-start: auto;
}

/* A list page's head row: the label and its ⓘ at the start, the filter
   pushed to the far end — the same shape on every list page. */
.section-label--row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 999px;
}

.section-more {
  margin-inline-start: auto;
  font-size: 0.85rem;
  font-weight: 500;
}

.section-count.is-alert {
  color: var(--danger, #b54034);
  background: var(--danger-bg, #fbe9e7);
}

/* Student triage list */
/* No overflow clipping: the rows' status dropdowns must be able to open
   past the list's edge, so the rounding sits on the end rows instead. */
.student-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.student-list li:first-child .student-row {
  border-start-start-radius: var(--radius);
  border-start-end-radius: var(--radius);
}

.student-list li:last-child .student-row {
  border-end-start-radius: var(--radius);
  border-end-end-radius: var(--radius);
}

/* A row is link + (alerts, controls): the link grows, the rest keeps its
   place at the inline end. */
.student-list li {
  display: flex;
  align-items: center;
}

.student-alerts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.member-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-inline: 8px 14px;
}

.member-controls form {
  display: inline-flex;
}

/* Three short words need no 120px field. */
.member-controls .dropdown,
.member-filter .dropdown {
  min-width: 0;
  width: 6rem;
}

.member-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 0;
  opacity: 0.55;
}

.member-remove:hover {
  opacity: 1;
  color: var(--danger);
  background: var(--bg-alt);
}

.member-remove [data-lucide] {
  width: 16px;
  height: 16px;
}

.student-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fdecea;
  border: 1px solid #efc4bd;
  color: #a33a2a;
  font-size: 0.78rem;
  white-space: nowrap;
}

.student-alert-badge form {
  display: inline-flex;
}

.student-alert-badge button {
  border: none;
  background: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.student-list li + li {
  border-top: 1px solid var(--border);
}

.student-row {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  color: var(--text);
}

.pending-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.pending-actions form {
  display: inline;
}

.pending-actions button {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.student-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.student-name {
  font-weight: 700;
}

.student-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Student stat rings */
/* One widget per row (2026-10-31). */
.ring-grid {
  display: grid;
  grid-template-columns: 1fr;
  /* Same 8px rhythm as the card-to-card spacing, horizontally and below. */
  gap: 8px;
  margin-bottom: 8px;
}

/* Open cards share the row's height; a collapsed one shrinks to its
   title instead of standing as an empty box. */
.ring-grid > details:not([open]) {
  align-self: start;
}

/* The grid's own gap spaces these; the generic card-to-card margin would
   otherwise offset the second card and leave the two boxes unequal heights. */
.ring-grid > .card + .card {
  margin-top: 0;
}

.ring-item {
  text-align: center;
}

/* الحفظ and المراجعة side by side inside one widget; stacked on phones. */
.plan-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 28px;
}

.plan-part {
  padding: 8px 0;
}

.plan-part .target-edit {
  margin-top: 4px;
}

.plan-part .target-edit[open] > summary {
  margin-bottom: 10px;
}

/* The progress cards speak the statistics page's language (2026-11-15):
   a lane — the fact as a figure, the goal beside it, a bar between. */
.attendance-widget > .lane,
.plan-widget .lane {
  text-align: start;
  margin-top: 8px;
}

.attendance-widget > .lane {
  margin-bottom: 12px;
}

.ring-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ring-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: 6px;
}

.dot--ok { background: var(--ok); }
.dot--late { background: var(--late); }
.dot--warn { background: var(--gold); }
.dot--bad { background: var(--danger); }

/* Own points, one bar per category */
.points-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.points-label {
  flex: 0 0 40%;
  font-size: 0.9rem;
}

.points-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to left, var(--accent) var(--width), var(--bg-alt) var(--width));
}

.points-bar.is-negative {
  background: linear-gradient(to left, var(--danger) var(--width), var(--bg-alt) var(--width));
}

.points-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 700;
}

table.session-table {
  width: 100%;
  border-collapse: collapse;
}

table.session-table th,
table.session-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: start;
}

.login-form {
  max-width: 380px;
  margin: 48px auto;
}

.login-form h2 {
  text-align: center;
  margin: 0 0 20px;
}

.login-form .btn {
  width: 100%;
  margin-top: 4px;
}

.login-form .auth-links {
  margin: 14px 0 0;
  text-align: center;
}

.login-form .auth-links a {
  display: inline-block;
  padding: 4px 0;
}

/* Login / registration: card fixed and centered, no page scroll. */
/* No header on the auth pages — the box carries the logo itself, so the page
   must stay scrollable for the taller forms on small screens. */
body.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.auth-logo img {
  height: 76px;
  width: auto;
}

.auth-page main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-page main > .container {
  width: min(380px, 100%);
}

.auth-page .login-form {
  margin: 0;
  width: 100%;
  max-width: none;
}

/* One height for text fields and menus alike, on every auth form. */
.login-form input {
  width: 100%;
  height: 2.375rem;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

/* iOS WebKit keeps its own grey, borderless chrome on date fields — and
   ignores the author border and height — until appearance is stripped. */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface);
  color: var(--text);
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: start;
}

/* digits read left to right — under RTL the browser shows 13:00 as 00:13 */
input[type="time"] {
  direction: ltr;
  text-align: right;
}

input[type="time"]::-webkit-date-and-time-value {
  text-align: right;
}

.password-field {
  position: relative;
  display: block;
  margin-bottom: 12px;
}

.password-field input {
  margin-bottom: 0;
  padding-left: 42px;
}

.password-toggle {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.password-toggle:hover {
  color: var(--text);
}

.wizard-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.wizard-actions .btn {
  flex: 1;
  width: auto;
  margin-top: 0;
}

.reg-progress {
  display: flex;
  gap: 6px;
  margin: 14px 0;
}

.reg-progress-seg {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-alt);
  transition: background 0.2s;
}

.reg-progress-seg.is-done {
  background: var(--accent);
}

.reg-course {
  margin: 0 0 4px;
  text-align: center;
  color: var(--text-muted);
}

/* The answers are whole sentences: the menu spans the card and wraps them
   instead of cutting them off. */
.register-form .dropdown {
  display: block;
  width: auto;
  margin-bottom: 12px;
}

.register-form .dd-toggle {
  height: auto;
  min-height: 2.375rem;
  padding-block: 8px;
}

.register-form .dd-panel {
  width: 100%;
  max-width: none;
}

.register-form .dd-label,
.register-form .dd-option {
  white-space: normal;
}

.register-form .checkbox-label {
  align-items: flex-start;
  margin: 8px 0;
}

/* Undo the full-width text-field styling .login-form gives every input. */
.register-form .checkbox-label input {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: 3px 0 0;
  padding: 0;
}

.field-hint,
.field-error {
  margin: -6px 0 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field-error {
  color: var(--danger);
}

.reg-field:not(.is-invalid) .field-error {
  display: none;
}

.reg-field.is-invalid input:not([type="checkbox"]),
.reg-field.is-invalid .dd-toggle {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.reg-field.is-invalid .checkbox-label {
  color: var(--danger);
}

.registration-data {
  margin: 0;
}

.registration-group {
  margin: 18px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--accent-dark);
}

.section-heading + .registration-group,
summary + .registration-group {
  padding-top: 0;
  border-top: 0;
}

.section-heading + .registration-group {
  margin-top: 0;
}

.registration-data dt {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.registration-data dd {
  margin: 0 0 10px;
}

.page-header--actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header--actions .page-header-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  gap: 8px;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.empty-state {
  color: var(--text-muted);
}

.grading-form .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.grading-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.grading-form input,
.grading-form textarea,
.grading-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  min-width: 120px;
  height: 2.5rem;
}

.grading-form select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b6258'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  padding-left: 28px;
}

.grading-form .list-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.grading-form select[multiple] {
  height: auto;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  min-height: unset;
}

#surah-ranges-container {
  margin: 4px 0 10px;
}

.form-row.session-add-row {
  display: grid;
  grid-template-columns: repeat(4, 160px);
  justify-content: start;
}

.session-add-row > * {
  min-width: 0;
}

.session-add-row select[multiple] {
  min-width: 0;
}

.session-add-row .dropdown,
.session-add-row .dropdown--multi {
  width: 100%;
  min-width: 0;
}

.session-add-row select {
  width: 100%;
}

.session-notes-field {
  grid-column: 1 / -1;
}

.session-notes-field input {
  width: 100%;
}

.session-entry-errors {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.7;
}

.surah-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.surah-range-label {
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 100px;
}

.surah-range-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.surah-range-row input[type="number"] {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  min-width: unset;
}

.surah-range-row .surah-range-errors {
  width: 56px;
}

.session-entry-link {
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.meeting-description {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.meeting-gap {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-inline-start: 6px;
}

/* A level's lists — homework, practical لقاءات: one row each, the title
   leading, its state at the end. */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

.task-row:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.task-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 220px;
  min-width: 0;
}

.task-title {
  font-weight: 700;
}

.task-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.task-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-done {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.confirm-done .lane-note {
  flex: 1 1 240px;
  margin: 0;
}

.confirm-done .btn [data-lucide] {
  width: 16px;
  height: 16px;
}

.task-heading {
  margin: 0;
  font-size: 1.25rem;
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.announcement-menu {
  margin-inline-start: auto;
}


.note-row,
.note-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-card {
  border-inline-start: 4px solid var(--accent);
}

.note-card--plain {
  margin: 10px 0 0;
  padding-inline-start: 12px;
}

.note-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-date {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.note-text {
  margin: 0;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.note-earlier summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.note-row textarea,
.field-wide,
.field-wide textarea {
  width: 100%;
}

.note-row textarea,
.field-wide textarea {
  min-height: 92px;
  line-height: 1.8;
}

.submission > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  cursor: pointer;
}

.submission-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.submission-body form,
.submission-body .task-list {
  width: 100%;
}

.submission-body + .grading-form {
  margin-top: 14px;
}

/* A file's player takes a line of its own under its name and menu. */
.task-row > .submission-audio {
  flex-basis: 100%;
  max-width: none;
}

.submission-audio {
  width: 100%;
  max-width: 420px;
}

.feedback-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border-inline-start: 4px solid var(--accent);
  background: var(--bg-alt);
}

.meeting-kind {
  flex: 0 0 auto;
  padding: 2px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.meeting-kind--practical {
  background: var(--accent);
  color: #fff;
}

.session-entry--meeting {
  cursor: pointer;
}

.session-entry--meeting.is-scheduled {
  background: #f2faf5;
  border-color: #c6dece;
}

.session-entry--meeting.is-cancelled {
  background: #fdf3f2;
  border-color: #ecc8c5;
}

.session-entry--meeting.is-activity {
  background: #fef9e7;
  border-color: #e8d78a;
}

.meeting-status-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

/* The description is typed only once نشاط or ملغى is chosen (or the pencil
   is pressed); until then the row shows it as plain text. */
.meeting-description-fields { display: none; }
.session-entry--meeting.is-editing .meeting-description-fields {
  display: flex;
  align-items: center;
  gap: 8px;
}
.session-entry--meeting.is-editing .meeting-description,
.session-entry--meeting.is-editing .meeting-description-edit { display: none; }

.meeting-description-fields input {
  width: 14rem;
  max-width: 40vw;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.85rem;
}

.meeting-status-select {
  padding: 3px 6px;
  border: none;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b6258'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 8px center;
  padding-left: 22px;
  cursor: pointer;
}

.meeting-status-select.status-scheduled { background-color: #f2faf5; }
.meeting-status-select.status-cancelled { background-color: #fdf3f2; }
.meeting-status-select.status-activity  { background-color: #fef9e7; }

.session-entry--add {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
}

.session-entry--add summary,
a.session-entry--add {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

/* The same line as a plain link: it opens another page instead. */
a.session-entry--add {
  flex-direction: row;
  text-decoration: none;
}

.session-entry--add summary::-webkit-details-marker {
  display: none;
}

.session-entry--add summary span,
a.session-entry--add span {
  flex: 1;
  font-size: 0.9rem;
}

.session-entry--add summary [data-lucide],
a.session-entry--add [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
  transition: opacity 0.12s ease;
}

.session-entry--add summary:hover [data-lucide],
a.session-entry--add:hover [data-lucide] {
  opacity: 0.7;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-entry {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Only the session history is a real table — every row shares the same
   column lines. Meeting rows and the rafiq widget reuse .session-entry
   as plain flex rows. */
.sessions-card .session-entry {
  display: grid;
  grid-template-columns: 6rem 4.5rem minmax(0, 15rem) 6rem minmax(0, 1fr) 5.5rem auto auto;
}

.sessions-card .session-entry-date { grid-column: 1; }
.sessions-card .session-entry-type { grid-column: 2; }
.sessions-card .session-entry-details { grid-column: 3; }
.sessions-card .session-entry-errors { grid-column: 4; }
.sessions-card .session-entry-notes { grid-column: 5; }
.sessions-card .session-grade-slot { grid-column: 6; }
.sessions-card .session-entry .item-menu { grid-column: 7 / 9; justify-self: end; }

.session-entry.is-pass {
  background: #f2faf5;
  border-color: #c6dece;
}

.session-entry.is-fail {
  background: #fdf3f2;
  border-color: #ecc8c5;
}

.session-entry.is-excused {
  background: #fdf8ec;
  border-color: #ecdcb4;
}

.attendance-widget .absence-form {
  margin-top: 14px;
  text-align: start;
}

/* the card is narrow: date, reason and button share one line */
.attendance-widget .absence-form .form-row {
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 0;
}

.attendance-widget .absence-form label {
  min-width: 0;
}

.attendance-widget .absence-form .dropdown {
  min-width: 0;
}

.attendance-widget .absence-form .announce-title-field input {
  min-width: 0;
}

.attendance-widget .absence-form .btn {
  flex: none;
}

.attendance-widget .notice-row {
  margin-top: 8px;
  text-align: start;
}

.session-entry-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.session-entry-type {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  padding-top: 2px;
}

.session-entry-details {
  font-size: 0.875rem;
  line-height: 1.7;
}

.session-entry-errors {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.session-entry-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 0;
  flex-shrink: 0;
  padding-top: 2px;
}

.session-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  background: #fbf1d8;
  color: #9c7a2e;
  border: 2px solid #e8d49a;
}

.tag-chip.is-selected {
  border-color: #9c7a2e;
}

.tag-chip-x {
  display: none;
  opacity: 0.65;
  font-size: 0.85rem;
  line-height: 1;
}

.tag-chip.is-selected .tag-chip-x {
  display: inline;
}

.session-grade-slot {
  display: flex;
  justify-content: center;
}

.session-grade-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.session-grade-badge.grade-pass {
  background: #d6f0e0;
  color: #1d6b40;
}

.session-grade-badge.grade-fail {
  background: #fcdede;
  color: #9b2020;
}

.session-grade-badge.grade-mid {
  background: #fdf3dc;
  color: #7a5200;
}

.meta-list {
  margin: 0 0 14px;
  font-size: 0.85rem;
}

.meta-list span + span {
  margin-inline-start: 24px;
}

.meta-list .meta-label {
  color: var(--text-muted);
}

.messages {
  /* Floating toasts: visible wherever the page is scrolled to, and never
     in the way of clicks underneath. */
  position: fixed;
  top: calc(76px + env(safe-area-inset-top, 0px));
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

.messages.is-hidden {
  opacity: 0;
}

.messages li {
  /* max-content, not fit-content: Safari resolves fit-content on a flex
     item to the minimum width and folds the toast into a squeezed oval. */
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(40, 60, 45, 0.18);
  animation: toast-in 0.25s ease-out;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-close {
  border: none;
  background: none;
  color: inherit;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.6;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.messages .success {
  background: #e3f3e8;
  color: var(--accent-dark);
  border: 1px solid #bfe0cb;
}

.messages .error {
  background: #fbe9e7;
  color: #b3261e;
  border: 1px solid #f0c4c0;
}

.messages .warning {
  background: #fdf3dc;
  color: #7a5200;
  border: 1px solid #f0dca8;
}

.search-box {
  margin: 16px 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box .member-filter {
  flex-shrink: 0;
}

.search-box input[type="search"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ---- غريب القرآن: the surah directory and the word search ---- */
.surah-directory {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 28px;
}

.surah-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.surah-link:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.surah-number {
  min-width: 26px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.surah-name {
  font-weight: 600;
}

.surah-due {
  padding: 0 8px;
  border-radius: 999px;
  background: #e8f1ec;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.surah-word-count {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.word-count {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
}

.word-results {
  margin-bottom: 28px;
  border-top: 1px solid var(--border);
}

.word-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  overflow-wrap: anywhere;
}

.word-result:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.word-result .word,
.word-table .word {
  font-family: "Amiri", serif;
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--accent-dark);
  line-height: 1.9;
}

.result-reference {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* The surah page: two tabs over the words, then the table of meanings. */
.study-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.study-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 2px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.study-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}

.study-tab-count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg-alt);
  font-size: 0.75rem;
  font-weight: 700;
}

.word-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.word-toolbar .search-box {
  flex: 1;
  margin: 0;
}

.word-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.word-table .verse-column { width: 56px; }
.word-table .word-column { width: 32%; }

.word-table th,
.word-table td {
  padding: 12px 14px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.word-table tbody tr:last-child > * {
  border-bottom: 0;
}

.word-table thead th {
  padding: 8px 14px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.word-table .verse-cell {
  padding-top: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.word-table .word { font-size: 1.7rem; }
.word-table .meaning { padding-top: 15px; font-size: 1.08rem; }

.word-table tr:target > * {
  background: #fdf6e3;
}

.word-table tr {
  scroll-margin-top: 120px;
}

.word-tafsirs {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.78rem;
}

.word-tafsirs a {
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

.word-tafsirs a:hover {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.review-intro {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .surah-directory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .surah-directory { grid-template-columns: 1fr; }
  .word-result { grid-template-columns: 1fr; gap: 4px; }
  .word-table .verse-column { width: 52px; }
  .word-table .word-column { width: 36%; }
  .word-table th, .word-table td { padding: 10px 6px; }
  .word-table .word { font-size: 1.45rem; }
  .word-table .meaning { font-size: 1rem; }
}

/* ---- المكتبة: shelves of book cards ---- */
/* Each section of a shelf is a box of its own, 8px from the next. */
.library-section {
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.library-section > .section-label {
  margin-top: 0;
}

.library-section .session-entry--add {
  margin-bottom: 16px;
}

.section-new {
  margin-top: 8px;
}

.card .task-row {
  box-shadow: none;
}

/* A file is one tap: its name asks what to do with it (share-file.js). */
.file-row .task-main {
  align-items: flex-start;
  color: inherit;
  text-decoration: none;
}

.library-section .section-label > .item-tools {
  margin-inline-start: auto;
}

.library-section.is-hidden .book-shelf {
  opacity: 0.5;
}

.section-add {
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}

/* Technical support reading a course it is no member of: everything shows,
   nothing can be pressed — the server refuses any change as well. */
.observing-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.observing-note a {
  margin-inline-start: auto;
  font-weight: 600;
  white-space: nowrap;
}

.observing-note [data-lucide] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.is-observing main form[method="post"]:not(.support-may) button,
.is-observing .session-entry--add:not(.support-may),
.is-observing .section-add:not(.support-may),
.is-observing .item-menu:not(.support-may),
.is-observing .item-eye:not(.support-may),
.is-observing .shelves:not([data-arrange-url]) .section-grip {
  display: none !important;
}

/* Dragging a file or a section to its place (shelf-sort.js): the original
   stays in the page as a faint marker of where it will land, a copy
   follows the pointer. */
[data-arrange-url] .book {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.section-grip {
  display: inline-flex;
  margin-inline-start: -6px;
  color: var(--text-muted);
  opacity: 0.55;
  cursor: grab;
  touch-action: none;
}

.section-grip [data-lucide] {
  width: 16px;
  height: 16px;
}

.is-sort-ghost {
  opacity: 0.3;
}

.sort-clone,
.book.sort-clone {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  opacity: 0.96;
  filter: drop-shadow(0 14px 22px rgba(46, 42, 36, 0.28));
}

.section-label.sort-clone {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
}

.is-sorting {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.is-sorting .book-shelf {
  min-height: 64px;
  border-radius: 12px;
  outline: 1px dashed var(--border);
  outline-offset: 6px;
}

/* An item's actions live in one quiet ⋯ menu — never a row of buttons.
   The panel opens under the dots, towards the content. */
.item-menu {
  position: relative;
  flex: 0 0 auto;
}

.item-tools {
  display: inline-flex;
  align-items: center;
}

.item-tools form {
  display: inline-flex;
  margin: 0;
}

.item-menu > summary,
.item-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}

.item-menu > summary::-webkit-details-marker {
  display: none;
}

.item-menu > summary:hover,
.item-menu[open] > summary,
.item-eye:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.item-menu > summary [data-lucide],
.item-eye [data-lucide] {
  width: 18px;
  height: 18px;
}

.item-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-end: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  max-width: 280px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(46, 42, 36, 0.18);
  font-size: 0.92rem;
  font-weight: 400;
}

.item-menu-panel form {
  margin: 0;
}

.item-menu-panel button,
.item-menu-panel a,
.item-menu-file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.item-menu-panel button:hover,
.item-menu-panel a:hover,
.item-menu-file:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.item-menu-panel [data-lucide] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.item-menu-panel .is-danger,
.item-menu-panel .is-danger [data-lucide] {
  color: var(--danger);
}

.item-menu-label {
  padding: 8px 12px 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.confirm-input {
  width: 100%;
  margin-bottom: 16px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* Every cover stands as tall as its neighbours and as wide as its own page:
   a book narrow, a deck of slides wide — `--ratio` is the file's own. */
.book-shelf {
  --cover-height: 210px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px 20px;
  align-items: flex-start;
  margin-top: 8px;
}

.book {
  --ratio: 0.69;
  width: calc(var(--cover-height) * var(--ratio));
  max-width: 100%;
}

.shelf-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.shelf-views {
  margin-inline-start: auto;
}

@media (max-width: 600px) {
  .book-shelf { --cover-height: 160px; }
}

.shelf-views .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  cursor: pointer;
}

.shelf-views .pill [data-lucide] {
  width: 16px;
  height: 16px;
}

.book-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.shelf-as-list .book-shelf {
  --cover-height: 56px;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
}

.shelf-as-list .book {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 0;
}

.shelf-as-list .book-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.shelf-as-list .book-cover-wrap {
  flex: 0 0 auto;
  height: var(--cover-height);
  margin-inline-end: max(0px, calc(100px - var(--cover-height) * var(--ratio)));
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(46, 42, 36, 0.14);
}

.shelf-as-list .book-cover--file {
  gap: 0;
  font-size: 0.6rem;
}

.shelf-as-list .book-cover--file [data-lucide] {
  width: 20px;
  height: 20px;
}

.shelf-as-list .book-details {
  padding: 0;
  min-width: 0;
}

.shelf-as-list .book-tools {
  position: static;
}

.shelf-as-list .book.has-menu .book-details {
  padding-inline-end: 0;
}

.book-card {
  display: block;
  color: var(--text);
}

.book-card:hover {
  color: var(--text);
}

/* The spine sits on the right, where an Arabic book opens. */
.book-cover-wrap {
  position: relative;
  aspect-ratio: var(--ratio);
  overflow: hidden;
  border-radius: 12px 8px 8px 12px;
  background: var(--bg-alt);
  box-shadow: 0 10px 24px rgba(46, 42, 36, 0.16), 4px 0 0 rgba(255, 255, 255, 0.35) inset;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.book-cover-wrap::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 5px;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.18), transparent);
}

.book-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover--file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.book-cover--file [data-lucide] {
  width: 44px;
  height: 44px;
  stroke-width: 1.5;
}

a.book-card:hover .book-cover-wrap,
a.book-card:focus-visible .book-cover-wrap {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px rgba(46, 42, 36, 0.22), 4px 0 0 rgba(255, 255, 255, 0.35) inset;
}

a.book-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 8px;
}

.book-details {
  padding: 12px 2px 0;
}

.book-details h3 {
  margin: 0 0 2px;
  font-size: 1.02rem;
  line-height: 1.5;
}

.book {
  position: relative;
}

.book-tools {
  position: absolute;
  top: calc(var(--cover-height) + 8px);
  inset-inline-end: -6px;
}

.book.has-menu .book-details {
  padding-inline-end: 60px;
}

.book.is-hidden .book-cover-wrap {
  opacity: 0.45;
}

.toc {
  margin: 0 0 24px;
  padding: 14px 20px;
  background: var(--bg-alt);
  border-radius: var(--radius);
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.toc ul {
  margin: 0;
  padding-inline-start: 20px;
}

.toc li + li {
  margin-top: 4px;
}

/* Attendance page */
.attendance-list {
  display: flex;
  flex-direction: column;
}

.attendance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.att-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.att-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.att-opt span {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
  white-space: nowrap;
  user-select: none;
}

.att-opt-present input:checked ~ span {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok-dark);
}

.att-opt-kind input:checked ~ span {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

.att-opt-late input:checked ~ span {
  background: var(--late);
  border-color: var(--late);
  color: #fff;
}

.att-opt-excused input:checked ~ span {
  background: var(--gold);
  color: #fff;
  border-color: #9c7a2e;
}

.att-opt-absent input:checked ~ span {
  background: var(--danger);
  color: #fff;
  border-color: #8f3328;
}

/* Badge groups (tajweed / ghareeb / rafiq) — single-select chips */
.badge-group-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.badge-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.badge-group-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.badge-group-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* The pair member's weekly contact rating on the rafiq widget. */
.rafiq-rate {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 12px;
}

.rafiq-rate .rafiq-rate-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.rafiq-rate button.badge-chip {
  font-family: inherit;
  background: var(--surface);
}

.badge-chip {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  user-select: none;
}

.badge-chip.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

.badge-chip.badge-chip--pos.is-selected,
.tag-chip.tag-chip--pos.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

.badge-chip.badge-chip--mid.is-selected,
.tag-chip.tag-chip--mid.is-selected {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}

.badge-chip.badge-chip--neg.is-selected,
.tag-chip.tag-chip--neg.is-selected {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Naqqat (points) pages */
.naqqat-sub-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 18px 0 6px;
  color: var(--text);
}

.naqqat-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.naqqat-auto-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--gold, #c9a227);
  color: #fff;
}

.card > summary.auto-summary .naqqat-auto-badge { margin-inline-start: auto; }

/* An automatic category is information, not a form: a flat card with the
   title row and the rule, nothing to open. */
.auto-card .auto-summary {
  display: flex;
  align-items: center;
  margin: 0;
  font-weight: 700;
  color: var(--accent-dark);
}

.auto-card .auto-summary .naqqat-auto-badge { margin-inline-start: auto; }

.auto-card .category-rule { margin-bottom: 0; }
.card > summary.auto-summary::after { margin-inline-start: 8px; }

.section-chips-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.naqqat-student-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.naqqat-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.naqqat-student-name { font-weight: 500; flex: 1; }

.naqqat-points-badge {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.naqqat-points-badge.points-pos { color: var(--accent-dark); }
.naqqat-points-badge.points-neg { color: var(--danger); }
.naqqat-points-badge.points-zero { color: var(--text-muted); }

.naqqat-points-input {
  width: 80px;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--input-bg, var(--card-bg));
  color: var(--text);
  font-size: 0.9rem;
}

.naqqat-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.badge-group-chips--inline { align-items: center; }

/* ── Tech console (English / LTR) ─────────────────────────────────────────── */
body.tech {
  direction: ltr;
  text-align: left;
}

.tech-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tech-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tech-heading {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

/* The console's header (2026-11-15): brand and page name on one line, the
   navigation under it as one row that scrolls sideways when it must — a
   phone never gets three lines of buttons. */
body.tech .site-header .container {
  flex-wrap: wrap;
  gap: 8px 16px;
}

.tech-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 100%;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px;
}

.tech-nav::-webkit-scrollbar,
.tech-tabs::-webkit-scrollbar {
  display: none;
}

.tech-nav form {
  margin-inline-start: auto;
}

.tech-nav-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.tech-nav-link:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.tech-nav-link.is-active {
  background: var(--accent);
  color: #fff;
}

.tech-nav-link.is-active .tech-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* A course's own pages: Settings, Members, Permissions — and what only
   the Quran course has. */
.tech-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tech-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}

.tech-tab:hover {
  color: var(--text);
}

.tech-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

.tech-card--level {
  background: var(--bg);
}

/* A ladder on the console's front door: the hull with its levels inside. */
.tech-ladder {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* A cell whose content may run over several lines. */
.tech-wrap {
  white-space: normal;
}

/* One card per role, each with its switches — reads the same on a phone
   as on a desk, no matrix to scroll. */
.tech-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

.tech-role {
  margin: 0;
  padding: 12px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.tech-role legend {
  padding: 0 6px;
  font-weight: 700;
}

.tech-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.9rem;
  cursor: pointer;
}

.tech-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

/* The notification rules: a switch, who hears it, and the wording. */
.tech-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tech-rule {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tech-rule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.tech-rule-head .tech-check {
  flex: 1 1 260px;
  font-weight: 600;
}

.tech-rule .tech-texts {
  margin-top: 6px;
}

/* A phone has no room for columns: every table row becomes a card, each
   cell on its own line under the name of its column. */
@media (max-width: 760px) {
  .tech-table,
  .tech-table tbody,
  .tech-table tr,
  .tech-table td {
    display: block;
    width: 100%;
  }

  .tech-table {
    border: 0;
    background: none;
    border-radius: 0;
    overflow: visible;
  }

  .tech-table thead {
    display: none;
  }

  .tech-table tr {
    margin-bottom: 10px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  /* the column's name on the left, the value on the right */
  .tech-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
    text-align: end;
  }

  .tech-table tr td:last-child {
    border-bottom: 0;
  }

  .tech-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  /* the row's first cell is its heading */
  .tech-table td:first-child {
    font-weight: 700;
    font-size: 1rem;
  }

  /* long content and the actions take the full width under their name */
  .tech-table td.tech-wrap,
  .tech-table td.tech-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    text-align: start;
  }

  .tech-table td.tech-wrap::before,
  .tech-table td.tech-actions::before {
    flex: 1 1 100%;
  }

  .tech-actions form,
  .tech-inline-form {
    flex-wrap: wrap;
  }

  .tech-inline-form > * {
    flex: 1 1 100%;
  }

  .tech-section h3 {
    flex-wrap: wrap;
  }
}

.tech-sub {
  color: var(--text-muted);
}

.tech-table td.tech-level-name {
  padding-inline-start: 38px;
}

/* The console's front door: one card per area. */
.tech-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.tech-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.12s ease;
}

.tech-card:hover {
  border-color: var(--accent);
}

.tech-card-title {
  font-weight: 700;
  color: var(--accent-dark);
}

.tech-card-count {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.tech-card-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tech-tag.is-alert {
  background: var(--danger-bg);
  color: var(--danger);
}

.tech-section {
  margin-bottom: 32px;
}

.tech-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 1rem;
}

.tech-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 2px 10px;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tech-table th,
.tech-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

/* Arabic answers inside the English console read right to left */
.tech-table [dir="rtl"] {
  text-align: right;
}

.tech-table thead th {
  background: var(--bg-alt);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.tech-table tr:last-child td {
  border-bottom: none;
}

.tech-actions-col {
  width: 1%;
  white-space: nowrap;
}

.tech-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tech-form {
  max-width: 720px;
}

.tech-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.tech-sort {
  margin-bottom: 12px;
}

.tech-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--bg-alt);
  color: var(--text-muted);
}

.tech-tag.is-teacher,
.tech-tag.is-new {
  background: rgba(47, 111, 79, 0.12);
  color: var(--accent-dark);
}

/* الجلسات: the dawra picker rides in the summary row, far left, and only
   while the card is open. */
.sessions-card > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.sessions-card > summary > span {
  flex: 1;
}

.sessions-dawra-select {
  margin: 0;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.sessions-card[open] > summary .sessions-dawra-select {
  display: flex;
}

.sessions-dawra-select select {
  height: 2.1rem;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 0.85rem;
}

/* The site-wide dropdown (dropdown.js). The native select stays for the
   value and for validation, so it is hidden without being display:none. */
.dropdown {
  position: relative;
  display: inline-block;
  min-width: 120px;
}

/* Fixed, so the field does not grow as more options are ticked. */
.dropdown--multi {
  width: 180px;
}

.dropdown select {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.dd-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 2.5rem;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: start;
  cursor: pointer;
}

.dd-toggle:hover:not(:disabled) {
  border-color: var(--accent);
}

.dd-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.dd-toggle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dd-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-label.is-placeholder {
  color: var(--text-muted);
}

.dd-caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-inline: 5px solid transparent;
  border-top: 6px solid var(--text-muted);
}

.dropdown:has(.dd-panel:not([hidden])) .dd-caret {
  transform: rotate(180deg);
}

.dd-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  inset-inline-end: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(320px, 80vw);
  max-height: 264px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(46, 42, 36, 0.14);
}

.dropdown.is-up .dd-panel {
  top: auto;
  bottom: calc(100% + 4px);
}

.dd-group {
  padding: 8px 10px 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dd-option {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.92rem;
  white-space: nowrap;
  cursor: pointer;
}

.dd-option.is-active {
  background: var(--bg-alt);
}

.dd-option.is-selected {
  color: var(--accent-dark);
  font-weight: 700;
}

.dropdown--multi .dd-option.is-selected::after {
  content: "✓";
  margin-inline-start: 8px;
}

.dd-option.is-disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Contexts that sized the native select have to size the toggle instead. */
.dawra-select .dd-toggle,
.sessions-dawra-select .dd-toggle {
  height: 2.1rem;
  font-size: 0.85rem;
}

/* The status pill hugs its label instead of filling the form-field width. */
.dropdown:has(.meeting-status-select) {
  min-width: 0;
}

.meeting-status-select ~ .dd-toggle {
  height: auto;
  padding: 3px 8px;
  border: none;
  font-size: 0.82rem;
}

.meeting-status-select.status-scheduled ~ .dd-toggle { background: #f2faf5; }
.meeting-status-select.status-cancelled ~ .dd-toggle { background: #fdf3f2; }
.meeting-status-select.status-activity  ~ .dd-toggle { background: #fef9e7; }

/* Invalid inputs, last so it beats the per-form field styling. */
input.is-invalid,
select.is-invalid,
textarea.is-invalid,
.grading-form select[multiple].is-invalid,
select.is-invalid ~ .dd-toggle {
  border-color: var(--danger);
  background: var(--danger-bg);
}

/* تقييم اللقاء: section headings and the per-category calculation rule. */
.taqyeem-section {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin: 34px 0 12px;
}

.taqyeem-section:first-child {
  margin-top: 0;
}

.category-rule {
  margin: 6px 0 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* الرفيق القرآني: a pair row opens into its own edit form. */
.session-list > .card {
  /* The list already spaces its items; drop the card's own margin. */
  margin: 0;
}

.rifqaa-pair > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rifqaa-names {
  font-weight: 500;
}
/* Flashcards (ported from the static site) */
.flashcard-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.flashcard {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-align: center;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
}

.fc-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  width: 100%;
}

.flashcard .face-content {
  font-size: 1.6rem;
}

.flashcard .card-hint {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.flashcard.is-front .card-hint {
  display: block;
}

.flashcard.is-front .face-content {
  font-family: "Amiri", serif;
  font-size: 2.2rem;
  color: var(--accent-dark);
}

.flashcard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 480px;
}

.flashcard-rating {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  background: var(--bg-alt);
  width: 100%;
}

.flashcard-rating[hidden] {
  display: none;
}

.flashcard-rating .btn-again { border-color: #b5563f; color: #b5563f; }
.flashcard-rating .btn-hard { border-color: var(--gold); color: #9c7a2e; }
.flashcard-rating .btn-good { border-color: var(--accent); color: var(--accent-dark); }
.flashcard-rating .btn-easy { border-color: #3f7d8c; color: #3f7d8c; }
.flashcard-rating .btn-again:hover { background: #b5563f; color: #fff; }
.flashcard-rating .btn-hard:hover { background: var(--gold); color: #fff; }
.flashcard-rating .btn-good:hover { background: var(--accent); color: #fff; }
.flashcard-rating .btn-easy:hover { background: #3f7d8c; color: #fff; }

.flashcard-progress {
  color: var(--text-muted);
  font-size: 0.9rem;
  min-width: 64px;
  text-align: center;
}

.fc-reference {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.review-today {
  margin-bottom: 16px;
}

.review-today .study-tab-count {
  margin-inline-start: 2px;
  padding: 1px 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

#flashcard-container:fullscreen,
#flashcard-container:-webkit-full-screen,
#flashcard-container.is-fallback-fullscreen {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}

#flashcard-container:fullscreen .flashcard-stage,
#flashcard-container:-webkit-full-screen .flashcard-stage,
#flashcard-container.is-fallback-fullscreen .flashcard-stage {
  width: 100%;
  max-width: 700px;
}

#flashcard-container:fullscreen .flashcard,
#flashcard-container:-webkit-full-screen .flashcard,
#flashcard-container.is-fallback-fullscreen .flashcard {
  min-height: 50vh;
  max-width: 700px;
}

#flashcard-container:fullscreen .flashcard .face-content,
#flashcard-container:-webkit-full-screen .flashcard .face-content,
#flashcard-container.is-fallback-fullscreen .flashcard .face-content {
  font-size: 2.4rem;
}

#flashcard-container:fullscreen .flashcard.is-front .face-content,
#flashcard-container:-webkit-full-screen .flashcard.is-front .face-content,
#flashcard-container.is-fallback-fullscreen .flashcard.is-front .face-content {
  font-size: 3.2rem;
}

#flashcard-container.is-fallback-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: auto;
}

body.flashcards-fullscreen-open {
  overflow: hidden;
}

.fc-range-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.fc-range-filter input[type="number"] {
  width: 58px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  text-align: center;
}


.fc-end-screen {
  text-align: center;
  gap: 12px;
}

.fc-score {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
}

.fc-score.is-good { color: var(--accent); }
.fc-score.is-fair { color: #c77a1a; }
.fc-score.is-weak { color: var(--danger); }

.fc-score-msg {
  font-size: 1.05rem;
  margin: 8px 0 16px;
}


.form-row--inline {
  align-items: flex-end;
}

/* ---- Student leaderboard: top 5 + own row ---- */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}
/* The student's own row: outlined, not filled — it should read as "you are
   here", not as the winner. */
.leaderboard-row.is-me {
  border-color: var(--accent-dark);
  background: var(--bg-alt);
}
.leaderboard-rank {
  min-width: 1.6rem;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.leaderboard-name { flex: 1; }
.leaderboard-trend,
.leaderboard-streak {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
}
.leaderboard-trend svg,
.leaderboard-streak svg {
  width: 18px;
  height: 18px;
}
.leaderboard-trend.is-up { color: var(--accent); }
.leaderboard-trend.is-down { color: var(--danger); }
.leaderboard-streak {
  color: #d9730d;
  font-size: 0.85rem;
  font-weight: 700;
}
/* The ellipsis marks the skipped ranks, so it belongs in the rank column
   rather than centred across the row. */
.leaderboard-gap {
  padding: 0 10px;
}
.leaderboard-gap .leaderboard-rank {
  color: var(--text-muted);
  letter-spacing: 1px;
  line-height: 1;
}

/* ---- Phones (#11) ---- */
@media (max-width: 640px) {
  .container { padding: 0 12px; }

  .header-context { font-size: 1rem; }

  /* A session row is a wide flex of fixed-width columns; on a phone those
     minimums leave the surah text a few pixels, so let it wrap into rows. */
  .session-entry { flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; }
  .plan-split { grid-template-columns: 1fr; }
  .teacher-hub { grid-template-columns: 1fr; gap: 8px; }
  .hub-btn { padding: 24px 16px; }
  .rafiq-widget {
    grid-column: 1 / -1;
  }

  .session-entry-date,
  .sessions-card .session-entry { display: flex; flex-wrap: wrap; }
  .session-entry-type { min-width: 0; padding-top: 0; order: 1; }
  .session-grade-slot { min-width: 0; order: 2; margin-inline-start: auto; }
  .session-entry .item-menu { order: 2; }
  .session-entry-details { flex: 1 1 100%; order: 3; }
  .session-entry-errors { flex: 1 1 100%; text-align: start; order: 3; }
  .session-entry-notes { flex: 1 1 100%; width: auto; max-width: none; order: 4; }

  /* Headers that pair a title with a dawra select / action button. */
  .page-header--with-dawra { flex-wrap: wrap; gap: 8px; }
  .form-row.session-add-row { grid-template-columns: repeat(2, minmax(0, 160px)); }

  /* A card summary holds a title plus filter selects; on a phone they don't
     fit on one line and pushed the collapse chevron off the edge. */
  .card > summary { flex-wrap: wrap; }
  /* order pushes the filters below the title so the collapse chevron stays
     on the title's line instead of dropping to one of its own. */
  .sessions-dawra-select { flex: 1 1 100%; order: 1; }
  .sessions-dawra-select select { flex: 1; min-width: 0; }
}

/* ── التقويم — the shared calendar ──────────────────────────────────────── */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cal-title {
  margin: 0;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.cal-arrow:hover {
  color: var(--accent-dark);
  background: var(--bg-alt);
}

.cal-arrow [data-lucide] {
  width: 18px;
  height: 18px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-grid--head {
  margin-bottom: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.cal-day {
  height: 104px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

/* A crowded day never grows the row — its bars scroll inside the cell. */
.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.cal-bar {
  flex-shrink: 0;
}

.cal-day.is-out {
  opacity: 0.45;
  background: var(--bg);
}

.cal-day.has-events {
  cursor: pointer;
}

.cal-day.has-events:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.cal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 600;
  align-self: flex-start;
}

.cal-num.is-today {
  background: var(--accent);
  color: #fff;
}

.cal-bar {
  position: relative;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
}

.cal-bar-fill {
  position: absolute;
  inset: 0;
  display: flex;
}

/* Several courses, one bar: each stripe fades out of its neighbour instead
   of cutting against it — the stripes overlap and the overlapping edge runs
   from transparent to the stripe's own colour. */
.cal-stripe {
  flex: 1;
  background: linear-gradient(to left, transparent, var(--shade) 18px);
}

.cal-stripe:first-child {
  background: var(--shade);
}

.cal-bar--activity, .cal-bar--other {
  color: var(--on-shade);
}

.cal-stripe + .cal-stripe {
  margin-inline-start: -18px;
}

.cal-stripe--quran { --stripe: #2d5e44; }
.cal-stripe--tajweed { --stripe: #49916b; }
.cal-stripe--nahw { --stripe: var(--nahw); }
.cal-stripe--level-1 { --stripe: var(--level-1); }
.cal-stripe--level-2 { --stripe: var(--level-2); }
.cal-stripe--level-3 { --stripe: var(--level-3); }
.cal-stripe--itqan { --stripe: var(--itqan); }

.cal-bar-text {
  position: relative;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-sheet {
  display: none;
}

.cal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(46, 42, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.cal-modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(46, 42, 36, 0.25);
  padding: 22px;
  width: min(460px, 100%);
  max-height: 85vh;
  overflow-y: auto;
}

.cal-close {
  position: absolute;
  top: 10px;
  left: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  line-height: 0;
}

.cal-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.cal-sheet-date {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.cal-event {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-inline-start: 4px solid var(--border);
}

/* An event wears its course's colour (owner decision 2026-11-25), its kind
   the shade: a درس the colour itself, an exam darker, an activity much
   lighter, an administrative meeting greyed, anything else palest. The
   bar in the grid, the card's edge and the kind's label all follow it. */
.cal-event, .cal-stripe { --shade: var(--stripe); }
.cal-event--exam, .cal-bar--exam .cal-stripe { --shade: color-mix(in srgb, var(--stripe) 55%, black); }
.cal-event--activity, .cal-bar--activity .cal-stripe { --shade: color-mix(in srgb, var(--stripe) 45%, white); }
.cal-event--admin, .cal-bar--admin .cal-stripe { --shade: color-mix(in srgb, var(--stripe) 35%, #6b7280); }
.cal-event--other, .cal-bar--other .cal-stripe { --shade: color-mix(in srgb, var(--stripe) 22%, white); }
.cal-event--activity, .cal-event--other, .cal-bar--activity, .cal-bar--other { --on-shade: var(--text); }

.cal-event { border-inline-start-color: var(--shade); }

.cal-event-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cal-event-head h5 {
  margin: 0;
  font-size: 1.02rem;
}

.cal-kind {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
  color: #fff;
  flex-shrink: 0;
}

.cal-kind {
  background: var(--shade);
  color: var(--on-shade, #fff);
}

.cal-event-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.cal-event-facts li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.cal-event-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
}

.cal-event-facts [data-lucide] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.cal-event-courses {
  flex-wrap: wrap;
  row-gap: 6px;
}

.cal-course {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-course + .cal-course {
  margin-inline-start: 8px;
}

.cal-course-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--stripe);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cal-course-icon [data-lucide] {
  width: 12px;
  height: 12px;
}

.cal-event-desc {
  margin: 10px 0 0;
  font-size: 0.92rem;
}

.cal-event-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cal-event-actions .btn [data-lucide] {
  width: 15px;
  height: 15px;
}

@media (max-width: 640px) {
  .cal-day {
    height: 64px;
    padding: 4px;
    border-radius: 8px;
  }

  .cal-bar {
    height: 6px;
    padding: 0;
    border-radius: 999px;
  }

  .cal-bar-text {
    display: none;
  }

  .cal-weekday {
    font-size: 0.66rem;
  }

  .cal-num {
    width: 20px;
    height: 20px;
    font-size: 0.74rem;
  }
}

/* إشعارات الجهاز — the one-time prompt and the inbox banner. */
.push-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(46, 42, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.push-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(46, 42, 36, 0.25);
  padding: 22px;
  width: min(420px, 100%);
}

.push-modal h4 {
  margin: 0 0 8px;
}

.push-modal p {
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.push-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.push-box.is-off {
  border-inline-start: 4px solid var(--danger);
  background: var(--danger-bg);
}

.push-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* The site's own confirmation dialog (confirm.js). */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(46, 42, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.confirm-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(46, 42, 36, 0.25);
  padding: 22px;
  width: min(400px, 100%);
}

.confirm-text {
  margin: 0 0 16px;
  font-size: 0.98rem;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Choosing among several answers: one per line, full width. */
.confirm-actions--stack {
  flex-direction: column;
  align-items: stretch;
}

/* الرفيق القرآني — the deliberately-unpaired strip above the pairs. */
.rifqaa-unpaired {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.rifqaa-unpaired-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.tech-list {
  margin: 0;
  padding-inline-start: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tech-list li {
  margin-bottom: 4px;
}

.test-banner {
  background: var(--danger);
  color: #fff;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
}

.test-banner ~ header.site-header {
  border-bottom: 3px solid var(--danger);
}

/* The red dot that marks the exact spot a «يتطلب إجراء» row points at. */
.todo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b30;
  margin-inline-start: 7px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Pull-to-refresh (ptr.js) — only the installed iOS web app, where the
   gesture is not native. The circle rides the rubber-band bounce. */
.ptr {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -48px);
  z-index: 60;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(46, 42, 36, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
  opacity: 0;
  pointer-events: none;
}

.ptr svg {
  transition: transform 0.15s ease;
}

.ptr.is-ready svg {
  transform: rotate(180deg);
}

.ptr.is-loading svg {
  display: none;
}

.ptr.is-loading::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent-dark);
  animation: ptr-spin 0.7s linear infinite;
}

@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* The hero fills the screen, so a bobbing chevron says the page goes on. */
.landing-scroll-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
  opacity: 0.75;
  animation: scroll-hint-bob 2s ease-in-out infinite;
  transition: opacity 0.3s ease;
}

.landing-scroll-hint [data-lucide] {
  width: 28px;
  height: 28px;
}

.landing-scroll-hint.is-gone {
  opacity: 0;
  pointer-events: none;
}

@keyframes scroll-hint-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

@media (prefers-reduced-motion: reduce) {
  .landing-scroll-hint {
    animation: none;
    transform: translateX(-50%);
  }
}

/* The Notifications page's editable wording, folded under each rule. */

.tech-texts summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.tech-text-field {
  margin: 10px 0 2px;
}

.tech-text-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tech-text-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

.tech-text-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* The Latin menu labels inside the install hints — their own line, LTR. */
.push-latin {
  display: block;
  margin-top: 6px;
  direction: ltr;
  text-align: start;
  font-size: 0.85em;
  color: var(--text-muted);
}

.ring-item .target-form {
  margin-top: 14px;
  text-align: start;
}

.ring-item .target-form .form-row {
  justify-content: flex-start;
  margin-bottom: 0;
}

/* The dawra target opens behind its pencil (teacher's view of a student). */
/* Save and delete stay side by side, also when the row wraps on a phone. */
.target-actions {
  display: flex;
  gap: 8px;
}

.target-edit > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}

.target-edit > summary::-webkit-details-marker {
  display: none;
}

.target-edit > summary [data-lucide] {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.target-edit > summary:hover [data-lucide] {
  opacity: 1;
}

.target-preview {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: start;
}

/* ── الإحصائيات (2026-11-15) ── */
.stats-scope {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* The choice between one لقاء and a stretch: two halves of one control. */
.seg {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-alt);
}

.seg-btn {
  padding: 6px 18px;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: var(--shadow);
}

/* One tap per لقاء; the strip scrolls sideways when it is long. */
.pill-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}

.pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.stats-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.stats-range label {
  flex: 1 1 140px;
}

.stats-scope-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Three lanes side by side: what happened, measured against who was
   asked — the figure is the fact, the bar's track the whole it is of. */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 28px;
}

.lane {
  --lane: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* The two plans keep their colour wherever they appear: حفظ green,
   مراجعة gold — lanes, flag groups, list columns, the progress page. */
.lane--hifz { --lane: var(--accent); }
.lane--murajaa { --lane: var(--gold); }

.lane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.lane-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.lane--hifz .lane-title::before,
.lane--murajaa .lane-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lane);
}

.lane-figure {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.lane-figure small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.lane-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lane .ring-legend {
  margin: 0;
  justify-content: flex-start;
}

.stats-plans {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
  display: flex;
}

.bar > span {
  background: var(--lane, var(--accent));
  border-radius: 999px;
}

.bar--stack > span {
  border-radius: 0;
}

.bar-ok { background: var(--ok) !important; }
.bar-late { background: var(--late) !important; }
.bar-warn { background: var(--gold) !important; }
.bar-bad { background: var(--danger) !important; }

/* What needs a look, grouped like the lanes above: one line each, the
   names behind it. */
.flag-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 28px;
  align-items: start;
}

.flag-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flag-group > h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

p.flag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.flag--none {
  --flag: var(--border);
  color: var(--text-muted);
}

.flag--none b {
  font-weight: 500;
}

.flag {
  --flag: var(--border);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--flag);
  border-radius: 10px;
  padding: 0 12px;
}

.flag--bad { --flag: var(--danger); }
.flag--warn { --flag: var(--gold); }

.flag > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.flag > summary::-webkit-details-marker {
  display: none;
}

.flag > summary b {
  min-width: 2em;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-alt);
  font-size: 0.82rem;
  text-align: center;
}

.flag--bad > summary b {
  background: var(--danger-bg);
  color: var(--danger);
}

.flag .stat-chips {
  padding-bottom: 12px;
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
}

.stat-chip b {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-alt);
  font-size: 0.75rem;
  font-weight: 600;
}

/* One learner per row, in four columns that line up down the list:
   name, attendance, then what is done against the goal of each plan. */
.stat-rows {
  display: flex;
  flex-direction: column;
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 170px minmax(0, 1.25fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 8px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: 0;
}

@media (min-width: 721px) {
  .stat-rows--three .stat-row {
    grid-template-columns: minmax(120px, 1fr) 170px minmax(0, 1.25fr);
  }
}

.stat-row--head {
  padding: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-row--head .lane-title {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* A column heading sorts its table: arrows beside the name. */
.stat-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.stat-sort [data-lucide] {
  width: 13px;
  height: 13px;
}

.stat-sort .stat-sort-desc,
.stat-sort .stat-sort-asc,
.stat-sort[data-dir] .stat-sort-idle {
  display: none;
}

.stat-sort[data-dir="desc"] .stat-sort-desc,
.stat-sort[data-dir="asc"] .stat-sort-asc {
  display: inline;
}

.stat-sort[data-dir] {
  color: var(--accent-dark);
}

.stat-name {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.stat-att {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.att-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.att-tag--ok { background: #d6f0e0; color: #1d6b40; }
.att-tag--late { background: #edf2cf; color: #5d6b17; }
.att-tag--warn { background: #fdf3dc; color: #7a5200; }
.att-tag--bad { background: var(--danger-bg); color: var(--danger); }

.stat-plan {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

/* The column heads name the plan on a wide screen; a phone has no room
   for them, so each cell carries its own. */
.stat-plan-title {
  display: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-plan-text {
  font-size: 0.85rem;
  color: var(--text);
}

.stat-plan-text.is-muted {
  color: var(--text-muted);
}

.stat-plan-text.is-bad {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 720px) {
  .stat-row {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 8px 16px;
  }

  .stat-row--head {
    display: none;
  }

  .stat-att {
    justify-content: flex-end;
  }

  .stat-plan-title {
    display: block;
  }
}

/* A swiped notification slides out without widening the page. */
[data-notification-list] {
  overflow-x: clip;
}

[data-notification-list] .notification {
  touch-action: pan-y;
}

.notification-meta form {
  display: inline-flex;
}

.notification-delete {
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.notification-delete:hover {
  color: var(--danger);
}
