/*
  The Schedule section (DESIGN.md 5.2). Tokens come from ui/tokens.css and the
  shared components from ui/app.css; everything here is prefixed sch-.
  Colour that means something (a group's dot, a subject's swatch, a severity)
  always has words or a shape beside it.
*/

.sch {
  container-type: inline-size;
  padding: var(--s-5);
  background: var(--card);
  border: var(--border);
  border-radius: var(--r-2);
}

.sch .intro__first {
  margin-top: var(--s-2);
  font-size: var(--t-md);
  color: var(--ink-2);
}

.sch .tabs {
  margin-top: var(--s-4);
}

/* Above 900 px the nine tabs are one row. Beside the 320 px inspector they
   run short of room from about 1100 px down, so the padding between them
   falls first (to 2 px a side), then the type (14 px under 1000 px, 13 px
   under 925 px); the row scrolls sideways before it would wrap, as it does in
   larger type. Measured at 1100, 1001, 960, 925 and 901 px, 16 px type: the
   last tab was 45 px out of the row at 1100 px with the seven-tab padding. */
@media not all and (max-width: 900px) {
  .sch > .tabs > .tabs__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .sch > .tabs > .tabs__list > .tabs__tab {
    flex: none;
    padding: 0 clamp(2px, 8cqi - 42px, var(--s-3));
    white-space: nowrap;
  }
}

@media (min-width: 901px) and (max-width: 1000px) {
  .sch > .tabs > .tabs__list > .tabs__tab {
    font-size: var(--t-sm);
  }
}

@media (min-width: 901px) and (max-width: 925px) {
  .sch > .tabs > .tabs__list > .tabs__tab {
    font-size: 0.8125rem;
  }
}

.sch-lead {
  max-width: 46rem;
}

.sch-hint {
  margin-top: var(--s-1);
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: var(--lh-sm);
}

.sch-btn--small {
  min-height: 30px;
  padding: 0 var(--s-2);
  font-size: var(--t-sm);
}

.sch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.sch-scroll {
  margin-top: var(--s-4);
  overflow-x: auto;
}

.sch-empty {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  max-width: 34rem;
  padding: var(--s-5) 0;
}

.sch-empty__text {
  font-size: var(--t-lg);
  line-height: 1.4;
}

.sch-coming .sch-hint {
  margin-top: var(--s-3);
}

/* Marks and findings: a shape, a number and the word. */

.sch-mark {
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sch-mark--problem,
.sch-finding-line--problem .sch-finding-line__word {
  color: var(--problem);
}

.sch-mark--warning,
.sch-finding-line--warning {
  color: var(--warning);
}

.sch-mark--note,
.sch-finding-line--note .sch-finding-line__word {
  color: var(--note);
}

.sch-finding-line {
  margin-top: var(--s-1);
  font-size: var(--t-sm);
  line-height: var(--lh-sm);
}

.sch-finding-line--warning {
  color: var(--ink);
}

.sch-finding-line--warning::before {
  content: "▲ ";
  color: var(--warning);
}

.sch-slot__findings .sch-finding-line--warning::before {
  content: none;
}

.sch-finding-line--warning .sch-finding-line__word {
  color: var(--warning);
}

.sch-finding-line__word {
  font-weight: var(--w-semibold);
}

.sch-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
}

.sch-dot {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: var(--border-width) solid var(--line-strong);
}

/* Groups: the list, then the editor. */

.sch-groups__cols {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  align-items: start;
  gap: var(--s-5);
  margin-top: var(--s-4);
}

.sch-groups__side {
  display: grid;
  gap: var(--s-2);
}

.sch-groups__find {
  display: grid;
  gap: var(--s-2);
}

.sch-groups__tally {
  color: var(--ink-2);
  font-size: var(--t-sm);
}

/* "All groups" is for a phone whose list is folded to the chosen group (the
   end of this file). */
.sch-groups__all {
  display: none;
}

.sch-groups__list {
  display: grid;
  gap: var(--s-1);
  max-height: 60vh;
  padding: 2px;
  overflow-y: auto;
  list-style: none;
}

.sch-group {
  display: grid;
  gap: var(--s-1);
  width: 100%;
  padding: var(--s-2);
  border: var(--border);
  border-radius: var(--r-1);
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.sch-group:hover {
  border-color: var(--accent);
}

.sch-group[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sch-group__top {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.sch-group__name {
  min-width: 0;
  overflow: hidden;
  font-weight: var(--w-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-group__grade {
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.sch-group__marks {
  display: flex;
  gap: var(--s-2);
  margin-left: auto;
  font-size: var(--t-xs);
}

.sch-group__bars {
  display: grid;
  gap: 2px;
}

.sch-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.sch-bar--same {
  grid-template-columns: minmax(0, 1fr);
}

/* The day by day behind the one bar, as text for a touch or the keys; the
   title is for a mouse. */
.sch-bar__detail {
  display: none;
  color: var(--ink-2);
  font-size: var(--t-xs);
}

.sch-group:focus .sch-bar__detail,
.sch-group:focus-within .sch-bar__detail,
.sch-group[aria-selected="true"] .sch-bar__detail {
  display: block;
}

.sch-bar__track {
  height: 6px;
  border: var(--border-width) solid var(--line-strong);
  border-radius: 3px;
  background: var(--card);
  overflow: hidden;
}

.sch-bar__fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.sch-editor {
  min-width: 0;
}

.sch-editor__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.sch-editor__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-lg);
  line-height: var(--lh-lg);
}

.sch-editor__actions {
  display: flex;
  gap: var(--s-2);
}

.sch-editor__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: var(--s-3) var(--s-4);
  margin-top: var(--s-3);
}

.sch-editor__fields > .field:first-child {
  flex: 1 1 12rem;
}

.sch-colour__row,
.sch-colour__presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1);
}

.sch-colour__row {
  max-width: 24rem;
}

.sch-swatch {
  position: relative;
  width: 28px;
  height: 28px;
  border: var(--border-width) solid var(--line-strong);
  border-radius: var(--r-1);
}

.sch-swatch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sch-swatch:has(:checked) {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink);
}

