/* أنماط خاصة بصفحات children — قائمة الأطفال، ملف الطفل وأقسامه، تشغيل الجلسة */

/* ── قائمة الأطفال ── */
.ch-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.ch-card { display: flex; flex-direction: column; gap: var(--s3); }

.ch-card-top { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.ch-card-name { flex: 1; min-width: 0; }
.ch-card-tags { display: flex; flex-wrap: wrap; gap: var(--s1); }

/* ── ملف الطفل ── */
/* الرأس المثبت: صورة + اسم + صف حقائق واحد؛ على الهاتف يمرر الصف داخل نفسه ولا يلتف */
.ch-pin {
  position: sticky; inset-block-start: calc(var(--topbar-h) + 1px); z-index: 20; display: flex; align-items: center; gap: var(--s3);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px var(--s4); margin-block-end: var(--s4); min-width: 0;
}
.ch-pin-main { flex: 1; min-width: 0; }
.ch-pin-name { display: flex; align-items: center; gap: var(--s2); min-width: 0; flex-wrap: wrap; }
.ch-pin-name h2 { margin: 0; font-size: var(--fs-section); font-weight: 600; line-height: 1.4; min-width: 0; }
.ch-pin-name .badge { flex: none; }
.ch-pin-facts { display: flex; flex-wrap: wrap; gap: 2px var(--s3); color: var(--muted); font-size: var(--fs-meta); margin-top: 2px; min-width: 0; }
.ch-fact { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ch-fact .ic { width: 14px; height: 14px; }
@media (max-width: 640px) {
  .ch-pin { padding: var(--s2) var(--s3); gap: var(--s2); margin-inline: calc(var(--s2) * -1); }
  .ch-pin .avatar { width: 36px !important; height: 36px !important; font-size: 15px !important; }
  .ch-pin-name { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ch-pin-name h2 { white-space: nowrap; flex: none; font-size: var(--fs-body); }
  .ch-pin-facts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ch-pin-name::-webkit-scrollbar, .ch-pin-facts::-webkit-scrollbar { display: none; }
}
@media print { .ch-pin { position: static; } }
.ch-hub { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: var(--s4); align-items: start; }
.ch-hub-main { min-width: 0; }
.ch-activity { margin-top: 37px !important; }
.ch-activity .card-header { min-height: 44px; }
.ch-act-row {
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 42px; padding: 6px var(--s4); background: none; border: 0;
  border-block-end: 1px solid var(--line-soft); cursor: pointer; text-align: start; color: var(--ink); transition: background var(--t-hover) ease;
}
.ch-act-row:last-child { border-block-end: 0; }
.ch-act-row:hover { background: var(--surface-2); }
.ch-act-row .ic { width: 15px; height: 15px; color: var(--muted); }
@media (max-width: 1000px) {
  .ch-hub { grid-template-columns: minmax(0, 1fr); }
  .ch-activity { margin-top: 0 !important; }
}
.ch-profile-card { margin-bottom: var(--s4); }
.ch-sections { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.ch-secview { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.ch-secview > .card, .ch-secview > .stack > .card { margin-top: 0; }
.ch-secnav .tabs { margin: 0; }

/* أدوات صغيرة داخل البطاقات */
.ch-toolbar { margin: 0; }
.ch-month { inline-size: auto; max-inline-size: 100%; }
.ch-mtype { flex: 1 1 200px; max-inline-size: 320px; }
.ch-modal-top { margin-bottom: var(--s3); }
.pre, .ch-note-body, .ch-eval-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* الاستمارات */
.ch-form-sec + .ch-form-sec { margin-top: var(--s5); }
.ch-form .sectiontitle { margin-top: 0; }
.ch-followup { margin-top: var(--s2); padding-inline-start: var(--s4); border-inline-start: 2px solid var(--line); }
/* عرض الاستمارة المعبأة كتقرير */
.ch-report-rows { display: flex; flex-direction: column; }
.ch-report-row { padding-block: var(--s2); border-block-end: 1px solid var(--line-soft); break-inside: avoid; }
.ch-report-row:last-child { border-block-end: 0; }
.ch-report-q { color: var(--muted); font-size: 13px; }
.ch-report-a { font-weight: 600; color: var(--ink); }
.ch-report-f { margin-top: var(--s1); padding-inline-start: var(--s3); border-inline-start: 2px solid var(--line); font-size: 14px; }
@media print { .ch-report-sec { break-inside: auto; } .ch-report-sec .sectiontitle { break-after: avoid; } .ch-form.card { break-inside: auto; } }

/* الجلسات */
.ch-sess { display: flex; flex-direction: column; gap: var(--s3); }
.ch-sess-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.ch-sess-body { display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line-soft); }
.ch-goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s2) var(--s4); }
.ch-goal { padding-inline-start: var(--s3); border-inline-start: 2px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.ch-goal-t { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-weight: 600; }
.ch-act { color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.ch-act .ic { color: var(--ok); }
.ch-sess-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); }
.ch-sent { display: flex; flex-wrap: wrap; gap: var(--s1); }

/* البرنامج والمراحل */
.ch-stages { display: flex; flex-direction: column; gap: var(--s2); }
.ch-stage { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.ch-stage-ic { display: inline-flex; color: var(--primary-ink); }
.ch-stage.done .ch-stage-ic { color: var(--ok); }
.ch-run-t { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.ch-editstages { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.ch-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 0 var(--s4); }

/* التقييمات */
.ch-eval { display: flex; flex-direction: column; gap: var(--s3); }
.ch-eval-head { display: flex; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.ch-eval-body { padding-top: var(--s3); border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 1.8; }

.ev-details { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.ev-goals { display: flex; flex-direction: column; gap: var(--s2); }
.ev-goal { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.ev-goal > .grow { flex: 1 1 180px; min-width: 0; }
table.tbl.ev-words { min-width: 0; table-layout: fixed; }
.tbl.compact.ev-words th, .tbl.compact.ev-words td { white-space: normal; overflow-wrap: anywhere; padding-inline: var(--s1); }
select.in.ev-rate { width: 100%; min-width: 0; height: var(--field-h-sm); min-height: var(--field-h-sm); padding-inline: var(--s1); background-image: none; font-size: 13px; text-align: center; }

/* الرسائل */
.ch-thread { display: flex; flex-direction: column; gap: var(--s4); }
.ch-thread > .card { margin-top: 0; }
.ch-msgs { display: flex; flex-direction: column; gap: var(--s2); }
.ch-msgs .msgbubble { margin: 0; }

/* ملاحظات الإدارة */
.ch-composer { margin-bottom: var(--s4); }
.ch-note { margin: 0; }
.ch-note-meta { margin-top: var(--s2); }

/* المرفقات */
.ch-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: var(--s3); }
.ch-file { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--card); }
.ch-file-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); color: var(--muted); text-decoration: none; }
.ch-file-thumb .ic { width: 28px; height: 28px; }
.ch-file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; } /* صور التواقيع حبر داكن: خلفية بيضاء مقصودة */
.ch-file-info { padding: var(--s2) var(--s3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* جداول الكلمات */
.ch-words { min-width: 420px; }
.ch-word-in { min-width: 7em; }
.ch-rate { min-width: 5.5em; height: var(--field-h-sm); }
.ch-addrow { margin-top: var(--s3); }

/* ── تشغيل الجلسة ── */
.ch-att { display: flex; flex-direction: column; align-items: center; gap: var(--s5); text-align: center; padding-block: var(--s6); }
.ch-att-q { margin: 0; font-size: 18px; }
.ch-att-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: var(--s4); justify-content: center; width: 100%; }
.ch-att-btn { justify-content: center; flex-direction: column; padding: var(--s4) var(--s3); gap: var(--s2); }
.ch-att-btn.is-ok .tile-ic { color: var(--ok); }
.ch-att-btn.is-no .tile-ic { color: var(--danger); }
.ch-att .alert { width: 100%; text-align: start; }
.ch-rgoal { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s2) var(--s3); background: var(--card); transition: background .15s, border-color .15s; }
.ch-rgoal.on { background: var(--primary-tint); border-color: var(--primary-line); }
.ch-rgoal-body { display: flex; flex-direction: column; gap: var(--s2); padding-inline-start: var(--s5); padding-bottom: var(--s2); }
.ch-words-toggle { margin-top: var(--s4); }
.ch-words-box { margin-top: var(--s3); }
/* العرض المقسوم: الأهداف بجانب الملاحظات على الشاشات العريضة، والتسلسل نفسه على الهاتف */
.ch-run-split { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.ch-run-side { display: contents; }
.ch-prev { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
@media (min-width: 1280px) {
  .ch-run-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: var(--s4); align-items: start; }
  .ch-run-side {
    display: flex; flex-direction: column; gap: var(--s4); position: sticky; inset-block-start: calc(var(--topbar-h) + var(--s4));
    max-height: calc(100vh - var(--topbar-h) - var(--s5)); overflow-y: auto; min-width: 0;
  }
  .ch-run-split.words { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* جدول الكلمات يحتاج عرضاً */
  .ch-run-side > .card { margin-top: 0; }
  .ch-run-side .formgrid { grid-template-columns: minmax(0, 1fr); }
}
.ch-run-actions { display: flex; gap: var(--s2); flex-wrap: wrap; position: sticky; bottom: 0; padding: var(--s3) 0; background: var(--bg); border-block-start: 1px solid var(--line); z-index: 2; }
.ch-done { text-align: center; padding-block: var(--s6); display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.ch-done h2 { margin: 0; }
.ch-done-ic { color: var(--ok); }
.ch-done-ic .ic { width: 36px; height: 36px; }
.ch-done-btns { justify-content: center; margin-top: var(--s3); }

@media (max-width: 640px) {
  .ch-rgoal-body { padding-inline-start: 0; }
  .ch-att-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-run-actions > .btn { flex: 1; }
  .ch-mtype { max-inline-size: none; }
}

.ch-profile-card .profile { grid-template-columns: minmax(0, 1fr) auto; }
.ch-profile-card .profile-main > .kv { margin-top: 0; padding-top: 0; border-top: 0; }

/* بطاقة عنوان فقط (المحتوى في بطاقات تالية) — بلا جسم فارغ */
.card.head-only > .card-header { margin-block-end: calc(var(--card-pad) * -1); border-block-end: 0; }

/* ── تقدّم الأهداف: الخط بلون الهوية فقط، والحالات تبقى في الشارات مع نصها ── */
.gp-summary { margin: 0 0 var(--s2); font-weight: 500; }
.gp-pick { min-width: 0; width: min(100%, 400px); }
.gp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s3); color: var(--muted); font-size: var(--fs-small); margin-block-end: var(--s3); }
.gp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gp-key { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--primary-ink); background: var(--primary-ink); }
.gp-key.session { background: var(--card); }
.gp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s3); align-items: start; }
.gp-goal { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3); min-width: 0; }
.gp-goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); overflow-wrap: anywhere; }
.gp-goal-head b { font-weight: 600; min-width: 0; }
.gp-goal-head .badge { flex: none; }
.gp-goal-sub { color: var(--muted); font-size: var(--fs-small); margin-block: 2px var(--s2); }
.gp-note { color: var(--muted); font-size: var(--fs-meta); margin-block-start: var(--s1); }
.gp-plot { position: relative; min-width: 0; }
.gp-svg { display: block; max-width: 100%; direction: ltr; overflow: visible; }
.gp-grid-line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.gp-tick { fill: var(--muted); font-size: 12px; font-family: inherit; }
.gp-num { font-variant-numeric: tabular-nums; }
.gp-line { fill: none; stroke: var(--primary-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.gp-dot { stroke-width: 2; }
.gp-dot.eval { fill: var(--primary-ink); stroke: var(--card); }
.gp-dot.session { fill: var(--card); stroke: var(--primary-ink); }
.gp-hit { fill: transparent; stroke: none; cursor: default; outline: none; }
.gp-hit:focus-visible { stroke: var(--primary-ink); stroke-width: 1.5; }
.gp-tip {
  position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, -100%); padding: 4px 8px; white-space: nowrap;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-xs); font-size: var(--fs-small);
  opacity: 0; transition: opacity var(--t-hover) ease;
}
.gp-tip.on { opacity: 1; }
.gp-data { margin-block-start: var(--s3); }
.gp-data summary { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; cursor: pointer; color: var(--primary-ink); font-size: var(--fs-meta); list-style: none; }
.gp-data summary::-webkit-details-marker { display: none; }
.gp-data summary .ic { width: 14px; height: 14px; transition: transform var(--t-hover) ease; }
.gp-data[open] summary .ic { transform: rotate(180deg); }
.gp-data .tablewrap { margin-block-start: var(--s2); }

/* ── الملخص المبسط للأهل ── */
.ev-summary { background: var(--primary-tint); border: 1px solid var(--primary-line); border-radius: var(--radius-sm); padding: var(--s3); line-height: 1.8; overflow-wrap: anywhere; }
.ev-summary-k { font-size: var(--fs-small); color: var(--muted); }
.ev-sum-act { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin-block-start: var(--s2); }
