:root {
  --bg: #0f141f;
  --bg-soft: rgba(30, 37, 53, 0.84);
  --panel: rgba(27, 34, 50, 0.9);
  --panel-2: rgba(35, 44, 63, 0.94);
  --text: #f7f7fb;
  --muted: #aeb8cc;
  --line: rgba(255,255,255,0.10);
  --accent: #c9a66b;
  --accent-2: #7cc1c7;
  --danger: #ef4444;
  --blue: #3b82f6;
  --shadow: 0 20px 60px rgba(0,0,0,0.28);
  --radius: 24px;
}

html[data-theme='light'] {
  --bg: #f4f2ee;
  --bg-soft: rgba(255,255,255,0.84);
  --panel: rgba(255,255,255,0.92);
  --panel-2: rgba(247,250,255,0.98);
  --text: #1c2333;
  --muted: #627089;
  --line: rgba(16, 32, 58, 0.1);
  --shadow: 0 18px 60px rgba(17, 33, 61, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { max-width: 100%; overflow-x: clip; overscroll-behavior-y: none; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, rgba(201, 166, 107, 0.14), transparent 34%), var(--bg);
  color: var(--text);
  min-height: 100dvh;
}
body.no-scroll {
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px clamp(14px, 2.6vw, 24px);
  backdrop-filter: blur(18px);
  background: rgba(15, 20, 31, 0.72);
  border-bottom: 1px solid var(--line);
}
html[data-theme='light'] .topbar { background: rgba(238, 244, 251, 0.82); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 48px;
  height: 48px;
  min-width: 48px;
  aspect-ratio: 1 / 1;
  flex: 0 0 48px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.brand-logo-protected { user-select: none; -webkit-user-drag: none; pointer-events: none; }
.brand-title { font-weight: 800; }
.brand-subtitle { font-size: 13px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar .icon-btn {
  width: 38px;
  height: 38px;
}
.page-shell { padding: 20px clamp(16px, 3vw, 28px) calc(136px + env(safe-area-inset-bottom)); }
.unlock-page-shell {
  min-height: calc(100dvh - 74px);
  display: grid;
  align-content: center;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom) + 20px);
}
.unlock-page-shell .app-footer {
  display: none;
}
.unlock-screen .topbar {
  backdrop-filter: none;
  background: rgba(15, 20, 31, 0.96);
}
html[data-theme='light'] .unlock-screen .topbar {
  background: rgba(244, 242, 238, 0.96);
}
.app-root { display: grid; gap: 18px; min-width: 0; }
.app-footer {
  margin-top: 22px;
  padding: 8px 0 2px;
  text-align: center;
}
.app-footer-line {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.app-footer-credit {
  margin-top: 6px;
}
.app-footer-credit a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.app-footer-credit a:hover {
  text-decoration: none;
  opacity: .92;
}
.panel, .panel-sub, .hero-card, .auth-panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.panel, .hero-card { padding: 20px; }
.panel-sub { padding: 16px; }
.hero-card {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap;
}
.compact-hero { padding-block: 18px; }
.eyebrow { color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: clamp(20px, 2.6vw, 28px); }
h3 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt16 { margin-top: 16px; }
.stretch { flex: 1 1 auto; }
.break-all { word-break: break-all; }

.skeleton-block {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}
.skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.13), transparent);
  animation: skeleton-shimmer 1.15s infinite;
}
@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}
.skeleton-card { min-height: 132px; }
.skeleton-student-card { min-height: 150px; }
.skeleton-ranking-summary { min-height: 132px; }
.skeleton-ranking-row { min-height: 74px; margin-bottom: 10px; }
.skeleton-detail-hero { min-height: 110px; margin-bottom: 10px; }
.skeleton-kpi { min-height: 112px; }
.skeleton-page-summary { min-height: 72px; }

.hero-badges, .toolbar-inline, .row-wrap, .lesson-row-actions, .review-card-body {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.admin-date-dock {
  padding: 14px 18px;
}
.admin-date-dock .mushaf-top-label {
  display: block;
  margin-bottom: 8px;
}
.admin-date-dock .toolbar-inline {
  justify-content: space-between;
  gap: 12px;
}
.admin-date-dock .select-input {
  max-width: 220px;
}
.badge, .mini-chip, .rank-pill, .average-badge {
  padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); font-size: 13px;
}
.average-badge { background: rgba(124, 193, 199, 0.16); }
.rank-pill { background: rgba(201, 166, 107, 0.2); }

.icon-btn, .primary-btn, .ghost-btn, .ghost-link, .tool-btn, .attendance-btn {
  border: 1px solid var(--line); color: var(--text); border-radius: 14px; transition: .18s ease; cursor: pointer;
}
.icon-btn, .ghost-link, .ghost-btn, .tool-btn, .attendance-btn { background: rgba(255,255,255,.05); }
.primary-btn {
  background: linear-gradient(135deg, rgba(201,166,107,0.95), rgba(124,193,199,0.88));
  color: #03111d; font-weight: 700;
}
.action-btn {
  border-color: rgba(201,166,107,.55);
  box-shadow: 0 10px 26px rgba(201,166,107,.2);
}
.action-btn:hover {
  box-shadow: 0 12px 30px rgba(201,166,107,.28);
}
.icon-btn { width: 42px; height: 42px; }
.primary-btn, .ghost-btn, .tool-btn, .attendance-btn, .ghost-link { padding: 11px 14px; }
.ghost-link { display: inline-flex; align-items: center; }
.primary-btn:hover, .ghost-btn:hover, .tool-btn:hover, .attendance-btn:hover, .icon-btn:hover { transform: translateY(-1px); }
.primary-btn.is-loading, .ghost-btn.is-loading { opacity: .75; cursor: wait; transform: none; }
.primary-btn:disabled, .ghost-btn:disabled { opacity: .72; cursor: not-allowed; }
.attendance-btn.yes.active { background: rgba(52, 211, 153, .18); }
.attendance-btn.no.active { background: rgba(239, 68, 68, .20); }
.tool-btn.active { background: rgba(201, 166, 107, .2); }
.danger-btn {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.bottom-tabs {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  margin-inline: auto;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  width: min(760px, calc(100% - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  z-index: 45; display: grid; grid-template-columns: repeat(var(--tab-count, 4), minmax(0, 1fr));
  gap: 10px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); border-radius: 24px; background: rgba(15,20,31,.86); border: 1px solid var(--line); backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
}
html[data-theme='light'] .bottom-tabs { background: rgba(255,255,255,.8); }
.tab-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  min-height: 58px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.tab-btn.active {
  background: rgba(255,255,255,.09);
  color: var(--text);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.tab-btn > :not(.tab-icon) { font-size: 12px; line-height: 1.1; }
.current-actor-stack { display: grid; gap: 6px; }
.current-actor-name { display: block; font-size: 18px; line-height: 1.2; }
.tab-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}
.tab-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 18px; }

.stats-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
#adminOverview.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stats-grid > .stat-card { min-height: 132px; }
.stats-grid > .stat-card.stat-span-2 { grid-column: span 2; }
.stats-grid > .stat-card.stat-span-3 { grid-column: span 3; }
.stats-grid > .stat-card.stat-span-4 { grid-column: span 4; }
.stat-card {
  padding: 18px; border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.045));
  border: 1px solid var(--line); box-shadow: 0 16px 34px rgba(8,12,20,.2), 0 2px 0 rgba(255,255,255,.04) inset;
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { margin-top: 10px; font-size: 28px; font-weight: 800; text-shadow: 0 6px 22px rgba(0,0,0,.14); }
.count-up { display:inline-block; white-space:nowrap; }

