@font-face {
  font-family: Manrope;
  src: url('/assets/manrope.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f5f5f2;
  --white: #fff;
  --text: #202c47;
  --muted: #526079;
  --line: #d3d9e3;
  --accent: #375cab;
  --selected: #ebf0fc;
  --camera: #192337;
  --gutter: clamp(1rem, 4vw, 2.75rem);
  --mono: ui-monospace, 'Liberation Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--page); color: var(--text); font: 1rem/1.55 Manrope, system-ui, sans-serif; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.25; font-weight: 800; }
h1 { font-size: clamp(1.75rem, 3vw, 2.125rem); letter-spacing: -.035em; }
h2 { font-size: 1.15rem; letter-spacing: -.018em; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(100%, 81rem); margin-inline: auto; padding-inline: var(--gutter); }
.icon { display: block; width: 1.125rem; height: 1.125rem; flex: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.skip { position: fixed; top: .5rem; left: .5rem; transform: translateY(-150%); z-index: 2; background: var(--white); padding: .6rem; }
.skip:focus { transform: none; }

.topbar { background: var(--text); color: var(--white); }
.head-inner { min-height: 4rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem 1rem; padding-block: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .72rem; line-height: 1.25; }
.brand > i { display: grid; place-items: center; width: 2.45rem; height: 2.45rem; background: #364967; color: #e2ebff; border-radius: .5rem; }
.brand > i .icon { width: 1.4rem; height: 1.4rem; }
.brand small { display: block; margin-top: .16rem; color: #c3cfe3; font-size: .76rem; }
.brand strong { font-size: 1.02rem; font-weight: 800; }
.workspace { flex: 1; }
.workspace.compact { max-width: 54rem; }
.main { min-width: 0; padding-block: clamp(1.65rem, 4vw, 2.8rem); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .12rem; }
.nav a, .logout .button { display: flex; align-items: center; justify-content: flex-start; gap: .55rem; min-height: 2.75rem; padding: .4rem .6rem; border: 1px solid transparent; border-radius: .25rem; color: var(--text); font-size: .875rem; font-weight: 750; text-decoration: none; text-align: left; }
.topbar .nav a, .topbar .quiet { color: #e1e8f6; }
.topbar .nav a:hover, .topbar .nav a[aria-current], .topbar .quiet:hover { background: #344767; color: white; }
.topbar .nav a[aria-current] { border-bottom: 2px solid #abc7ff; }
.topbar :focus-visible { outline-color: #cfdeff; }
.nav a[aria-current] .icon { color: var(--accent); }
.logout { margin-left: .35rem; }
.logout .button { color: var(--muted); }

.page-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .65rem 1.5rem; margin-bottom: 1.35rem; }
.lead { color: var(--muted); max-width: 65ch; margin-top: .3rem; }
.sheet { min-width: 0; border: 1px solid var(--line); border-radius: .75rem; background: var(--white); }
.meeting-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .65rem; font-size: .875rem; }
.meeting-line .icon { color: var(--muted); }
.meeting-line time { font-weight: 750; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; color: var(--muted); font-size: .82rem; font-weight: 750; line-height: 1.35; }
.status::before { content: ''; flex: none; width: .4rem; height: .4rem; border: 1px solid currentColor; border-radius: 50%; }
.status.marked { color: var(--accent); }
.status.marked::before { background: currentColor; }
.page-heading .meeting-line .status { border-left: 1px solid var(--line); padding-left: .65rem; }

.station { min-width: 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--white); padding: .5rem; }
.station-actions { display: flex; justify-content: space-between; align-items: center; gap: .65rem 1rem; padding: .75rem .5rem .25rem; }
.finder { display: grid; place-items: center; min-height: 12rem; aspect-ratio: 16 / 9; overflow: hidden; background: var(--camera); isolation: isolate; border-radius: .48rem; }
.finder > * { grid-area: 1 / 1; }
.finder video { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.camera-mask { display: grid; grid-template: 1fr 1fr / 1fr 1fr; width: min(70%, 15rem); aspect-ratio: 1; pointer-events: none; color: #65728b; z-index: 1; }
.camera-mask i { width: 1.15rem; height: 1.15rem; border-top: 2px solid currentColor; border-left: 2px solid currentColor; }
.camera-mask i:nth-child(2) { justify-self: end; transform: rotate(90deg); }
.camera-mask i:nth-child(3) { align-self: end; transform: rotate(-90deg); }
.camera-mask i:nth-child(4) { justify-self: end; align-self: end; transform: rotate(180deg); }
.finder[data-camera='on'] .camera-mask { color: var(--white); }
.camera-placeholder { display: grid; justify-items: center; width: min(60%, 16rem); gap: .65rem; color: #e6eaf2; text-align: center; font-size: .92rem; }
.camera-placeholder .icon { width: 1.6rem; height: 1.6rem; color: #bbc4d6; }
.scan-result { align-self: stretch; justify-self: stretch; display: grid; align-content: center; justify-items: center; gap: .37rem; padding: 1rem; min-width: 0; background: var(--selected); color: var(--text); text-align: center; z-index: 2; pointer-events: none; }
.scan-result strong { max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.35rem, 4vw, 2.25rem); letter-spacing: -.035em; }
.result-mark { display: grid; place-items: center; margin-bottom: .3rem; width: 2.8rem; height: 2.8rem; border-radius: 50%; background: var(--accent); color: white; }
.result-mark .icon { width: 1.65rem; height: 1.65rem; }
@media (prefers-reduced-motion: no-preference) {
  .scan-result:not([hidden]) .result-mark { animation: confirm-mark 150ms ease-out; }
  @keyframes confirm-mark { from { transform: scale(.82); opacity: .5; } to { transform: none; opacity: 1; } }
}
.station-actions { min-height: 4rem; }
.station-actions .button { flex: none; }
.scan-feedback { color: var(--muted); overflow-wrap: anywhere; }
.scan-feedback[data-tone='ok'], .scan-feedback[data-tone='error'] { color: var(--accent); font-weight: 800; }
.noscript { padding: .65rem .9rem; }
.guide { margin-top: .5rem; }
.guide summary { cursor: pointer; padding: .7rem 0; min-height: 2.75rem; color: var(--muted); font-weight: 750; width: fit-content; }
.guide summary:hover { color: var(--accent); }
.guide p { padding-bottom: .7rem; color: var(--muted); max-width: 65ch; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.75rem; width: fit-content; max-width: 100%; border: 1px solid transparent; border-radius: .25rem; padding: .45rem .8rem; font-size: .875rem; font-weight: 800; line-height: 1.25; text-align: center; text-decoration: none; cursor: pointer; }
.primary { color: var(--white); background: var(--accent); }
.primary:hover:not(:disabled) { background: #28498d; }
.primary:disabled { background: #e7eaf0; color: var(--muted); cursor: not-allowed; }
.secondary { background: var(--white); border-color: #bac3d3; color: var(--accent); }
.quiet { background: transparent; color: var(--accent); }
.secondary:hover, .quiet:hover { background: var(--selected); }
.button:active:not(:disabled) { transform: translateY(1px); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.field, .login-form { display: grid; gap: .3rem; min-width: 0; }
label { display: block; color: var(--muted); font-size: .85rem; font-weight: 800; }
input:not([type='checkbox']), select { width: 100%; min-width: 0; min-height: 2.75rem; padding: .4rem .6rem; border: 1px solid #b5bece; border-radius: .25rem; color: var(--text); background: var(--white); }
input::placeholder { color: var(--muted); }
.notice { border-left: 3px solid var(--accent); background: var(--selected); color: var(--accent); padding: .65rem .8rem; margin-bottom: 1rem; font-weight: 750; }
.login-box { width: min(100%, 27rem); margin: clamp(1rem, 6vh, 4rem) auto; padding: clamp(1.2rem, 4vw, 2rem); background: white; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: .75rem; }
.login-form { border-top: 1px solid var(--line); padding-top: 1rem; }
.login-form button { margin-top: .5rem; }

.control-sheet, .section-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; padding: 1rem; }
.sheet .guide { padding-inline: 1rem; }
.control-sheet { border-left: 4px solid var(--accent); }
.control-sheet .meeting-line { margin-top: .45rem; }
.control-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .75rem; }
.check-label { display: flex; align-items: center; gap: .45rem; min-height: 2.75rem; }
.check-label input { width: 1rem; height: 1rem; flex: none; margin: 0; accent-color: var(--accent); }
.list-sheet + .list-sheet, .control-sheet + .list-sheet { margin-top: 1.1rem; }
.action-filter { display: flex; align-items: end; gap: .5rem; max-width: 100%; }
.action-filter .field { flex: 1; }
.ledger-metrics { display: flex; flex-wrap: wrap; gap: .85rem 1.65rem; padding: .8rem 1rem; border-top: 1px solid var(--line); }
.ledger-metrics dt { font-size: .85rem; color: var(--muted); }
.ledger-metrics dd { font: 750 clamp(1.05rem, 2.5vw, 1.35rem)/1.4 var(--mono); overflow-wrap: anywhere; }
.meeting-log { display: grid; list-style: none; border-top: 1px solid var(--line); padding: .35rem 1rem; }
.meeting-log li { min-height: 2.5rem; }
.meeting-log li + li { border-top: 1px solid var(--line); }
.meeting-log li > span:last-child { margin-left: auto; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 0 .8rem; padding-inline: 1rem; border-bottom: 1px solid var(--line); }
.filter-tabs a { min-height: 2.75rem; display: inline-flex; gap: .37rem; align-items: center; padding: .25rem .15rem; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-weight: 800; font-size: .875rem; }
.filter-tabs a[aria-current], .filter-tabs a:hover { color: var(--accent); border-color: var(--accent); }
.filter-tabs a .mono { font-size: .77rem; }
.list-filters { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 10rem); gap: .7rem; padding: .8rem 1rem; }
.records { width: 100%; border-collapse: collapse; text-align: left; }
.records td, .records th { border-top: 1px solid var(--line); padding: .52rem clamp(.45rem, 1.5vw, 1rem); vertical-align: middle; overflow-wrap: anywhere; }
.records th { background: var(--selected); color: var(--muted); font-size: .8rem; }
.records td { font-size: .88rem; }
.records td strong { font-weight: 750; }
.records td .secondary { border-color: transparent; text-align: left; justify-content: flex-start; padding-left: .25rem; }
.records tr:target { background: var(--selected); }
#payment-feedback:not(:empty) { padding: .35rem 0 .8rem; color: var(--accent); }
.empty { border-top: 1px solid var(--line); padding: 1rem; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: .3rem; }
.print-actions { margin-bottom: 1rem; }
.qr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.qr-grid svg { width: 100%; height: auto; display: block; }

@media (max-width: 767px) {
  .qr-grid { grid-template-columns: minmax(0, 1fr); }
  .records, .records tbody { display: block; }
  .records thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .records tr { display: block; border-top: 1px solid var(--line); padding-block: .45rem; }
  .records td { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; gap: .4rem; padding: .22rem 1rem; border: 0; }
  .records td::before { content: attr(data-label); color: var(--muted); font: 750 .82rem/1.35 Manrope, system-ui, sans-serif; }
  .records td.name-cell { display: block; font-size: 1rem; }
  .records td.name-cell::before { content: none; }
  .qr-grid svg { max-width: 21rem; }
}

@media (max-width: 460px) {
  .head-inner { flex-wrap: wrap; column-gap: .55rem; }
  .school-activity { padding-left: .55rem; }
  .top-label { display: none; }
  .nav a, .nav a[aria-current] { padding-inline: .37rem; }
  .nav a .icon { display: none; }
  .list-filters { grid-template-columns: minmax(0, 1fr); }
  .station-actions { flex-direction: column; align-items: stretch; }
  .station-actions .button { width: 100%; }
  .camera-mask { width: min(60%, 10rem); }
}

@media (prefers-reduced-motion: reduce) { .button:active:not(:disabled) { transform: none; } }

@media print {
  @page { margin: 10mm; }
  .print-page { background: white; min-height: auto; }
  .print-page .topbar, .print-page .page-heading, .print-actions, .skip { display: none; }
  .print-page .workspace, .print-page .main { width: 100%; margin: 0; padding: 0; }
  .qr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4mm; }
  .qr-grid svg { break-inside: avoid; page-break-inside: avoid; }
}
