/* Ours, not the mockup's: the pieces the mockup didn't have, and the small adjustments its
   markup needs once it is real. Loaded last on every page in the new shell
   (include/shell/head.php). Uses the mockup's tokens from style.css throughout - no new colours. */

/* ---------- Links that look like the mockup's buttons ----------
   The mockup drew navigation as <button data-nav>; real pages use links, so they can be opened
   in a new tab and work without script. Same classes, minus the underline. */
a.nav-btn,
a.cta-btn,
a.cta-btn-secondary,
a.btn-outline,
a.pn-view-btn {
  text-decoration: none;
}

/* ---------- User chip and account menu ----------
   The chip is a button here: it opens the account menu (My Details, Team, Log out...), which the
   mockup left out. Reset to look exactly like the mockup's plain chip until hovered. The menu is
   placed from the chip's own box: the footer itself is Vas's sticky one (style.css, 12 Oct), with
   the usage bar above the chip. */
.sidebar-account {
  position: relative;
}

.user-chip--button {
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-chip--button:hover,
.user-chip--button[aria-expanded="true"] {
  background: #F4F2FB;
}

.user-chip--button:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

/* The same panel as the mockup's row menu (.row-kebab-menu in contacts.css), opening upwards
   because the chip sits at the bottom of the sidebar. */
.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 8px);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.account-menu[hidden] {
  display: none;
}

/* .btn-primary-solid sets display, which beats the hidden attribute. Without this the preview's
   "Use this design" (include/school/ui/wizard-modals.php) showed on every preview, not only on
   Choose a Design and My Templates as in the mockup. On Drafts it led to the dashboard (7 Oct). */
.btn-primary-solid[hidden] {
  display: none;
}

.account-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
}

.account-menu a:hover {
  background: #F4F2FB;
}

.account-menu-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 2px;
}

/* ---------- Toast: problems ----------
   The mockup's toast only ever said things went well. A problem uses the danger colour so it
   doesn't read as a success. */
.toast.toast--error {
  background: var(--danger);
}

/* ---------- Form errors in popups ----------
   One line under the field, in normal flow, cleared as soon as the field is edited. */
.modal-field-error {
  margin: 8px 0 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
}

.modal-field-error[hidden] {
  display: none;
}

.modal-field:has(.modal-field-error:not([hidden])) input,
.modal-field:has(.modal-field-error:not([hidden])) select {
  border-color: var(--danger);
}

/* ---------- An on/off switch in a popup (Make private on Create a Newsletter) ----------
   The mockup has none. A real checkbox, hidden, so the label, the keyboard and screen readers
   work as they do for any checkbox; the track beside it is what's seen. */
.modal-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  cursor: pointer;
}

.modal-switch-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.modal-switch-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
}

.modal-switch .modal-field-hint {
  margin-top: 2px;
}

.modal-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.modal-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background 0.15s ease;
}

.modal-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.modal-switch input:checked + .modal-switch-track {
  background: var(--purple);
}

.modal-switch input:checked + .modal-switch-track::after {
  transform: translateX(18px);
}