.sch-swatch:has(:focus-visible) {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: 4px;
}

.sch-colour__custom {
  width: 44px;
  height: 30px;
  padding: 0;
  border: var(--border-width) solid var(--line-strong);
  border-radius: var(--r-1);
  background: var(--card);
  vertical-align: middle;
}

.sch-days {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--s-5);
  margin-top: var(--s-5);
}

.sch-day {
  min-width: 0;
}

.sch-day__head {
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.sch-day__title,
.sch-daytype__title,
.sch-checks__heading,
.sch-panel__title {
  font-size: var(--t-lg);
  line-height: var(--lh-lg);
}

.sch-day__line {
  margin-top: var(--s-1);
  font-size: var(--t-sm);
}

/* "Same as A Day": shown, greyed, and not editable until it is its own copy. */
.sch-day--same,
.sch-daytype--same {
  padding: var(--s-3);
  border: var(--border-width) dashed var(--line-strong);
  border-radius: var(--r-2);
  background: var(--paper);
}

.sch-slots--same,
.sch-bells--same {
  color: var(--ink-2);
}

.sch-slots {
  margin-top: var(--s-2);
  table-layout: fixed;
}

.sch-slots__period {
  width: 8.75rem;
}

.sch-slots__more {
  width: 2.5rem;
}

.sch-slots th,
.sch-slots td,
.sch-edit-table td,
.sch-bells td,
.sch-bells th {
  padding: var(--s-1) var(--s-1);
  vertical-align: top;
}

.sch-slots .field__input,
.sch-edit-table .field__input,
.sch-bells .field__input {
  height: 32px;
  font-size: var(--t-sm);
}

.sch-slot__period {
  font-weight: var(--w-semibold);
}

.sch-slot__name {
  display: inline-block;
  line-height: 32px;
}

.sch-slot__time {
  display: block;
  margin-left: 22px;
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-weight: var(--w-regular);
}

.sch-slot__extra {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: start;
  gap: var(--s-1);
  margin-top: var(--s-1);
}

.sch-slot__extra .field__input {
  height: 28px;
  font-size: var(--t-xs);
}

.sch-slots tbody th {
  font-size: var(--t-sm);
  letter-spacing: 0;
  text-transform: none;
}

.sch-slot__menu {
  width: 32px;
  height: 32px;
  font-weight: var(--w-bold);
}

.sch-slot .chips {
  margin-bottom: var(--s-1);
}

.sch-room--missing {
  border-style: dashed;
  border-color: var(--warning);
}

/* Under the field: the words that are not options (nothing matches, two
   rooms do, the building has no rooms yet). Empty, it takes no room. */
.sch-room__line {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: var(--lh-sm);
}

.sch-room__line:empty {
  display: none;
}

/* Under the field: what it holds is no room of the building. */
.sch-room__missing {
  margin-top: var(--s-1);
  color: var(--warning);
  font-size: var(--t-sm);
  line-height: var(--lh-sm);
}

.sch-slot[data-shown="true"] > *,
.sch-edit-table tr[data-shown="true"] > * {
  background: var(--accent-soft);
  box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);
}

.sch-slot.is-dragging > *,
.sch-edit-table tr.is-dragging > * {
  opacity: 0.5;
}

.sch-slot.is-drop > *,
.sch-edit-table tr.is-drop > * {
  box-shadow: inset 0 3px 0 var(--accent);
}

.sch-grip {
  display: inline-block;
  width: 18px;
  margin-right: var(--s-1);
  color: var(--ink-2);
  line-height: 32px;
  text-align: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.sch-grip--button {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: var(--border-width) solid transparent;
  border-radius: var(--r-1);
  background: none;
}

.sch-grip--button:hover {
  border-color: var(--line-strong);
}

/* Teachers and subjects: tables edited in place. */

.sch-edit-table {
  min-width: 40rem;
}

.sch-teachers__name {
  min-width: 8.5rem;
}

/* The Subject select as wide as its longest subject, and Notes wide enough
   to read what is typed, so neither is cut short at 1280 px with the
   inspector open, and the whole row still fits there (Name, Rooms and
   Part-time give up the room). Narrower, the table scrolls sideways in its
   box. */
.sch-teachers__subject > select {
  min-width: max-content;
}

.sch-teachers__notes {
  min-width: 7.5rem;
}

.sch-teachers .sch-edit-table .picker {
  min-width: 6.5rem;
}

.sch-teachers__marks {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-1);
  font-size: var(--t-xs);
}