.stat-note { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.overview-accordion {
  padding: 0;
  overflow: hidden;
}
.overview-accordion-highlighted {
  border-color: rgba(201,166,107,.28);
  box-shadow: 0 16px 40px rgba(201,166,107,.08), 0 2px 0 rgba(255,255,255,.04) inset;
}
.overview-accordion > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  cursor: pointer;
}
.overview-accordion > summary::-webkit-details-marker { display: none; }
.overview-accordion-head {
  min-width: 0;
  display: grid;
  gap: 8px;
}
.overview-accordion-topline {
  display: grid;
  gap: 6px;
}
.overview-accordion-value {
  margin-top: 0;
  font-size: clamp(26px, 2.2vw, 34px);
  line-height: 1;
}
.overview-accordion-note {
  margin-top: 0;
  font-size: 13px;
  line-height: 1.45;
  max-width: 38ch;
}
.accordion-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  font-size: 14px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-width: 52px;
  min-height: 44px;
  padding: 8px 12px;
  transition: color .2s ease, border-color .2s ease;
}
.accordion-hint strong {
  font-size: 22px;
  line-height: 1;
  transition: transform .2s ease;
}
.overview-accordion[open] .accordion-hint {
  color: var(--accent);
  border-color: rgba(201,166,107,.35);
}
.overview-accordion[open] .accordion-hint strong {
  transform: rotate(180deg);
}
.overview-accordion-body {
  padding: 0 18px 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.overview-detail-row {
  display: grid;
  gap: 8px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.overview-detail-label {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.overview-detail-value {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.02em;
}
.overview-detail-value .count-up {
  color: var(--accent);
}
.overview-accordion[open] .overview-accordion-body {
  animation: overviewAccordionFade .24s ease;
}
@keyframes overviewAccordionFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.overview-cards-student {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.overview-cards-public {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.overview-cards-student > .stat-card {
  min-height: 0;
}

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.student-grid, .lesson-list { display: grid; gap: 12px; }
.student-grid { grid-template-columns: 1fr; }
.student-card, .lesson-row, .review-card {
  width: 100%; padding: 16px; border-radius: 20px; border: 1px solid var(--line);
  background: rgba(255,255,255,.05); color: var(--text); text-align: left;
}
.student-card { cursor: pointer; }
.metric-bar {
  margin-top: 12px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.metric-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(124,193,199,.85), rgba(201,166,107,.9));
}
.metric-bar.danger > span {
  background: linear-gradient(90deg, rgba(239,68,68,.85), rgba(245,158,11,.9));
}

.progress-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ranking-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ranking-mobile-list { display: none; }
.ranking-mobile-card { width: 100%; text-align: left; cursor: pointer; }

.ranking-mobile-card { display: grid; gap: 10px; }

.ranking-open { cursor: pointer; }

.bars-list { display: grid; gap: 8px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(120px, 2fr) 56px;
  align-items: center;
  gap: 10px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(124,193,199,.88), rgba(201,166,107,.88));
}
.student-card-top, .review-card-top, .detail-hero, .key-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.student-card-meta, .lesson-row-meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.lesson-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lesson-row-main { min-width: 180px; }

.table-head, .table-row {
  padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line);
}
.table-head { background: rgba(255,255,255,.06); color: var(--muted); font-size: 13px; }
.table-row { background: rgba(255,255,255,.03); }
.table-grid { display: grid; gap: 12px; align-items: center; }
.ranking-grid {
  display: grid;
  align-items: center;
  column-gap: 12px;
  grid-template-columns: 56px minmax(220px, 1.8fr) repeat(6, minmax(88px, .72fr));
}
.session-grid {
  display: grid;
  align-items: center;
  gap: 10px 12px;
  grid-template-columns: 56px minmax(110px, 1fr) minmax(110px, 1fr) minmax(90px, 1fr) minmax(110px, 1fr) minmax(150px, 1.2fr) 120px;
}
.table-row.session-grid > span {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  line-height: 1.25;
  word-break: break-word;
}
.session-time { white-space: nowrap; }
.session-mobile-list { display: none; }
.session-mobile-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}
.session-mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.session-mobile-meta {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.session-mobile-meta span {
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}

.table-head.ranking-grid,
.table-row.ranking-grid { width: 100%; }
.table-head.ranking-grid > * { font-weight: 600; }
.table-head.ranking-grid > :nth-child(n+3),
.table-row.ranking-grid > :nth-child(n+3) { text-align: center; }
.table-head.ranking-grid > :nth-child(2),
.table-row.ranking-grid > :nth-child(2) { text-align: left; }
#rankingTable { display: grid; gap: 10px; overflow-x: hidden; }
.table-head.ranking-grid,
.table-row.ranking-grid { min-width: 0; width: 100%; }

.archived-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-shell { max-width: 440px; margin: 7vh auto 0; }
.auth-form { display: grid; gap: 12px; margin-top: 18px; }
.text-input, .select-input, .number-input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); color: var(--text);
}
.number-input { max-width: 104px; }
.error-text { color: #fca5a5; margin-top: 14px; }
.success-text { color: #86efac; margin-top: 14px; }

.detail-hero { padding: 14px 0; }
.surah-grid {
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  max-height: 420px; overflow: auto; padding-right: 4px;
}
.surah-pill {
  display: grid; gap: 6px; align-content: start; padding: 10px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
}
button.surah-pill { cursor: pointer; text-align: left; color: var(--text); }
.surah-pill.idle { opacity: .72; }
.surah-pill.learning { background: rgba(59,130,246,.14); }
.surah-pill.ok { background: rgba(52,211,153,.14); }
.surah-pill.repeat { background: rgba(245,158,11,.14); }
.surah-pill-number { font-weight: 800; }
.surah-pill-name { font-size: 12px; color: var(--muted); line-height: 1.35; }

.mushaf-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.mushaf-stage {
  position: relative; overflow: hidden; border-radius: 24px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
}
.mushaf-image { display: block; width: 100%; height: auto; }
.mushaf-canvas {
  position: absolute; inset: 0; z-index: 2;
}
.mushaf-canvas.readonly { pointer-events: none; }
.mushaf-canvas.editable { cursor: crosshair; }
.mushaf-side { display: grid; gap: 12px; position: sticky; top: 148px; align-content: start; }
.toolbar-vertical { display: grid; gap: 12px; }
.side-stat {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line);
}
.annotation {
  position: absolute; border-radius: 8px; border: 2px solid rgba(239,68,68,.95); background: rgba(239,68,68,.18);
}
.annotation.orange, .annotation.blue { border-color: rgba(245,158,11,.95); background: rgba(245,158,11,.22); }
.annotation.preview { pointer-events: none; }
.annotation.interactive { cursor: pointer; }
.annotation-badge {
  position: absolute; right: -5px; bottom: -9px; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 700;
  background: rgba(7,17,31,.88); color: white; border: 1px solid rgba(255,255,255,.18);
}
.review-grid { display: grid; gap: 10px; grid-template-columns: minmax(180px, 1fr) 110px; }
.key-box { display: grid; gap: 12px; }
.session-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  display: grid;
  gap: 8px;
}
.session-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.empty-state {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}

