/* ==========================================================================
   False Bay High School
   Homework and attendance pages — loaded only by the five pages that need it.
   ========================================================================== */

/* ---------- Sample-data bar ---------- */
.demo-bar {
  background: #FDF3D6; border-bottom: 1px solid #E6D08A; color: #5A4512;
  font-size: .88rem; line-height: 1.5; padding: 10px var(--gutter); text-align: center;
}
.demo-bar code { background: #fff; padding: .1em .4em; border-radius: 4px; font-size: .92em; }

.linkish {
  background: none; border: 0; font: inherit; color: var(--gold); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  /* Vertical padding only, so it still sits inside a sentence but is a large
     enough target on a phone. */
  display: inline-block; padding: 8px 2px;
}
.linkish:hover { color: var(--ink); }

/* ---------- Sign-in gate ---------- */
.gate { display: grid; place-items: center; padding: clamp(32px, 7vw, 80px) 0; }
.gate__card {
  background: #fff; border: 1px solid var(--slate-150); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: clamp(28px, 4vw, 44px); width: min(440px, 100%);
  text-align: center;
}
.gate__icon {
  display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px;
  border-radius: 50%; background: var(--gold-050); color: var(--gold);
}
.gate__icon svg { width: 26px; height: 26px; }
.gate__card h2 { font-size: 1.4rem; margin-bottom: .4em; }
.gate__card > p { color: var(--slate-500); font-size: .94rem; margin-bottom: 1.5em; }
.gate__form { text-align: left; }
.gate__form .btn { width: 100%; justify-content: center; }
.gate__msg { margin-top: 1em; font-size: .9rem; min-height: 1.2em; }
.gate__msg.is-error { color: #A32B17; }
.gate__msg.is-info  { color: var(--slate-700); }
.gate__reset { margin-top: 1.1em; font-size: .86rem; }

/* The gate markup wraps its caption in a span rather than a separate label. */
.field > span { font-size: .88rem; font-weight: 650; color: var(--ink); }

/* ---------- Staff page furniture ---------- */
.staff-bar {
  display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center;
  justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--slate-150);
  margin-bottom: 26px;
}
.staff-bar__who { font-size: .9rem; color: var(--slate-500); }
.staff-bar__who strong { color: var(--ink); }
.staff-bar__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  background: var(--cream); border: 1px solid var(--slate-150);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 26px;
}
.toolbar .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.toolbar .field input, .toolbar .field select { padding: .58em .8em; }
.toolbar__spacer { flex: 1 1 auto; }
.toolbar .btn { flex: none; }

.form-msg { margin-top: 1em; font-size: .92rem; min-height: 1.3em; }
.form-msg.is-error { color: #A32B17; }
.form-msg.is-ok    { color: var(--success); }
.form-msg.is-busy  { color: var(--slate-500); }

.empty {
  text-align: center; padding: clamp(36px, 7vw, 72px) 20px; color: var(--slate-500);
  border: 1px dashed var(--slate-300); border-radius: var(--radius); background: var(--cream);
}
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .35em; }

/* ---------- Homework list ---------- */
.hw-day { margin-bottom: 38px; }
.hw-day__head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 16px; border-bottom: 2px solid var(--gold-200);
}
.hw-day__head h2 { font-size: 1.24rem; margin: 0; }
.hw-day__head span { font-size: .82rem; color: var(--slate-500); }