.sch-edit-table .picker {
  min-width: 8rem;
}

.sch-edit-table .chips {
  margin-bottom: var(--s-1);
}

.sch-flag {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border: var(--border-width) solid var(--warning);
  border-left-width: 4px;
  border-radius: var(--r-1);
}

.sch-flag__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.sch-subjects__hex {
  margin-left: var(--s-2);
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.sch-subjects__use {
  color: var(--ink-2);
  white-space: nowrap;
  line-height: 32px;
}

/* Day. */

.sch-daytab__basics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  margin-top: var(--s-4);
}

.sch-daytypes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr));
  align-items: start;
  gap: var(--s-5);
  margin-top: var(--s-5);
}

.sch-daytype {
  display: grid;
  gap: var(--s-2);
  min-width: 0;
}

.sch-daytype .sch-scroll {
  margin-top: 0;
}

.sch-bells td,
.sch-bells th {
  line-height: 32px;
}

.sch-bells__found {
  min-width: 10rem;
  line-height: var(--lh-sm);
}

.sch-bells .sch-finding-line,
.sch-bells .sch-hint {
  margin-top: 0;
  line-height: var(--lh-sm);
}

/* Checks, and the findings panel in the inspector. */

.sch-checks__heading {
  margin-top: var(--s-6);
}

.sch-checks__none {
  margin-top: var(--s-4);
  font-weight: var(--w-medium);
}

.sch-findings td {
  vertical-align: top;
}

.sch-finding__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

.sch-findings .sch-finding__actions {
  flex: none;
  flex-wrap: nowrap;
}

/* A finding's sentence with its buttons beside it; under it when the cell is
   too narrow for both (and always on a phone: the end of this file). */
.sch-finding__cell {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
}

.sch-finding__what {
  flex: 1 1 14rem;
  min-width: 0;
}

/* The finding the inspector is showing. */
.sch-findings tr[data-selected="true"] > * {
  background: var(--accent-soft);
}

.sch-findings tr[data-selected="true"] > :first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sch-panel {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
}

.sch-panel .sch-counts {
  flex-direction: column;
}

.sch-panel__scope {
  font-size: var(--t-md);
  font-weight: var(--w-semibold);
}

.sch-panel__none,
.sch-panel__more {
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.sch-panel__list {
  display: grid;
  gap: var(--s-3);
  list-style: none;
}

.sch-finding {
  display: grid;
  gap: var(--s-2);
  padding-left: var(--s-3);
  border-left: 3px solid var(--line-strong);
  font-size: var(--t-sm);
  line-height: var(--lh-sm);
}

.sch-finding--problem {
  border-left-color: var(--problem);
}

.sch-finding--warning {
  border-left-color: var(--warning);
}

.sch-finding--note {
  border-left-color: var(--note);
}

/* Narrow: the list above the editor, the day types one under another. */

@container (max-width: 58rem) {
  .sch-days {
    grid-auto-flow: row;
  }
}

/* Three day types side by side need more than two do: a room field is 188 px
   narrower than its column, and the column under 310 px leaves the room
   under 120 px (30 px at 1440 px with the inspector open, SV2-87b). The
   editor is the section's width less the list beside it (314 px), so under
   84rem of section the third goes under the other two: side by side the
   room is then 145 px or more. */
@container (max-width: 84rem) {
  .sch-days[data-shown="3"] {
    grid-auto-flow: row;
  }
}

@container (max-width: 44rem) {
  .sch-groups__cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .sch-groups__list {
    max-height: 14rem;
  }

  .sch-daytypes {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .sch {
    padding: var(--s-3);
  }

  /* A finding's buttons go under its sentence, where all three fit. */
  .sch-finding__what {
    flex-basis: 100%;
  }

  .sch-findings .sch-finding__actions {
    flex-wrap: wrap;
  }

  /* The Groups tab on a phone: the list and the editor take turns
     (ui/schedule/groups.js has the same width, NARROW). With no group chosen
     yet the cards are the page and there is no editor; a tap folds the list
     to that group's card, with "All groups" under it and the editor next. */
  /* All its cards are on the page, so the list is no scroller of its own:
     one would clip the card's scroll margin (below) to its own edge. */
  .sch-groups__list {
    max-height: none;
    overflow-y: visible;
  }

  /* The chosen card is scrolled to the top of the surface (groups.js); this
     much paper stays between it and the top bar, as the section's own
     padding leaves above the first card (the Foreman measured its edge 0.1
     px under the bar at 390 by 844 without it). */
  .sch-group {
    scroll-margin-top: var(--s-3);
  }

  .sch-groups[data-folded="false"] .sch-editor {
    display: none;
  }

  .sch-groups[data-folded="true"] .sch-group:not([aria-selected="true"]),
  .sch-groups[data-folded="true"] .sch-groups__find {
    display: none;
  }

  .sch-groups[data-folded="true"] .sch-groups__all {
    display: block;
  }

  /* A period's row on a phone: its name and time on a line of their own,
     and the room field under it at the row's full width beside the menu.
     (Beside the name the field was 150 px, and "203 — Ms. Vandermeer" was
     cut at its edge.) The column headings are for a screen reader here. */
  .sch-slots:not(.sch-slots--same),
  .sch-slots:not(.sch-slots--same) > tbody {
    display: block;
  }

  .sch-slots:not(.sch-slots--same) > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sch-slot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border-top: var(--border);
  }

  .sch-slot > .sch-slot__period {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--s-2);
    padding-bottom: 0;
  }

  .sch-slot > td {
    border-top: 0;
  }

  .sch-slot .sch-slot__time {
    display: inline;
    margin-left: 0;
  }

  /* the marks of a row are drawn once round the two lines, not round each */
  .sch-slot[data-shown="true"] > .sch-slot__period {
    box-shadow: inset 0 2px 0 var(--accent);
  }

  .sch-slot[data-shown="true"] > td {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .sch-slot.is-drop > td {
    box-shadow: none;
  }
}

@media (pointer: coarse) {
  .sch-btn--small,
  .sch-slot__menu,
  .sch-grip--button {
    min-height: 44px;
    min-width: 44px;
  }

  .sch-swatch {
    width: 44px;
    height: 44px;
  }
}

/* ---------- SV2-72d: the Fix dialog (ui/schedule/checks-fix.js) ----------
   Its own rules, out of the inline styles it was laid out with (SV2-70).
   The title with nothing over it and the Close button stay in view however
   long the list is, on a phone upright and on its side too (W4): the
   dialog is a column the window's height at the most, and its body, the
   finding, the switch and the list, scrolls between them. */

#fix-dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--s-4));
  max-height: calc(100dvh - var(--s-4));
}