.modal-switch input:focus-visible + .modal-switch-track {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

/* A <form> wrapping a popup's header, body and footer has to pass the dialog's flex column
   through, or the body stops scrolling inside the dialog's max-height. */
.modal-dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* ...and the display: flex above would otherwise beat [hidden]. Send Test Email hides its form
   once the email has gone (ui/js/wizard.js); without this the "sent" step showed underneath it. */
.modal-dialog > form[hidden] {
  display: none;
}

/* Buttons that are working on something. */
.btn-primary-solid:disabled,
.btn-outline:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* A primary button with nothing to do yet (Change groups' Save before any change) is greyed out,
   not "working". */
.btn-primary-solid:disabled:not(:active) {
  cursor: not-allowed;
}

.btn-outline--small {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-outline--danger {
  color: var(--danger);
}

.btn-outline--danger:hover {
  border-color: var(--danger);
  color: var(--danger-dark);
}

/* ---------- Lists (Contacts, a group's page, Groups) ---------- */

/* The tabs are links between two pages, not buttons switching panels. */
a.design-tab {
  text-decoration: none;
}

a.create-menu-item {
  text-decoration: none;
  color: inherit;
}

/* In the mockup the search box kept its own bottom margin inside the filters row, so it sat
   higher than the selects beside it. Direct children only: Teacher Content's search sits in its
   own group (.tc-filters-left) and teacher-content.css sizes it. */
.ct-filters > .pn-search {
  margin-bottom: 0;
  flex: 0 1 260px;
}

/* A native select is as wide as its longest option, and Wonde group names run long ("10A/Ar1
   Registration Group"), which pushed the filters onto a second line. Capped; the open list still
   shows every name in full. */
.ct-filters-right .pill-select {
  max-width: 180px;
  text-overflow: ellipsis;
}

.ct-list {
  transition: opacity 0.15s ease;
}

.ct-list.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.ct-head-actions {
  text-align: right;
}

/* The whole first cell ticks the row, so a near miss doesn't open the contact instead. */
.ct-check-cell {
  display: flex;
  align-items: center;
  align-self: stretch;
  cursor: pointer;
}

.ct-row.gc-row:not(.ct-row--head),
.ct-row.gr-row:not(.ct-row--head) {
  cursor: pointer;
}

/* The contact's name is the way into it: a button, styled exactly as the mockup's name line. */
.ct-name-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.ct-name-btn:hover {
  color: var(--purple);
}

.ct-name-btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
  border-radius: 4px;
}

/* One group chip, cut short with "..." when the name is long (the full name is in its title and
   in the "+N" tooltip): Wonde class names run long, and the column is 120px. */
.ct-groups-cell .ct-group-chip {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state-action {
  margin-top: 18px;
  text-decoration: none;
}

.gr-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.gr-name-link {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gr-name-link:hover {
  color: var(--purple);
}

.gr-wonde-mark {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.gc-wonde-logo {
  height: 18px;
  width: auto;
}

/* ---------- Bulk bar (while rows are ticked) ----------
   Not in the mockup, which drew row checkboxes without saying what they were for. It takes the
   place of the search and filters while anything is ticked. */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  /* The height of the search and filters row it takes the place of (41px), so ticking a row
     doesn't nudge the table down (9 Oct). The small buttons are 32px. */
  min-height: 41px;
  margin-bottom: 20px;
  padding: 3px 4px 3px 18px;
  background: #F4F2FB;
  border: 1px solid #E2DEF3;
  border-radius: var(--radius-md);
}

.bulk-bar[hidden],
.ct-filters[hidden] {
  display: none;
}

.bulk-bar-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--navy);
}

.bulk-bar-clear {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
}

.bulk-bar-clear:hover {
  text-decoration: underline;
}

.bulk-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- The contact popup ---------- */

.contact-loading {
  margin: 0;
  padding: 24px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

.contact-loading[hidden] {
  display: none;
}

/* Someone who isn't receiving: said once, at the top, with why and what to do. */
.contact-receiving {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.contact-receiving[hidden] {
  display: none;
}

.contact-receiving .status-pill {
  flex-shrink: 0;
}

.contact-receiving p {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.contact-receiving-action {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--purple);
  cursor: pointer;
}

.contact-receiving-action:hover {
  text-decoration: underline;
}

/* Inside a popup the group list opens in place and pushes the fields below it down: floating over
   them, it was cut off by the popup's own scrolling body. */
.modal .multi-select-panel {
  position: static;
  margin-top: 6px;
  box-shadow: none;
}

.multi-select-find {
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.multi-select-find:focus {
  outline: none;
  border-color: var(--purple);
}

.multi-select-find[hidden],
.multi-select-option[hidden],
[data-group-picker][hidden],
.contact-view-chips[hidden] {
  display: none;
}

.multi-select-empty {
  margin: 6px 4px;
  font-size: 13px;
  color: var(--ink-faint);
}

.multi-select-empty[hidden] {
  display: none;
}

.contact-view-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.contact-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0;
  font-size: 14px;
  color: var(--navy);
}

.contact-children span {
  color: var(--ink-faint);
}

.modal-field[hidden],
#addContactDetailFields[hidden] {
  display: none;
}

/* A parent's students: the mockup's Student Name + UPN pair, once per child, and "Add More"
   under them (include/school/ui/contact-modals.php). */
.contact-student {
  margin-top: 14px;
}

.contact-student + .contact-student {
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.contact-student-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.contact-student-remove {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
}

.contact-student-remove:hover {
  color: var(--danger);
}

.contact-student-remove[hidden] {
  display: none;
}

.modal-field.contact-add-student {
  margin-top: 10px;
}

.contact-add-student .modal-field-error {
  margin: 0 0 8px;
}

.contact-add-student-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--purple);
  cursor: pointer;
}

.contact-add-student-btn:hover {
  text-decoration: underline;
}

.contact-add-student-note {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ---------- Change groups ---------- */

.change-groups-intro {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.change-groups-find {
  margin-bottom: 10px;
}

.change-groups-find[hidden] {
  display: none;
}

.change-groups-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 0 -6px;
}

.change-groups-list .multi-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.change-groups-heading {
  margin: 10px 10px 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.change-groups-heading:first-child {
  margin-top: 0;
}

.change-groups-heading[hidden],
.change-groups-empty[hidden],
.change-groups-summary[hidden] {
  display: none;
}

.change-groups-some {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-faint);
}

.change-groups-empty {
  margin: 8px 4px;
  font-size: 13px;
  color: var(--ink-faint);
}

.change-groups-summary {
  margin: 0;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

/* ---------- Add Contacts (a group's page) ---------- */

/* The mockup sized this pill for a year group ("Year 4"); here it holds the user type. */
#addMembersModal .person-group {
  width: 96px;
}

.add-members-more {
  margin: 0;
  padding: 8px 20px;
  font-size: 12.5px;
  color: var(--ink-faint);
  border-top: 1px solid var(--border);
}

.add-members-more[hidden] {
  display: none;
}

.add-members-footer .add-members-create {
  margin-right: auto;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
}

.add-members-footer .add-members-create:hover {
  text-decoration: underline;
}

/* ---------- Import Contacts (school-add-bulk-combined.php) ---------- */

/* Upload File beside the mockup's Download Excel Template. */
.ic-instructions-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.ic-sheet.is-dragover {
  outline: 2px dashed var(--purple);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}

/* Something to know about a row that was still imported - not a row to fix. */
.ic-error-row--note .ic-error-row-num {
  color: var(--ink-faint);
}

/* Rows with the same problem share a line ("Rows 4, 9, 12–40"), so the row numbers vary in
   length. The list is one grid, not a flex row each, so every problem starts in the same column:
   as wide as the longest set of numbers, up to 40% before they wrap. */
.ic-feedback-errors:not([hidden]) {
  display: grid;
  grid-template-columns: fit-content(40%) 1fr;
  column-gap: 12px;
}

.ic-feedback-errors .ic-error-row {
  display: contents;
}

.ic-feedback-errors .ic-error-row > span {
  padding: 6px 0;
}

/* Rows a demo account had no room for, said once under the rest (ui/js/import-contacts.js): plain
   words, not the summary's bold, because there is nothing in them to fix. */
.ic-feedback-text .ic-feedback-note {
  margin-top: 6px;
  font-weight: 400;
  color: var(--ink-muted);
}

.ic-feedback-errors:not([hidden]) + .ic-feedback-note {
  margin-top: 12px;
}

.ic-assign-contact {
  min-width: 0;
}

.ic-assign-contact-student {
  font-size: 12.5px;
  color: var(--ink-faint);
}

.ic-assign-contact-student strong {
  font-weight: 600;
  color: var(--ink-muted);
}

/* Long group names stay inside the row's column. */
.ic-assign-row .pill-select {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* A user type that can't be changed here: a Wonde contact, or a parent matched by email. */
.ic-assign-fixed {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.ic-assign-bulk .pill-select {
  max-width: 220px;
}

.ic-map-sample {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ic-map-sample:empty {
  display: none;
}

/* ---------- Import via Wonde (school-add-wonde-combined.php) ----------
   No page for this in the mockup: built from its import page, cards, pills and buttons. */

.wonde-banner {
  margin: 0 0 20px;
}

.wonde-search {
  position: relative;
  max-width: 560px;
}

.wonde-search .pn-search-field {
  width: 100%;
}

.wonde-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.wonde-results[hidden] {
  display: none;
}

.wonde-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.wonde-result:hover,
.wonde-result:focus-visible {
  background: var(--bg);
  outline: none;
}

.wonde-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.wonde-result-postcode {
  font-size: 12.5px;
  color: var(--ink-faint);
}

.wonde-results-note {
  margin: 0;
  padding: 10px;
  font-size: 13px;
  color: var(--ink-faint);
}

#wondeSelected:not(:empty) {
  margin-top: 20px;
}

.wonde-school {
  max-width: 560px;
  padding: 22px 24px;
}

.wonde-school-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.wonde-school-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.wonde-school-text {
  flex: 1;
  min-width: 0;
}

.wonde-school-name {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.wonde-school-address {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.wonde-school-head .status-pill {
  flex-shrink: 0;
}

.wonde-school-note {
  margin: 16px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.wonde-school-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
}

.wonde-remove-btn {
  margin-left: auto;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
}

.wonde-remove-btn:hover {
  text-decoration: underline;
}

/* What came back from Request, Cancel or Remove, on the card itself rather than in a toast. The
   shape is the review notice's: a tinted block in the page's colours, teal when it went through
   and the danger red when it didn't, so it reads without the colour alone carrying the news. */
.wonde-school-msg {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(103, 199, 195, 0.14);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--navy);
}

.wonde-school-msg--error {
  background: rgba(209, 67, 67, 0.1);
  color: var(--danger-dark);
}

/* Declined, or access withdrawn. Not a note in grey: it is the answer to the
   request, it stops the import, and the school usually says why. Same tinted
   block as the review notices, with a heading and the school's own words under
   a rule, so the reason is read as a quote and not as our wording. */
.wonde-school-alert {
  margin: 16px 0 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(209, 67, 67, 0.08);
}

.wonde-school-alert-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--danger-dark);
}

.wonde-school-alert p {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--navy);
}

.wonde-school-alert-reason {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(209, 67, 67, 0.18);
}

.wonde-school-alert-reason span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--danger-dark);
}

/* A message about the page rather than about one school: what a removal or a
   cancelled request leaves behind, once the card it belonged to has gone. */
.wonde-page-msg {
  max-width: 560px;
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(103, 199, 195, 0.14);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--navy);
}