.muted-banner {
  padding: 14px 16px;
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 9, 15, 0.64);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(520px, 100%);
}
.modal-card-scrollable {
  width: min(620px, 100%);
  max-height: min(92dvh, 860px);
  display: flex;
  flex-direction: column;
  overflow: clip;
}
.modal-card-head {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.modal-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 2px 0 0;
}
.modal-card-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  background: transparent;
  justify-content: flex-end;
}

.rating-stars {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.star-btn {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  min-height: 54px;
  font-weight: 700;
  font-size: 17px;
}

.star-btn.active {
  border-color: rgba(201,166,107,.72);
  background: rgba(201,166,107,.2);
}

.error-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.page-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin: 4px;
  background: rgba(255,255,255,.04);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.trend-list {
  display: grid;
  gap: 6px;
}

.trend-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(120%);
  padding: 12px 16px; border-radius: 999px; background: rgba(7,17,31,.94); color: #fff; border: 1px solid rgba(255,255,255,.14); transition: .22s ease;
  z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 980px) {
  .mushaf-layout { grid-template-columns: 1fr; }
  .mushaf-side { position: static; }
  .ranking-grid { grid-template-columns: 44px minmax(180px, 1.25fr) repeat(6, minmax(72px, .68fr)); font-size: 13px; }
  .session-grid { grid-template-columns: 46px 1fr 1fr 1fr 90px 130px 90px; font-size: 13px; }
}

@media (max-width: 720px) {
  .topbar { padding-inline: 14px; }
  .topbar { flex-wrap: wrap; }
  .page-shell { padding-inline: 14px; }
  .bottom-tabs { grid-template-columns: repeat(var(--tab-count, 4), minmax(0,1fr)); }
  .hero-card { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .student-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .ranking-summary,
  .bars-list,
  .table-head.ranking-grid,
  .table-row.ranking-grid { display: none; }
  .ranking-mobile-list { display: grid; gap: 10px; }
  .session-grid { display: none; }
  #sessionsTable .table-head { display: none; }
  #sessionsTable .table-row { display: none; }
  .session-mobile-list { display: grid; gap: 10px; }
  #rankingTable, #sessionsTable { overflow-x: hidden; }
  .toolbar-inline, .row-wrap { width: 100%; }
  .toolbar-inline > * { flex: 1 1 auto; }
  .number-input { max-width: none; }
  .bar-row { grid-template-columns: minmax(84px, 1fr) minmax(100px, 2fr) 46px; gap: 8px; }
  .overview-cards-student { grid-template-columns: 1fr; }
}

/* --- Mushaf line editor v2 --- */
.key-box-main { display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; }
.rating-weights-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.rating-weight-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}
.rating-weight-title {
  font-weight: 700;
}
.rating-weight-hint {
  color: var(--muted);
  font-size: 12px;
}
.line-correspondence-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(56vh, 420px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: rgba(255,255,255,.03);
}
.line-correspondence-grid {
  display: grid;
  gap: 8px;
  min-width: 320px;
}
.line-correspondence-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}
.line-correspondence-row > label {
  font-weight: 600;
}
.line-correspondence-row .number-input {
  width: 100%;
  min-width: 0;
}
.editor-toolbar-inline { align-items:center; flex-wrap:wrap; }
.modern-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.surah-card { padding:16px; border-radius:20px; border:1px solid var(--line); background: rgba(255,255,255,.05); display:grid; gap:8px; }
.surah-card.ok { box-shadow: inset 0 0 0 1px rgba(52,211,153,.22); }
.surah-card.repeat { box-shadow: inset 0 0 0 1px rgba(239,68,68,.22); }
.surah-card.idle { opacity:.9; }
.surah-card-top { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.surah-card-meta { color: var(--muted); font-size: 13px; }
.surah-rating { font-weight:800; color: var(--accent); white-space:nowrap; }
.mushaf-layout-editor { align-items:flex-start; }
.mushaf-stage { min-width:0; overflow:auto; }
.mushaf-viewport {
  position: relative;
  width: 100%;
  max-width: 456px;
  aspect-ratio: 456 / 707;
  margin-inline: auto;
  border-radius: 22px;
  overflow: hidden;
  background: #f6f1e5;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.mushaf-viewport.is-editable { touch-action: pinch-zoom; }
.mushaf-viewport.is-editable.is-interacting { touch-action: none; }
.mushaf-viewport.is-delete-mode .line-overlay { pointer-events: none; }
.mushaf-image {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  user-select:none;
  -webkit-user-drag:none;
}
.is-editable .mushaf-image { pointer-events:none; }
.line-overlay,
.annotation-layer {
  position:absolute;
  inset:0;
}
.line-overlay { z-index: 2; }
.annotation-layer { z-index: 3; pointer-events:none; }
.annotation-layer.show-repeats .annotation-badge { opacity: 1; transform: scale(1); }
.annotation-box {
  position:absolute;
  z-index:3;
  border:none;
  border-radius: 999px;
  box-sizing:border-box;
  pointer-events:auto;
  min-width: 18px;
  overflow: visible;
  cursor: pointer;
  touch-action: none;
  background: transparent;
}
.annotation-layer.delete-mode .annotation-box { box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.annotation-box::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(1.2px);
}
.annotation-box.red::before {
  background: radial-gradient(ellipse at center, rgba(239,68,68,.34) 0%, rgba(239,68,68,.22) 58%, rgba(239,68,68,.10) 78%, rgba(239,68,68,0) 100%);
}
.annotation-box.orange::before {
  background: radial-gradient(ellipse at center, rgba(245,158,11,.32) 0%, rgba(245,158,11,.22) 58%, rgba(245,158,11,.10) 78%, rgba(245,158,11,0) 100%);
}
.annotation-box.readonly { pointer-events:none; }
.annotation-box.selected { box-shadow: 0 0 0 1.5px rgba(255,255,255,.34); }
.annotation-box.deletable { box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.annotation-badge {
  position:absolute; top:-8px; right:-6px; min-width: 20px; height: 20px; display:grid; place-items:center;
  border-radius:999px; padding:0 5px; background: rgba(15,20,31,.92); color:#fff; font-size:10px; font-weight:700;
  opacity: 0; transform: scale(.92); transition: opacity .16s ease, transform .16s ease;
}
.annotation-grip.move {
  position:absolute; inset:0; cursor:grab;
}
.annotation-handle-hit {
  position:absolute; top:-5px; bottom:-5px; width: 20px; display:flex; align-items:center; justify-content:center;
}
.annotation-handle {
  position:relative; width: 7px; height: calc(100% - 10px); min-height: 18px; border-radius: 999px; background: rgba(255,255,255,.42);
  pointer-events:none;
}
.annotation-handle-hit.left { left:-10px; cursor: ew-resize; }
.annotation-handle-hit.right { right:-10px; cursor: ew-resize; }
.annotation-handle.left, .annotation-handle.right { left:auto; right:auto; cursor: inherit; }
.annotation-layer.readonly .annotation-badge { right:4px; top:4px; }
.side-stat { display:flex; justify-content:space-between; gap:12px; margin-top: 10px; }
.side-stat strong { font-size: 18px; }
.number-input, .select-input {
  padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text);
}
.page-chip {
  padding: 8px 12px; border-radius: 999px; border:1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text);
}
.session-grid { grid-template-columns: 56px 1fr 1fr 1fr 120px 150px 120px; }
.ranking-grid { grid-template-columns: 56px minmax(220px, 1.8fr) repeat(6, minmax(88px, .72fr)); }
.muted-banner { padding: 16px 20px; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); padding: 12px 16px; border-radius: 999px; background: rgba(15,20,31,.92); color:#fff; opacity:0; pointer-events:none; transition:opacity .18s ease; z-index:100; }
.toast.show { opacity:1; }
@media (max-width: 860px) {
  .mushaf-layout { grid-template-columns: 1fr; }
  .mushaf-side { order: 2; }
  .mushaf-stage { order: 1; }
  .session-grid { grid-template-columns: 1fr; }
  .bottom-tabs { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); width: calc(100% - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)); gap:6px; padding:8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .tab-btn { min-height:54px; }
  .tab-btn > :not(.tab-icon) { font-size:11px; }
}


