/* K & A Study Hub
   Colours and feel taken from the centre's own poster and logo: a warm cream
   page, the logo's navy, coral, green and amber, round friendly type, chunky
   pill buttons. Phone first; the same pages widen for tablets and computers.
   Written with logical properties (inline-start/end) so Arabic, right to left,
   needs no separate stylesheet. No glows, no emoji. */

:root {
  color-scheme: only light;      /* never repainted by a phone's dark mode */
  --navy: #1D375C;
  --navy-700: #142944;
  --navy-100: #DCE4EF;
  --navy-50: #EEF2F7;
  --coral: #DC6953;
  --coral-700: #B9503B;
  --coral-100: #F8DCD5;
  --coral-50: #FCEFEB;
  --green: #406756;
  --green-700: #2F4F41;
  --green-100: #D6E5DC;
  --green-50: #ECF3EF;
  --amber: #FCA549;
  --amber-700: #A9620F;
  --amber-100: #FFE6C7;
  --amber-50: #FFF5E8;

  --bg: #F6F1E9;
  --paper: #FFFFFF;
  --ink: #1C2A3D;
  --ink-soft: #5C6A7C;
  --line: #E8DFD1;
  --line-strong: #D6CBB9;
  --danger: #C2412D;
  --danger-50: #FCECE8;

  --radius: 22px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --shadow: 0 1px 2px rgba(29, 55, 92, .05), 0 4px 14px rgba(29, 55, 92, .06);
  --shadow-btn: 0 4px 0 var(--coral-700);
  --font: 'Baloo Bhaijaan 2', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --tabbar-h: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  padding-bottom: var(--tabbar-h);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0 0 .5rem; font-weight: 800; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; margin-top: 1.6rem; }
h3 { font-size: 1.06rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--navy); text-decoration-thickness: 2px; text-underline-offset: 3px; }
b, strong { font-weight: 700; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 1.2em; height: 1.2em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.22em;
}
use[href="#i-sparkle"] { fill: currentColor; stroke: none; }
.ic-fill { fill: currentColor; stroke: none; }
/* arrows point the way the page reads */
[dir="rtl"] .back-btn .ic, [dir="rtl"] .ic.flip,
[dir="rtl"] .viewer-nav .ic, [dir="rtl"] .month-nav .ic { transform: scaleX(-1); }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246, 241, 233, .96);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  padding-top: max(8px, env(safe-area-inset-top));
}
.appbar-row { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 46px; height: 46px; flex: none; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { color: var(--navy); font-size: 1.08rem; font-weight: 800; white-space: nowrap; }
.brand-text small { color: var(--ink-soft); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn, .icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--navy);
  cursor: pointer; text-decoration: none; padding: 0;
  font: inherit;
}
.back-btn { border-color: var(--navy); }
.back-btn:hover, .icon-btn:hover { background: var(--navy-50); }
.icon-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.dot-count {
  position: absolute; inset-block-start: -4px; inset-inline-end: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--coral); color: #fff;
  font-size: .72rem; font-weight: 800; line-height: 20px; text-align: center;
  border: 2px solid var(--bg);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--navy);
  font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.chip:hover { background: var(--navy-50); }
.inline-form { display: inline; margin: 0; }

/* ---------- section bar ---------- */
.topnav { padding: 10px 0 2px; }
.topnav-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; overscroll-behavior-x: contain; }
.topnav-row::-webkit-scrollbar { display: none; }
.topnav a {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  min-height: 42px; padding: 0 16px;
  border-radius: 999px; background: var(--paper);
  color: var(--ink-soft); text-decoration: none; font-weight: 700; font-size: .92rem;
  border: 1px solid var(--line);
}
.topnav a:hover { color: var(--navy); border-color: var(--line-strong); }
.topnav a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- phone tab bar ---------- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  display: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 6px 4px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px; border-radius: 14px;
  color: var(--ink-soft); text-decoration: none; font-size: .74rem; font-weight: 700;
}
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a.active { color: var(--coral); }
.tabbar a.active .ic { stroke-width: 2.4; }

