/* =========================================================
   Teacher dashboard and student "My classes" pages
   ========================================================= */
.thead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.thead h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin-top: .4rem; }
.tnotice { max-width: 560px; margin: 2rem auto; text-align: center; }
.tnotice a { color: var(--purple); text-decoration: underline; }
.tmuted { color: var(--ink-soft); font-size: .9rem; }
.tgrid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.tmain { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; min-width: 0; }
.btn--sm { padding: .5rem .95rem; font-size: .88rem; }
.btn--soft { background: var(--tint); color: var(--ink); border-color: transparent; }
.tdanger { color: #c0254f !important; }
.tlink { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; font-size: .85rem; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }
.tlink:hover { color: var(--ink); }

/* Class list */
.tclasses { position: sticky; top: 6rem; }
.tclasslist { list-style: none; padding: 0; display: grid; gap: .5rem; margin-bottom: 1.2rem; }
.tclass {
  width: 100%; text-align: left; display: grid; gap: .15rem;
  padding: .75rem .9rem; border-radius: 14px; border: 2px solid #efecfb; background: var(--white);
  font: inherit; color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s;
}
.tclass:hover { border-color: var(--purple); }
.tclass.is-on { border-color: var(--purple); background: #f6f3ff; }
.tclass strong { font-size: 1rem; }
.tclass span { font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.tclass--static { cursor: default; position: relative; }
.tclass--static:hover { border-color: #efecfb; }
.tclass--static .tlink { position: absolute; right: .9rem; top: .8rem; }
.tnewclass { border-top: 2px solid var(--tint); padding-top: 1rem; }

/* Empty states */
.tempty { text-align: center; padding: 2rem 1rem; }
.tempty__icon { font-size: 2.6rem; margin-bottom: .4rem; }
.tempty h2 { font-size: 1.4rem; margin-bottom: .4rem; }
.tempty p { color: var(--ink-soft); max-width: 460px; margin: 0 auto; }

/* Class header and code */
.tclasshead__top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.tclasshead h2 { font-size: 1.7rem; margin-bottom: .1rem; }
.tclasshead__btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.tcode {
  margin-top: 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.2rem; border-radius: 18px; background: linear-gradient(135deg, #f3efff, #eaf5ff);
}
.tcode__label { display: block; font-size: .82rem; font-weight: 700; color: var(--ink-soft); margin-bottom: .2rem; }
.tcode__code { font-family: "Courier New", monospace; font-size: 2rem; letter-spacing: .25em; color: var(--purple); user-select: all; }
.tcode__btns { display: flex; gap: .5rem; }

/* Tabs */
.ttabs { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.ttabs [data-tab] {
  padding: .6rem 1rem; border-radius: 999px; border: 2px solid #e4e1f5; background: var(--white);
  font: inherit; font-weight: 800; font-size: .9rem; color: var(--ink-soft); cursor: pointer;
}
.ttabs [data-tab].is-on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.ttabs .spacer { flex: 1; }

/* Tables */
.ttable-wrap { overflow-x: auto; }
.ttable { width: 100%; border-collapse: collapse; font-size: .92rem; }
/* Headings may wrap onto two lines, so long Welsh headings don't make the table wider than the page */
.ttable th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: .5rem .6rem; border-bottom: 2px solid var(--tint); white-space: normal; vertical-align: bottom; min-width: 4.5rem; line-height: 1.25; }
.ttable th small { text-transform: none; letter-spacing: 0; font-weight: 600; }
.ttable td { padding: .6rem; border-bottom: 1px solid #f1eff9; vertical-align: middle; }
.ttable tbody tr:hover { background: #fbfaff; }
.tstudent { display: inline-flex; align-items: center; gap: .55rem; background: none; border: 0; font: inherit; font-weight: 800; color: var(--ink); cursor: pointer; padding: 0; }
.tstudent:hover span { text-decoration: underline; }
.tstudent .avatar { width: 30px; height: 30px; font-size: .85rem; }
.pillcount, .pct { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-weight: 800; font-size: .85rem; background: var(--tint); }
.pillcount.is-good, .pct.is-good { background: #e6faf5; color: #0b8a72; }
.pct.is-mid { background: #fff4e0; color: #a35b00; }
.pct.is-low { background: #ffeef3; color: #c0254f; }

.ttable--grid th, .ttable--grid td { text-align: center; }
.ttable--grid th:first-child, .ttable--grid td:first-child { text-align: left; font-weight: 800; }
.cell { color: #c9c6dc; font-weight: 800; }
.cell--done { color: #0b8a72; background: #f2fcf9; }
.cell--part { color: #a35b00; background: #fff8ec; }
.state { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-weight: 800; font-size: .8rem; white-space: nowrap; }
.state--complete { background: #e6faf5; color: #0b8a72; }
.state--started { background: #fff4e0; color: #a35b00; }
.state--not-started { background: #f3f2f8; color: var(--ink-soft); }

/* Set work list */
.twork { border: 2px solid #efecfb; border-radius: 18px; margin-bottom: .8rem; overflow: hidden; }
.twork summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; cursor: pointer; list-style: none; flex-wrap: wrap; }
.twork summary::-webkit-details-marker { display: none; }
.twork[open] summary { background: #fbfaff; border-bottom: 2px solid #efecfb; }
.twork__main strong { display: block; font-size: 1.05rem; }
.twork__meta { font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.twork__bar { display: grid; gap: .3rem; min-width: 200px; font-size: .82rem; font-weight: 800; color: var(--ink-soft); text-align: right; }
.twork__track { height: 10px; border-radius: 999px; background: #eeecf8; overflow: hidden; }
.twork__track span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .8s cubic-bezier(.22, 1, .36, 1); }
.twork__body { padding: 1rem 1.2rem 1.2rem; display: grid; gap: .9rem; }
.twork__body > .tlink { justify-self: start; }
.twork__note { font-style: italic; color: var(--ink-soft); }
.twork__chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip2 { padding: .3rem .7rem; border-radius: 999px; background: var(--tint); font-size: .82rem; font-weight: 700; }

.due { font-size: .82rem; font-weight: 800; color: var(--ink-soft); }
.due--soon { color: #a35b00; }
.due--late { color: #c0254f; }
.due--done { color: #0b8a72; }
.due--none { font-weight: 700; }

/* Strengths and weak spots */
.tmeters { display: grid; gap: .7rem; }
.tmeter { display: grid; grid-template-columns: minmax(140px, 220px) 1fr 3.2rem auto; gap: .9rem; align-items: center; }
.tmeter__name { font-weight: 800; }
.tmeter__name small { display: block; font-weight: 600; color: var(--ink-soft); font-size: .78rem; }
.tmeter__track { height: 12px; border-radius: 999px; background: #eeecf8; overflow: hidden; }
.tmeter__track b { display: block; height: 100%; border-radius: inherit; }
.tmeter__track b.is-good { background: var(--teal); }
.tmeter__track b.is-mid { background: var(--orange); }
.tmeter__track b.is-low { background: var(--pink); }
.tmeter em { font-style: normal; font-weight: 800; text-align: right; }

/* Dialogs */
.tdialog { margin: auto; width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); border: 0; border-radius: 24px; padding: 0; box-shadow: var(--shadow-lg); color: var(--ink); }
.tdialog::backdrop { background: rgba(29, 27, 58, .45); backdrop-filter: blur(3px); }
.tdialog[open] { display: flex; flex-direction: column; }
.tdialog .form { display: flex; flex-direction: column; gap: 0; max-height: inherit; min-height: 0; }
.tdialog__head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.5rem; border-bottom: 2px solid var(--tint); }
.tdialog__head h2 { font-size: 1.4rem; display: flex; align-items: center; gap: .6rem; }
.tdialog__x { border: 0; background: var(--tint); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.tdialog__body { padding: 1.2rem 1.5rem; overflow-y: auto; display: grid; gap: 1rem; grid-auto-rows: max-content; align-content: start; }
.tdialog__body h3 { font-size: 1.05rem; margin-top: .4rem; }
.tdialog__foot { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.5rem; border-top: 2px solid var(--tint); flex-wrap: wrap; }
.tdialog__foot .btn { width: auto; }
.tdialog__count { flex: 1; font-weight: 800; color: var(--ink-soft); font-size: .9rem; }
.tdialog__foot .formmsg { flex-basis: 100%; order: -1; }
.tform2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }

.tpick { border: 2px solid #efecfb; border-radius: 16px; padding: 1rem; }
.tpick__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.tpick__head h3 { margin: 0; }
.tpick__head input { padding: .5rem .8rem; border: 2px solid #e4e1f5; border-radius: 10px; font: inherit; max-width: 200px; }
.tpick__hint { color: var(--ink-soft); font-size: .82rem; margin: .3rem 0 .6rem; }
.tunit { margin-top: .5rem; }
.tunit summary { font-weight: 800; cursor: pointer; padding: .3rem 0; }
.tunit__count { color: var(--purple); }
.tunit__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem; padding: .4rem 0 .4rem .2rem; }
.tcheck { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border-radius: 10px; cursor: pointer; font-size: .9rem; font-weight: 600; }
.tcheck:hover { background: var(--tint); }
.tcheck input { width: 1.05rem; height: 1.05rem; accent-color: var(--purple); flex-shrink: 0; }
.tcheck:has(input:checked) { background: #f1edff; font-weight: 800; }

.stats--small { grid-template-columns: repeat(4, 1fr); }
.stats--small strong { font-size: 1.5rem; }
.sdlist { list-style: none; padding: 0; display: grid; gap: .4rem; }
.sdlist li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem .8rem; border-radius: 12px; background: #fbfaff; font-weight: 700; }
.sdlist small { display: block; font-weight: 600; color: var(--ink-soft); font-size: .8rem; }
/* Pupil progress grouped by unit and topic heading */
.tdialog__body { grid-template-columns: minmax(0, 1fr); } /* long lines wrap instead of widening the dialog */
.sdunits { display: grid; gap: .6rem; }
.sdunit .tgroup__meta { white-space: normal; }
.sdunit { border: 2px solid #efecfb; border-radius: 16px; }
.sdunit[open] { border-color: #ddd7f6; }
.sdunit > summary { list-style: none; display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: .7rem; padding: .75rem 1rem; cursor: pointer; border-radius: 14px; }
.sdunit > summary::-webkit-details-marker { display: none; }
.sdunit > summary:hover { background: #faf9ff; }
.sdunit[open] > summary .tgroup__chev { transform: rotate(180deg); }
.sdunit .tgroups { padding: 0 .8rem .8rem; }
.sdunit .tgroup > summary { grid-template-columns: auto 1fr auto auto auto; }
.sdsubs { padding: 0 .8rem .7rem; gap: .3rem; }
.sdsub--new { opacity: .55; }
.sdsub--done { box-shadow: inset 4px 0 0 #19c39a; }
.sdsub__dash { font-weight: 800; color: var(--ink-soft); padding: 0 .55rem; }
@media (max-width: 640px) {
  .sdunit > summary { grid-template-columns: 1fr auto auto; }
  .sdunit > summary .tgroup__meta { grid-column: 1; grid-row: 2; }
  .sdunit .tgroup > summary { grid-template-columns: auto 1fr auto auto; }
  .sdunit .tgroup__meta { grid-column: 2; grid-row: 2; }
}
.sdlist .due { margin-left: .4rem; }

/* Student: set work */
.codeinput { font-family: "Courier New", monospace; font-size: 1.4rem !important; letter-spacing: .25em; text-transform: uppercase; }
.hwfilter { display: flex; gap: .4rem; }
.hwfilter button { padding: .55rem 1rem; border-radius: 999px; border: 2px solid #e4e1f5; background: var(--white); font: inherit; font-weight: 800; color: var(--ink-soft); cursor: pointer; }
.hwfilter button.is-on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.hwcard { display: grid; gap: .8rem; margin-bottom: 1rem; }
.hwcard.is-done { border-color: #bfeee2; }
.hwcard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.hwcard__head h2 { font-size: 1.3rem; margin: 0; }
.hwcard__bar { display: flex; align-items: center; gap: .8rem; }
.hwcard__bar .twork__track { flex: 1; }
.hwitems { list-style: none; padding: 0; display: grid; gap: .4rem; }
.hwitems li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem .9rem; border-radius: 12px; background: #fbfaff; flex-wrap: wrap; }
.hwitems a { font-weight: 800; color: var(--purple); }
.hwitems a:hover { text-decoration: underline; }
.hwitems span { font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.hwitems li.is-done { background: #f2fcf9; }
.hwitems li.is-done span { color: #0b8a72; }

@media (max-width: 900px) {
  .tgrid { grid-template-columns: minmax(0, 1fr); }
  .tclasses { position: static; }
  .stats--small { grid-template-columns: repeat(2, 1fr); }
  .tmeter { grid-template-columns: 1fr 3rem; }
  .tmeter__track { grid-column: 1 / -1; grid-row: 2; }
  .tmeter .tlink { grid-column: 1 / -1; justify-self: start; }
  .tform2 { grid-template-columns: 1fr; }
  .twork__bar { min-width: 0; width: 100%; text-align: left; }
}

/* "Working must be shown" switch and tags */
.tswitch { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; border: 2px solid #efecfb; border-radius: 16px; cursor: pointer; }
.tswitch:has(input:checked) { border-color: var(--purple); background: #f6f3ff; }
.tswitch input { position: absolute; opacity: 0; pointer-events: none; }
.tswitch__track { flex-shrink: 0; width: 44px; height: 26px; border-radius: 999px; background: #dcd9ec; position: relative; transition: background .2s; margin-top: .1rem; }
.tswitch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.tswitch input:checked + .tswitch__track { background: var(--purple); }
.tswitch input:checked + .tswitch__track::after { transform: translateX(18px); }
.tswitch input:focus-visible + .tswitch__track { box-shadow: 0 0 0 4px rgba(108, 76, 245, .25); }
.tswitch strong { display: block; }
.tswitch small { display: block; color: var(--ink-soft); font-size: .82rem; margin-top: .15rem; line-height: 1.45; }
.worktag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: #f1edff; color: var(--purple); font-size: .78rem; }
.worknote { background: #f6f3ff; border-radius: 12px; padding: .65rem .9rem; font-size: .9rem; }
.thcut { display: inline-block; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* =========================================================
   Admin page
   ========================================================= */
.adm__sub { color: var(--ink-soft); margin-top: .3rem; }
.adm__stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .7rem; margin-bottom: 1.4rem; }
/* Icon and number side by side, the label underneath across the whole card (long Welsh words need the room) */
.adm__stat { background: var(--white); border: 2px solid #efecfb; border-radius: 18px; padding: .9rem 1rem; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon num" "label label"; gap: .25rem .5rem; align-items: center; box-shadow: var(--shadow); min-width: 0; }
.adm__stat-icon { grid-area: icon; font-size: 1.4rem; line-height: 1; }
.adm__stat b { grid-area: num; font-family: var(--font-head, inherit); font-size: 1.5rem; line-height: 1.1; }
.adm__stat-label { grid-area: label; font-size: .82rem; line-height: 1.3; color: var(--ink-soft); font-weight: 700; overflow-wrap: break-word; hyphens: auto; min-width: 0; }
.adm__tabs { margin-bottom: 1rem; }
.adm__panel { padding: 1.2rem; }
.adm__tools { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .8rem; }
.adm__tools input, .adm__tools select, .adm__inline { font: inherit; font-size: .92rem; padding: .55rem .8rem; border: 2px solid #e6e2f6; border-radius: 12px; background: var(--white); color: var(--ink); }
.adm__tools input { flex: 1 1 220px; min-width: 0; }
.adm__tools select { min-width: 0; max-width: 100%; } /* long Welsh options mustn't push it past the edge */
.adm__tools #csvBtn { margin-left: auto; }
.adm__inline { padding: .35rem .5rem; font-weight: 700; }
.adm__count { font-size: .85rem; color: var(--ink-soft); font-weight: 700; margin-bottom: .4rem; }
.adm__tablewrap { overflow-x: auto; }
.adm__table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.adm__table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: .5rem .6rem; border-bottom: 2px solid var(--tint); white-space: normal; vertical-align: bottom; min-width: 4.5rem; line-height: 1.25; }
.adm__table td { padding: .6rem; border-bottom: 1px solid #f1eff9; vertical-align: middle; }
.adm__table tbody tr:hover { background: #fbfaff; }
.adm__table tr.is-off td { opacity: .6; }
.adm__nowrap { white-space: nowrap; }
.adm__empty { text-align: center; color: var(--ink-soft); padding: 2rem !important; }
.adm__who { display: flex; align-items: center; gap: .6rem; min-width: 180px; }
.adm__who .avatar { width: 34px; height: 34px; flex: none; }
.adm__who strong { display: inline; }
.adm__who small { display: block; color: var(--ink-soft); font-size: .8rem; word-break: break-all; }
.adm__who--big .avatar { width: 64px; height: 64px; }
.adm__who--big strong { font-size: 1.2rem; }
.adm__you { background: var(--tint); color: var(--purple); border-radius: 99px; padding: .05rem .5rem; font-size: .72rem; font-weight: 800; }
.adm__tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }
.lvl { display: inline-block; border-radius: 99px; padding: .15rem .65rem; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.lvl--owner { background: var(--ink); color: var(--white); }
.lvl--admin { background: var(--purple); color: var(--white); }
.lvl--teacher { background: var(--teal); color: var(--white); }
.lvl--student { background: var(--tint); color: var(--purple); }
.lvl--on { background: #e6faf5; color: #0b8a72; }
.lvl--off { background: #ffeef3; color: #c0254f; }
.ttable th:empty, .adm__table th:empty { min-width: 0; } /* the empty heading over the buttons column needs no room */
.lvl--wait { background: #fff3d6; color: #9a5b00; white-space: normal; border-radius: 12px; max-width: 9rem; line-height: 1.3; }
/* New password shown to a teacher after a reset */
.sdpw { background: #e6faf5; border: 2px solid var(--teal); border-radius: 16px; padding: .8rem 1rem; display: grid; gap: .3rem; }
.sdpw p { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 700; }
.sdpw .btn { width: auto; }
.sdpw small { color: var(--ink-soft); }
.sdpw__code { font-family: "Courier New", monospace; font-size: 1.2rem; background: var(--white); padding: .15rem .5rem; border-radius: 8px; user-select: all; }
.tdialog__head h2 { flex-wrap: wrap; }
.adm__pending { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; background: #fff3d6; border: 2px solid var(--orange); border-radius: 18px; padding: .8rem 1rem; margin-bottom: 1rem; font-weight: 800; }
.adm__pending[hidden] { display: none; }
.adm__rowbtns { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; }
.adm__rowbtns .btn { width: auto; white-space: nowrap; }
.adm__pending .btn { width: auto; }
.lvl--plan { background: #fff4e0; color: #b35c00; }
.adm__card { background: #fbfaff; border-radius: 18px; padding: 1rem; }
.adm__facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1rem; }
.adm__facts dt { font-size: .75rem; color: var(--ink-soft); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.adm__facts dd { margin: 0; font-weight: 800; }
.adm__h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.adm__mini { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; font-size: .9rem; }
.adm__mini li span { color: var(--ink-soft); font-size: .82rem; }
.adm__muted { color: var(--ink-soft); font-size: .9rem; }
.tdialog .form.adm__edit { display: grid; gap: .8rem; grid-auto-rows: max-content; max-height: none; }
.tdialog .adm__edit .btn { justify-self: start; width: auto; padding-left: 1.4rem; padding-right: 1.4rem; }
.adm__actions .btn { width: auto; }
.adm__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.adm__danger { color: #c0254f !important; border-color: #f5c2d0 !important; }
.adm__danger:hover { background: #ffeef3 !important; }
.adm__result { margin-top: .9rem; background: #e6faf5; border-radius: 14px; padding: .8rem 1rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-weight: 700; }
.adm__result small { flex-basis: 100%; color: var(--ink-soft); font-weight: 600; }
.adm__pw { font-size: 1.05rem; background: var(--white); padding: .2rem .6rem; border-radius: 8px; }
.adm__note { margin-top: 1rem; color: var(--ink-soft); font-size: .9rem; }
.adm__hint { color: var(--ink-soft); font-size: .8rem; }
.adm__small { width: min(560px, calc(100vw - 2rem)); }
.adm__levels { display: grid; gap: 1rem; }
.adm__levels > div { display: grid; grid-template-columns: 90px 1fr; gap: .8rem; align-items: start; }
.adm__levels p { margin: 0; }
.adm__audit { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.adm__audit li { padding: .55rem .2rem; border-bottom: 1px solid #f1eff9; font-size: .92rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: baseline; }
.adm__audit small { color: var(--ink-soft); }
.adm__audit time { margin-left: auto; color: var(--ink-soft); font-size: .8rem; white-space: nowrap; }
.adm__det summary { cursor: pointer; font-weight: 800; }
.adm__toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: var(--white); padding: .75rem 1.2rem; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow-lg); z-index: 1000; transition: opacity .5s, transform .5s; max-width: calc(100vw - 2rem); }
.adm__toast--bad { background: #c0254f; }
.adm__toast.is-gone { opacity: 0; transform: translate(-50%, 10px); }
@media (max-width: 640px) {
  .adm__facts { grid-template-columns: repeat(2, 1fr); }
  .adm__tools .btn, .adm__tools #csvBtn { margin-left: 0; width: 100%; }
  .adm__tools select { flex: 1 1 45%; }
  .adm__levels > div { grid-template-columns: 1fr; gap: .3rem; }
  .adm__stats { grid-template-columns: repeat(2, 1fr); }
}
.adm__edit .tform2 { grid-template-columns: 1fr 1.4fr; }
@media (max-width: 640px) { .adm__edit .tform2 { grid-template-columns: 1fr; } }

/* ===== Build a homework (29 Nov 2026) ===== */
#workDialog { width: min(1040px, calc(100vw - 2rem)); }
.tkind { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .4rem 0 1rem; }
.tkind__opt { display: flex; gap: .6rem; align-items: flex-start; border: 2px solid #e4e1f5; border-radius: 14px; padding: .7rem .8rem; cursor: pointer; }
.tkind__opt:has(input:checked) { border-color: var(--purple); background: var(--tint); }
.tkind__opt input { margin-top: .25rem; accent-color: var(--purple); }
.tkind__opt small, .topt small { display: block; color: var(--ink-soft); font-size: .8rem; font-weight: 600; }
.tbuild { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; }
.tbuild__browse, .tbuild__chosen, .tbuild__opts { border: 2px solid #efecfb; border-radius: 16px; padding: 1rem; min-width: 0; }
.tbuild__chosen h3, .tbuild__opts h3 { margin: 0 0 .5rem; }
.tbuild__list { max-height: 360px; overflow: auto; padding-right: .3rem; }
.tbuild__chosen { max-height: 470px; overflow: auto; }
.qtopic { margin: .15rem 0 .15rem .6rem; }
.qtopic > summary { cursor: pointer; font-weight: 700; padding: .25rem 0; }
.qlist { list-style: none; margin: .2rem 0 .5rem; padding: 0; display: grid; gap: .25rem; }
.qlist li { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: 10px; background: #faf9ff; font-size: .9rem; }
.qlist li > span:first-child { flex: 1; min-width: 0; }
.qlist__random { background: #fff6e6 !important; }
.hwq { margin: 0; padding-left: 1.6rem; display: grid; gap: .35rem; }
.hwq li { padding: .35rem .2rem; border-bottom: 1px dashed #ece9f8; }
.hwq li::marker { font-weight: 800; color: var(--purple); }
.hwq li { display: list-item; }
.hwq__text { display: inline-flex; flex-direction: column; vertical-align: middle; max-width: calc(100% - 6rem); }
.hwq__text small[data-ph] { color: var(--ink-soft); font-size: .75rem; font-weight: 700; }
.hwq__btns { float: right; display: inline-flex; gap: .1rem; }
.hwq__btns .tlink:disabled { opacity: .3; cursor: default; }
.hwq--view li { display: list-item; }
.hwq--view .pct { float: right; }
.tbuild__opts { margin-top: 1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.tbuild__opts h3 { grid-column: 1 / -1; }
.topt { border: 0; margin: 0; padding: 0; display: grid; gap: .5rem; align-content: start; }
.topt legend { font-weight: 800; margin-bottom: .3rem; padding: 0; }
.topt label { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.topt input[type=radio], .topt input[type=checkbox] { margin-top: .2rem; accent-color: var(--purple); flex: none; }
.topt input[type=number] { width: 4.2rem; padding: .15rem .35rem; border: 2px solid #e4e1f5; border-radius: 8px; font: inherit; }
.twork__tools { display: flex; justify-content: flex-end; margin-bottom: .6rem; }
.twork__actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .8rem; flex-wrap: wrap; }
@media (max-width: 820px) {
  .tkind, .tbuild, .tbuild__opts { grid-template-columns: 1fr; }
  .tbuild__list { max-height: 300px; }
}

/* Make pupil logins */
.tstudents__top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.tstudents__top p { margin: 0; }
.bulk__notes { font-size: .85rem; padding-left: 1.2rem; }
#bulkNames { width: 100%; font: inherit; padding: .6rem .8rem; border: 2px solid #e4e1f5; border-radius: 12px; resize: vertical; }
.bulk__btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.qlist .btn, .hwq .tlink, .tbuild .btn { width: auto; flex: none; margin: 0; }
.qlist li > span:first-child { flex: 1 1 auto; overflow-wrap: anywhere; }
/* Phones: the question name gets its own line, Preview and + Add go under it (longer Welsh labels squeezed it) */
@media (max-width: 520px) {
  .qlist li { flex-wrap: wrap; }
  .qlist li > span:first-child { flex-basis: 100%; }
  .qlist li > .tlink, .qlist__random > .btn { margin-left: auto; }
}
.hwq__btns { display: inline-flex; gap: .35rem; }

/* ===== Privacy, terms and schools pages ===== */
.policy { max-width: 860px; margin: 0 auto; padding-top: 1rem; }
.policy__tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.policy__tabs a { padding: .45rem 1rem; border-radius: 999px; border: 2px solid #e4e1f5; font-weight: 800; color: var(--ink); text-decoration: none; background: #fff; }
.policy__tabs a[aria-current="page"] { background: var(--purple); border-color: var(--purple); color: #fff; }
.policy__card h1 { margin-top: 0; }
.policy__card h2 { margin: 1.6rem 0 .5rem; font-size: 1.25rem; }
.policy__card p, .policy__card li { line-height: 1.6; }
.policy__card ul { padding-left: 1.2rem; display: grid; gap: .35rem; }
.policy__card a { color: var(--purple); font-weight: 700; overflow-wrap: anywhere; }
.policy__table th { text-align: left; width: 28%; vertical-align: top; }
.policy__table td { vertical-align: top; line-height: 1.5; }
.policy__card p { margin: 0 0 .9rem; }
.policy__card .tmuted { margin-bottom: 1.2rem; }
.adm__backup { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 14px; background: #fff8e6; }
.adm__backup p { margin: 0; flex: 1 1 320px; font-size: .9rem; }

/* Admin: access codes for the school pilot (30 Nov 2026) */
.adm__intro { margin: 0 0 1rem; color: var(--ink-soft); line-height: 1.5; }
.adm__codeform { display: grid; grid-template-columns: 2fr 1.3fr 1fr auto; gap: .7rem; align-items: end; margin-bottom: 1rem; }
.adm__codeform .field { margin: 0; }
.adm__codeform .btn { width: auto; white-space: nowrap; }
.adm__code { font-size: 1rem; letter-spacing: .06em; }
.adm__off td { opacity: .55; }
@media (max-width: 760px) { .adm__codeform { grid-template-columns: 1fr; } }