.wonde-page-msg--error {
  background: rgba(209, 67, 67, 0.1);
  color: var(--danger-dark);
}

.wonde-page-msg[hidden] {
  display: none;
}

.wonde-sync {
  max-width: 560px;
  margin-top: 20px;
  padding: 20px 24px;
}

.wonde-sync[hidden] {
  display: none;
}

.wonde-sync-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.wonde-sync-where {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

/* How far through the pass the worker is. Lighter than the phase name: it is
   the number that moves, not the heading. */
.wonde-sync-scanned {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.wonde-sync-scanned[hidden] {
  display: none;
}

.wonde-sync-percent {
  font-variant-numeric: tabular-nums;
}

/* The sweep: the bar above the real progress bar, filling and refilling.

   Its width is set from ui/js/wonde.js on every frame rather than by a CSS
   animation, because its speed is not constant -- it runs faster while there is
   a lot waiting to be counted and slows when there is little, the same backlog
   that drives the figures below. A keyframe animation cannot change speed
   without restarting, which shows as a stutter.

   Thinner and quieter than the progress bar under it, so the two are not
   mistaken for each other. */
.wonde-activity {
  height: 4px;
  margin-bottom: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}

.wonde-activity-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--purple));
}

/* Finished or stopped: the sweep has nothing left to report, so it goes still
   rather than suggesting work that is no longer happening. */
.wonde-activity.is-done .wonde-activity-bar {
  width: 100%;
  opacity: 0.35;
}

/* Fallback for a page whose script did not run; the script handles the same
   preference itself, and what it sets wins. */
@media (prefers-reduced-motion: reduce) {
  .wonde-activity-bar {
    width: 100%;
    opacity: 0.45;
  }
}

.wonde-progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}

.wonde-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--purple);
  transition: width 0.4s ease;
}

.wonde-sync-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

/* Tabular figures, so a number climbing from 9 to 1,000 does not shuffle the
   words beside it on every frame. */