#fix-dialog .dialog__title,
#fix-dialog .dialog__buttons {
  flex: none;
}

/* A scroller clips what is drawn outside its padding box, a focus ring
   included: the body keeps a ring's room inside its edges (padding, the
   same taken back from the dialog's own padding at the sides so the text
   stays where it was) and scrolls a focused control in clear of them
   (scroll-padding), so the switch's ring at the left and a Try it's at the
   right are drawn whole (SV2-72d2). */
#fix-dialog .dialog__body {
  --fix-ring: calc(var(--focus-width) + var(--focus-offset));
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--fix-ring);
  margin-inline: calc(var(--fix-ring) * -1);
  scroll-padding: var(--fix-ring);
}

.fix-switch {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  cursor: pointer;
}

.fix-asking {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.fix-list {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fix-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--s-2);
  padding-bottom: var(--s-3);
  border-bottom: var(--border);
}

.fix-list__words {
  flex: 1 1 16rem;
  margin: 0;
}

.fix-refusal {
  color: var(--problem);
}

/* a window with little height (a phone on its side): less paper round the
   dialog's edge, so the list has more of it */
@media (max-height: 500px) {
  #fix-dialog {
    padding: var(--s-3) var(--s-4);
  }

  #fix-dialog .dialog__body {
    margin-top: var(--s-2);
  }

  #fix-dialog .dialog__buttons {
    margin-top: var(--s-3);
  }
}

/* ---------- SV2-78: the Day tab's cards, and more day types ----------
   DESIGN 11.3 and 11.6. The Day tab is four cards one under another; the
   day types are a list of rows that stack under 640 px; the group editor
   has a row of chips choosing which day types it shows. Every chip, tick,
   radio and row menu is 44 px on a coarse pointer or under 640 px (11.2). */

.sch-card {
  margin-top: var(--s-5);
  padding: var(--s-4);
  border: var(--border);
  border-radius: var(--r-2);
  background: var(--card);
}

.sch-card__title {
  font-size: var(--t-lg);
  line-height: var(--lh-lg);
}

.sch-card__sub {
  font-size: var(--t-md);
  font-weight: var(--w-semibold);
}

.sch-card > .sch-hint {
  max-width: 46rem;
}

.sch-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sch-fieldset > legend {
  padding: 0;
  margin-bottom: var(--s-1);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
}

.sch-radio {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  cursor: pointer;
}

.sch-radio > input,
.sch-tick > input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.sch-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
}

/* The day types, one row each: grip, name, then short and kind, then menu. */

.sch-dtlist {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
  padding: 0;
  list-style: none;
}

.sch-dtrow {
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-2) var(--s-3);
  border: var(--border-width) solid var(--line);
  border-radius: var(--r-1);
  background: var(--card);
}

.sch-dtrow--same {
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--paper);
}

.sch-dtrow.is-dragging {
  opacity: 0.6;
}

.sch-dtrow.is-drop {
  box-shadow: inset 0 3px 0 var(--accent);
}

.sch-dtrow__grip {
  align-self: center;
}

.sch-dtrow__more {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-2) var(--s-4);
}

.sch-dtrow__kindbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
}

.sch-dtrow__kind {
  margin: 0;
}

.sch-dtrow__kind[data-kind="same"],
.sch-dtrow__kind[data-kind="base"] {
  color: var(--ink-2);
}

.sch-dtrow__menu {
  align-self: center;
}

.sch-dtadd {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: var(--border);
}

.sch-dtadd__row {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: var(--s-3) var(--s-6);
}