@media (max-width: 899px) {
  body:not(.role-admin):not(.role-teacher) { --tabbar-h: 74px; }
  body:not(.role-admin):not(.role-teacher) .tabbar { display: flex; }
  body:not(.role-admin):not(.role-teacher) .topnav { display: none; }
  .hide-sm { display: none !important; }
}
@media (max-width: 520px) {
  .brand-text small { display: none; }
  .lang-chip span { display: none; }
  .lang-chip { width: 44px; padding: 0; justify-content: center; }
  .hide-xs { display: none !important; }
  h1 { font-size: 1.45rem; }
}

/* ---------- page ---------- */
.page { padding-top: 16px; padding-bottom: 48px; min-height: 60vh; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .lead { margin: 2px 0 0; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { color: var(--coral); font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 2px; }
[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: .9rem; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; }
.section-head a { margin-inline-start: auto; font-weight: 700; font-size: .92rem; white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border-radius: 999px; border: none;
  background: var(--coral); color: #fff;
  font-family: inherit; font-size: 1rem; font-weight: 800; line-height: 1.1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-btn);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { background: #D45E48; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-700); }
.btn.navy { background: var(--navy); box-shadow: 0 4px 0 var(--navy-700); }
.btn.navy:hover { background: #23446F; }
.btn.navy:active { box-shadow: 0 1px 0 var(--navy-700); }
.btn.green { background: var(--green); box-shadow: 0 4px 0 var(--green-700); }
.btn.ghost {
  background: var(--paper); color: var(--navy);
  border: 1.5px solid var(--line-strong); box-shadow: none;
}
.btn.ghost:hover { background: var(--navy-50); }
.btn.ghost:active { transform: translateY(1px); }
.btn.danger { background: var(--paper); color: var(--danger); border: 1.5px solid #EAB9AE; box-shadow: none; }
.btn.danger:hover { background: var(--danger-50); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn.small.navy, .btn.small:not(.ghost):not(.danger) { box-shadow: 0 3px 0 var(--coral-700); }
.btn.small.navy { box-shadow: 0 3px 0 var(--navy-700); }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: none; padding: 0; color: var(--navy); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; }
.card.tint { background: var(--amber-50); border-color: var(--amber-100); }
.grid { display: grid; gap: 14px; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.split { display: grid; gap: 18px; }
@media (min-width: 960px) { .split { grid-template-columns: 1.6fr 1fr; align-items: start; } }

/* ---------- flash ---------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--navy-50); color: var(--navy); font-weight: 600;
  border: 1px solid var(--navy-100);
}
.flash .ic { margin-top: 3px; }
.flash.success { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.flash.error { background: var(--danger-50); color: var(--danger); border-color: #F2C6BC; }
.flash.warning { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }

/* ---------- tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 800; white-space: nowrap;
  background: var(--navy-50); color: var(--navy);
}
.tag.ok, .tag.att-present, .tag.pay-paid { background: var(--green-50); color: var(--green-700); }
.tag.warn, .tag.att-late, .tag.pay-pending { background: var(--amber-50); color: var(--amber-700); }
.tag.danger, .tag.att-absent { background: var(--danger-50); color: var(--danger); }
.tag.att-excused, .tag.pay-waived { background: var(--navy-50); color: var(--ink-soft); }
.tag.coral { background: var(--coral-50); color: var(--coral-700); }
.tag.subj { background: color-mix(in srgb, var(--c) 13%, white); color: var(--c); }

/* ---------- promotion slides ---------- */
.promos { position: relative; margin: 4px 0 8px; }
.promo-track {
  display: flex; gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; overscroll-behavior-x: contain;
  border-radius: var(--radius);
}
.promo-track::-webkit-scrollbar { display: none; }
.promo {
  flex: 0 0 100%; scroll-snap-align: start;
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr; align-items: center;
  min-height: 250px;
  border-radius: var(--radius);
  background: var(--c, var(--navy)); color: #fff;
}
.promo-body { position: relative; z-index: 1; padding: 26px 24px 30px; }
.promo h2 { color: #fff; font-size: 1.75rem; margin: 0 0 6px; line-height: 1.15; }
.promo p { font-size: 1.05rem; opacity: .95; margin: 0 0 16px; max-width: 34em; }
.promo .btn { background: #fff; color: var(--c, var(--navy)); box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.promo .btn:hover { background: var(--amber-50); }
.promo-art { position: relative; align-self: stretch; display: flex; align-items: center; justify-content: center; padding: 18px 18px 0; }
.promo-art img { max-height: 230px; width: auto; border-radius: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); background: #fff; }
.promo .sparkles { position: absolute; inset: 0; pointer-events: none; color: rgba(255, 255, 255, .22); }
.promo .sparkles .ic { position: absolute; }
.promo .sparkles .s1 { width: 54px; height: 54px; inset-inline-end: 6%; top: 12%; color: var(--amber); opacity: .9; }
.promo .sparkles .s2 { width: 26px; height: 26px; inset-inline-end: 18%; top: 48%; }
.promo .sparkles .s3 { width: 34px; height: 34px; inset-inline-start: 46%; bottom: 10%; }
.promo.has-art .sparkles .s1 { inset-inline-end: auto; inset-inline-start: 4%; top: 6%; width: 30px; height: 30px; }
.promo-image-only { padding: 0; min-height: 0; background: var(--paper); }
.promo-image-only img { display: block; width: 100%; height: auto; }
@media (max-width: 719px) {
  .promo.has-art { grid-template-rows: auto auto; }
  .promo.has-art .promo-art { order: -1; padding: 18px 18px 0; }
  .promo.has-art .promo-art img { max-height: 210px; }
  .promo.has-art .promo-body { padding-top: 14px; }
}
@media (min-width: 720px) {
  .promo { min-height: 300px; }
  .promo.has-art { grid-template-columns: 1.25fr 1fr; }
  .promo-body { padding: 36px 40px; }
  .promo h2 { font-size: 2.3rem; }
  .promo-art { padding: 22px; }
  .promo-art img { max-height: 280px; }
}
.promo-dots { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.promo-dots button {
  width: 10px; height: 10px; padding: 0; border-radius: 999px; border: none;
  background: var(--line-strong); cursor: pointer; transition: width .2s ease;
}
.promo-dots button[aria-current="true"] { width: 26px; background: var(--coral); }
.promo-arrows { position: absolute; inset-inline: 10px; top: 50%; display: none; justify-content: space-between; pointer-events: none; transform: translateY(-50%); }
.promo-arrows .icon-btn { pointer-events: auto; background: rgba(255, 255, 255, .92); border-color: transparent; }
@media (hover: hover) and (min-width: 720px) { .promos.many:hover .promo-arrows { display: flex; } }
[dir="rtl"] .promo-arrows .ic { transform: scaleX(-1); }

/* ---------- welcome strip on the front page ---------- */
.hero-mini {
  display: grid; gap: 14px; align-items: center;
  padding: 18px; margin: 18px 0 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.hero-mini h1 { font-size: 1.5rem; margin: 0; }
.hero-mini h1 .hl { color: var(--coral); }
@media (min-width: 760px) { .hero-mini { grid-template-columns: 1fr auto; padding: 22px 26px; } }
.facts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--ink-soft); font-weight: 600; }
.facts li { display: inline-flex; align-items: center; gap: 6px; }
.facts .ic { color: var(--green); }

/* ---------- year-group picker ---------- */
.grade-picker { display: grid; gap: 10px; }
.stage { display: grid; gap: 6px; }
.stage-label { font-size: .8rem; font-weight: 800; color: var(--ink-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.gchip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--paper); color: var(--navy);
  font-weight: 700; font-size: .92rem; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.gchip:hover { border-color: var(--navy); }
.gchip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.gchip.all { border-style: dashed; }
@media (max-width: 719px) {
  .grade-picker.compact .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; padding-bottom: 2px; }
  .grade-picker.compact .chips::-webkit-scrollbar { display: none; }
}
.picked { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.picked .gchip { pointer-events: none; }

/* ---------- subjects ---------- */
.subj-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; flex: none;
  border-radius: 16px;
  background: var(--c); color: #fff;
}
.subj-badge .ic { width: 28px; height: 28px; stroke-width: 1.9; }
.subj-badge.sm { width: 38px; height: 38px; border-radius: 12px; }
.subj-badge.sm .ic { width: 21px; height: 21px; }
.subj-badge.lg { width: 72px; height: 72px; border-radius: 22px; }
.subj-badge.lg .ic { width: 40px; height: 40px; }
.subj-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit;
  border-top: 5px solid var(--c);
  transition: transform .15s ease, border-color .15s ease;
}
a.subj-card:hover { transform: translateY(-2px); border-color: var(--line-strong); border-top-color: var(--c); }
.subj-card .top { display: flex; gap: 12px; align-items: center; }
.subj-card h3 { margin: 0; font-size: 1.2rem; }
.subj-card .by { color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
.subj-card .desc { color: var(--ink); margin: 0; font-size: .95rem; }
.subj-card .foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line); font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.subj-card .foot .go { margin-inline-start: auto; color: var(--coral); display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
[dir="rtl"] .subj-card .foot .go .ic { transform: scaleX(-1); }

.subject-hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.subject-hero h1 { margin: 0; }
.teacher-line { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-weight: 600; }

/* ---------- groups (class times) ---------- */
.group-card { display: grid; gap: 10px; border-inline-start: 5px solid var(--c, var(--navy)); }
.group-card .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.group-card .head h3 { margin: 0; }
.times { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.times li { display: flex; gap: 8px; align-items: flex-start; }
.times .ic { color: var(--coral); margin-top: 4px; }
.meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--ink-soft); font-weight: 600; font-size: .93rem; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item .ic { color: var(--green); }
.seats { display: flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 700; color: var(--green-700); }
.seats-track { flex: 1; max-width: 220px; height: 8px; border-radius: 999px; background: var(--green-50); overflow: hidden; }
.seats-fill { height: 100%; border-radius: 999px; background: var(--green); }
.seats.few { color: var(--amber-700); }
.seats.few .seats-fill { background: var(--amber); }
.seats.full { color: var(--danger); }
.seats.full .seats-fill { background: var(--coral); }
.enrol-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 10px; border-top: 1px dashed var(--line); }
.enrol-form select { flex: 1; min-width: 160px; max-width: 320px; }
.already { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-weight: 700; color: var(--green-700); font-size: .92rem; }

/* ---------- people ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  /* a tint with a ring: dark initials stay readable on every colour */
  background: color-mix(in srgb, var(--c) 22%, white); color: var(--ink);
  box-shadow: inset 0 0 0 2.5px var(--c);
  font-weight: 800; font-size: 1.15rem; line-height: 1;
}
.avatar.sm { width: 34px; height: 34px; font-size: .95rem; }
.avatar.xs { width: 22px; height: 22px; font-size: .7rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.6rem; }
.who { display: inline-flex; align-items: center; gap: 6px; }
.teacher-card { display: flex; gap: 14px; align-items: center; }
.teacher-photo {
  width: 74px; height: 74px; flex: none; border-radius: 50%;
  object-fit: cover; background: var(--c); border: 3px solid var(--c);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 800; font-size: 1.6rem;
}
.teacher-card h3 { margin: 0; }
.teacher-card .subs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.student-card { display: grid; gap: 12px; text-decoration: none; color: inherit; border-top: 5px solid var(--c); }
.student-card .top { display: flex; gap: 12px; align-items: center; }
.student-card h3 { margin: 0; }
a.student-card:hover { border-color: var(--line-strong); border-top-color: var(--c); }
.next-class { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--bg); font-weight: 600; font-size: .93rem; }
.next-class .ic { color: var(--coral); }

/* ---------- agenda ---------- */
.agenda { display: grid; gap: 8px; }
.agenda-day { margin: 14px 0 6px; font-weight: 800; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.agenda-day:first-child { margin-top: 0; }
.agenda-day .tag { font-size: .72rem; }
.class-row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  background: var(--paper); border: 1px solid var(--line);
  border-inline-start: 5px solid var(--c);
  border-radius: 14px;
}
.class-time { display: flex; flex-direction: column; align-items: center; min-width: 52px; line-height: 1.1; color: var(--navy); }
.class-time b { font-size: 1.15rem; }
.class-time small { color: var(--ink-soft); font-weight: 700; }
.class-main { flex: 1; min-width: 0; }
.class-title { font-weight: 800; color: var(--navy); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.class-meta { display: flex; gap: 4px 12px; flex-wrap: wrap; color: var(--ink-soft); font-size: .88rem; font-weight: 600; }
.class-note { font-size: .86rem; color: var(--amber-700); font-weight: 600; }
.class-row.cancelled { opacity: .72; background: repeating-linear-gradient(-45deg, #fff, #fff 8px, #faf6ef 8px, #faf6ef 16px); }
.class-row.cancelled .class-title > :first-child { text-decoration: line-through; }

/* ---------- the centre's week ---------- */
.week { display: grid; gap: 12px; }
.day-col { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.day-col h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.day-col h3 .count { margin-inline-start: auto; }
.day-col.today { border-color: var(--coral); box-shadow: inset 0 3px 0 var(--coral); }
.day-col.empty { display: none; }
.slot { display: block; padding: 8px 10px; border-radius: 12px; background: var(--bg); border-inline-start: 4px solid var(--c); text-decoration: none; color: inherit; }
.slot + .slot { margin-top: 6px; }
.slot b { color: var(--navy); display: block; line-height: 1.25; }
.slot small { display: block; color: var(--ink-soft); font-weight: 600; line-height: 1.35; }
a.slot:hover { background: var(--amber-50); }
@media (min-width: 1000px) {
  .week { grid-template-columns: repeat(7, 1fr); gap: 8px; }
  .day-col { padding: 10px 8px; }
  .day-col.empty { display: block; }
  .day-col h3 { font-size: .95rem; }
}

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { margin: 0; min-width: 9em; text-align: center; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.who-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.who-tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--paper); text-decoration: none; color: var(--navy); font-weight: 700; }
.who-tabs a.all { padding: 0 16px; }
.who-tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .78rem; font-weight: 800; color: var(--ink-soft); padding: 4px 0; }
.cal-day {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  min-height: 58px; padding: 5px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  font: inherit; color: var(--ink); text-align: start; cursor: pointer;
}
.cal-day .n { font-weight: 800; font-size: .95rem; line-height: 1; }
.cal-day.out { background: transparent; border-color: transparent; color: #B8AE9E; }
.cal-day.today .n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: -3px; border-radius: 50%; background: var(--coral); color: #fff; }
.cal-day.selected { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.cal-day:disabled { cursor: default; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: block; }
.dots i.x { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.cal-pills { display: none; }
@media (min-width: 760px) {
  .cal { gap: 6px; }
  .cal-day { min-height: 104px; padding: 7px; }
  .cal-day .dots { display: none; }
  .cal-pills { display: grid; gap: 3px; }
  .cal-pills span { display: block; padding: 1px 6px; border-radius: 6px; background: var(--c); color: #fff; font-size: .74rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-pills span.x { background: transparent; color: var(--ink-soft); text-decoration: line-through; box-shadow: inset 0 0 0 1px var(--line-strong); }
}
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; margin: 10px 0; font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); display: inline-block; }

/* ---------- KPI tiles and bars ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { color: var(--ink-soft); font-weight: 700; font-size: .86rem; display: flex; align-items: center; gap: 6px; }
.tile .value { color: var(--navy); font-weight: 800; font-size: 1.7rem; line-height: 1.2; margin-top: 2px; }
.tile .sub { color: var(--ink-soft); font-size: .84rem; font-weight: 600; }
.tile.accent { background: var(--navy); border-color: var(--navy); }
.tile.accent .label, .tile.accent .sub { color: var(--navy-100); }
.tile.accent .value { color: #fff; }
.hbars { display: grid; gap: 10px; }
/* label and value on one line, the bar under them: long Arabic year-group
   names are never cut short */
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.hbar-label { font-weight: 700; font-size: .92rem; color: var(--ink); grid-column: 1; grid-row: 1; }
.hbar-value { grid-column: 2; grid-row: 1; }
.hbar-track { grid-column: 1 / -1; grid-row: 2; }
.hbar-track { height: 12px; background: var(--bg); border-radius: 0 6px 6px 0; overflow: hidden; }
[dir="rtl"] .hbar-track { border-radius: 6px 0 0 6px; }
.hbar-fill { display: block; height: 100%; background: var(--c, var(--navy)); border-radius: 0 4px 4px 0; min-width: 2px; }
[dir="rtl"] .hbar-fill { border-radius: 4px 0 0 4px; }
.hbar-value { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: end; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 18px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.col .bar { width: 100%; max-width: 34px; background: var(--coral); border-radius: 4px 4px 0 0; min-height: 2px; }
.col .v { font-size: .76rem; font-weight: 800; color: var(--navy); }
.col .cap { font-size: .66rem; color: var(--ink-soft); white-space: nowrap; font-weight: 600; }
.col:not(:first-child):not(:last-child):nth-child(even) .cap { visibility: hidden; }
@media (min-width: 760px) { .col:nth-child(even) .cap { visibility: visible !important; } }

/* ---------- forms ---------- */
form.stack, .stack { display: grid; gap: 14px; }
/* The label's words (and an "(optional)" beside them) flow on one line; the
   field sits under them, and a hint after the field goes under that. */
label { display: block; font-weight: 700; font-size: .93rem; color: var(--navy); }
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
label > input ~ .hint, label > select ~ .hint, label > textarea ~ .hint { display: block; margin-top: 4px; }
label .hint, .hint { font-weight: 500; color: var(--ink-soft); font-size: .84rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="url"], input:not([type]),
select, textarea {
  width: 100%; min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs);
  background: #fff; color: var(--ink);
  font-family: inherit; font-size: 1rem;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: var(--navy); }
input[type="file"] { font: inherit; font-size: .92rem; }
.pair { display: grid; gap: 12px; }
@media (min-width: 700px) { .pair { grid-template-columns: 1fr 1fr; } .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; } }
.row-2, .row-3 { display: grid; gap: 12px; }
.lang-tag { font-size: .72rem; font-weight: 800; color: var(--ink-soft); background: var(--bg); padding: 0 8px; border-radius: 999px; margin-inline-start: 4px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks .pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: #fff; font-weight: 600; font-size: .9rem; color: var(--ink); cursor: pointer; }
.checks .pill:has(input:checked) { background: var(--navy-50); border-color: var(--navy); color: var(--navy); }
.checks .pill input { width: 18px; height: 18px; accent-color: var(--navy); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; }
legend { font-weight: 800; color: var(--navy); padding: 0 6px; }
.kind-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-pick label { cursor: pointer; }
.kind-pick input { position: absolute; opacity: 0; pointer-events: none; }
.kind-pick .opt { display: grid; justify-items: center; gap: 4px; padding: 14px 10px; border: 2px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; text-align: center; color: var(--navy); }
.kind-pick .opt .ic { width: 30px; height: 30px; color: var(--coral); }
.kind-pick .opt small { font-weight: 500; color: var(--ink-soft); }
.kind-pick input:checked + .opt { border-color: var(--navy); background: var(--navy-50); }
.kind-pick input:focus-visible + .opt { outline: 2px solid var(--navy); outline-offset: 2px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line-strong); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--navy); }
.swatch input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 3px; }
.form-card { max-width: 560px; margin: 0 auto; }
.form-wide { max-width: 900px; }
.auth-card { max-width: 460px; margin: 12px auto 0; }
.auth-card .logo { display: block; width: 92px; height: 92px; margin: 0 auto 8px; }
.auth-card h1 { text-align: center; }
.auth-card .lead { text-align: center; }
.alt-link { text-align: center; margin-top: 14px; font-weight: 600; }
.code-input { font-size: 1.8rem !important; letter-spacing: .4em; text-align: center; direction: ltr; font-weight: 800; }
.meeting-rows { display: grid; gap: 8px; }
.meeting-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; align-items: end; }
.meeting-row label { font-size: .8rem; }
.danger-zone { border-color: #F2C6BC; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--bg); color: var(--ink-soft); font-weight: 800; font-size: .8rem; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; color: var(--ink-soft); font-size: .84rem; }
tr.off td { color: var(--ink-soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- lists ---------- */
.list { display: grid; gap: 10px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
a.list-item:hover { border-color: var(--line-strong); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .main b { color: var(--navy); }
.notice { display: grid; gap: 4px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.notice.fresh { border-inline-start: 5px solid var(--coral); }
.notice h3 { margin: 0; font-size: 1rem; }
.notice time { color: var(--ink-soft); font-size: .82rem; font-weight: 600; }
.fee-lines { display: grid; gap: 6px; margin: 8px 0; }
.fee-line { display: flex; gap: 10px; align-items: baseline; }
.fee-line .what { flex: 1; }
.fee-line .amt { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.fee-total { display: flex; gap: 10px; align-items: baseline; padding-top: 8px; border-top: 1.5px dashed var(--line-strong); font-weight: 800; color: var(--navy); font-size: 1.1rem; }
.fee-total .amt { margin-inline-start: auto; }
.price-tiers { display: flex; gap: 8px; flex-wrap: wrap; }
.price-tier { display: grid; text-align: center; padding: 8px 14px; border-radius: 14px; background: var(--amber-50); border: 1px solid var(--amber-100); }
.price-tier b { color: var(--navy); font-size: 1.15rem; }
.price-tier small { color: var(--amber-700); font-weight: 700; }

/* ---------- gallery and the picture viewer ---------- */
.photos { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .photos { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .photos { grid-template-columns: repeat(4, 1fr); } }
.photos a { display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--line); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.photos a:hover img { transform: scale(1.03); }
.photo-page { display: grid; gap: 12px; justify-items: center; }
.photo-page img { max-height: 72vh; border-radius: 16px; background: #fff; }
.viewer {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14, 24, 40, .94);
  padding: max(56px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom));
}
.viewer figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 100%; }
.viewer img { max-width: 94vw; max-height: 78vh; border-radius: 12px; object-fit: contain; background: #fff; }
.viewer figcaption { color: #fff; font-weight: 600; text-align: center; max-width: 40em; }
.viewer-close { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer-nav.prev { inset-inline-start: 10px; }
.viewer-nav.next { inset-inline-end: 10px; }
.viewer .icon-btn { background: rgba(255, 255, 255, .95); border-color: transparent; }
body.viewing { overflow: hidden; }

/* ---------- empty states, pager, footer ---------- */
.empty { text-align: center; padding: 28px 16px; background: var(--paper); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.empty-ic { display: inline-flex; width: 54px; height: 54px; border-radius: 50%; align-items: center; justify-content: center; background: var(--amber-50); color: var(--amber-700); margin-bottom: 8px; }
.empty-ic .ic { width: 26px; height: 26px; }
.empty h3 { margin-bottom: 4px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 22px; color: var(--ink-soft); font-size: .9rem; }
.footer-row { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.footer-row img { border-radius: 50%; background: #fff; }
.footer-row a { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font-weight: 700; text-decoration: none; }
.contact-list { display: grid; gap: 10px; }
.contact-item { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
.contact-item .ic-wrap { width: 46px; height: 46px; flex: none; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--c, var(--navy)); color: #fff; }
.contact-item b { display: block; color: var(--navy); }
.contact-item span { color: var(--ink-soft); font-weight: 600; }
a.contact-item:hover { border-color: var(--line-strong); }
.issued { font-size: 1.8rem; font-weight: 800; letter-spacing: .12em; color: var(--coral); background: var(--coral-50); padding: 10px 18px; border-radius: 14px; display: inline-block; direction: ltr; }
.thumb { width: 92px; height: 60px; object-fit: cover; border-radius: 10px; background: var(--c, var(--line)); display: block; }
.promo-mini { width: 120px; height: 66px; border-radius: 12px; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 800; font-size: .74rem; padding: 6px; text-align: center; line-height: 1.2; flex: none; }
.promo-mini img { width: 100%; height: 100%; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .appbar, .topnav, .tabbar, .site-footer, .btn, .back-btn { display: none !important; }
  body { background: #fff; }
}
.stack > .card + .card { margin-top: 0; }

/* ---------- a child's own class page ---------- */
.kid-hello { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.kid-hello h1 { margin: 0; }
.kid-class { display: grid; gap: 12px; border-inline-start: 6px solid var(--c); }
.kid-class-head { display: flex; gap: 12px; align-items: center; }
.kid-class-head h3 { margin: 0; font-size: 1.25rem; }
.kid-class.cancelled { opacity: .75; }
.kid-join { min-height: 58px; font-size: 1.15rem; }
.kid-qr { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.kid-qr img { border-radius: 10px; border: 1px solid var(--line); background: #fff; flex: none; }
.kid-qr p { margin: 0; }
.class-row .join + .btn { margin-inline-start: 4px; }
.same-time { border-color: var(--amber-100); background: var(--amber-50); }
.same-time .kid-links { display: grid; gap: 8px; margin-top: 10px; }
.same-time .kid-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.same-time .kid-link b { min-width: 6em; }

/* ---------- class files ---------- */
.files { display: grid; gap: 8px; }
.file-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.file-badge, .file-thumb { width: 52px; height: 52px; flex: none; border-radius: 12px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; overflow: hidden; }
.file-badge .ic { width: 22px; height: 22px; }
.file-badge span { font-size: .66rem; font-weight: 800; letter-spacing: .02em; }
.kind-pdf .file-badge { background: #FCE8E5; color: #B3261E; }
.kind-word .file-badge { background: #E3ECFA; color: #1F4E9C; }
.kind-powerpoint .file-badge { background: #FDEBDD; color: #A8471A; }
.kind-excel .file-badge { background: #E2F2E8; color: #1E6B3E; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-main { flex: 1; min-width: 0; }
.file-title { font-weight: 800; color: var(--navy); text-decoration: none; overflow-wrap: anywhere; }
.file-title:hover { text-decoration: underline; }
.file-meta { display: flex; gap: 4px 12px; flex-wrap: wrap; color: var(--ink-soft); font-size: .84rem; font-weight: 600; }
.file-note { font-size: .88rem; margin-top: 2px; }
.file-actions { display: flex; gap: 6px; align-items: center; }
.upload-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px; background: var(--bg); }

.amount-form { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.amount-form input { width: 96px; min-height: 40px; padding: 6px 10px; text-align: end; }
.amount-form .icon-btn { width: 40px; height: 40px; }
.price-table input { width: 110px; min-height: 42px; padding: 6px 10px; }

/* ---- notifications on this phone ---------------------------------------- */
.push-head { display: flex; align-items: center; gap: 8px; color: var(--navy); }
.push-head h2 { margin: 0; font-size: 1.05rem; }
.push-head .push-dismiss { margin-inline-start: auto; }
.push-card p { margin: 8px 0; }
.push-card .btn-row { margin-top: 10px; }
.push-card [data-push-msg]:empty { display: none; }
.push-prompt { border-inline-start: 4px solid var(--coral); }