.wonde-count strong {
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.wonde-count-waiting {
  color: var(--ink-faint);
}

.wonde-sync-done {
  margin-top: 16px;
  text-decoration: none;
}

.wonde-sync-done[hidden] {
  display: none;
}

/* ---------- The send flow (include/shell/wizard-top.php) ---------- */

/* The shell's wrapper, passed through: body.wizard-page lays out the top bar, the page and the
   footer as one column, and an extra box in between would break that. */
.app.app--wizard {
  display: contents;
}

/* A step already done is a link back to it, looking exactly like the step. */
.step-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.step-link:hover .step-label {
  color: var(--purple);
}

a.btn-ghost,
a.btn-primary-solid,
a.btn-select-design,
a.btn-edit {
  text-decoration: none;
}

/* Details: a field that needs fixing. */
.form-field:has(.modal-field-error:not([hidden])) input {
  border-color: var(--danger);
}

.field-hint a {
  color: var(--purple);
  font-weight: 600;
}

/* The emoji picker under the subject (the mockup's emoji button did nothing). */
.emoji-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(9, 32px);
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.emoji-panel[hidden] {
  display: none;
}

.emoji-option {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.emoji-option:hover,
.emoji-option:focus-visible {
  background: #F1EFF9;
  outline: none;
}

/* A design whose thumbnail Mailerly hasn't made yet. */
.preview-generating {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.preview-generating img {
  width: 120px;
  height: auto;
}

.preview-generating p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

a.chosen-action-btn {
  text-decoration: none;
}

.preview-design-error {
  text-align: center;
}

/* The email preview: the real email in a frame. */
.modal-dialog--preview {
  max-width: 760px;
  height: 85vh;
}

.modal-body--frame {
  display: flex;
  padding: 0;
  overflow: hidden;
}

.email-preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.modal-footer .btn-ghost {
  margin-right: auto;
}

/* Choose a Design */
a.design-action-btn {
  text-decoration: none;
}

.design-card[hidden] {
  display: none;
}

/* The design this newsletter uses now, first in the list. */
.design-in-use {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--purple);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

/* Audience */
.audience-note {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.audience-note a {
  color: var(--purple);
  font-weight: 600;
}

.audience-group-find {
  max-width: 320px;
  margin-bottom: 12px;
}

.group-row[hidden] {
  display: none;
}

/* Everyone is on: every group is ticked and the rows are locked. */
.group-list.is-covered .group-row {
  cursor: default;
}

.group-list.is-covered .group-name,
.group-list.is-covered .group-count {
  color: var(--ink-faint);
}

/* A disabled checkbox is drawn grey whatever the accent colour, which loses the tick just when
   it is the point, so the locked rows draw their own box. */
.group-list.is-covered input[type="checkbox"]:disabled {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--purple);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  border: 1px solid var(--purple);
  border-radius: 4px;
  cursor: default;
}

/* A long group list scrolls in its own box rather than pushing Also send to off the page. */
.group-list {
  max-height: 440px;
  overflow-y: auto;
}

/* Review: a note under Recipients, and the notices (test mode, what's missing, a failed send). */
.review-left-out {
  margin: 8px 2px 0;
  font-size: 13px;
  color: var(--ink-faint);
}

.review-notice {
  margin: 0 0 24px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(103, 199, 195, 0.12);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--navy);
}

.review-notice--warning {
  background: rgba(253, 181, 21, 0.14);
}

.review-notice ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.btn-primary-solid:disabled[title] {
  cursor: not-allowed;
}

/* ---------- Phase 5: the newsletter lists ---------- */

/* The pill's base look, from previous-newsletters.css, for the pages that don't load that sheet
   (Team, Subscription, Switch account, joining a team). */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill--sent {
  background: rgba(103, 199, 195, 0.18);
  color: #2C7A76;
}

/* Sent Newsletter Report lists every newsletter, not only sent ones (the mockup has Sent only). */
.status-pill--draft {
  background: var(--bg);
  color: var(--ink-muted);
}

.status-pill--sending {
  background: rgba(108, 96, 170, 0.12);
  color: var(--purple);
}

.status-pill--failed {
  background: rgba(253, 181, 21, 0.2);
  color: #8A5A00;
}

.pn-metric-none {
  font-size: 13px;
  color: var(--ink-faint);
}

/* A row's own thumbnail box stays when a design has no picture yet. */
.pn-thumb:empty {
  background: var(--bg);
}

/* A button that reads as a link inside a sentence ("See who", "Clear search"). */
.link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--purple);
  text-decoration: underline;
  cursor: pointer;
}

/* The report: results the mockup doesn't have, and a name that opens the contact. */
.cr-result--left .cr-result-dot,
.cr-result--pending .cr-result-dot {
  background: transparent;
  border: 1.5px solid var(--border-strong);
}

.cr-result-flag {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
}

a.cr-result-date {
  color: var(--purple);
}

a.cr-recipient-name {
  text-decoration: none;
}

a.cr-recipient-name:hover {
  color: var(--purple);
  text-decoration: underline;
}

.cr-cell-muted {
  font-size: 13px;
  color: var(--ink-faint);
}

/* Wonde class names run long; a chip stops short of the column's edge. */
.cr-groups .group-chip {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-body .review-notice {
  margin: 0;
}

.cr-check-now:disabled {
  cursor: default;
  opacity: 0.6;
}

/* ---------- Phase 6, redone 8 Oct: Settings, My Details, Team ----------
   None of them is in the mockup. Vas asked why they sat to the left: they were narrow cards
   pinned against the sidebar, put together from three of his pages' parts. They are laid out as
   the Teacher Portal now (my-content.css): Settings and My Details as its Add content form,
   Team as its My Content list. Only what that page has no rule for is here. */

/* Fields one under another in a section: Add content has one field, then a row of two, 20px
   apart. */
.mc-section > .modal-field + .modal-field,
.mc-section > .mc-grid-2 + .modal-field {
  margin-top: 20px;
}

.mc-section > .mc-grid-2:first-child,
.mc-section > .mc-help + .mc-grid-2 {
  margin-top: 0;
}

/* The login's password field, eye and rules (login.css, which only the login loads). */
.lg-pw {
  position: relative;
}

.lg-pw input {
  padding-right: 46px;
}

.lg-pw-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}