.mushaf-topbar-wrap { margin-bottom: 10px; }
.mushaf-topbar {
  display:grid;
  gap:16px;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.2fr);
  align-items:stretch;
  margin-bottom: 20px;
}
.attempt-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(52, 211, 153, .36);
  background: linear-gradient(135deg, rgba(52, 211, 153, .14), rgba(59, 130, 246, .09));
  margin-bottom: 16px;
  position: sticky;
  top: 96px;
  z-index: 12;
  backdrop-filter: blur(3px);
}
.attempt-dock-main { display: grid; gap: 8px; min-width: 0; }
.attempt-dock-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attempt-collapse-btn { margin-inline-start: auto; min-height: 32px; padding: 6px 10px; }
.attempt-dock-body { display: grid; gap: 8px; }
.attempt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .55);
  animation: attemptPulse 1.8s infinite;
}
.attempt-student-label { color: var(--muted); font-size: 13px; }
.attempt-kpis { display: flex; gap: 8px; flex-wrap: wrap; }
.attempt-kpi {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(9, 15, 23, .42);
}
.attempt-kpi strong { font-size: 14px; margin-left: 4px; }
.attempt-kpi.good strong { color: #93c5fd; }
.attempt-kpi.warn strong { color: #fbbf24; }
.attempt-kpi.ok strong { color: #34d399; }
.attempt-coverage-list { display: flex; gap: 8px; flex-wrap: wrap; max-height: 68px; overflow: auto; padding-right: 4px; }
.attempt-chip {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  white-space: nowrap;
}
.attempt-chip.partial { border-color: rgba(245, 158, 11, .55); }
.attempt-chip.whole { border-color: rgba(52, 211, 153, .55); }
.attempt-dock-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, max-content);
  align-content: center;
}
.attempt-dock-actions .ghost-btn,
.attempt-dock-actions .primary-btn {
  min-height: 38px;
  padding: 8px 12px;
}
.compact-toggle {
  padding: 8px 10px;
  min-height: 38px;
}
.compact-toggle span { white-space: nowrap; }
.attempt-finalize-editor { display: grid; gap: 10px; max-height: 320px; overflow: auto; }
.modal-card-scrollable .attempt-finalize-editor { max-height: none; overflow: visible; }
.attempt-range-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.attempt-range-row .toolbar-inline { justify-content: space-between; align-items: center; }
.attempt-range-summary {
  display: grid;
  gap: 8px;
}
.attempt-surah-list {
  display: grid;
  gap: 8px;
}
.attempt-surah-segment {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.attempt-surah-title {
  font-weight: 700;
  line-height: 1.35;
}
.attempt-surah-title [lang='ar'] {
  unicode-bidi: plaintext;
}
.attempt-surah-meta {
  line-height: 1.35;
}
@keyframes attemptPulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.mushaf-top-card {
  display:grid;
  gap:12px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  min-width: 0;
}
.mushaf-top-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.mushaf-topbar-viewer {
  grid-template-columns: minmax(0, 1fr);
}
.mushaf-side-viewer {
  gap: 10px;
}
.mushaf-side-card {
  padding: 14px;
  border-radius: 16px;
}
.start-attempt-btn {
  width: 100%;
  min-height: 48px;
}
.mushaf-nav-inline { display:grid; grid-template-columns: 64px minmax(112px, 1fr) 64px; gap:10px; align-items:center; }
.mushaf-nav-btn { min-height: 46px; font-weight: 700; }
.mushaf-page-input { text-align: center; font-size: 14px; font-weight: 700; min-height: 46px; width: 100%; max-width: none; justify-self: stretch; }
.mushaf-nav-hint { margin: 0; }
.segmented-tools { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px; }
.segmented-tools-errors { grid-template-columns: 1fr; }
.mode-btn.active {
  background: rgba(124,193,199,.18);
  border-color: rgba(124,193,199,.5);
}
.segmented-tools-modes { grid-template-columns: 1fr; }
.mushaf-mode-stack .panel-sub { border-radius: 16px; }
.toolbar-vertical .tool-btn.active {
  background: rgba(201, 166, 107, .26);
  border-color: rgba(201, 166, 107, .55);
}
.toolbar-vertical .mode-btn.active[data-mode='delete'] {
  background: rgba(239, 68, 68, .2);
  border-color: rgba(239, 68, 68, .45);
}
.toolbar-vertical .mode-btn.active[data-mode='resolve'] {
  background: rgba(52, 211, 153, .2);
  border-color: rgba(52, 211, 153, .45);
}
.toggle-row {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line);
}
.toggle-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.line-overlay.is-delete-mode { opacity: .18; }
.line-overlay.is-passive {
  pointer-events: none;
}
.line-overlay.is-hover-only {
  pointer-events: auto;
}
.line-overlay.is-hover-only .line-band {
  cursor: default;
}
.line-overlay.is-passive .line-band::after {
  background: transparent !important;
}
.is-hidden { display: none !important; }
@media (max-width: 860px) {
  .mushaf-topbar { grid-template-columns: 1fr; }
  .attempt-dock {
    position: static;
    grid-template-columns: 1fr;
  }
  .attempt-dock-actions {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  .attempt-collapse-btn { margin-inline-start: 0; }
}
@media (max-width: 720px) {
  .mushaf-top-card { padding: 14px; }
  .mushaf-side-viewer { margin-top: 8px; }
  .start-attempt-btn { min-height: 54px; font-size: 16px; }
  .mushaf-nav-inline { grid-template-columns: minmax(78px, auto) minmax(0,1fr) minmax(78px, auto); }
  .mushaf-nav-btn, .mushaf-page-input { min-height: 50px; }
  .mushaf-page-input { font-size: 13px; }
  .segmented-tools { grid-template-columns: 1fr; }
  .attempt-kpis { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .attempt-kpi { width: 100%; }
  .attempt-dock-actions { grid-template-columns: 1fr; }
  .attempt-range-grid { grid-template-columns: 1fr; }
  .student-learned-grid { grid-template-columns: 1fr 1fr; }
}


.student-controls-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}

.playful-card {
  position: relative;
  overflow: hidden;
}

.playful-card::after {
  content: '';
  position: absolute;
  inset: auto -10% -45% auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  opacity: .18;
  pointer-events: none;
}

.card-stars::after {
  background: radial-gradient(circle, rgba(201,166,107,.95), transparent 70%);
}

.card-sun::after {
  background: radial-gradient(circle, rgba(124,193,199,.9), transparent 70%);
}

.card-wave::after {
  background: radial-gradient(circle, rgba(96,165,250,.85), transparent 70%);
}

.card-heart::after {
  background: radial-gradient(circle, rgba(244,114,182,.8), transparent 70%);
}

.stat-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  max-width: 24ch;
}

.ranking-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.ranking-row-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: rgba(255,255,255,.03);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

.ranking-row-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(201,166,107,.45);
  background: rgba(255,255,255,.07);
}

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

