/* SchoolDay v221 additions. Loaded last so these rules win over v207-v220. */

/* --- Group Identical Phonics: chips are tappable as well as draggable ---- */
.phonics-group-chip-v220 { cursor: grab; }
.phonics-group-chip-v220:active { cursor: grabbing; }
/* A quiet dot marks the chips that actually have a sound to play, so a silent
   tap on a soundless phonic does not read as a broken button. */
.phonics-group-chip-v220.has-sound-v221::after {
  content: "";
  display: inline-block;
  width: .38rem;
  height: .38rem;
  margin-left: .38rem;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  vertical-align: middle;
}

/* --- Manage Floorplan: grid overlay, snapping affordances, dividers ------ */
/* renderFloorCanvas sets background-color and background-image inline on the
   canvas, so a stylesheet-only grid can never show through. The grid is an
   overlay child instead, sitting under every item (items are z-index >= 1). */
.floorplan-grid-overlay-v221 {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 79, 140, .20) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 79, 140, .20) 1px, transparent 1px);
  background-size: var(--floorplan-grid-size-v221, 20px) var(--floorplan-grid-size-v221, 20px);
}
.floorplan-grid-size-v221 {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
  font-size: .85rem;
  white-space: nowrap;
}
.floorplan-grid-size-v221 select { width: auto; min-width: 5.5rem; padding: .3rem .4rem; }
#floorplanGridToggleV221.active {
  background: var(--admin-selected-tab-bg, #f5c542);
  color: var(--admin-selected-tab-text, #111827);
  border-color: var(--admin-selected-tab-border, #d09a00);
}
/* Dividers are thin, so their resize handles need to stay reachable. */
.floorplan-item-v214.floorplan-divider-v221 { min-height: 4px; overflow: visible; }
.floorplan-item-v214.floorplan-divider-v221 .resize-handle-v215 { width: 12px; height: 12px; }

/* Square colour swatches, so the colour reads at a glance. The v216 rule sets
   border-radius: 50% !important, hence the !important here. */
.floorplan-colour-swatch-v216 { border-radius: 6px !important; }

/* --- Class Calendars: routine rows -------------------------------------- */
/* PIN | Mon | Tue | Wed | Thu | Fri | Save, all on one line. */
.routine-class-card-v221 .routine-title-days-v214,
.routine-class-card-v221 .routine-body-v214 {
  grid-template-columns: minmax(104px, .7fr) repeat(5, minmax(88px, 1fr)) minmax(104px, .7fr);
  gap: .3rem;
}
.routine-pin-cell-v221,
.routine-save-cell-v221 { display: grid; align-content: stretch; gap: .3rem; min-width: 0; }
.routine-row-button-v221 {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: .35rem .4rem;
  font-size: .8rem;
  line-height: 1.15;
  white-space: normal;
}
.routine-class-card-v221 .routine-body-v214 textarea {
  font-size: .82rem;
  line-height: 1.25;
  padding: .4rem .45rem;
  border-radius: .45rem;
}
/* A filled routine box is tinted with a very pale version of the school's
   accent colour. The routine-saved class is already maintained by the renderer
   and by saveClassRoutine, and cleared on input. */
.routine-class-card-v221 .routine-body-v214 textarea.routine-saved {
  background: color-mix(in srgb, var(--admin-header-border, #f5c542) 16%, #ffffff);
  border-color: color-mix(in srgb, var(--admin-header-border, #f5c542) 55%, #bdcbe0);
}
@media (max-width: 900px) {
  .routine-class-card-v221 .routine-body-v214 { grid-template-columns: 1fr; }
  .routine-row-button-v221 { height: auto; min-height: 2.4rem; }
}

/* --- Homework modal: spacing, one scroller, real close buttons ----------- */
/* Lift the title and give the heading less dead space below it. */
.class-function-modal .modal-heading {
  align-items: center;
  padding-bottom: .5rem;
  margin-bottom: .5rem;
  gap: .75rem;
}
.class-function-modal .modal-heading h2 { margin: 0 0 .1rem; line-height: 1.2; }
.class-function-modal .modal-heading p { margin: 0; }
/* The close control now sits inside the heading. It used to float at a
   negative offset on a panel with overflow:auto, which clipped it. */
.class-function-modal .modal-heading .class-function-close-x {
  position: static;
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--admin-function-border, #0c3f78);
  box-shadow: none;
  font-size: 1.4rem;
}
.class-function-modal .modal-heading .class-function-close-x:hover { filter: brightness(1.1); }
/* One scroller only: the phases list expands and the modal panel scrolls. */
.class-function-modal .phonics-choice-grid {
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}
/* Uncramped action row: buttons size to their text and wrap naturally. */
.class-function-modal .modal-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: .5rem !important;
  margin-top: .9rem;
  padding-top: .75rem;
  border-top: 1px solid #dde8f4;
}
.class-function-modal .modal-actions button {
  width: auto !important;
  flex: 1 1 auto;
  min-width: 8.5rem;
  min-height: 2.6rem !important;
  padding: .5rem .8rem !important;
}
.class-function-modal.actions-top .modal-actions {
  margin-top: 0;
  margin-bottom: .75rem;
  padding-top: 0;
  padding-bottom: .75rem;
  border-top: 0;
  border-bottom: 1px solid #dde8f4;
}

/* --- Manage Subjects: bulk milestones ----------------------------------- */
.bulk-milestone-tool-v221 {
  border: 1px solid #d4dfe7;
  border-radius: .65rem;
  background: #ffffff;
  padding: .55rem .7rem;
}
.bulk-milestone-tool-v221[open] { padding-bottom: .75rem; }
.bulk-milestone-tool-v221 > summary { cursor: pointer; font-weight: 800; }
.bulk-milestone-tool-v221 > *:not(summary) { margin-top: .55rem; }
.bulk-milestone-separator-v221 {
  border: 1px solid #d4dfe7;
  border-radius: .55rem;
  padding: .5rem .6rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .9rem;
  align-items: center;
}
.bulk-milestone-separator-v221 legend { font-weight: 800; font-size: .85rem; padding: 0 .3rem; }
.bulk-milestone-separator-v221 label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .88rem;
  white-space: nowrap;
}
.bulk-milestone-separator-v221 input[type="radio"] { width: auto; }
.bulk-milestone-separator-v221 #bulkMilestoneOtherV221 { width: 5rem; padding: .25rem .35rem; }
.bulk-milestone-list-v221 { margin: .4rem 0 0; padding-left: 1.4rem; display: grid; gap: .15rem; }
.bulk-milestone-list-v221 li { font-size: .9rem; }
.bulk-milestone-preview-v221 { border-top: 1px dashed #d4dfe7; padding-top: .5rem; }