.lg-pw-toggle:hover {
  color: var(--navy);
  background: var(--border);
}

.lg-pw-toggle.is-on {
  color: var(--purple);
}

.lg-rules {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lg-rules li {
  position: relative;
  padding-left: 22px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.lg-rules li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  box-sizing: border-box;
}

.lg-rules li.is-met {
  color: #2C7A76;
}

.lg-rules li.is-met::before {
  border-color: var(--teal);
  background: var(--teal);
}

/* My Details: the password as a line with its button, under the fields; changing it is a popup. */
.md-password {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* The line's button keeps its words on one line and its size; the text beside it wraps instead
   ("Ask to move" on a phone, My Subscription). */
.md-password > .btn-outline,
.md-password > form,
.md-password > .status-pill {
  flex-shrink: 0;
  white-space: nowrap;
}

/* A line's explanation under its label (My Subscription) is the card's help text - smaller and
   muted, as under a card's title - so facts read as facts and explanations as explanations.
   Its own block, so it wraps at its own line height, without the help text's bottom margin.
   On a line with a button (.md-password) and on a plain one ("Coming up", .md-line) alike. */
.md-password .mc-help,
.md-line .mc-help {
  display: block;
  margin: 0;
}

/* A notice in a stack of cards (My Subscription) takes the stack's gap, not its own margin too. */
.mc-form > .review-notice {
  margin: 0;
}

.md-password-label {
  display: block;
  margin-bottom: 4px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
}

.md-password-dots {
  font-size: 14.5px;
  letter-spacing: 2px;
  color: var(--ink-muted);
}

/* A form page's heading with no line under it (My Details for a member of staff) keeps the
   gap the line would have left. */
.mc-form-head h2:last-child {
  margin-bottom: 24px;
}

/* My Details for a member of staff: their name and email as plain lines, in the password
   line's style, each under a rule. My Subscription's lines too, including the first one under a
   card's help text, as .md-password already is, and one under a line with a button (the PO
   number under "Invoices go to"). */
.md-line + .md-line,
.md-line + .md-password,
.md-password + .md-line,
.mc-help + .md-line {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.md-line-value {
  display: block;
  font-size: 14.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* ---------- Teacher Portal: the user chip in the top bar (include/shell/portal-top.php) ----------
   The sidebar's chip and menu (agreed 8 Oct, in place of the name and Log out); the menu drops
   down from the bar instead of up from the bottom of the sidebar. On a phone only the avatar
   shows, as only Log out did before. */
.tp-account {
  position: relative;
}

.tp-account .user-chip--button {
  width: auto;
}

.tp-account .user-meta {
  max-width: 220px;
}

.tp-account .account-menu {
  top: calc(100% + 6px);
  bottom: auto;
  left: auto;
  right: 0;
  min-width: 200px;
}

.tp-header-left a {
  display: inline-flex;
}

@media (max-width: 860px) {
  .tp-account .user-meta {
    display: none;
  }
}

/* Subscription's Billing card still uses this. */
.settings-intro {
  margin: -8px 0 24px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* ---------- Phase 6: Subscription ---------- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.plan-card.is-current {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(103, 199, 195, 0.18);
}

.plan-card .status-pill {
  align-self: flex-start;
}

.plan-name {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  color: var(--navy);
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan-price[hidden],
.plan-subscribe[hidden] {
  display: none;
}

.plan-amount {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
}

.plan-per {
  font-size: 13px;
  color: var(--ink-faint);
}

.plan-interval {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border);
}

.plan-interval-btn {
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.plan-interval-btn.is-active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.plan-features {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.plan-features li {
  position: relative;
  padding-left: 22px;
}

.plan-features li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 4px;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(-45deg);
}

.plan-subscribe {
  justify-content: center;
  margin-top: auto;
}

.billing-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.billing-card h3 {
  margin-bottom: 10px;
}

.billing-card .settings-intro {
  margin: 0;
}

.billing-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.billing-by {
  font-size: 11.5px;
  color: var(--ink-faint);
}

@media (max-width: 640px) {
  .billing-card { flex-direction: column; align-items: flex-start; }
}

/* ---------- Phase 6: pages outside an account (Switch account, joining a team) ---------- */

.app.app--plain {
  display: contents;
}

body.plain-page {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

.plain-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.plain-logo img {
  display: block;
  height: 32px;
}

.plain-body {
  padding: 40px 16px 64px;
}

.plain-column {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.plain-column--narrow {
  max-width: 520px;
}

.account-card.is-current {
  border-color: var(--teal);
}

.account-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-card-title {
  flex: 1;
  min-width: 0;
}

.account-card-title h3 {
  margin: 0 0 2px;
}

.account-card-role {
  font-size: 13px;
  color: var(--ink-faint);
}

.account-people {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-muted);
}

.account-people summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--purple);
}

.account-people ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.account-people li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}

.invite-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 36px 32px;
}

.invite-card h3 {
  margin: 0;
  font-size: 20px;
}

.invite-card p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* Send a Newsletter, Details: a long subject (or From name, or reply-to) used to widen the
   preview column, because a flex item won't shrink below its content and the mockup's
   .meta-value doesn't wrap. The column keeps its share now, and long values wrap onto more lines,
   so the whole subject can still be read. */
.wizard-preview {
  min-width: 0;
}

.meta-value {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* "Private - only you can see this" under a private design's name (Vas, 6 Oct). */
.design-private {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  max-width: 100%;
  margin-top: 4px;
  padding: 2px 9px;
  /* A pill on one line; on a narrow card it wraps, and a full pill radius would make a blob. */
  border-radius: 10px;
  background: #F1EFF9;
  color: var(--purple);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
}

.design-private svg {
  flex-shrink: 0;
}

/* A design with a newsletter started on it (one design, one newsletter - Andrew, 5 Oct). Top
   right, clear of the mockup's Draft badge and the picker's In use, which sit top left. */
.design-started {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(103, 199, 195, 0.95);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* ---------- Login (login.php, Vas's login.html) ----------
   His "Not you?", "Forgot password?" and "Back to log in" were buttons that switched steps in the
   browser; the server draws each step now, so they are links. */
a.lg-link,
a.lg-back {
  text-decoration: none;
}

a.lg-link:hover {
  text-decoration: underline;
}

/* Choosing a school: Riz's step for someone on the staff list at more than one school. Not in
   Vas's design, so it is made of his pieces - the boxes look like the email line above them. */
.lg-schools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
}

.lg-school {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lg-school:hover {
  border-color: var(--purple);
}

.lg-school:has(input:checked) {
  border-color: var(--purple);
  background: #F8F7FC;
}

.lg-school input {
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--purple);
}

.lg-school span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The way between logging in and signing up, under the main button: "New to School Newsletter?
   Create an account" on the login (22 Oct), "Already have an account? Log in" on onboarding.php.
   The resend line's look, centred. */
.lg-signup {
  margin: 20px 0 0;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-muted);
}

/* "resend the email" is a form now, so it can post; it still reads as one line of text. */
form.lg-resend .lg-link {
  font-size: inherit;
}

/* ---------- Drop-down lists (a select, opened) ---------- */
/* Drawn by ui/js/app.js in place of the browser's own list, for .pill-select and
   .modal-field select. The mockup never shows a select open; this is its "..." menu
   (.row-kebab-menu): the same card, border, shadow and hover. The chosen option is purple with
   a tick. Font size comes from the select it opens from. Not in the mockup: to be confirmed
   with Vas (8 Oct). */
.select-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: min(340px, calc(100vw - 32px));
  max-height: 280px;
  overflow-y: auto;
  /* A long list (a Wonde school's groups) scrolls; a thin bar, not the system's full one. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
}

.select-menu[hidden] {
  display: none;
}

.select-menu-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  line-height: 1.35;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.12s ease;
}

.select-menu-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.select-menu-option svg {
  flex-shrink: 0;
  color: var(--purple);
  visibility: hidden;
}

.select-menu-option.is-active {
  background: var(--bg);
}

.select-menu-option[aria-selected="true"] {
  font-weight: 600;
  color: var(--purple);
}

.select-menu-option[aria-selected="true"] svg {
  visibility: visible;
}

.select-menu-option[aria-disabled="true"] {
  color: var(--ink-faint);
  cursor: default;
}

/* The select stays lit while its list is open, as it is while focused. */
.pill-select.is-open {
  border-color: var(--purple);
  color: var(--navy);
}

/* ---------- The shared "Are you sure?" when it isn't a delete ---------- */
/* The mockup's "Send this campaign?" (review.html, .modal-confirm-text in review.css): words
   only, no icon, left-aligned. window.confirmAction() switches to it when danger isn't set. */
.modal-confirm--plain {
  display: block;
  padding: 0;
  text-align: left;
}

.modal-confirm--plain .modal-confirm-icon {
  display: none;
}

.modal-confirm--plain p {
  line-height: 1.55;
}

.modal-confirm p strong {
  color: var(--navy);
}

/* ---------- One search box on every page (Andrew, 9 Oct) ----------
   The mockup has two: white (.pn-search-field: Contacts, Groups, Sent Newsletter Report, Teacher
   Content) and light grey (.design-search: Drafts, My Templates, Previous Newsletters, Choose a
   Design), and each page its own width (260 to 360px). On a page they're all white now, and 260px
   wide - what fits beside All Contacts' five filters on a 1440px screen without wrapping. Inside a
   popup a search stays grey, as the mockup's popup searches are. The examples follow one pattern
   too ("Search contacts...", "Search drafts..."). */
.design-search input,
.audience-group-find input {
  background: var(--surface);
}

.modal .pn-search-field input {
  background: var(--bg);
}

/* The icon 12px in on both (the mockup had .design-search's at 13px). */
.design-search svg {
  left: 12px;
}

.design-search,
.pn-search,
.ct-filters > .pn-search,
.cr-recipients-search,
.tc-filters-left .pn-search,
.tc-ac {
  flex: 0 1 260px;
  width: 260px;
  max-width: 100%;
}

/* Teacher Content's two boxes keep their narrower width on a small laptop (teacher-content.css). */
@media (max-width: 1100px) {
  .tc-filters-left .pn-search,
  .tc-ac {
    flex-basis: 230px;
    width: 230px;
  }
}

@media (max-width: 640px) {
  .design-search,
  .pn-search,
  .ct-filters > .pn-search,
  .cr-recipients-search,
  .tc-filters-left .pn-search,
  .tc-ac {
    flex-basis: auto;
    width: 100%;
  }
}

/* ---------- Settings: two named sections, and the unsubscribe line (9 Oct) ----------
   Each section is named as Add content names its own (my-content.html: .mc-label, then .mc-help),
   here as a heading. The preview is the foot of an email: small, grey, centred, the link
   underlined. */
.mc-section-title {
  display: block;
  margin: 0 0 4px;
  line-height: 1.4;
}

.mc-section-title + .mc-help {
  margin-bottom: 20px;
}

.mc-section > .mc-help + .modal-field {
  margin-top: 0;
}

.settings-preview-label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.settings-unsub-preview {
  padding: 16px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.settings-unsub-preview p {
  margin: 0;
}

.settings-unsub-preview a {
  color: inherit;
  text-decoration: underline;
}

/* Draft Newsletters and My Templates: Private sits with Archived at the right of the toolbar
   (design-picker.css spreads the toolbar's items apart, which put a third one in the middle). */
.design-toolbar [data-private-btn] {
  margin-left: auto;
}

.design-toolbar [data-private-btn] + [data-show-view="archived"] {
  margin-left: -6px;
}

/* Archived's and Private's "Back to" button, beside the title, without making the title row
   taller than the main list's (the button is 39px, the title 32px), so the title, search and
   cards stay where they were when the view changes. */
[data-design-page] .design-header > [data-show-view] {
  margin-top: -4px;
  margin-bottom: -4px;
}

@media (max-width: 640px) {
  .design-toolbar [data-private-btn],
  .design-toolbar [data-private-btn] + [data-show-view="archived"] {
    margin-left: 0;
  }
}

/* ---------- My Blocks (9 Oct) ----------
   Laid out as Settings: the cards one under another, 20px apart, as .mc-form lays out its
   sections. Each preview is a frame (my-blocks.php says why) that takes the block's height once
   it has drawn; until then it holds a little room so the page doesn't jump as much. */
.mb-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mb-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #F5F4F0;
  padding-top: 24px;
  padding-bottom: 24px;
}

.mb-preview iframe {
  display: block;
  width: 100%;
  height: 160px;
  border: 0;
}

/* A name filled in from the staff list: read-only rather than disabled, so it's still sent,
   and looking as a disabled field does (style.css). */
.modal-field input[readonly] {
  background: var(--border);
  border-color: var(--border);
  color: var(--ink-muted);
}

/* ---------- Team, in Vas's design (team.css, 12 Oct) ----------
   Only what team.css leaves to the build. */

/* Add people's suggestions are Vas's .tm-ac-list, but placed on <body> under the field, as the
   select lists are (ui/js/account.js): the popup's body scrolls and would cut off a list inside
   it. */
.tm-ac-list.people-suggest {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  z-index: 1000;
  /* More than four people scroll; a thin bar, as the select lists have (.select-menu), not the
     system's full one with arrows (found on dev with real staff, 12 Oct). */
  scrollbar-width: thin;
}

/* Why a name can't be changed (a member of staff's, in Add people and Edit): under the two name
   fields, before the role. */
.tm-modal-body .tm-name-hint {
  margin: -10px 0 18px;
}

.tm-name-hint[hidden] {
  display: none;
}

/* The row just added or changed lights up edge to edge across the card, not only between its
   padding (Andrew, 12 Oct). The card is a stacking context so the light sits behind the row's
   content and above the card's own white. */
.tm-card {
  --tm-card-pad: 24px;
  position: relative;
  z-index: 0;
  overflow: hidden;
}

.tm-person {
  position: relative;
}

.tm-person.is-new {
  animation: none;
}

.tm-person.is-new::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--tm-card-pad) * -1);
  right: calc(var(--tm-card-pad) * -1);
  z-index: -1;
  animation: tm-flash 2.4s ease forwards;
}

.tm-person.is-new:first-child::before {
  top: -4px;
}

.tm-person.is-new:last-child::before {
  bottom: -4px;
}

@media (max-width: 640px) {
  .tm-card {
    --tm-card-pad: 18px;
  }
}

/* ---------- Demo accounts ---------- */

/* A route a demo account can see but not take - Import via Wonde (include/school/ui/create-contact-options.php).
   Greyed and inert rather than hidden: the demo is there to show what the product does. */
.create-menu-item.is-unavailable {
  cursor: default;
  opacity: 0.55;
}

.create-menu-item.is-unavailable:hover {
  background: none;
}

/* Add Contact and Import have a greyed twin for a demo at its contact limit, and ui/js/contacts.js
   shows one or the other; .create-menu-item's display: flex would otherwise beat [hidden]. */
.create-menu-item[hidden] {
  display: none;
}

/* The line across the top of every screen in a demo workspace (include/shell/sidebar.php). */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--purple, #6C60AA);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.demo-banner strong {
  font-weight: 600;
}