.sch-dtadd__go {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.sch-dtadd__count {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.sch-followers {
  margin: var(--s-3) 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
}

/* Other bell schedules. */

.sch-bsched {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: var(--border);
}

.sch-bsched__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.sch-bsched__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
}

.sch-bsched__off {
  margin: var(--s-2) 0 0;
}

.sch-bsched__add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.sch-bells__off {
  text-align: center;
}

.sch-bells__none {
  color: var(--ink-2);
  font-style: italic;
}

/* The group editor's choice of day types, with more than two of their own. */

.sch-show {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.sch-show__label {
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
}

.sch-show__chip {
  min-height: 32px;
  padding: 0 var(--s-3);
  border: var(--border-width) solid var(--line-strong);
  border-radius: var(--r-1);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-sm);
  cursor: pointer;
}

.sch-show__chip[aria-pressed="true"],
.sch-show__chip[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: var(--w-semibold);
}

.sch-show__chip:hover {
  border-color: var(--accent);
}

.sch-same-lines {
  margin: var(--s-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-sm);
}

.sch-same-lines li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-2);
  min-height: 32px;
  color: var(--ink-2);
}

.sch-complete {
  margin-top: var(--s-2);
  color: var(--ink-2);
  font-size: var(--t-sm);
}

/* three day types side by side only where the window holds them */
.sch-days[data-shown="3"] {
  gap: var(--s-4);
}

@media (max-width: 640px) {
  .sch-dtrow {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .sch-dtrow__grip {
    display: none;
  }

  .sch-dtrow__name {
    grid-column: 1;
  }

  .sch-dtrow__more {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sch-dtrow__menu {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 640px), (pointer: coarse) {
  .sch-radio,
  .sch-tick,
  .sch-show__chip,
  .sch-same-lines li {
    min-height: 44px;
  }

  .sch-tick,
  .sch-show__chip {
    min-width: 44px;
  }

  .sch-dtrow .sch-slot__menu,
  .sch-dtrow .sch-btn--small,
  .sch-bsched .sch-btn--small,
  .sch-same-lines .sch-btn--small {
    min-height: 44px;
    min-width: 44px;
  }
}

/* A finger does not drag a day type: no grip to aim at (Move up and Move
   down are in the row's menu). */
@media (pointer: coarse) {
  .sch-dtrow__grip .sch-grip {
    display: none;
  }
}

/* ---------- SV2-80: the Calendar tab ----------
   DESIGN 11.4. The tab row scrolls sideways under 900 px; the year is months
   in a wrapping grid (3 across, 2 under 1100 px, 1 under 640 px), each date a
   square with its day type's short name on its tint; the date dialog is not
   modal and is a bottom sheet under 640 px; the panel sits in the inspector
   or under the year. Targets are 44 px on a coarse pointer or under 640 px
   (11.2). */

@media (max-width: 900px) {
  .sch > .tabs > .tabs__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    /* room past the last tab, so the fade never lies over one scrolled to the end */
    padding-right: 24px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }

  .sch > .tabs > .tabs__list::-webkit-scrollbar {
    display: none;
  }

  .sch > .tabs > .tabs__list > .tabs__tab {
    flex: none;
    white-space: nowrap;
  }
}

@media (pointer: coarse) {
  .sch > .tabs > .tabs__list > .tabs__tab {
    min-height: 44px;
    min-width: 44px;
  }
}

.cal-lead {
  margin-bottom: var(--s-4);
  color: var(--ink-2);
}

.cal-year {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-5) var(--s-4);
}

@media (max-width: 1099px) {
  .cal-year {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cal-year {
    grid-template-columns: minmax(0, 1fr);
  }
}

.cal-year[hidden] {
  display: none;
}

.cal-month__name {
  margin-bottom: var(--s-1);
  font-size: var(--t-md);
  font-weight: var(--w-semibold);
}

.cal-month__grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 3px;
}

.cal-month__grid th {
  padding: 0 0 var(--s-1);
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-weight: var(--w-medium);
  text-align: center;
}

.cal-month__grid abbr {
  text-decoration: none;
}

.cal-day {
  position: relative;
  height: 2.75rem;
  padding: 0;
  border-radius: var(--r-1);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.cal-day.is-school {
  background: color-mix(in srgb, var(--tint, var(--room-default)) 30%, var(--card));
}

.cal-day.is-closed {
  background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line) 5px 6px), var(--paper);
  color: var(--ink-2);
}

.cal-day.is-out {
  background: none;
  box-shadow: none;
  color: var(--ink-2);
  cursor: default;
}

.cal-day__n {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: var(--t-xs);
  line-height: 1;
}

.cal-day__t {
  display: block;
  padding-top: 0.6rem;
  font-family: var(--font-plan);
  font-size: var(--t-md);
  font-weight: var(--w-semibold);
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}

.cal-day__t.is-long {
  font-size: var(--t-sm);
}

.cal-day.is-closed .cal-day__t {
  font-size: var(--t-xs);
  font-weight: var(--w-medium);
}

.cal-day__b {
  display: block;
  font-family: var(--font-plan);
  font-size: var(--t-xs);
  line-height: 1.1;
}

/* changed by hand: a tick in the corner (the name says so too) */
.cal-day.is-changed::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-top: 9px solid var(--ink-2);
  border-left: 9px solid transparent;
  border-top-right-radius: var(--r-1);
}