.kpi-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}

.kpi-card span {
  font-size: 12px;
  color: var(--muted);
}

.kpi-card strong {
  font-size: 26px;
  line-height: 1.05;
}

.kpi-card.kpi-primary {
  background: linear-gradient(180deg, rgba(124,193,199,.2), rgba(201,166,107,.18));
}

.kpi-card.kpi-warning {
  background: linear-gradient(180deg, rgba(239,68,68,.2), rgba(245,158,11,.18));
}

.student-mushaf-topbar {
  grid-template-columns: minmax(220px, .9fr) minmax(240px, 1.1fr);
}

.mushaf-arrow-btn {
  font-size: 20px;
  line-height: 1;
  padding-inline: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#adminStudentDetail {
  display: grid;
  gap: 14px;
}

.teacher-actions-summary .section-head {
  align-items: center;
}

.student-learned-panel .toolbar-inline > * {
  flex: 0 1 auto;
}

.detail-hero-student {
  align-items: flex-start;
}

.compact-badges {
  justify-content: flex-end;
}

.student-detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: start;
}

.page-summary-card {
  display: grid;
  gap: 10px;
}

.page-summary-grid {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}

.page-summary-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-summary-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.page-summary-density {
  font-size: 15px;
  font-weight: 700;
}

.page-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-summary-pill {
  min-width: 100px;
  flex: 1 1 110px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}

.page-summary-pill span {
  color: var(--muted);
  font-size: 12px;
}

.page-summary-pill strong {
  font-size: 18px;
}

.page-summary-empty {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  white-space: nowrap;
}

.star-rating.subtle {
  gap: 1px;
}

.star {
  position: relative;
  font-size: 16px;
  line-height: 1;
  color: rgba(255,255,255,.16);
}

.star.full {
  color: var(--accent);
}

.star.half {
  color: rgba(255,255,255,.16);
}

.star.half::before {
  content: '★';
  position: absolute;
  inset: 0 auto 0 0;
  width: 52%;
  overflow: hidden;
  color: var(--accent);
}

.star-rating-value {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

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

.annotation-box.resolved {
  opacity: .48;
  filter: saturate(.65);
}

.surah-accordion-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.surah-accordion {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  overflow: hidden;
}

.surah-accordion summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.surah-accordion-summary {
  display: grid;
  gap: 4px;
}

.surah-accordion summary::-webkit-details-marker {
  display: none;
}

.surah-accordion-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

@media (max-width: 860px) {
  .student-mushaf-topbar,
  .student-detail-grid {
    grid-template-columns: 1fr;
  }

  .compact-badges {
    justify-content: flex-start;
  }
}

.learned-form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.student-learned-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.learned-mode-field { min-width: min(320px, 100%); }
.wrap-toolbar { flex-wrap: wrap; }

.student-learned-panel #studentLearnedList .ghost-btn {
  justify-content: flex-start;
  text-align: left;
  font-size: 12px;
}

.learned-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.learned-field .number-input {
  max-width: none;
  width: 100%;
}

.learned-surah-choices {
  display: grid;
  gap: 6px;
}

.learned-choice,
.learned-choice-single {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-size: 13px;
}

.learned-choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.learned-segment-list .ghost-btn {
  justify-content: flex-start;
  text-align: left;
  font-size: 12px;
}

.line-band { position:absolute; border:none; background:rgba(255,255,255,0.01); }

.line-band { position:absolute; background:transparent; border:none; padding:0; margin:0; touch-action:manipulation; }
.line-band::after { content:""; position:absolute; inset:0; border-radius:14px; background:transparent; transition:background .16s ease; }
.line-band:hover::after, .line-band:focus-visible::after { background:rgba(255,255,255,.06); }
.line-overlay.is-hover-only .line-band:hover::after,
.line-overlay.is-hover-only .line-band:focus-visible::after {
  background: rgba(124,193,199,.16);
}

@media (max-width: 720px) {
  .learned-form-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Furqan UI polish layer --- */
#rankingSummary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (min-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.summary-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.summary-card::after {
  content: '';
  position: absolute;
  inset: auto -14% -48% auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  opacity: .16;
  pointer-events: none;
}
.summary-card-gold::after { background: radial-gradient(circle, rgba(201,166,107,.95), transparent 70%); }
.summary-card-blue::after { background: radial-gradient(circle, rgba(124,193,199,.92), transparent 70%); }
.summary-card-rose::after { background: radial-gradient(circle, rgba(244,114,182,.88), transparent 70%); }
.summary-card-compact { text-align: left; color: var(--text); cursor: pointer; }
.summary-card-compact:hover { transform: translateY(-1px); border-color: rgba(201,166,107,.45); }
.summary-card-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.podium-rank-label {
  color: var(--text);
  font-weight: 800;
  font-size: clamp(21px, 1.8vw, 30px);
  line-height: 1.1;
  text-transform: none;
  letter-spacing: normal;
}
.summary-card-value { font-size: clamp(22px, 2vw, 30px); font-weight: 800; }
.summary-card-note { color: var(--muted); font-size: 13px; line-height: 1.35; }
.podium-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "second first third";
  align-items: end;
}
.podium-card {
  min-height: 178px;
}
.podium-first {
  grid-area: first;
  min-height: 214px;
  transform: translateY(-12px);
  border-color: rgba(201,166,107,.5);
  box-shadow: 0 18px 40px rgba(201,166,107,.18);
}
.podium-second,
.podium-third {
  min-height: 188px;
}
.podium-second { grid-area: second; }
.podium-third { grid-area: third; }
.podium-slot-empty {
  min-height: 1px;
}
.podium-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.podium-metrics span {
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
}
.podium-metrics strong {
  font-size: 15px;
  line-height: 1;
}
.podium-metrics small {
  font-size: 11px;
  color: var(--muted);
}

.student-card {
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  box-shadow: var(--shadow);
}
.student-card:hover { transform: translateY(-1px); border-color: rgba(201,166,107,.45); }
.student-card-highlight {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.student-card-highlight > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
}
.student-highlight-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.student-card-highlight strong {
  font-size: 20px;
  line-height: 1.05;
}
.student-card-highlight small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}
.student-card-meta-compact {
  display: flex;
  flex-wrap: wrap;
  overflow-x: hidden;
  gap: 8px;
  margin-top: 12px;
  padding-bottom: 2px;
}
.student-card-meta-compact span {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
  white-space: nowrap;
}
.ranking-card-highlight { margin-top: 0; }
.kpi-sub { display:block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.metric-bar {
  margin-top: 10px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.metric-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(124,193,199,.88), rgba(201,166,107,.9));
}
.metric-bar.warning > span {
  background: linear-gradient(90deg, rgba(239,68,68,.82), rgba(245,158,11,.88));
}

.table-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