.demo-banner a {
  color: #fff;
  text-decoration: underline;
}

/* The same bar in the "something needs your attention" colour, for a card payer whose
   subscription has lapsed - paused after a failed payment, usually (include/shell/sidebar.php).

   A MODIFIER, not a second banner, on purpose: everything below about fitting the shell around a
   full-width bar keys off .demo-banner, and a banner with its own class would need all of it
   repeated. Amber rather than red: the school has lost nothing, sending is paused until the card
   is updated, and red reads as an account that has gone.

   A LITERAL, not a token, because there is no amber token: style.css has --yellow (#fdb515), the
   brand's yellow, and white text on it is unreadable (about 1.7:1). This is that yellow taken
   down until white sits on it properly - 5.4:1, past AA for the banner's 13px - so the bar is
   recognisably the brand's amber rather than a new colour. A token was not added to style.css for
   one rule. */
.demo-banner--billing {
  background: #8c5a00;
}

/* The shell is built to fill the window exactly - .app at least 100vh, the sidebar a sticky 100vh
   column with its own scroll, the page scrolling the window (style.css). A banner above it added
   its own height to every page: a page scroll on the dashboard, and the sidebar's foot (the usage
   bar and the user's name) pushed below the window until you scrolled. So, only when there is a
   banner:

     the body stacks banner and .app as a column, and .app fills what the banner leaves rather
     than a whole 100vh of its own. The body grows with the page (height: auto) - left at
     style.css's 100% it would be one window tall, and the banner, sticky inside it, would scroll
     away once the page passed the first window.

     on a desktop the banner stays at the top, and everything that sticks or is sized to the
     window below it moves down by its height: the sidebar, Teacher Content's column headings and
     detail panel, and where the browser stops when it scrolls something into view.
     --demo-banner-h is the banner's height, set by include/shell/sidebar.php because the words
     wrap onto a second line on narrower screens; 40px is one line, for the moment before it runs.

     on a phone or tablet the sidebar is a fixed overlay and the banner is three or four lines,
     too much to keep on screen, so it scrolls away with the page. */