/* today: a 2 px ink ring; chosen: a 2 px accent line inside (never the tint alone) */
.cal-day[aria-current="date"] {
  box-shadow: 0 0 0 2px var(--ink);
}

.cal-day[aria-selected="true"] {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-day[aria-current="date"][aria-selected="true"] {
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--accent);
}

.cal-day:focus-visible {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: 3px;
  z-index: 1;
}

.cal-status {
  min-height: 1.35em;
  margin-top: var(--s-3);
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.cal-show {
  margin-bottom: var(--s-3);
}

.cal-show[hidden] {
  display: none;
}

.cal-list {
  margin-top: var(--s-4);
}

.cal-list__summary {
  min-height: 32px;
  font-weight: var(--w-semibold);
  cursor: pointer;
}

.cal-list__table {
  width: 100%;
  margin-top: var(--s-2);
  border-collapse: collapse;
  font-size: var(--t-sm);
}

.cal-list__table th,
.cal-list__table td {
  padding: var(--s-1) var(--s-2);
  border-bottom: var(--border);
  text-align: left;
  vertical-align: top;
}

.cal-list__table tbody th {
  font-weight: var(--w-medium);
  white-space: nowrap;
}

.cal-list__table tr.is-closed td,
.cal-list__table tr.is-closed th {
  color: var(--ink-2);
}

.cal-list__table tr[aria-current="date"] th {
  font-weight: var(--w-bold);
}

/* the date dialog: beside the year, not over the page. Its body scrolls and
   Apply and Close stay at its foot; calendar/dialog.js sets --sheet-lift (how
   far the keyboard covers the page) and --sheet-max (the visual viewport's
   height) so that Note and Apply are both reachable with the keyboard up. */
.cal-dialog {
  position: fixed;
  inset: auto var(--s-5) calc(var(--s-5) + var(--sheet-lift, 0px)) auto;
  z-index: 40;
  width: min(24rem, calc(100vw - 2 * var(--s-5)));
  max-height: min(calc(100vh - 7rem), var(--sheet-max, 100vh));
  margin: 0;
  box-shadow: var(--shadow);
}

.cal-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-dialog > .dialog__title {
  flex: none;
}

.cal-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: var(--s-3);
  align-content: start;
}

.cal-dialog > .dialog__buttons {
  flex: none;
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: var(--border);
  background: var(--card);
}

.cal-dialog__radio {
  min-height: 32px;
}

.cal-dialog .field__input {
  width: 100%;
}

@media (max-width: 640px) {
  .cal-dialog {
    inset: auto 0 var(--sheet-lift, 0px) 0;
    width: 100%;
    max-width: none;
    max-height: min(75vh, var(--sheet-max, 75dvh));
    border-radius: var(--r-2) var(--r-2) 0 0;
  }

  .cal-dialog .field__input,
  .cal-dialog input,
  .cal-dialog select {
    font-size: 16px;
  }
}

/* the setup card and the panel */
.cal-range,
.cal-addbreak,
.cal-break {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-2) var(--s-3);
}

.cal-group {
  margin-top: var(--s-4);
}

.cal-weekdays,
.cal-breaks,
.cal-breaklist,
.cal-counts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.cal-weekday {
  display: grid;
  gap: var(--s-1);
}

.cal-toggle {
  min-width: 6.5rem;
  min-height: 36px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.cal-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: var(--w-semibold);
}

.cal-toggle[aria-pressed="true"]::before {
  content: "✓ ";
}

.cal-select {
  max-width: 100%;
}

.cal-rotation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.cal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding-left: var(--s-2);
  border: var(--border);
  border-radius: var(--r-1);
  background: var(--paper);
}

.cal-chip__remove {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}

.cal-chip__remove:hover {
  color: var(--ink);
}

.cal-break {
  margin-bottom: var(--s-2);
}

.cal-break__count {
  min-width: 7rem;
  padding-bottom: var(--s-2);
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.cal-actions,
.cal-files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.cal-panel {
  padding: var(--s-4);
}

.cal-slot .cal-panel {
  margin-top: var(--s-5);
  padding: var(--s-4) 0 0;
  border-top: var(--border);
}

.cal-panel__title {
  font-size: var(--t-lg);
  line-height: var(--lh-lg);
}

.cal-panel__summary {
  margin-top: var(--s-2);
}

.cal-panel__sub {
  margin-top: var(--s-4);
  margin-bottom: var(--s-1);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
}

.cal-counts li {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-sm);
}

.cal-counts__n {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.cal-rules {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
}

.cal-rules th,
.cal-rules td {
  padding: 2px var(--s-1) 2px 0;
  text-align: left;
}

.cal-rules thead th {
  color: var(--ink-2);
  font-weight: var(--w-medium);
}

.cal-rules .cal-select {
  width: 100%;
}

.cal-breakline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1) var(--s-2);
  margin-bottom: var(--s-1);
  font-size: var(--t-sm);
}

.cal-addbreak {
  margin-top: var(--s-2);
}

.cal-date {
  min-width: 9.5rem;
}

.cal-import__paste {
  width: 100%;
  font-family: ui-monospace, monospace;
}