#rankingTable {
  gap: 12px;
  display: grid;
}
.ranking-grid {
  grid-template-columns: 52px minmax(0, 2fr) repeat(6, minmax(0, .75fr));
}
.ranking-row-btn {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}
.ranking-row-btn strong,
.ranking-row-btn .ranking-name-cell {
  font-weight: 800;
}
.ranking-place-number {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(26px, 2.2vw, 34px);
  line-height: 1;
  font-weight: 800;
  color: var(--accent);
  min-width: 38px;
}
.ranking-place-mobile {
  margin-left: auto;
  min-width: 34px;
  font-size: 28px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
}
.kpi-card::after {
  content: '';
  position: absolute;
  inset: auto -12% -48% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: .16;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.75), transparent 70%);
}
.kpi-card strong {
  font-size: clamp(24px, 2.8vw, 34px);
}
@media (min-width: 1080px) {
  .tab-panel[data-panel='student'] .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    align-items: stretch;
  }

  .tab-panel[data-panel='student'] .kpi-grid .kpi-card {
    height: 100%;
  }
}
.detail-hero-strong {
  gap: 16px;
  align-items: flex-start;
}

#rankingSummary {
  margin-bottom: 16px;
}

.ranking-name-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-controls-card .toolbar-inline,
.student-controls-card {
  align-items: center;
}

.mushaf-nav-card .mushaf-nav-inline {
  width: min(100%, 360px);
  margin-inline: auto;
}
.mushaf-nav-card .mushaf-page-input {
  justify-self: center;
}
.mushaf-surah-select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.mushaf-stage {
  overflow: visible;
}

.surah-card {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
}
.surah-card.ok {
  background: linear-gradient(180deg, rgba(52,211,153,.14), rgba(255,255,255,.03));
}
.surah-card.repeat {
  background: linear-gradient(180deg, rgba(245,158,11,.18), rgba(255,255,255,.03));
}
.surah-card.idle {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}
.surah-card .toolbar-inline .ghost-btn { flex: 1 1 auto; }

.page-summary-grid {
  box-shadow: var(--shadow);
}
.page-summary-main .star-rating {
  align-self: center;
}

.learned-box {
  border: 1px solid rgba(52, 211, 153, .55);
  background: linear-gradient(180deg, rgba(52,211,153,.12), rgba(52,211,153,.06));
  box-shadow: 0 8px 24px rgba(16, 185, 129, .14);
}

.annotation-box::before {
  inset: -2px;
  filter: blur(1.6px);
}

@media (max-width: 860px) {
  #rankingSummary,
  .podium-grid {
    grid-template-columns: 1fr;
  }
  .podium-first {
    transform: none;
  }
  .podium-card,
  .podium-first,
  .podium-second,
  .podium-third {
    min-height: 0;
  }

  .student-card-highlight {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ranking-grid {
    grid-template-columns: 48px minmax(0, 1.6fr) repeat(6, minmax(0, .72fr));
  }
}


.admin-hero-card {
  align-items: center;
}

.mushaf-nav-card .mushaf-nav-inline {
  width: min(100%, 360px);
  margin-inline: auto;
}
.mushaf-nav-card .mushaf-page-input {
  justify-self: center;
}

@media (max-width: 720px) {
  .line-correspondence-row {
    grid-template-columns: 1fr;
  }
  .brand-logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-basis: 44px;
  }

  .admin-date-dock {
    padding: 16px;
  }

  .admin-date-dock .toolbar-inline {
    align-items: stretch;
  }

  .podium-rank-label {
    font-size: 20px;
  }
}

@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  #adminOverview.stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #overviewCards .overview-accordion,
  #overviewCards .stat-card {
    grid-column: 1 / -1;
  }
  .kpi-grid,
  .error-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .stats-grid > .stat-card {
    min-height: 0;
    padding: 12px;
  }
  .stats-grid > .stat-card.stat-span-2 { grid-column: span 2; }
  .stat-label {
    font-size: 12px;
    line-height: 1.2;
  }
  .stat-value {
    margin-top: 8px;
    font-size: 22px;
  }
  .stat-note {
    display: none;
  }
  .kpi-card {
    padding: 10px 10px;
    gap: 4px;
  }
  .kpi-card strong {
    font-size: 20px;
  }
  .kpi-sub {
    display: none;
  }
  .student-card-highlight > div { padding: 10px 8px; }
  .student-card-highlight strong { font-size: 18px; }
  .student-card-highlight small { font-size: 10px; }
  .student-card-meta-compact { gap: 6px; }
  .student-card-meta-compact span { padding: 5px 8px; font-size: 12px; }
  .stat-card { box-shadow: 0 12px 24px rgba(8,12,20,.18); }
  .ranking-place-number {
    font-size: 24px;
  }
  .podium-metrics {
    gap: 6px;
  }
}

.mushaf-quick-tools {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 88px));
  width: min(720px, calc(100% - 26px));
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(15,20,31,.78);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  animation: quickToolsIn .18s ease;
}
html[data-theme='light'] .mushaf-quick-tools {
  background: rgba(255,255,255,.82);
}
@media (min-width: 721px) {
  .mushaf-quick-tools {
    display: none !important;
  }
}
.quick-tool-btn {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 12px;
  min-height: clamp(40px, 7.8vw, 46px);
  font-size: clamp(10px, 2.5vw, 11px);
  font-weight: 700;
  cursor: pointer;
  line-height: 1.1;
}
.quick-tool-btn span {
  font-size: clamp(13px, 3.7vw, 16px);
}
.quick-tool-btn small {
  font-size: clamp(9px, 2.6vw, 11px);
  font-weight: 700;
}
.quick-tool-btn.active {
  background: rgba(201,166,107,.24);
  border-color: rgba(201,166,107,.5);
}
.quick-tools-toggle {
  display: none;
}
@keyframes quickToolsIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@media (max-width: 720px) {
  .quick-tools-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
  }
  .mushaf-quick-tools {
    width: calc(100% - 18px);
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 84px));
    gap: 6px;
    padding: 7px;
  }
  .quick-tool-btn {
    min-height: 42px;
  }
  .quick-tool-btn span {
    font-size: 14px;
  }
  .quick-tool-btn small {
    font-size: 10px;
  }
}

