/*
 * The teacher portal and the public pages: Khlel's layout (docs/02-khlel-reference.md §1) in Al-Maher's plum, for a phone first.
 */
:root {
    --heading: 'Cairo', 'IBM Plex Sans Arabic', sans-serif;
    /* Staff screens (the teacher portal): numbers in IBM Plex Mono. The student's and guardian's pages keep the text font. */
    --numbers: 'IBM Plex Mono', 'IBM Plex Sans Arabic', monospace;
    --ink: #4A2839; --ink-d: #683B50; --page: #F6F4F2; --card: #fff; --line: #E4DFDC; --muted: #8a7f85; --text: #241B20;
    --hifz: #683B50; --tathbit: #A87A93; --muraja: #A7A189; --accent: #8A6516; --danger: #911B1D;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-variant-numeric: tabular-nums; background: var(--page); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

/* Sign-in, as Khlel's «تسجيل الدخول كمعلم حلقة» */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: #fff; }
.auth-box { width: 100%; max-width: 360px; }
.auth-mark { font-size: 40px; font-weight: 700; color: var(--ink-d); text-align: center; margin-bottom: 8px; }
.auth h1 { font-size: 20px; margin: 0 0 24px; text-align: center; }
.auth h1 mark { background: #ece9e4; color: inherit; padding: 2px 8px; border-radius: 6px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; }
.input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: #fff; }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--ink-d); color: #fff; font-weight: 500; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-light { background: #f1efeb; color: var(--text); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: .45; cursor: default; }
.error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* The day */
.bar { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar b { font-size: 16px; }
.bar small { opacity: .75; display: block; font-size: 12px; }
.bar .btn-sm { background: rgb(255 255 255 / .14); }
.wrap { max-width: 760px; margin: 0 auto; padding: 14px 16px 90px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.card { background: var(--card); border-radius: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .05); padding: 14px; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.select { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }
.daynav { display: flex; align-items: center; gap: 8px; }
.daynav .label { text-align: center; min-width: 150px; }
.daynav .label b { display: block; font-size: 14px; }
.notice { background: #fdf0e6; color: #8a4a1f; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.flash { background: #ecf5ee; color: #2f6b3d; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

/* Khlel's cards: title, target / done, a coloured percentage */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border-radius: 12px; padding: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.kpi .t { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 15px; direction: ltr; text-align: right; }
.kpi .p { font-size: 22px; font-weight: 500; direction: ltr; text-align: left; }

/* Students */
.students { display: flex; flex-direction: column; gap: 8px; }
.st { background: var(--card); border-radius: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .05); overflow: hidden; }
.st-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.st-name { flex: 1; min-width: 0; background: none; border: 0; text-align: start; padding: 0; cursor: pointer; }
.st-name b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-name span { font-size: 12px; color: var(--muted); }
.chips { display: flex; gap: 4px; }
.chip { min-width: 40px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12px; cursor: pointer; padding: 0 6px; }
.chip.on { color: #fff; border-color: transparent; }
.dots { display: flex; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #e7e4de; }
.st-body { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 12px; }
.track { border-inline-start: 4px solid; padding-inline-start: 10px; }
.track-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.track-h b { font-size: 14px; }
.grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 6px; align-items: end; }
.grid label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 2px; }
.grid .input { height: 40px; padding: 0 8px; }
.saved { font-size: 12px; color: #2f6b3d; }
.bulk { position: fixed; bottom: 0; inset-inline: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: center; z-index: 10; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Fonts: headings in Cairo; in the teacher portal, numbers in IBM Plex Mono. */
h1, h2, h3, .bar b, .auth-mark { font-family: var(--heading); }
.staff .kpi .v, .staff .kpi .p, .staff .grid .input, .staff .chip { font-family: var(--numbers); }

/* The student's record (public): Khlel's screenshots 2, 5 and 6. Numbers in the text font, tabular. */
.record { background: #fff; min-height: 100dvh; }
.rec-head { text-align: center; padding: 18px 16px 6px; }
.rec-head h1 { font-size: 26px; margin: 10px 0 2px; color: var(--ink-d); }
.rec-head h2 { font-size: 16px; margin: 0 0 4px; font-family: inherit; font-weight: 600; }
.rec-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pill { border: 0; border-radius: 999px; padding: 7px 16px; background: var(--ink-d); color: #fff; font-size: 13px; cursor: pointer; }
.pill.on { background: var(--hifz); }
.weeks { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 12px; justify-content: center; flex-wrap: wrap; }
.wk { min-width: 44px; height: 30px; border-radius: 999px; border: 1px solid var(--muted); background: #fff; cursor: pointer; }
.wk.on { background: var(--hifz); border-color: var(--hifz); color: #fff; }
.target { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.target b { display: inline-block; min-width: 22px; text-align: center; color: #fff; border-radius: 999px; margin-inline-end: 6px; padding: 0 6px; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rec-table th { color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.rec-table td { padding: 8px 6px; border-bottom: 1px solid #f1efeb; text-align: center; }
.rec-table td:first-child, .rec-table th:first-child { text-align: start; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; color: var(--ink-d); }
.kpis .kpi .v, .kpis .kpi .p { font-family: inherit; }
.map-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #f1efeb; }
.map-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: none; }
.surah { font-size: 17px; }
.surah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.surah-box { background: #F6F4F2; border-radius: 8px; padding: 10px 6px; text-align: center; font-size: 13px; }
.child { display: block; text-decoration: none; color: inherit; }
/* One width for every section of the public pages: the main site's max-w-7xl px-4 sm:px-6 lg:px-8. Wide content spreads
   into columns rather than narrowing the box. The teacher's day keeps its narrow .wrap. */
.record .wrap { max-width: 80rem; padding-inline: 16px; }
@media (min-width: 640px) { .record .wrap { padding-inline: 24px; } }
@media (min-width: 1024px) { .record .wrap { padding-inline: 32px; } }
.children { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); align-items: start; }
.children .card { margin-bottom: 0; }
.map-card { columns: 300px 3; column-gap: 32px; }
.map-card > p, .map-card > .empty { column-span: all; }
.map-card .map-item { break-inside: avoid; }
.child:hover { box-shadow: 0 2px 8px rgb(0 0 0 / .08); }

/* The mosque screen («البث المباشر»): large, dark, readable from across the room. */
.tv { min-height: 100dvh; background: #241B20; color: #F6F4F2; padding: 3vh 4vw; font-size: 2.2vh; }
.tv-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgb(255 255 255 / .15); padding-bottom: 2vh; margin-bottom: 2vh; }
.tv-center { font-family: var(--heading); font-size: 5vh; font-weight: 700; }
.tv-sub { color: #CFB0C0; font-size: 3vh; }
.tv-clock { text-align: end; }
.tv-clock b { display: block; font-size: 6vh; line-height: 1; }
.tv-clock span { color: #a39c93; }
.tv-list { display: grid; gap: 1.2vh; }
.tv-row { display: flex; align-items: center; gap: 2vw; background: rgb(255 255 255 / .06); border-radius: 1.2vh; padding: 1.4vh 2vw; }
.tv-rank { font-size: 4vh; font-weight: 700; color: #CFB0C0; min-width: 4vw; text-align: center; }
.tv-name { flex: 1; font-size: 3.4vh; font-weight: 600; }
.tv-name small { display: block; font-size: 2vh; color: #a39c93; font-weight: 400; }
.tv-pct { font-size: 4vh; font-weight: 600; min-width: 9vw; text-align: center; }
.tv-pct small { display: block; font-size: 1.8vh; color: #a39c93; font-weight: 400; }
.tv-empty { text-align: center; color: #a39c93; font-size: 3vh; padding: 10vh 0; }

/* The platforms' rights line, on every page (the mosque screen in its own colours). */
.site-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: inherit; }
body:has(.bulk) .site-footer { padding-bottom: 76px; }
body:has(.tv) { background: #241B20; }
body:has(.tv) .site-footer { color: #a39c93; background: #241B20; font-size: 1.6vh; padding: 0 0 2vh; }
/* The sign-in card carries the rights line itself. */
body:has(.almahr-auth) .site-footer { display: none; }
body:has(.almahr-auth) { background: #FAF6F8; }

.site-footer__link { color: var(--ink-d); font-weight: 600; text-decoration: none; display: inline-block; margin-bottom: 4px; }
.site-footer__link:hover { text-decoration: underline; }

.rec-info { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink-d); text-decoration: none; }
.rec-info:hover { text-decoration: underline; }
.rec-info svg { width: 16px; height: 16px; color: #A97C93; }