.cal-import__table {
  width: 100%;
  margin-top: var(--s-2);
  border-collapse: collapse;
  font-size: var(--t-sm);
}

.cal-import__table th,
.cal-import__table td {
  padding: var(--s-1) var(--s-2);
  border-bottom: var(--border);
  text-align: left;
}

@media (max-width: 640px), (pointer: coarse) {
  .cal-day {
    height: 44px;
  }

  .cal-toggle,
  .cal-chip,
  .cal-chip__remove,
  .cal-dialog__radio,
  .cal-list__summary,
  .cal-select,
  .cal-files .btn,
  .cal-breakline .sch-btn--small,
  .cal-break .sch-btn--small {
    min-height: 44px;
  }

  .cal-chip__remove {
    min-width: 44px;
  }
}

.cal-rotation .cal-select,
.cal-weekday .cal-select {
  width: auto;
}

/* a weekday a row on a phone: its toggle, then its bells */
@media (max-width: 640px) {
  .cal-weekdays {
    flex-direction: column;
  }

  .cal-weekday {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
  }

  .cal-weekday .cal-select {
    width: 100%;
  }
}

/* the weekdays' rules fit the 320 px inspector: the two choices share the row */
.cal-rules {
  table-layout: fixed;
}

.cal-rules th[scope="row"] {
  width: 6.5rem;
}

/* with bells to choose, a weekday is two lines (its day, then its bells) so a
   name like "Early Release" shows whole at 320 px; the header row stays for
   a screen reader */
.cal-rules--bells,
.cal-rules--bells tbody {
  display: block;
}

.cal-rules--bells thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.cal-rules--bells tr {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 2px var(--s-2);
  padding: var(--s-1) 0;
  border-bottom: var(--border);
}

.cal-rules--bells th[scope="row"] {
  grid-row: 1 / span 2;
  align-self: center;
  width: auto;
}

.cal-rules--bells td {
  display: block;
  padding: 0;
}

/* A bell table on a narrow screen (day.js): a disclosure headed by its name. */
.sch-fold {
  min-width: 0;
}

.sch-fold__summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font-weight: var(--w-semibold);
}

.sch-fold__summary .sch-daytype__title {
  display: inline;
}

/* ---------- SV2-85: marked periods (the Day tab's fifth card) and the Duties tab ----------
   DESIGN 11.3 card 5, 11.5, 11.6. A mark is a sentence that is a button; it
   opens its editor in place. Chips, ticks, radios and row buttons are 44 px
   on a coarse pointer or under 640 px (11.2). */

.sch-marks {
  display: grid;
  gap: var(--s-1);
  margin: var(--s-3) 0;
  padding: 0;
  list-style: none;
}

.sch-marks__empty {
  margin: var(--s-3) 0;
  color: var(--ink-2);
}

.sch-marks__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
}

.sch-marks__item.is-open {
  display: block;
}

.sch-marks__line {
  padding: var(--s-1) var(--s-2);
  border: var(--border);
  border-radius: var(--r-1);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 32px;
}

.sch-marks__line:hover {
  background: var(--accent-soft);
}

.sch-marks__none,
.sch-marks__beaten {
  color: var(--note);
}

.sch-marks__beaten {
  font-size: var(--t-sm);
}

.sch-markedit {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3);
  border: var(--border);
  border-radius: var(--r-2);
  background: var(--paper);
}

.sch-markedit__legend,
.sch-markedit__label {
  margin: 0 0 var(--s-1);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
}

.sch-markedit__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--s-3);
}

.sch-markedit__says {
  margin: 0;
  max-width: 46rem;
}

.sch-markedit__ticks,
.sch-markedit__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
  margin-top: var(--s-1);
}

.sch-markedit__set + .sch-markedit__ticks {
  margin-top: var(--s-1);
}

/* Staggered dismissal (DESIGN 12.2): the editor is the marks editor's kind;
   the minutes and seconds sit side by side. */
.sch-release__time {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  align-items: flex-start;
  margin-bottom: var(--s-1);
}

.sch-markedit__nowings,
.sch-markedit__nogrades {
  margin: var(--s-1) 0 0;
}

@media (max-width: 640px), (pointer: coarse) {
  .sch-releaseedit .sch-show__chip {
    min-height: 44px;
    min-width: 44px;
  }

  .sch-marks__line,
  .sch-markedit .seg__label,
  .sch-markedit .chip__remove,
  .sch-markedit .btn,
  .sch-duties .btn,
  .sch-duties .chip__remove,
  .sch-duties .sch-show__chip {
    min-height: 44px;
  }

  .sch-markedit .chip__remove,
  .sch-duties .chip__remove,
  .sch-duties .sch-show__chip {
    min-width: 44px;
  }

  .sch-markedit .field__input,
  .sch-duties__table .field__input,
  .sch-duties__table select {
    height: 44px;
  }
}

.sch-duties__table td {
  vertical-align: top;
}

/* The table is as wide as its card at 1280 px with the inspector open (about
   790 px): the columns share what there is, the controls give way to their
   column, and the What field keeps room for a label as long as "Science
   meeting". Narrower than its controls need, the card scrolls it sideways. */
.sch-duties__table select,
.sch-duties__table .field__input:not([type="date"]) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.sch-duties__table th {
  padding-inline: var(--s-1);
  letter-spacing: 0.04em;
}