@media (max-width: 720px) {
  .overview-cards-student {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .overview-cards-public {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .modal-card-scrollable {
    max-height: calc(100dvh - 18px);
  }
  .modal-scroll-body {
    padding-right: 0;
  }
  .modal-card-footer {
    padding-top: 10px;
  }
  .overview-accordion > summary {
    align-items: flex-start;
    padding: 15px 14px;
    gap: 10px;
  }
  .overview-accordion-topline {
    gap: 7px;
  }
  .overview-accordion-value {
    font-size: 28px;
  }
  .overview-accordion-note {
    display: block;
    font-size: 12px;
    line-height: 1.45;
    max-width: none;
  }
  .accordion-hint {
    min-width: 44px;
    min-height: 38px;
    padding: 5px 7px;
    font-size: 10px;
  }
  .accordion-hint strong {
    font-size: 18px;
    line-height: 1;
  }
  .overview-accordion-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 14px 14px;
    gap: 9px;
  }
  .overview-detail-row {
    padding: 12px;
    gap: 7px;
  }
  .overview-detail-label {
    font-size: 12px;
  }
  .overview-detail-value {
    font-size: 18px;
  }
}


@media (min-width: 721px) and (max-width: 1024px) {
  .overview-cards-student {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .attempt-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  }
}


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

.ranking-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.ranking-filter span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ranking-filter .select-input {
  min-width: 240px;
}

.ranking-current-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ranking-current-hint strong {
  color: var(--text);
}

@media (max-width: 720px) {
  .ranking-toolbar {
    justify-content: stretch;
  }

  .ranking-filter {
    width: 100%;
    flex-wrap: wrap;
  }
  .ranking-filter .select-input {
    min-width: 0;
    width: 100%;
  }

  .ranking-current-hint {
    margin-bottom: 10px;
    font-size: 12px;
    width: 100%;
  }
}


.attempt-page-shell {
  padding-bottom: 48px;
}
.attempt-header-hidden .topbar {
  display: none;
}
.attempt-header-hidden .attempt-page-shell {
  padding-top: 10px;
}
.attempt-page-shell .app-footer { display: none; }
.attempt-app { gap: 16px; }
.attempt-hero-card { align-items: center; }
.attempt-toolbar-shell { display: grid; gap: 16px; }
.attempt-back-link .attempt-back-short { display: none; }
.attempt-shell-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.attempt-shell-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.attempt-status-student { font-weight: 700; color: var(--text); }
.attempt-status-card {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(52, 211, 153, .3);
  background: linear-gradient(135deg, rgba(52, 211, 153, .12), rgba(59, 130, 246, .08));
}
.attempt-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.attempt-shell-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mushaf-review-topbar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mushaf-review-topbar .mushaf-nav-card { align-content: start; }
.mushaf-review-topbar .primary-btn { width: 100%; }
.attempt-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}
.attempt-side-panel {
  display: grid;
  gap: 12px;
  top: 96px;
  align-content: start;
}
.attempt-side-group {
  display: grid;
  gap: 10px;
}
.attempt-action-group {
  justify-items: stretch;
}
.attempt-side-card {
  padding: 14px;
  border-radius: 16px;
}
.attempt-actions-card .primary-btn,
.attempt-actions-card .ghost-btn {
  width: 100%;
}
.attempt-action-group .desktop-tool-stack {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
}
.attempt-action-group .segmented-tools {
  width: 100%;
}
.attempt-action-group .toggle-row {
  min-height: 42px;
}
.attempt-status-stats {
  display: grid;
  gap: 10px;
}
.attempt-range-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.attempt-quick-tools {
  display: none;
}
.attempt-result-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.attempt-result-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  display: grid;
  gap: 4px;
}
.attempt-result-item span {
  color: var(--muted);
  font-size: 12px;
}
.attempt-result-item.metric { min-height: 88px; }
.attempt-result-surahs-block {
  align-content: start;
  gap: 10px;
}
.attempt-result-surahs {
  display: grid;
  gap: 8px;
}
.attempt-result-surah-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.attempt-result-surah-number {
  font-weight: 700;
  color: var(--muted);
}
.attempt-result-surah-name {
  font-weight: 700;
  line-height: 1.35;
  unicode-bidi: plaintext;
}
.readonly {
  pointer-events: none;
}
.annotation-layer.readonly {
  pointer-events: none;
}
#adminPageSummary,
#attemptPageSummary {
  display: grid;
}
@media (min-width: 981px) {
  .attempt-side-panel {
    align-items: center;
  }
  .attempt-side-panel > * {
    width: min(100%, 318px);
  }
}
@media (max-width: 980px) {
  .attempt-shell-head,
  .attempt-layout,
  .mushaf-review-topbar {
    grid-template-columns: 1fr;
  }
  .attempt-side-panel {
    position: static;
  }
}
@media (max-width: 720px) {
  .attempt-page-shell {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }
  .attempt-back-link .attempt-back-full { display: none; }
  .attempt-back-link .attempt-back-short { display: inline; }
  .attempt-quick-tools {
    display: grid;
    width: min(470px, var(--attempt-quick-tools-viewport-width, calc(100% - 12px)));
    gap: 6px;
    padding: 7px 8px;
    bottom: max(6px, calc(env(safe-area-inset-bottom) + 6px));
    left: var(--attempt-quick-tools-center, 50%);
    right: auto;
    transform: translateX(-50%);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: var(--attempt-quick-tools-bottom-shift, 0px);
  }
  .attempt-quick-tools .quick-tool-btn {
    min-height: clamp(40px, 10.5vw, 46px);
    padding: clamp(3px, 0.9vw, 4px) clamp(2px, 1vw, 4px);
    font-size: calc(clamp(10px, 2.8vw, 11px) * var(--attempt-quick-tools-scale, 1));
  }
  .attempt-quick-tools .quick-tool-btn span {
    font-size: calc(clamp(12px, 3.8vw, 15px) * var(--attempt-quick-tools-scale, 1));
  }
  .attempt-quick-tools .quick-tool-btn small {
    font-size: calc(clamp(8px, 2.7vw, 10px) * var(--attempt-quick-tools-scale, 1));
  }
  .desktop-tool-stack {
    display: none;
  }
  .attempt-side-panel .mushaf-nav-card {
    order: 1;
  }
  .attempt-side-panel .attempt-action-group {
    order: 2;
  }
  .attempt-side-panel .attempt-status-stats {
    order: 3;
  }
  .attempt-side-panel #attemptPageSummary {
    order: 4;
  }
  .attempt-shell-head {
    gap: 10px;
  }
  .attempt-shell-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .attempt-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .student-learned-grid {
    grid-template-columns: 1fr;
  }
  .attempt-range-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (hover: none) and (pointer: coarse) and (min-width: 721px) and (max-width: 1024px) {
  .attempt-page-shell {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }
  .attempt-quick-tools {
    display: grid !important;
    width: min(470px, var(--attempt-quick-tools-viewport-width, calc(100% - 20px)));
    gap: 6px;
    padding: 7px 8px;
    bottom: max(8px, calc(env(safe-area-inset-bottom) + 8px));
    left: var(--attempt-quick-tools-center, 50%);
    right: auto;
    transform: translateX(-50%);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: var(--attempt-quick-tools-bottom-shift, 0px);
  }
  .attempt-quick-tools .quick-tool-btn {
    min-height: clamp(40px, 8.6vw, 46px);
    padding: clamp(3px, 0.9vw, 4px) clamp(2px, 1vw, 4px);
    font-size: calc(clamp(10px, 2.2vw, 11px) * var(--attempt-quick-tools-scale, 1));
  }
  .attempt-quick-tools .quick-tool-btn span {
    font-size: calc(clamp(12px, 3vw, 15px) * var(--attempt-quick-tools-scale, 1));
  }
  .attempt-quick-tools .quick-tool-btn small {
    font-size: calc(clamp(8px, 2.2vw, 10px) * var(--attempt-quick-tools-scale, 1));
  }
  .desktop-tool-stack {
    display: none;
  }
}

.attempt-link-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;margin:14px 0;}

.teacher-grid{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:12px;align-items:center}
@media (max-width:760px){.teacher-grid{grid-template-columns:1fr;}}


.ayah-hotspot {
  position: absolute;
  display: block;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 14px;
  touch-action: none;
  pointer-events: auto;
}
.ayah-hotspot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(124,193,199,.04);
  border: 1px dashed rgba(124,193,199,.18);
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.ayah-hotspot:hover::before,
.ayah-hotspot:focus-visible::before {
  background: rgba(124,193,199,.08);
  border-color: rgba(124,193,199,.35);
}
.ayah-hotspot.selected::before {
  background: rgba(201,166,107,.10);
  border-color: rgba(201,166,107,.55);
  box-shadow: inset 0 0 0 1px rgba(201,166,107,.28);
}
.ayah-hotspot-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  min-width: 22px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(15,20,31,.88);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.ayah-summary-card {
  display: grid;
  gap: 6px;
}
.ayah-summary-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.ayah-summary-text {
  line-height: 1.6;
  color: var(--text);
}
.annotation-box.pending {
  opacity: .92;
}
.annotation-box.pending::before {
  filter: blur(0.8px);
}

