/* ============================================================
   STUDENT IDENTITY — avatars, ID card, admin editor
   Appended after the base stylesheet so it can override the
   plain-table look of the student roster.
   ============================================================ */

/* ---------- avatar ---------- */
.avatar {
  display: inline-grid; place-items: center;
  border-radius: 50%; overflow: hidden;
  font-weight: 700; font-size: .78rem; line-height: 1;
  color: #fff; letter-spacing: -.02em;
  background: linear-gradient(150deg, #6b7f9e, #44536b);
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(11,31,58,.18);
  flex: 0 0 auto; user-select: none;
}
.av-f { color: #fff; }
.av-m { color: #fff; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-person > div { min-width: 0; }
.cell-person b { display: block; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.cell-person .tiny { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   ID CARD
   ============================================================ */
.id-card {
  position: relative;
  width: 100%; max-width: 460px;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(152deg, #ffffff 0%, #f7f9fc 58%, #eef3f9 100%);
  border: 1px solid rgba(11,31,58,.10);
  box-shadow: 0 18px 44px -16px rgba(11,31,58,.34), 0 2px 6px rgba(11,31,58,.06);
  font-family: inherit;
  animation: idcIn .42s cubic-bezier(.22,.9,.28,1) both;
}
@keyframes idcIn {
  from { opacity: 0; transform: translateY(12px) rotateX(6deg); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .id-card { animation: none; } }

.idc-glow {
  position: absolute; inset-inline-end: -70px; top: -80px;
  width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212,161,44,.20), transparent 68%);
  pointer-events: none;
}

.idc-head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px;
  background: linear-gradient(115deg, var(--brand-900), var(--brand-700) 62%, var(--teal-600));
  color: #fff;
}
.idc-crest {
  width: 42px; height: 50px; flex: 0 0 auto;
  border-radius: 9px; background: #fff; padding: 3px;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.idc-crest img { width: 100%; height: 100%; object-fit: contain; }
.idc-schl { min-width: 0; }
.idc-schl b { display: block; font-size: .88rem; font-weight: 700; line-height: 1.25; }
.idc-schl span { font-size: .68rem; opacity: .72; }
.idc-title {
  margin-inline-start: auto; flex: 0 0 auto;
  font-size: .6rem; font-weight: 700; letter-spacing: .10em;
  text-transform: uppercase; opacity: .9;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  white-space: nowrap;
}
.id-card.ltr .idc-title { letter-spacing: .08em; }

.idc-body { display: flex; gap: 15px; padding: 16px; align-items: flex-start; }

.idc-photo { flex: 0 0 auto; width: 108px; text-align: center; }
.idc-photo img, .idc-initial {
  width: 108px; height: 132px; border-radius: 13px;
  object-fit: cover; display: grid; place-items: center;
  font-size: 2.1rem; font-weight: 800; color: #fff;
  background: linear-gradient(150deg, #7b8ca8, #4a5a73);
  box-shadow: 0 6px 16px -6px rgba(11,31,58,.42), inset 0 0 0 1px rgba(255,255,255,.16);
}
.idc-phcap { margin-top: 6px; font-size: .58rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-soft); font-weight: 600; }

.idc-fields { flex: 1 1 auto; min-width: 0; }
.idc-name { font-size: 1.06rem; font-weight: 800; line-height: 1.3; color: var(--brand-900); }
.idc-name-en { font-size: .76rem; color: var(--text-soft); margin-top: 1px; }
.idc-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 0; border-top: 1px dashed rgba(11,31,58,.12);
}
.idc-row:first-of-type { margin-top: 9px; }
.idc-lbl { flex: 0 0 96px; font-size: .68rem; color: var(--text-soft); font-weight: 600; }
.idc-val { flex: 1 1 auto; font-size: .82rem; font-weight: 600; min-width: 0;
  overflow-wrap: anywhere; }
.idc-val.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .01em; font-size: .8rem; }

.idc-foot {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px 12px;
  border-top: 1px solid rgba(11,31,58,.08);
  background: rgba(11,31,58,.028);
}
.idc-valid { font-size: .66rem; font-weight: 700; color: var(--brand-700); white-space: nowrap; }
.idc-bar {
  flex: 1 1 auto; height: 26px; min-width: 40px;
  background-image: repeating-linear-gradient(90deg,
    var(--brand-900) 0 2px, transparent 2px 4px,
    var(--brand-900) 4px 6px, transparent 6px 9px);
  opacity: .22; border-radius: 3px;
}
.idc-note { font-size: .6rem; color: var(--text-soft); text-align: end; max-width: 44%; }

/* ============================================================
   ADMIN EDITOR
   ============================================================ */
.ed-grid { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .ed-grid { grid-template-columns: 1fr; } }

.ed-photo { text-align: center; }
.ed-preview {
  width: 132px; height: 160px; margin: 0 auto 10px;
  border-radius: 15px; overflow: hidden;
  background: linear-gradient(150deg, #eef2f7, #e2e8f0);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(11,31,58,.08), var(--sh-1);
}
.ed-preview img { width: 100%; height: 100%; object-fit: cover; }
.ed-pick, .ed-photo .btn { width: 100%; margin-bottom: 6px; }
.ed-hint { font-size: .68rem; color: var(--text-soft); margin-top: 4px; line-height: 1.5; }

.ed-fields { display: grid; gap: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.ed-parent {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 16px; padding: 11px 13px;
  border-radius: 11px; font-size: .8rem; line-height: 1.5;
  background: rgba(14,116,144,.07);
  border: 1px solid rgba(14,116,144,.20);
  color: var(--brand-700); cursor: pointer;
}
.ed-actions {
  display: flex; gap: 9px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ed-actions .btn-danger { margin-inline-start: auto; }

/* student row click affordance */
#stBody tr { cursor: pointer; }
#stBody tr:hover { background: rgba(14,116,144,.045); }
#stBody tr:focus-within { background: rgba(14,116,144,.07); }

/* print only the card when printing from the modal */
@media print {
  .modal-foot, .modal-head .x-btn, .ed-actions, .ed-photo .btn { display: none !important; }
  .id-card { box-shadow: none; border: 1px solid #999; page-break-inside: avoid; }
}

/* ============================================================
   GENDER TAG — boys/girls section marker
   Boys and girls are taught in separate sections, so the class cell
   carries the section's gender as a small tinted pill.
   ============================================================ */
.gender-tag {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}
.gender-tag.g-boys {
  color: #1d4ed8;
  background: rgba(59,130,246,.13);
  border: 1px solid rgba(59,130,246,.28);
}
.gender-tag.g-girls {
  color: #be185d;
  background: rgba(236,72,153,.13);
  border: 1px solid rgba(236,72,153,.28);
}

/* ============================================================
   PARENT ATTENDANCE LEDGER
   Day-by-day record: which specific days the child was absent,
   late, or excused — not just an opaque total.
   ============================================================ */
.att-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 560px) {
  .att-legend { grid-template-columns: repeat(2, 1fr); }
}
.att-note {
  margin: 10px 0 0;
  line-height: 1.55;
  color: var(--text-faint);
}

.att-ledger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 340px;
  overflow-y: auto;
  padding-inline-end: 4px;
}
.att-row {
  display: grid;
  grid-template-columns: 104px 92px 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2, rgba(15, 30, 70, .035));
  border-inline-start: 3px solid var(--border);
  font-size: .78rem;
}
@media (max-width: 560px) {
  .att-row { grid-template-columns: 84px 78px 1fr; gap: 7px; font-size: .74rem; }
}
.att-row .d {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--text-faint);
  white-space: nowrap;
}
.att-row .s {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  white-space: nowrap;
}
.att-row .s svg { width: 13px; height: 13px; flex: 0 0 13px; }
.att-row .n {
  color: var(--text-faint);
  font-size: .72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-row .n.faint { opacity: .45; }

.att-row.present { border-inline-start-color: var(--green-500); }
.att-row.present .s { color: var(--green-600); }
.att-row.absent  { border-inline-start-color: var(--red-500);   background: var(--red-100); }
.att-row.absent .s  { color: var(--red-600); }
.att-row.late    { border-inline-start-color: var(--amber-500); }
.att-row.late .s    { color: var(--amber-600); }
.att-row.excused { border-inline-start-color: var(--teal-500); }
.att-row.excused .s { color: var(--teal-600, var(--teal-500)); }

@media print {
  .att-ledger { max-height: none; overflow: visible; }
  .att-row { break-inside: avoid; }
}
