:root {
  font: 16px/1.5 system-ui, sans-serif;
  color: #172b40;
  background: #f3f9fd;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem max(1rem, calc((100vw - 56rem) / 2));
  background: #fff;
  border-bottom: 1px solid #c8dced;
}
header a { color: #155a83; font-weight: 800; text-decoration: none; }
header span { font-size: 0.9rem; color: #506a7e; }
main { max-width: 56rem; margin: 1.5rem auto 3rem; padding: 0 1rem; }
h1 { font-size: clamp(1.55rem, 4vw, 2rem); margin: 0 0 0.4rem; }
h2, h3 { margin: 0 0 0.45rem; line-height: 1.25; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0.45rem 0 0.8rem; }
.muted { color: #526678; }
#notice { margin: 0 0 1rem; min-height: 1.5rem; }
#notice[data-error="true"] { color: #a02727; font-weight: 600; }
#auth, #account > section {
  background: #fff;
  border: 1px solid #c8dced;
  border-radius: 1rem;
  padding: 1.25rem;
  margin: 0 0 1.1rem;
}
#auth { max-width: 35rem; }
.auth-entry {
  padding: 1rem;
  margin: 0 0 1rem;
  border: 1px solid #c8dced;
  border-radius: 0.75rem;
  background: #eef8fe;
}
.auth-entry p { margin: 0 0 0.65rem; }
button, input, select { font: inherit; }
button {
  min-height: 44px;
  padding: 0.6rem 0.95rem;
  border: 1px solid #155a83;
  border-radius: 0.65rem;
  background: #155a83;
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(0.95); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.button-secondary, #show-sign-in {
  border-color: #b6cbdc;
  background: #fff;
  color: #174b70;
}
.button-danger { background: #fff; color: #a02727; border-color: #d8b2b2; }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible {
  outline: 3px solid #e3a12a;
  outline-offset: 3px;
}
label { display: block; margin: 0 0 0.35rem; font-weight: 620; }
input:not([type="checkbox"]), select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border: 1px solid #8da6b8;
  border-radius: 0.5rem;
  background: #fff;
  color: inherit;
}
.account-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.account-toolbar p { margin: 0; color: #526678; font-size: 0.92rem; }
.children-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 0 0.8rem;
  border-bottom: 1px solid #e0eaf2;
}
.children-heading p { margin: 0.35rem 0 0; max-width: 35rem; }
#add-student { flex-shrink: 0; min-height: 50px; padding: 0.7rem 1.15rem; }
.empty-state {
  padding: 1rem;
  margin: 1rem 0;
  background: #edf8ff;
  border: 1px dashed #a3cde2;
  border-radius: 0.7rem;
  color: #34546c;
}
.child-list { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; gap: 0.7rem; }
.child-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  background: #f4fbff;
  border: 1px solid #d2e7f3;
  border-radius: 0.75rem;
}
.child-label { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.report-table th, .report-table td { text-align: left; padding: 0.35rem 0.25rem; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.report-table .report-topic { font-weight: 700; padding-top: 0.75rem; }
.plan-warning { color: #b45309; font-weight: 600; }
.card-panel { text-align: center; }
.card-panel #card-qr svg { width: min(100%, 16rem); height: auto; background: #fff; }
.card-code { font: 700 1.1rem/1.6 ui-monospace, monospace; word-spacing: 0.5rem; overflow-wrap: anywhere; }
.child-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.child-actions button { min-width: 5rem; }
#consent-form {
  margin-top: 1rem;
  padding: 0.95rem;
  border: 1px solid #d3e2ec;
  border-radius: 0.75rem;
  background: #fbfdff;
}
#consent-form h3 { margin-bottom: 0.55rem; }
#parent-notice-details summary { cursor: pointer; color: #155a83; font-weight: 650; }
#parent-notice-details p { margin: 0.65rem 0; font-size: 0.91rem; line-height: 1.55; }
.consent-check { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0.7rem 0; font-weight: 500; }
.consent-check input { flex: none; margin: 0.28rem 0 0; width: 1.2rem; height: 1.2rem; }
#consent-status { margin: 0.6rem 0 0; }
#student-form {
  margin-top: 1rem;
  padding: 1rem;
  border: 2px solid #64a8ce;
  background: #f0faff;
  border-radius: 0.85rem;
}
#student-form p { margin-bottom: 0.8rem; }
.child-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.avatar-field { grid-column: 1 / -1; min-width: 0; }
.avatar-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.35rem 0.6rem; margin-bottom: 0.4rem; }
.avatar-label { font-weight: 700; }
.avatar-swipe-cue { color: #526678; font-size: 0.84rem; }
.avatar-strip {
  display: flex;
  gap: 0.65rem;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0.35rem 0.75rem;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: #a5bdca transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}
.avatar-option {
  position: relative;
  flex: 0 0 92px;
  min-width: 92px;
  min-height: 116px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.35rem 0.5rem;
  border: 2px solid #c5d8e4;
  border-radius: 0.85rem;
  background: #fff;
  color: #264c65;
  font-size: 0.875rem;
  line-height: 1.2;
  font-weight: 650;
  box-shadow: 0 2px 5px #0e365312;
}
.avatar-option img { display: block; width: 72px; height: 72px; border-radius: 19px; }
.avatar-option[aria-pressed="true"] {
  border-color: #1472a8;
  background: #e3f5ff;
  box-shadow: 0 0 0 2px #92d7f5, 0 3px 8px #1f5c7526;
}
.avatar-option .avatar-tick {
  position: absolute;
  top: 0.1rem;
  right: 0.15rem;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #116aa0;
  color: #fff;
  font-size: 0.77rem;
  opacity: 0;
}
.avatar-option[aria-pressed="true"] .avatar-tick { opacity: 1; }
.avatar-option:focus-visible { outline: 3px solid #e3a12a; outline-offset: 3px; }
.avatar-selected { margin: 0.2rem 0 0 !important; color: #245f83; font-size: 0.85rem; }
.child-avatar { display: block; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px; }
.child-identity { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
@media (prefers-reduced-motion: reduce) { .avatar-strip { scroll-behavior: auto; } }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.selected-child-panel {
  margin-top: 1rem;
  padding: 0.95rem;
  border-radius: 0.75rem;
  background: #f4f8fb;
}
.selected-child-panel label { margin-bottom: 0.5rem; }
#selected-student { max-width: 24rem; }
.selected-child-panel p { margin-bottom: 0; }
#progress-panel button { max-width: 100%; }
#data-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
#data-panel h2 { width: 100%; }
#deletion-pending { color: #a02727; font-weight: 650; }
@media (max-width: 40rem) {
  main { margin: 0.9rem auto 2rem; padding: 0 0.7rem; }
  #auth, #account > section { padding: 1rem; border-radius: 0.85rem; }
  .account-toolbar { align-items: flex-start; }
  .account-toolbar p { max-width: 65%; }
  .children-heading { flex-direction: column; align-items: stretch; }
  #add-student { width: 100%; }
  .child-fields { grid-template-columns: 1fr; gap: 0.65rem; }
  .avatar-option { flex-basis: 86px; min-width: 86px; }
  .child-list li { align-items: stretch; flex-direction: column; }
  .child-actions button { flex: 1; }
  #student-form { padding: 0.85rem; }
  .form-actions button { flex: 1; }
  #save-consent { width: 100%; }
}
