/* ============ Attendance page (.pg-attendance) ============ */

.pg-attendance .att-stats { margin-bottom: 16px; }

/* percentage colour coding: green >=85, amber 80–85, red <80 */
.pg-attendance .att-c-ok   { color: var(--success); }
.pg-attendance .att-c-warn { color: var(--warning); }
.pg-attendance .att-c-low  { color: var(--danger); }
.pg-attendance .att-c-none { color: var(--muted); }

/* 80% rule note */
.pg-attendance .att-note {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--gold-50);
  border-left: 4px solid var(--gold);
  margin-bottom: 16px; font-size: 13px;
}
.pg-attendance .att-note svg { width: 22px; height: 22px; color: var(--gold-dark); flex: none; margin-top: 1px; }

/* status colours shared by mini-bar segments + legend dots */
.pg-attendance .b-present { background: var(--success); }
.pg-attendance .b-late    { background: var(--gold); }
.pg-attendance .b-absent  { background: var(--danger); }
.pg-attendance .b-excused { background: var(--n-300); }

/* ----- student course cards ----- */
.pg-attendance .att-course {
  border-left: 4px solid var(--cc, var(--brand));
  cursor: pointer; transition: box-shadow .15s ease, transform .15s ease;
}
.pg-attendance .att-course:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.pg-attendance .att-course:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pg-attendance .att-course-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.pg-attendance .att-pct { font-size: 24px; font-weight: 800; line-height: 1.1; margin-bottom: 3px; }

.pg-attendance .att-bar {
  display: flex; height: 10px; border-radius: 99px; overflow: hidden;
  background: var(--line); margin-top: 14px;
}
.pg-attendance .att-bar span { display: block; height: 100%; }
.pg-attendance .att-legend {
  display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 10px; color: var(--muted);
}
.pg-attendance .att-legend .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px;
}

/* ----- staff: date bar + class cards ----- */
.pg-attendance .att-datebar { padding: 14px 20px; margin-bottom: 16px; }
.pg-attendance .att-datebar .input { width: auto; }
.pg-attendance .att-class { border-left: 4px solid var(--cc, var(--brand)); }