/* --- Furqan auth / landing refresh --- */
.landing-screen .page-shell {
  padding-top: 18px;
}
.marketing-hero {
  align-items: center;
  gap: 24px;
  overflow: hidden;
}
.landing-copy {
  flex: 1 1 420px;
  min-width: 0;
}
.lead-text {
  max-width: 720px;
  font-size: 17px;
  line-height: 1.65;
}
.landing-visual {
  flex: 0 1 360px;
  display: grid;
  gap: 14px;
  min-width: min(100%, 320px);
}
.floating-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: rgba(255,255,255,.72);
}
.soft-accent-card {
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(240,248,255,.9));
}
.warm-accent-card {
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,247,236,.94));
}
.floating-title {
  font-weight: 800;
  margin-bottom: 10px;
}
.feature-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}
.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.step-list {
  display: grid;
  gap: 14px;
}
.step-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
}
.step-num {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(201,166,107,.16);
  color: #8f6120;
  font-weight: 800;
}
.support-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.compact-btn {
  padding: 10px 14px;
}
.full-width {
  width: 100%;
  display: inline-flex;
  justify-content: center;
}
.auth-panel-wide {
  max-width: 620px;
}
.auth-info-list {
  display: grid;
  gap: 10px;
}
.auth-info-row {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.6);
}
.copy-field {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(201,166,107,.55);
  background: rgba(255,255,255,.62);
  word-break: break-all;
  font-size: 14px;
  line-height: 1.45;
}
.teacher-circle-grid {
  display: grid;
  gap: 18px;
}
.responsive-table {
  overflow-x: auto;
}
.table-like th,
.table-like td {
  white-space: nowrap;
}
.stack-gap-md {
  display: grid;
  gap: 14px;
}
.stack-gap-sm {
  display: grid;
  gap: 10px;
}
#teacherManagementPanel[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
  .marketing-hero {
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding-inline: 12px;
  }
  .panel, .hero-card {
    padding: 16px;
    border-radius: 20px;
  }
  .topbar {
    padding-inline: 12px;
  }
  .brand-logo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    flex-basis: 42px;
  }
  .brand-subtitle {
    display: none;
  }
  .compact-btn {
    padding: 9px 12px;
    font-size: 14px;
  }
  .cta-stack,
  .support-links,
  .toolbar-inline {
    width: 100%;
  }
  .cta-stack .primary-btn,
  .cta-stack .ghost-btn,
  .support-links .ghost-btn,
  .toolbar-inline .ghost-btn,
  .toolbar-inline .primary-btn {
    width: 100%;
    justify-content: center;
  }
  .auth-shell {
    width: min(100%, 100%);
  }
  .copy-field {
    font-size: 13px;
  }
  .bottom-tabs {
    gap: 6px;
    padding-inline: 8px;
  }
  .tab-btn {
    font-size: 12px;
  }
}


.landing-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.landing-stat-card, .history-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
}
.landing-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.landing-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}
.circle-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.history-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.circle-context-card:empty::before,
#studentHistoryList:empty::before {
  content: 'Загрузка…';
  color: var(--muted);
}
@media (max-width: 720px) {
  .landing-stat-card strong { font-size: 20px; }
  .history-card-head { align-items: flex-start; flex-direction: column; }
}

.auth-two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.divider-or {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 14px 0;
}

.circle-switch-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.circle-switch-card {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.circle-switch-card.active {
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 14px 34px rgba(14, 165, 233, 0.16);
}

.circle-switch-card span {
  font-size: 13px;
  color: #64748b;
}

.teacher-stat-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.teacher-stat-accordion summary {
  list-style: none;
}

.teacher-stat-accordion summary::-webkit-details-marker {
  display: none;
}

.circle-period-btn.active {
  background: rgba(201, 166, 107, 0.18);
  border-color: rgba(201, 166, 107, 0.4);
}

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

.analytics-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.94));
}

.analytics-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.analytics-card-head strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
  color: #0f172a;
}

.analytics-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 130px;
  margin-top: 18px;
}

.analytics-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.analytics-bar-col small {
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0.01em;
}

.analytics-bar-track {
  width: 100%;
  min-width: 16px;
  height: 96px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.75);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.analytics-bar-fill {
  display: block;
  width: 100%;
  border-radius: 999px;
  min-height: 4px;
}

.analytics-bar-fill.accent { background: linear-gradient(180deg, #38bdf8, #0ea5e9); }
.analytics-bar-fill.warning { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.analytics-bar-fill.danger { background: linear-gradient(180deg, #fb7185, #ef4444); }

.analytics-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.analytics-list-row {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.analytics-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.analytics-list-head strong {
  font-size: 14px;
  color: #0f172a;
}

.analytics-list-head span {
  font-size: 13px;
  color: #334155;
}

.analytics-segmented {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.8);
}

.analytics-segmented > span { display: block; height: 100%; }
.analytics-segmented > .accent { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.analytics-segmented > .warning { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.analytics-segmented > .danger { background: linear-gradient(90deg, #fb7185, #ef4444); }

.analytics-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.teacher-circle-grid .analytics-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (max-width: 720px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .analytics-bars {
    min-height: 112px;
    gap: 6px;
  }
  .analytics-bar-track {
    height: 84px;
  }
}

.analytics-line-wrap {
  position: relative;
  margin: 12px 0 4px;
  padding: 4px 0 8px;
}

.analytics-line-chart {
  width: 100%;
  height: 88px;
  display: block;
}

.analytics-line-area {
  fill: rgba(14, 165, 233, 0.12);
}

.analytics-line-chart.warning .analytics-line-area { fill: rgba(245, 158, 11, 0.14); }
.analytics-line-chart.danger .analytics-line-area { fill: rgba(239, 68, 68, 0.12); }
.analytics-line-stroke {
  fill: none;
  stroke: #0ea5e9;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.analytics-line-chart.warning .analytics-line-stroke { stroke: #f59e0b; }
.analytics-line-chart.danger .analytics-line-stroke { stroke: #ef4444; }
.analytics-head-meta {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.rich-history-card .page-chip { margin-right: 6px; }
.compact-select { min-width: 150px; }
.badge.subtle { background: rgba(15, 23, 42, 0.06); color: #334155; }
.badge-muted { background: rgba(100,116,139,.12); color: #64748b; }


.analytics-canvas-wrap {
  position: relative;
  min-height: 214px;
  margin: 14px 0 6px;
  border-radius: 22px;
  padding: 8px 10px 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.84), rgba(248,250,252,0.72));
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.analytics-canvas {
  width: 100% !important;
  height: 196px !important;
  display: block;
}

.analytics-chart-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.analytics-mini-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.analytics-mini-stat strong {
  font-size: 11px;
  line-height: 1.2;
  color: #475569;
  font-weight: 600;
}

.analytics-mini-stat small {
  font-size: 12px;
  color: #0f172a;
}

.js-chart-holder.chart-fallback {
  background: transparent;
  border: 0;
  padding: 0;
}

@media (max-width: 720px) {
  .analytics-canvas-wrap {
    min-height: 192px;
    padding: 4px 4px 0;
  }

  .analytics-canvas {
    height: 168px !important;
  }

  .analytics-chart-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