.sch-duties__table td:first-child {
  min-width: 8.5rem;
}

.sch-duties__table td:nth-child(2) {
  min-width: 8.5rem;
}

.sch-duties__table td:nth-child(3) {
  min-width: 6rem;
}

.sch-duties__table td:nth-child(4),
.sch-duties__table td:nth-child(5) {
  min-width: 7rem;
}

.sch-duties__table .picker,
.sch-duties__table .field {
  max-width: 100%;
}

.sch-duties__findrow > td {
  padding-top: 0;
  border-top: 0;
}

.sch-duties__findrow .sch-finding-line {
  margin: 0 0 var(--s-1);
}

/* the row's line carries the glyph in its word already: one triangle, not two */
.sch-duties__findrow .sch-finding-line--warning::before {
  content: none;
}

.sch-duties__table td > .field,
.sch-duties__table td > select,
.sch-duties__table td > .picker {
  margin-bottom: var(--s-1);
}

.sch-duties__times {
  display: flex;
  gap: var(--s-1);
}

.sch-duties__times .field__input {
  min-width: 0;
}

.sch-duties__times .field {
  flex: 1 1 0;
  min-width: 0;
}

.sch-duties__nobody {
  margin: 0 0 var(--s-1);
  color: var(--note);
}

.sch-duties__filter {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.sch-duties__editrow > td {
  background: var(--paper);
}

.sch-duties__days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--s-3);
  align-items: start;
}

.sch-duties__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
  margin-top: var(--s-1);
}

.sch-duties__dates {
  display: grid;
  gap: var(--s-2);
}

/* Under 640 px a duty is a card: its lines labelled, one under another. */
@media (max-width: 640px) {
  .sch-duties__table,
  .sch-duties__table tbody,
  .sch-duties__table tr,
  .sch-duties__table td {
    display: block;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .sch-duties__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .sch-duties__table tr {
    margin-bottom: var(--s-3);
    padding: var(--s-2) var(--s-3);
    border: var(--border);
    border-radius: var(--r-2);
    background: var(--card);
  }

  .sch-duties__table td {
    padding: var(--s-1) 0;
    border: 0;
  }

  .sch-duties__table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: var(--t-sm);
    font-weight: var(--w-semibold);
    color: var(--ink-2);
  }
}

/* Marked periods in the group editor and the grid (DESIGN 11.6): the mark's
   word beside the period, a No class row greyed and a No class cell hatched. */
.sch-slot__mark {
  margin-left: var(--s-2);
  padding: 0 var(--s-2);
  color: var(--ink-2);
}

.sch-slot.is-noclass > th,
.sch-slot.is-noclass > td {
  background: var(--paper);
  color: var(--ink-2);
}

.sch-slot__noclass {
  margin: var(--s-1) 0 0;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

/* ---------- SV2-129: the period word and period names (DESIGN 16.5) ---------- */

.sch-periodword {
  display: grid;
  gap: var(--s-3);
  min-width: 0;
}

.sch-wordother {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--card);
  min-width: 0;
}

.sch-wordother[hidden] {
  display: none;
}

.sch-wordother__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-4);
}

.sch-wordsample {
  margin: 0;
  overflow-wrap: anywhere;
}

.sch-names {
  flex-basis: 100%;
  min-width: 0;
}

.sch-names__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}

.sch-names__count {
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.sch-names__panel {
  margin-top: var(--s-3);
}

.sch-names__panel[hidden] {
  display: none;
}

.sch-names__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: var(--s-3) var(--s-5);
  margin: var(--s-3) 0 0;
  padding: 0;
  list-style: none;
}

.sch-names__row {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sch-names__row .field__input {
  max-width: 100%;
}

@media (max-width: 640px) {
  .sch-names__list {
    grid-template-columns: 1fr;
  }

  .sch-periodword .seg__label,
  .sch-names__toggle {
    min-height: 44px;
  }
}

@media (pointer: coarse) {
  .sch-periodword .seg__label,
  .sch-names__toggle,
  .sch-names__row .btn {
    min-height: 44px;
  }
}

/* Part-time: the column's button and the disclosure under the row
   (DESIGN 16.6, 16.12 item 4). The editor row sits inside the table's
   scrolling box, so its content sticks to the left edge and never grows
   wider than the window. */
.sch-teachers__part {
  min-width: 6.5rem;
}

.sch-part__button {
  max-width: 14rem;
  overflow-wrap: anywhere;
}

.sch-part__button[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sch-part__wrap {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  max-width: min(40rem, calc(100vw - 3rem));
}

.sch-part {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3);
  border: var(--border);
  border-radius: var(--r-2);
  background: var(--paper);
}

.sch-part__not,
.sch-part__only {
  display: grid;
  gap: var(--s-2);
}

.sch-part__entry {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border: var(--border);
  border-radius: var(--r-1);
}

.sch-part__saved {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-2);
}

.sch-part__words {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sch-part__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.sch-part__says {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--t-sm);
  overflow-wrap: anywhere;
}

@media (max-width: 640px), (pointer: coarse) {
  .sch-part .sch-btn--small,
  .sch-part__button {
    min-height: 44px;
  }
}