body:has(> .demo-banner) {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100vh;
}

/* style.css reserves the scrollbar's strip on every page, and on a page too short to scroll it
   showed as a blank stripe at the right end of the banner. Given back as the Teacher Portal does
   for its full-width header (teacher-portal.css); a page that does scroll draws its scrollbar
   beside the banner, as it would beside any top bar. */
:root:has(.demo-banner) {
  scrollbar-gutter: auto;
}

body:has(> .demo-banner) > .app {
  flex: 1 0 auto;
  min-height: 0;
}

@media (min-width: 961px) {
  .demo-banner {
    position: sticky;
    top: 0;
    z-index: 22;
  }

  html:has(.demo-banner) {
    scroll-padding-top: var(--demo-banner-h, 40px);
  }

  body:has(> .demo-banner) .sidebar {
    top: var(--demo-banner-h, 40px);
    height: calc(100vh - var(--demo-banner-h, 40px));
  }

  body:has(> .demo-banner) .tc-colhead.ct-row {
    top: var(--demo-banner-h, 40px);
  }

  body:has(> .demo-banner) .tc-panel {
    top: calc(24px + var(--demo-banner-h, 40px));
  }
}

/* Where the sidebar folds away (style.css, 960px), the menu button (.mobile-nav-toggle, fixed
   16px in from the top left and 42px square) sits on the start of the banner and covered
   "Demo workspace". So the words start to its right, and the banner is at least tall enough to
   hold it with the same 16px above and below. */