.hw-card {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 8px 20px; align-items: start;
  padding: 16px 18px; border: 1px solid var(--slate-150); border-radius: var(--radius);
  background: #fff; margin-bottom: 12px;
}
.hw-card + .hw-card { margin-top: 0; }
.grade-chip {
  display: inline-grid; place-items: center; min-width: 84px; padding: .45em .7em;
  border-radius: 999px; background: var(--ink); color: var(--gold-200);
  font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.hw-card__body h3 { font-size: 1.02rem; margin: 0 0 .25em; }
.hw-card__body p { margin: 0; font-size: .96rem; line-height: 1.6; color: var(--slate-700); }
.hw-card__meta { font-size: .82rem; color: var(--slate-500); margin-top: .5em !important; }
.hw-card__note {
  margin-top: .6em !important; font-size: .88rem; color: var(--ink-500);
  border-left: 3px solid var(--gold-200); padding-left: .8em;
}
.hw-card__due {
  text-align: right; font-size: .8rem; color: var(--slate-500); white-space: nowrap;
}
.hw-card__due strong { display: block; font-size: .95rem; color: var(--ink); }
.hw-card__due.is-soon strong { color: #A32B17; }
.hw-card__actions { display: flex; gap: 8px; margin-top: .5em; justify-content: flex-end; }

.btn--tiny {
  /* A row-level button on a list of fifty learners is still a thing people
     tap on a phone, so it gets a real target rather than a text-sized one. */
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; font-size: .78rem; padding: .4em .9em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300); background: #fff; color: var(--slate-700);
  cursor: pointer; font-family: inherit; text-decoration: none; white-space: nowrap;
}
.btn--tiny:hover { border-color: var(--gold); color: var(--ink); }
.btn--tiny.is-danger:hover { border-color: #A32B17; color: #A32B17; }

/* ---------- Attendance register ---------- */
.att-grade { margin-bottom: 30px; }
.att-grade__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  border-bottom: 2px solid var(--gold-200); padding-bottom: 8px; margin-bottom: 4px;
}
.att-grade__head h3 { margin: 0; font-size: 1.08rem; }
.att-grade__head span { font-size: .82rem; color: var(--slate-500); }

.att-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--slate-150);
}
.att-row:hover { background: var(--cream); }
.att-row.is-absent { background: #FCF4F2; }
.att-row__name { font-weight: 600; font-size: .98rem; }
.att-row__detail { grid-column: 1 / -1; display: none; gap: 12px; }
.att-row.is-absent .att-row__detail { display: grid; grid-template-columns: minmax(180px, 220px) 1fr; }
.att-row__detail .field { margin: 0; }
.att-row__detail select, .att-row__detail input { padding: .5em .7em; font-size: .9rem; }

.tick {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: .86rem; color: var(--slate-500); user-select: none;
  padding: .45em .8em; border: 1.5px solid var(--slate-300); border-radius: 999px;
  min-height: 40px;
}
.tick input { width: 17px; height: 17px; accent-color: #A32B17; margin: 0; }
.att-row.is-absent .tick { border-color: #D49384; color: #A32B17; font-weight: 650; }

/* ---------- Reports ---------- */
.summary-grid {
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 30px;
}
.summary-tile {
  background: var(--cream); border: 1px solid var(--slate-150); border-radius: var(--radius);
  padding: 18px 20px;
}
.summary-tile b { display: block; font-family: var(--font-head); font-size: 1.85rem; color: var(--ink); line-height: 1.1; }
.summary-tile span { display: block; font-size: .82rem; color: var(--slate-500); margin-top: .3em; }

.report-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.report-table th, .report-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--slate-150);
  vertical-align: top;
}
.report-table thead th {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--slate-500); border-bottom: 2px solid var(--slate-300); white-space: nowrap;
}
.report-table tbody tr:hover { background: var(--cream); }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table .total-row td { font-weight: 700; border-top: 2px solid var(--slate-300); background: var(--sand); }
.dates-cell { font-size: .84rem; color: var(--slate-700); line-height: 1.7; }
.date-pill {
  display: inline-block; background: var(--sand); border-radius: 4px;
  padding: .1em .45em; margin: 0 .25em .25em 0; white-space: nowrap;
}
.date-pill.is-unexplained { background: #F6DED7; color: #7A2413; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Year calendar */
.year-cal { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cal-month {
  border: 1px solid var(--slate-150); border-radius: var(--radius); padding: 14px;
  background: #fff;
}
.cal-month h4 { margin: 0 0 .6em; font-size: .92rem; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-grid span {
  aspect-ratio: 1; display: grid; place-items: center; font-size: .72rem;
  border-radius: 4px; color: var(--slate-500); font-variant-numeric: tabular-nums;
}
.cal-grid .dow { font-size: .62rem; text-transform: uppercase; color: var(--slate-300); aspect-ratio: auto; }
.cal-grid .off { color: var(--slate-300); }
.cal-grid .school { background: var(--sand); color: var(--ink-500); }
.cal-grid .absent { background: #E4BBB0; color: #6B1F10; font-weight: 700; }
.cal-grid .absent-unex { background: #C4553B; color: #fff; font-weight: 700; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .82rem; color: var(--slate-500); margin: 18px 0 26px; }
.legend i { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* ---------- Learner admin ---------- */
.learner-row { display: grid; grid-template-columns: 1fr 90px 110px auto; gap: 12px; align-items: center;
  padding: 9px 12px; border-bottom: 1px solid var(--slate-150); font-size: .94rem; }
.learner-row.is-inactive { opacity: .5; }
.learner-row__name strong { font-weight: 650; }
.pill-status { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--slate-500); }

/* ---------- The letterhead that only shows when printing ---------- */
.print-head { display: none; }

@media print {
  /* The printed letterhead carries the title, so the on-screen page head
     (dark band, breadcrumb, standfirst) goes entirely. */
  .demo-bar, .toolbar, .staff-bar, .page-head, .btn, .btn--tiny,
  .no-print { display: none !important; }

  body { background: #fff; font-size: 10.5pt; }
  .section { padding-block: 0 !important; }
  .wrap { max-width: none; padding: 0 !important; }

  .print-head {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    border-bottom: 2px solid #000; padding-bottom: 8pt; margin-bottom: 14pt;
  }
  .print-head img { height: 34pt; width: auto; }
  .print-head div { text-align: right; font-size: 9pt; line-height: 1.4; }
  .print-head strong { display: block; font-size: 11pt; }

  h1 { font-size: 17pt; margin-bottom: 4pt; }
  h2 { font-size: 12.5pt; }
  h3 { font-size: 11pt; }

  .hw-card, .cal-month, .summary-tile, .empty {
    border: 1px solid #999 !important; box-shadow: none !important;
    break-inside: avoid; page-break-inside: avoid;
  }
  .hw-day { break-inside: avoid-page; }
  .report-table { font-size: 9pt; }
  .report-table thead { display: table-header-group; }
  .report-table tr { break-inside: avoid; page-break-inside: avoid; }
  .table-scroll { overflow: visible !important; }
  .year-cal { grid-template-columns: repeat(4, 1fr); gap: 8pt; }
  .cal-grid span { font-size: 6.5pt; }
  .cal-grid .school { background: #EDEDED !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal-grid .absent { background: #BEBEBE !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal-grid .absent-unex { background: #555 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grade-chip { background: none !important; color: #000 !important; border: 1px solid #000; }
  a[href]::after { content: ''; }
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .hw-card { grid-template-columns: 1fr; gap: 10px; }
  /* A chip stretched the full width of a one-column card reads as a banner;
     keep it the size of its text. */
  .hw-card .grade-chip { justify-self: start; }
  .hw-card__due { text-align: left; }
  .att-row.is-absent .att-row__detail { grid-template-columns: 1fr; }
  .learner-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .learner-row__grade, .learner-row__status { font-size: .8rem; color: var(--slate-500); }
  .toolbar { padding: 14px; }
  .toolbar .field { flex: 1 1 100%; }
  .staff-bar { flex-direction: column; align-items: flex-start; }
}

/* ---------- Tabs on the Administration page ---------- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  border-bottom: 2px solid var(--fbh-line, var(--slate-150));
}
.tab {
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  padding: 11px 20px; min-height: 46px;
  color: var(--slate-500); background: none; border: 0;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--ink); border-bottom-color: var(--gold); }
.tab:focus-visible { outline: 3px solid var(--gold-400); outline-offset: -3px; }
.tab-panel[hidden] { display: none; }
.learner-row__name small { color: var(--slate-500); font-weight: 400; }
