/* مركز ضاد — design tokens taken from the approved mockups. No inline styles (strict CSP). */
:root {
  --ink: #12414b;
  --ink-2: #35606a;
  --muted: #4a6a72;
  --accent: #12798a;
  --accent-dark: #0b5663;
  --orange: #f28c28;
  --deep: #0b2a31;
  --cream: #fff9ee;
  --line: #f1e6d2;
  --line-cool: #dde8eb;
  --bg-cool: #f4f8f9;
  --teal-50: #e3f5f7;
  --orange-50: #ffebd3;
  --pink-50: #fce4ec;
  --yellow-50: #fff3cc;
  --blue-50: #e1f3fc;
  --green-50: #ddf3e4;
  --red-50: #fde3e1;
  --green-ink: #0f5132;
  --red-ink: #7a1713;
  --yellow-ink: #5a3e00;
  --blue-ink: #0b4a6b;
  --pink-ink: #7a1f44;
  --radius: 24px;
  --font: "Tajawal", system-ui, "Segoe UI", Tahoma, sans-serif;
  --display: "Baloo Bhaijaan 2", "Tajawal", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--cream); line-height: 1.7; font-size: 17px; }
body.cool { background: var(--bg-cool); font-size: 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 5vw, 52px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h2.display { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 40px); }
h3 { font-size: 20px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-sm { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0; }
.section.white { background: #fff; }
.section.teal { background: var(--teal-50); }
.section.dark { background: var(--ink); color: #fff; }
.section.dark .muted { color: #cde7ec; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; border: 2px solid transparent; text-align: center; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-accent { background: var(--orange); color: var(--deep); }
.btn-accent:hover { color: var(--deep); filter: brightness(0.95); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { color: var(--ink); background: var(--bg-cool); }
.btn-danger { background: #fff; color: #a12a22; border-color: #a12a22; }
.btn-success { background: var(--green-ink); color: #fff; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Header / footer */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.logo img { height: 60px; width: auto; display: block; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-weight: 500; }
.nav a { color: var(--ink); padding: 10px 2px; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; border-bottom: 3px solid var(--orange); }
.site-footer { background: var(--deep); color: #cde7ec; padding: 32px 0; font-size: 15px; }
.site-footer a { color: #cde7ec; padding: 10px 0; display: inline-block; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }

/* Hero */
.hero { background: var(--teal-50); padding: 56px 0 64px; }
.hero .container { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.hero-copy { flex: 1 1 440px; display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.hero-copy p { font-size: 20px; color: var(--ink-2); max-width: 560px; }
.hero h1 .accent { color: var(--accent); }
.hero-card { flex: 1 1 360px; background: #fff; border-radius: 36px; padding: 28px; }
.blocks { display: flex; gap: 10px; align-items: flex-end; height: 100px; margin-bottom: 18px; }
.blocks span { flex: 1; border-radius: 14px; }
.blocks span:nth-child(1) { background: #e5473e; height: 60%; }
.blocks span:nth-child(2) { background: #ffc531; height: 100%; }
.blocks span:nth-child(3) { background: #4ab3e6; height: 75%; }
.blocks span:nth-child(4) { background: #e9689a; height: 90%; }
.blocks span:nth-child(5) { background: var(--orange); height: 55%; }

/* Cards & surfaces */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
body.cool .card { border-color: var(--line-cool); }
.card.flat { border: 0; }
.card.tint-teal { background: var(--teal-50); border: 0; }
.card.tint-orange { background: var(--orange-50); border: 0; }
.card.tint-pink { background: var(--pink-50); border: 0; }
.card.tint-yellow { background: var(--yellow-50); border: 0; }
.card.tint-blue { background: var(--blue-50); border: 0; }
.card.tint-green { background: var(--green-50); border: 0; }
.card.tint-red { background: var(--red-50); border: 0; }
.card-strip { height: 12px; border-radius: var(--radius) var(--radius) 0 0; margin: -24px -24px 18px; }
.strip-pink { background: #e9689a; } .strip-yellow { background: #ffc531; } .strip-blue { background: #4ab3e6; } .strip-teal { background: var(--accent); }
.stat .label { color: var(--muted); font-size: 15px; }
.stat .value { font-size: 28px; font-weight: 800; }
.placeholder { border: 2px dashed #8dbac2; border-radius: var(--radius); min-height: 180px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); font-weight: 700; background: #fff; padding: 16px; text-align: center; }

/* Badges */
.badge { display: inline-block; font-weight: 700; font-size: 14px; padding: 2px 14px; border-radius: 999px; white-space: nowrap; }
.b-green { background: var(--green-50); color: var(--green-ink); }
.b-red { background: var(--red-50); color: var(--red-ink); }
.b-yellow { background: var(--yellow-50); color: var(--yellow-ink); }
.b-blue { background: var(--blue-50); color: var(--blue-ink); }
.b-pink { background: var(--pink-50); color: var(--pink-ink); }
.b-gray { background: var(--bg-cool); color: var(--muted); }

/* Alerts */
.alert { border-radius: 18px; padding: 14px 18px; font-weight: 700; }
.alert-danger { background: var(--red-50); color: var(--red-ink); }
.alert-warn { background: var(--yellow-50); color: #3f2c00; }
.alert-info { background: var(--blue-50); color: #083a55; }
.alert-success { background: var(--green-50); color: var(--green-ink); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 15px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; border: 1.5px solid #b9cdd1; border-radius: 14px; padding: 0 14px; font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
textarea { padding: 12px 14px; min-height: 96px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
input[type="file"] { font: inherit; max-width: 100%; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 3px; flex: none; }
.file-drop { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 14px; border: 2px dashed #8dbac2; border-radius: 18px; font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.file-drop input[type="file"] { min-width: 0; width: 100%; }
.stack > *, .stack-sm > *, .form > *, .portal-main > * { min-width: 0; }
legend { font-size: 20px; font-weight: 700; margin-bottom: 10px; display: flex; gap: 10px; align-items: center; }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; min-width: 560px; }
th { color: var(--muted); font-size: 15px; font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--line-cool); }
td { padding: 12px 8px; border-bottom: 1px solid #eef3f4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

/* Portals (parent / admin) */
.topbar { background: #fff; border-bottom: 1px solid var(--line-cool); }
.topbar .container { max-width: 1320px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.topbar .logo img { height: 50px; }
.portal { max-width: 1320px; margin: 0 auto; padding: 24px 20px 56px; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.sidenav { flex: 1 1 220px; max-width: 100%; background: #fff; border: 1px solid var(--line-cool); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.sidenav a { display: flex; align-items: center; min-height: 46px; border-radius: 14px; padding: 0 16px; color: var(--ink); font-weight: 700; }
.sidenav a[aria-current="page"] { background: var(--accent); color: #fff; }
.portal-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.child-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: #ffc531; color: var(--deep); font-family: var(--display); font-weight: 800; font-size: 26px; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* Teacher mobile app */
.app-shell { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-cool); }
.app-head { background: var(--accent); color: #fff; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.app-head a { color: #fff; }
.app-main { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.app-tabs { position: sticky; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line-cool); }
.app-tabs a { flex: 1; min-height: 60px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 15px; border-top: 4px solid transparent; }
.app-tabs a[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }
.kid-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line-cool); border-radius: 18px; padding: 10px 12px; flex-wrap: wrap; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid #b9cdd1; background: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }
.seg.att input[value="present"]:checked + span { background: var(--green-ink); border-color: var(--green-ink); }
.seg.att input[value="absent"]:checked + span { background: #a12a22; border-color: #a12a22; }

/* Media & misc */
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery figure { margin: 0; }
.gallery img, .gallery video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; background: var(--teal-50); display: block; }
.gallery figcaption { font-size: 14px; color: var(--muted); margin-top: 4px; }
meter { width: 100%; height: 14px; }
.bubble { max-width: 80%; border-radius: 18px; padding: 10px 16px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; }
.bubble.them { align-self: flex-start; background: var(--bg-cool); }
.bubble .meta { font-size: 12px; opacity: 0.8; }
details.faq { background: var(--cream); border-radius: 20px; padding: 14px 20px; }
details.faq summary { font-weight: 700; font-size: 18px; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.prose p { margin: 0 0 14px; white-space: pre-line; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--teal-50); }
.center-page .box { width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.center-page .box > .card { width: 100%; }

/* Print (invoices, progress reports → "Save as PDF") */
@media print {
  .no-print, .site-header, .site-footer, .topbar, .sidenav, .app-tabs { display: none !important; }
  body { background: #fff; font-size: 13pt; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
  .portal { padding: 0; }
}

/* PHP build helpers (no inline styles allowed by CSP) */
.t-center { text-align: center; }
.big-num { font-family: var(--display); font-size: 44px; font-weight: 800; }
h1.h-md { font-size: 26px; }
.w-sm { max-width: 520px; }
.hidden { display: none; }
.inline-form { display: inline; }
.mt { margin-top: 16px; }
.num { direction: ltr; unicode-bidi: plaintext; display: inline-block; }
.qr{display:inline-block}.qr img{display:block;max-width:100%;height:auto}

/* Phones: admin menu becomes a swipeable strip instead of a tall list */
@media (max-width: 700px) {
  .sidenav { flex-direction: row; overflow-x: auto; padding: 8px; gap: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav a { flex: 0 0 auto; min-height: 40px; padding: 0 14px; white-space: nowrap; font-size: .95rem; }
}
