/* Attendance+ module: kiosk, ID cards, calendar, grid. Everything is prefixed at-. */

/* ---------- kiosk ---------- */
body.at-kiosk-body { background: #0c2f30; color: #e6f1ef; min-height: 100vh; }
.at-kiosk { max-width: 1280px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) clamp(12px, 3vw, 28px) 24px; }
.at-k-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.at-k-brand { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; }
.at-k-brand b { display: block; color: #fff; font-size: 1.05rem; }
.at-k-brand small { color: #9fc1bd; }
.at-k-clock { text-align: right; }
.at-k-clock b { display: block; font-size: 1.8rem; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.at-k-clock small { color: #9fc1bd; }
.at-k-flash { margin-bottom: 12px; }
.at-k-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .at-k-main { grid-template-columns: minmax(0, 1fr); } }
.at-k-video { position: relative; aspect-ratio: 4 / 3; background: #061c1d; border-radius: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); }
.at-k-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.at-k-frame { position: absolute; inset: 18% 24%; border: 3px solid rgba(232, 163, 61, .9); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.25); pointer-events: none; }
.at-k-idle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 20px; background: rgba(6, 28, 29, .82); }
.at-k-idle[hidden] { display: none; }
.at-k-idle p { margin: 0; color: #dcebe8; }
.at-k-manual { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 12px; }
.at-k-manual label { flex: 1 1 220px; color: #cfe0dd; }
.at-k-manual input { font-size: 1.15rem; letter-spacing: .06em; text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; }
.at-k-side { display: flex; flex-direction: column; gap: 14px; }
.at-k-result { border-radius: 16px; padding: 22px; background: #fff; color: var(--ink); min-height: 230px; border-left: 10px solid var(--ref); transition: background .2s; }
.at-k-result.k-in { border-left-color: var(--good); background: #f1fbf6; }
.at-k-result.k-out { border-left-color: var(--info); background: #f2f7fd; }
.at-k-result.k-repeat, .at-k-result.k-done { border-left-color: var(--accent); background: #fffaf0; }
.at-k-result.k-bad { border-left-color: var(--bad); background: #fff5f4; }
.at-k-result.flash-in { animation: at-pop .35s ease-out; }
@keyframes at-pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
.at-k-kind { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; color: var(--ink-2); }
.k-in .at-k-kind { color: var(--good); } .k-out .at-k-kind { color: var(--info); } .k-bad .at-k-big { color: var(--bad); }
.at-k-big { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; line-height: 1.15; letter-spacing: -.01em; margin: 4px 0; overflow-wrap: anywhere; }
.at-k-time { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; margin: 6px 0 12px; }
.at-k-mark { font-weight: 600; }
.at-k-recent { background: rgba(255,255,255,.06); border-radius: 12px; padding: 12px 14px; }
.at-k-recent h2 { color: #fff; font-size: .95rem; }
.at-k-recent ul.rows li { border-color: rgba(255,255,255,.08); color: #dcebe8; }
.at-k-recent .muted { color: #9fc1bd; }

/* ---------- ID cards ---------- */
body.at-cards-body { background: var(--bg); }
.at-cards-page { max-width: 1100px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 14px 40px; }
.at-cards-tools .card { margin-bottom: 14px; }
.at-colour { flex: 0 0 110px !important; }
.at-sheet { display: grid; grid-template-columns: repeat(auto-fill, 85.6mm); gap: 5mm; justify-content: center; }
.at-card { width: 85.6mm; max-width: 100%; height: 54mm; border-radius: 3.2mm; background: #fff; border: 1px solid #d6dcda; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); break-inside: avoid; page-break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.at-card header { background: var(--card, #0f3d3e); color: #fff; display: flex; align-items: center; gap: 2mm; padding: 1.8mm 3mm; font-size: 3mm; }
.at-card header img { width: 5mm; height: 5mm; background: #fff; border-radius: 1mm; padding: .4mm; }
.at-card header b { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-card header span { font-size: 2.3mm; letter-spacing: .12em; font-weight: 700; opacity: .85; }
.at-card-body { flex: 1; display: grid; grid-template-columns: 15mm minmax(0, 1fr) 24mm; gap: 2.5mm; padding: 2.5mm 3mm 1mm; align-items: center; min-height: 0; }
.at-photo { width: 15mm; height: 19mm; border-radius: 1.5mm; background: #e9efed; border: .3mm dashed #b9c4c0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 7mm; font-weight: 800; color: #8a9893; line-height: 1; }
.at-photo small { font-size: 1.8mm; letter-spacing: .1em; margin-top: 1mm; }
.at-card-info { display: flex; flex-direction: column; gap: .6mm; font-size: 2.6mm; color: var(--ink-2); min-width: 0; }
.at-card-name { font-size: 3.4mm; color: var(--ink); line-height: 1.15; overflow-wrap: anywhere; }
.at-card-school { font-size: 2.3mm; }
.at-card-no { font-size: 2.3mm; font-family: ui-monospace, Consolas, monospace; color: var(--muted); }
.at-card-qr { display: flex; flex-direction: column; align-items: center; gap: .6mm; }
.at-card-qr .at-qr { width: 23mm; height: 23mm; }
.at-card-qr code { font-size: 1.75mm; background: none; padding: 0; white-space: nowrap; letter-spacing: .02em; }
.at-card footer { font-size: 2mm; color: var(--muted); padding: 0 3mm 1.5mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-qr svg { width: 100%; height: 100%; display: block; }
.at-qr:empty { background: repeating-linear-gradient(45deg, #eef1ef 0 4px, #fff 4px 8px); }
@media print {
  @page { size: A4; margin: 7mm 10mm; }
  body.at-cards-body { background: #fff; }
  .at-cards-page { padding: 0; max-width: none; }
  .at-sheet { gap: 2mm 4mm; justify-content: start; grid-template-columns: repeat(2, 85.6mm); }
  .at-card { box-shadow: none; border-color: #bbb; }
}

/* admin student panel */
.at-student-grid { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.at-mini-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.at-mini-qr .at-qr { width: 120px; height: 120px; }
.at-mini-qr code { font-size: .78rem; }
.at-student-card .actions form { margin: 0; }
.at-student-grid > .grow { flex: 1 1 220px; min-width: 0; }
.at-student-card ul.rows li { flex-wrap: wrap; gap: 4px 10px; }
.at-student-card ul.rows li .grow { flex: 1 1 140px; }
body.at-cards-body { min-height: 100vh; }

/* parent home */
.at-av { width: 36px; height: 36px; font-size: .95rem; margin: 0; flex: none; }
.at-upcoming { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.at-upcoming .chip { white-space: normal; }
.at-chip-hol { background: var(--bad-bg); color: var(--bad); }
.at-chip-ev { background: var(--info-bg); color: var(--info); }

/* teacher */
.at-rep-row form { margin: 0; }
@media (max-width: 640px) { .at-rep-row { flex-wrap: wrap; } .at-rep-row .grow { flex-basis: 100%; } }

/* replacements */
.at-pick { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbfcfb; }
.at-pick label { font-weight: 400; align-items: flex-start; }
.at-pick input { margin-top: 4px; }
.at-multi { min-height: 140px; }
.at-scroll { max-height: 640px; overflow-y: auto; }

/* ---------- calendar ---------- */
.at-month-nav { align-items: center; }
.at-month-nav b { min-width: 9.5em; text-align: center; }
.legend i.at-l-hol { background: var(--bad-bg); border: 1px solid #f3b9b2; }
.legend i.at-l-ev { background: var(--info-bg); border: 1px solid #b9d3f0; }
.legend i.at-l-rep { background: var(--good-bg); border: 1px solid #b5e1cc; }
.at-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 16px; }
.at-cal-h { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 2px 4px; }
.at-cal-d { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 104px; padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; font-size: .75rem; }
.at-cal-d.at-empty { background: transparent; border-color: transparent; }
.at-cal-d.at-hol { background: #fff6f5; border-color: #f3c3bd; }
.at-cal-d.at-today-d { box-shadow: inset 0 0 0 2px var(--brand-2); }
.at-dn { font-weight: 700; color: var(--ink-2); }
.at-tag { display: block; border-radius: 4px; padding: 1px 5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-t-hol { background: var(--bad-bg); color: var(--bad); }
.at-t-ev { background: var(--info-bg); color: var(--info); }
.at-t-rep { background: var(--good-bg); color: var(--good); }
.at-cls { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-cls.at-off { text-decoration: line-through; color: var(--muted); }
.at-noclass { font-weight: 800; color: var(--bad); text-transform: uppercase; font-size: .66rem; letter-spacing: .05em; }
.at-dots { display: none; gap: 3px; }
.at-dots b { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.at-dot-hol { background: var(--bad); } .at-dot-cls { background: var(--brand-2); } .at-dot-rep { background: var(--good); } .at-dot-ev { background: var(--info); }
@media (max-width: 700px) {
  .at-cal { gap: 2px; }
  .at-cal-d { min-height: 46px; padding: 3px; align-items: center; }
  .at-cal-d .at-tag, .at-cal-d .at-cls, .at-cal-d .at-noclass { display: none; }
  .at-dots { display: flex; }
  .at-cal-h { text-align: center; font-size: .66rem; padding: 0; }
}
.at-agenda .at-ag-day { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #eef1ef; }
.at-agenda .at-ag-day:last-child { border-bottom: 0; }
.at-agenda .at-ag-day p { margin: 0 0 4px; }
.at-ag-date { width: 40px; flex: none; text-align: center; line-height: 1.1; }
.at-ag-date b { display: block; font-size: 1.25rem; }
.at-ag-date small { color: var(--muted); }
.at-ag-day.at-hol .at-ag-date b { color: var(--bad); }
.at-hlist { padding: 0 18px 8px !important; }
.at-hlist form { margin: 0; }

/* ---------- monthly grid ---------- */
.at-grid-wrap { max-width: 100%; }
table.at-grid { font-size: .8rem; width: auto; min-width: 100%; }
table.at-grid th, table.at-grid td { padding: 6px 4px; }
table.at-grid th.at-day { text-align: center; min-width: 26px; font-size: .72rem; }
table.at-grid th.at-day small { display: block; font-weight: 500; text-transform: none; }
table.at-grid th.at-we { background: #f2f4f3; }
table.at-grid th.at-cd { background: #e7f2f1; color: var(--brand-2); }
table.at-grid .at-hd { background: #fff3f2; }
table.at-grid td.at-cell { text-align: center; white-space: nowrap; }
.at-sticky { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 150px; max-width: 190px; white-space: normal !important; }
thead .at-sticky, tfoot .at-sticky { background: #fafbfa; }
.at-sticky small { display: block; }
.at-c { display: inline-block; width: 18px; height: 18px; line-height: 18px; border-radius: 4px; font-size: .7rem; font-weight: 800; text-align: center; margin: 0 1px; }
.legend .at-c { margin-right: 2px; }
.at-P { background: var(--good-bg); color: var(--good); }
.at-L { background: var(--warn-bg); color: var(--warn); }
.at-A { background: var(--bad-bg); color: var(--bad); }
.at-E { background: var(--info-bg); color: var(--info); }
.at-H { background: #f3e9e8; color: #a3655f; }
@media print { .at-grid-wrap { overflow: visible; } }
.filters input[type=month] { width: auto; flex: 0 1 200px; }