/* ----- staff: register roster ----- */
.pg-attendance .att-reg-tools { margin-bottom: 4px; }
.pg-attendance .att-row {
  display: flex; gap: 12px; align-items: center; padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.pg-attendance .att-row:last-child { border-bottom: 0; }

/* .att-row is not a .list-row, so give the shared list classes the same
   look here (app.css only styles them under .list-row). Keeps names/rolls
   on the left and the P/L/A/E toggles flush right on every row. */
.pg-attendance .att-row .list-main { flex: 1; min-width: 0; }
.pg-attendance .att-row .list-title { font-weight: 700; font-size: 13.5px; }
.pg-attendance .att-row .list-sub { font-size: 12px; color: var(--muted); }

.pg-attendance .att-toggle { display: flex; gap: 6px; flex: none; }
.pg-attendance .att-toggle button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-weight: 800; font-size: 12px;
  cursor: pointer; font-family: inherit; transition: background .12s ease, color .12s ease;
}
.pg-attendance .att-toggle button:hover { border-color: var(--indigo-3); color: var(--text); }
.pg-attendance .att-toggle .t-present.active { background: var(--success); border-color: var(--success); color: #fff; }
.pg-attendance .att-toggle .t-late.active    { background: var(--gold);    border-color: var(--gold);    color: var(--indigo); }
.pg-attendance .att-toggle .t-absent.active  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.pg-attendance .att-toggle .t-excused.active { background: var(--n-500);  border-color: var(--n-500);  color: #fff; }

/* ----- staff: summary table ----- */
.pg-attendance .att-sum tr.att-low td { background: rgba(194,38,79,.055); }

/* ----- mobile ----- */
@media (max-width: 540px) {
  .pg-attendance .att-row { flex-wrap: wrap; }
  .pg-attendance .att-row .att-toggle {
    width: 100%; margin-left: 48px; justify-content: flex-start;
  }
  .pg-attendance .att-pct { font-size: 21px; }
}

/* ---------- Denning records (a tile per category, subjects, every class) ---------- */
.pg-attendance .b-online { background: var(--p-300); }
.pg-attendance .b-leave  { background: var(--g-200); }
.pg-attendance .b-bunk   { background: color-mix(in srgb, var(--danger) 55%, var(--card)); }
/* a subject the records give totals for but no classes: not clickable */
.pg-attendance .att-rec { cursor: default; }
.pg-attendance .att-rec:hover { box-shadow: var(--shadow-xs); transform: none; }
.pg-attendance .att-notice { margin-bottom: 14px; color: var(--text-2); border-left: 3px solid var(--warning); }

/* as many tiles as the records have categories: 2 a row on a phone, all in one on a wide screen */
.pg-attendance .att-stats-rec { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.pg-attendance .att-cat .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px;
}

.pg-attendance .att-hist { margin-top: 16px; }
.pg-attendance .att-hist .card-title .input { width: auto; max-width: 100%; }
.pg-attendance .att-h-date { white-space: nowrap; }
.pg-attendance .att-h-narrow { display: none; }
@media (max-width: 540px) {
  .pg-attendance .att-h-wide { display: none; }
  .pg-attendance .att-h-narrow { display: table-cell; }
  .pg-attendance .att-hist-table td, .pg-attendance .att-hist-table th { padding-left: 12px; padding-right: 12px; }
}

/* the doughnut: each category's share of the classes, the figure in the middle (the Denning app's attendance chart) */
.pg-attendance .att-ring-stat { display: flex; align-items: center; gap: 14px; }
.pg-attendance .att-ring {
  position: relative; width: 74px; height: 74px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
}
.pg-attendance .att-ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.pg-attendance .att-ring span { position: relative; font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.pg-attendance .att-ring-stat .stat-sub { margin-top: 2px; }
.pg-attendance .att-back { margin-bottom: 10px; }
.pg-attendance .att-ring-stat { grid-column: span 2; }

/* --- motion: each course's bar draws itself left to right as the page arrives --- */
@media (prefers-reduced-motion: no-preference) {
  .pg-attendance .att-bar { animation: attDraw .9s var(--ease-out) .18s both; }
}
@keyframes attDraw { from { clip-path: inset(0 100% 0 0 round 99px); } to { clip-path: inset(0 0 0 0 round 99px); } }
.pg-attendance .att-course, .pg-attendance .att-class { transition: box-shadow var(--d-ui) var(--ease-out), transform var(--d-ui) var(--ease-out); }

/* ----- on campus: the campus machines (entrance + classroom scans) ----- */
.pg-attendance .att-campus { margin-bottom: 16px; }
.pg-attendance .att-campus-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pg-attendance .att-campus-head h3 { margin: 0; }
.pg-attendance .att-campus-today { font-size: 15px; }
.pg-attendance .att-campus-figs { margin-top: 6px; }
.pg-attendance .att-campus-figs b { color: var(--text); }
.pg-attendance .att-campus-empty { margin: 12px 0 0; }
.pg-attendance .att-scans { list-style: none; margin: 12px 0 0; padding: 0; }
.pg-attendance .att-scans li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line); }
.pg-attendance .att-scan-main { min-width: 0; }
.pg-attendance .att-scan-subj { font-weight: 600; line-height: 1.3; }
.pg-attendance .att-scans .badge { flex: none; }
.pg-attendance .att-campus-more { margin-top: 6px; }
/* Today's classes from the card-reader screens (31 Oct 2026): Bunk until the card is tapped in that class */
.pg-attendance .att-day { margin-top: 14px; }
.pg-attendance .att-day-head { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pg-attendance .att-day-list { margin-top: 6px; }
.pg-attendance .att-day-hint { margin: 6px 0 0; }

/* Phone taps (2 Nov 2026): Tap to mark attendance, here and under the e-card on My Profile (js/pages/attendance.js App.phoneTap) */
.pg-attendance .att-tap { margin-bottom: 16px; }
.pg-attendance .att-tap h3 { margin: 0 0 4px; }
.att-tap-slot { margin-top: 12px; }
.att-tap-btn { width: 100%; min-height: 48px; font-size: 15px; }
.att-tap-out { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); display: grid; gap: 2px; justify-items: start; }
.att-tap-out b { font-size: 16px; }
.att-tap-out span { font-size: 13.5px; color: var(--text-2); }
.att-tap-out .att-tap-cancel { margin-top: 8px; }
.att-tap-out.tone-ok { background: var(--success-tint); border-color: transparent; }
.att-tap-out.tone-ok b { color: var(--success); }
.att-tap-out.tone-warn { background: var(--warning-tint); border-color: transparent; }
.att-tap-out.tone-warn b { color: var(--warning); }
.att-tap-out.tone-bad { background: var(--danger-tint); border-color: transparent; }
.att-tap-out.tone-bad b { color: var(--danger); }