@media (max-width: 960px) {
  .demo-banner {
    justify-content: flex-start;
    min-height: 74px;
    padding-left: 72px;
    text-align: left;
  }
}

/* Reset password and Log in side by side under create-demo.php's taken-address box. */
.lg-row-end {
  gap: 16px;
}

/* ---------- Invoices (invoices.php) ----------
   The campaign report's recipients table with five columns of our own: invoice, date, amount,
   status, and View at the right end. No minimum width, unlike the report's table: everything in
   it is short, so it fits whatever width the sidebar leaves instead of scrolling sideways. View's
   column has a set width because each row is its own grid - sized to its content, the heading
   row (no button) would put every heading to the right of its column. On a phone each invoice
   stacks into two lines, as My Subscription's lines do: the number over its date, amount and
   status, with View on the right. */
.inv-table {
  min-width: 0;
}

.inv-table .cr-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1fr) 80px;
}

@media (max-width: 640px) {
  .inv-table .cr-row--head {
    display: none;
  }

  .inv-table .cr-row {
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "number number number view"
      "date   amount status view";
    gap: 6px 12px;
    padding: 14px 16px;
  }

  .inv-number {
    grid-area: number;
  }

  .inv-date {
    grid-area: date;
  }

  .inv-amount {
    grid-area: amount;
  }

  .inv-status {
    grid-area: status;
  }

  .inv-view {
    grid-area: view;
  }
}

/* ---------- Dashboard: "What happens next" after signing up (school-dashboard.php, Vas 9 Nov) ---------- */

.welcome-heading {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.welcome-next {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.welcome-next li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.welcome-next-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: rgba(108, 96, 170, 0.12);
  color: var(--purple);
}

.welcome-support {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.welcome-support a {
  color: var(--purple);
  font-weight: 600;
}

/* ---------- Get started, in the corner (include/shell/getting-started.php, Vas 9 Nov) ----------
   Under the popups (.modal is z-index 50) and the menus, over the page. A pill until it's opened;
   the card is the size of Vas's example and scrolls inside itself on a short window. */

.gs {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  font-family: var(--font-body);
}

.gs[hidden],
.gs-pill[hidden],
.gs-card[hidden],
.gs-step-body[hidden] {
  display: none;
}

.gs-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

.gs-pill:hover {
  border-color: var(--border-strong);
}

/* Progress as a ring: a conic fill with the middle cut out. */
.gs-pill-ring {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(var(--purple) var(--gs-progress, 0%), var(--border) 0);
}

.gs-pill-ring::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface);
}

.gs-pill-count {
  font-size: 13px;
  color: var(--ink-faint);
}

.gs-card {
  width: 360px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.gs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.gs-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.gs-head p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.gs-head .icon-btn {
  flex-shrink: 0;
}

.gs-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 10px;
}

.gs-progress-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.gs-bar {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.gs-bar > span {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--purple);
  transition: width 0.3s ease;
}

.gs-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gs-step {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
}

.gs-step.is-open {
  background: var(--bg);
  border-color: var(--border);
}

.gs-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.gs-check {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  color: transparent;
}

.gs-step.is-done .gs-check {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.gs-step-title {
  flex: 1;
  min-width: 0;
}

.gs-step-note {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
}

.gs-step-chevron {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--ink-faint);
  transition: transform 0.2s ease;
}

.gs-step.is-open .gs-step-chevron {
  transform: rotate(180deg);
}

.gs-step-body {
  padding: 0 12px 14px 42px;
}

.gs-step-body p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.gs-link input {
  box-sizing: border-box;
  width: 100%;
  height: 36px;
  margin: 0 0 10px;
  padding: 0 10px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.gs-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.gs .gs-btn {
  padding: 8px 16px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .gs {
    right: 16px;
    bottom: 16px;
  }

  .gs-card {
    width: calc(100vw - 32px);
  }
}
