.board-menu {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  justify-self: end;
  z-index: 2;
}
.board-menu > summary {
  display: grid;
  place-items: center;
  list-style: none;
  min-width: 68px;
  min-height: 44px;
  padding: 5px;
  border: 1px solid #b6d5c282;
  border-radius: 9px;
  color: #fffbee;
  background: #ffffff17;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.board-menu > summary::-webkit-details-marker { display: none; }
.board-menu > summary:hover, .board-menu[open] > summary { background: #ffffff2c; }
.board-menu > summary:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.teacher-menu {
  position: absolute;
  inset: calc(100% + 8px) 0 auto auto;
  display: grid;
  width: min(230px, calc(100vw - 76px));
  gap: 6px;
  padding: 7px;
  border: 1px solid #d7e6dc;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px #112f2855;
}
.teacher-view .teacher-menu button {
  min-height: 46px;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
}
.teacher-menu button[aria-current="page"] {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}
.teacher-view .teacher-menu [data-close-teacher-menu] {
  text-align: center;
  background: var(--mint);
}
.billing-panel {
  padding: clamp(12px, 4vw, 26px);
  background: #fff;
  border: 1px solid #d5e4db;
  border-radius: 16px;
  box-shadow: 0 5px 14px #1935290a;
}
.billing-heading, .billing-sheet-head, .billing-total {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.billing-heading h2, .billing-heading p { margin: 0; }
.billing-heading p, .billing-period { color: var(--muted); font-size: 14px; }
.billing-sample {
  display: inline-block;
  flex: none;
  padding: 4px 8px;
  background: #fff1d3;
  color: #6d5017;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}
.billing-filters, .billing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px;
  margin-block: 14px;
}
.billing-filters label, .billing-mail label {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
}
.billing-panel select, .billing-panel input, .billing-panel textarea, .billing-actions button { font-size: 16px; }
.billing-total {
  align-items: center;
  padding: 12px;
  border-radius: 9px;
  background: #eaf5ed;
  color: #174b38;
}
.billing-total span { font-size: 14px; }
.billing-total strong { font-size: clamp(23px, 7vw, 32px); white-space: nowrap; }
.billing-table-wrap { container: purchase-lines / inline-size; max-width: 100%; overflow: auto; margin-top: 12px; }
.billing-table { width: 100%; min-width: 390px; border-collapse: collapse; font-size: 14px; }
.billing-table th, .billing-table td { padding: 9px 7px; border-bottom: 1px solid #dce7df; }
.billing-table th[scope="row"] { text-align: left; font-weight: 500; }
.billing-table .billing-number { text-align: right; white-space: nowrap; }
.billing-date { white-space: nowrap; }
.billing-item-detail { display: block; color: var(--muted); font-size: .92em; overflow-wrap: anywhere; }
.billing-cell-label { display: none; }
.billing-sheet {
  margin-top: 18px;
  padding: clamp(10px, 3vw, 26px);
  border: 1px solid #b5c9bd;
  border-radius: 7px;
  background: white;
}
.billing-sheet-head h3 { display: inline; font-size: 22px; margin-right: 6px; }
.billing-sheet-head > strong { text-align: right; font-size: 14px; }
.billing-recipient { margin: 14px 0 2px; font-weight: 700; }
.billing-period { margin: 0 0 12px; }
.billing-calculation { color: #426456; font-size: 14px; }
.billing-reference {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 3px 10px;
  margin: 16px 0 0;
  font-size: 14px;
}
.billing-mail {
  padding-top: 12px;
  margin-top: 18px;
  border-top: 1px solid #dce7df;
}
.billing-mail form { display: grid; gap: 10px; }
.billing-mail input, .billing-mail textarea { width: 100%; }
.billing-mail textarea {
  border: 1px solid #b9c9c0;
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.billing-mail p, .billing-mail .billing-actions { margin: 0; }
.class-funds form { display: grid; gap: 12px; }
.class-funds label { display: grid; gap: 4px; align-content: end; font-size: 14px; font-weight: 700; }
.class-fund-payment, .class-fund-payment-fields { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.class-fund-payment legend { margin-bottom: 8px; padding: 0; font-weight: 700; }
.class-fund-payment-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.class-fund-payment-options label { position: relative; cursor: pointer; }
.class-fund-payment-options input {
  position: absolute;
  inline-size: 1px;
  min-block-size: 0;
  block-size: 1px;
  margin: 0;
  padding: 0;
  clip-path: inset(50%);
}
.class-fund-payment-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 52px;
  padding: 8px;
  border: 1px solid #b9cec2;
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
}
.class-fund-payment-options input:checked + .class-fund-payment-option {
  border-color: var(--green);
  background: #e5f4eb;
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px var(--green);
}
.class-fund-payment-options input:focus-visible + .class-fund-payment-option {
  outline: 3px solid #d7a92e;
  outline-offset: 2px;
}
.class-fund-calendar {
  display: grid;
  place-items: center;
  inline-size: 24px;
  block-size: 23px;
  border: 1px solid currentColor;
  border-block-start-width: 5px;
  border-radius: 4px;
  font-size: 12px;
}
.class-fund-payment-fields { display: grid; gap: 12px; }
.class-fund-term {
  display: grid;
  gap: 8px;
  min-inline-size: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf8;
}
.teacher-setup .class-fund-term h3 { margin: 0; color: var(--green-dark); font-size: 17px; }
.teacher-setup .class-fund-field-note { margin: 0; }
.class-funds-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.class-funds-fields label { font-size: clamp(12px, 3.1vw, 14px); }
.class-funds-fields :is(input, select) { width: 100%; padding-inline: 7px; }
.class-fund-transfers {
  display: grid;
  gap: 6px;
  padding-block: 10px;
  border-block: 1px solid var(--line);
}
.class-fund-transfers h4 { margin: 0; font-size: 15px; }
[data-fund-transfer-rows] { display: grid; gap: 8px; }
.class-fund-transfer {
  display: grid;
  gap: 8px;
  min-inline-size: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}
.teacher-view [data-fund-transfer] { justify-self: start; min-height: 44px; font-size: 15px; }
.teacher-view [data-fund-transfer="remove"] { justify-self: end; }
.class-fund-month-input { position: relative; min-inline-size: 0; }
.class-funds-fields .class-fund-month-input input { padding-inline-end: 32px; appearance: textfield; }
.class-fund-month-input input::-webkit-inner-spin-button,
.class-fund-month-input input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.class-fund-month-input > span {
  position: absolute;
  inset-inline-end: 7px;
  inset-block: 0;
  display: grid;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  pointer-events: none;
}
.class-funds .billing-actions { margin: 0; }
.class-funds-result > p { font-size: 14px; }
.class-funds-result dl { display: grid; gap: 5px; margin-block: 8px 2px; }
.class-funds-result dl div { display: flex; justify-content: space-between; align-items: center; gap: 7px; border-radius: 6px; padding: 6px 8px; background: white; }
.class-funds-result dt, .class-funds-result dd { margin: 0; }
.class-funds-result dd { white-space: nowrap; font-weight: 700; }
.class-funds-result .budget-remaining { background: #e5f4e9; color: #0d563d; }
.class-funds-result .budget-overrun { background: #fbebea; color: #852d34; }
.board-funds { grid-column: 1; grid-row: 5; margin-top: 8px; padding-top: 6px; border-top: 1px solid #d8ead358; }
.board-funds p { margin: 0 0 3px; color: #e3efe9; font-size: 12px; line-height: 1.4; }
.board-funds dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin: 0; }
.board-funds dl > div { padding: 4px; background: #ffffff15; border-radius: 4px; }
.board-funds dt { font-size: 11px; color: #e3efe9; }
.board-funds dd { margin: 0; font-size: clamp(11px, 3.5vw, 15px); font-weight: 700; overflow-wrap: anywhere; line-height: 1.4; }
@media (max-width: 430px) {
  .teacher-view .school-card:has(.board-funds:not([hidden])) { --board-mascot-width: clamp(28px, 9vw, 38px); }
}
@container purchase-lines (max-width: 480px) {
  .billing-table { display: block; min-width: 0; }
  .billing-table thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
  .billing-table tbody { display: grid; gap: 8px; }
  .billing-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 10px;
    border: 1px solid #dce7df;
    border-radius: 9px;
    background: #f7faf8;
  }
  .billing-table tbody :is(th, td) {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  .billing-table :is(.billing-date, .billing-item) { grid-column: 1 / -1; }
  .billing-table .billing-date { color: var(--muted); font-size: .93em; }
  .billing-table th.billing-item { font-weight: 700; }
  .billing-table .billing-number { text-align: left; white-space: normal; font-variant-numeric: tabular-nums; }
  .billing-table .billing-line-total { color: #174b38; font-weight: 700; }
  .billing-cell-label { display: block; color: var(--muted); font-size: .9em; font-weight: 400; }
}

.teacher-view .school-card .board-mascot { grid-column: 2; grid-row: 3 / 6; }
.teacher-view .board-purchase {
  grid-column: 1;
  grid-row: 4;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1px 8px;
  min-height: 44px;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid #d5deb388;
  border-radius: 10px;
  background: #f8f2cf;
  color: #264033;
  text-align: left;
  font-size: clamp(13px, 3.4vw, 15px);
  line-height: 1.45;
}
.teacher-view .board-purchase:hover { background: #fff8dd; }
.teacher-view .board-purchase strong { font-size: clamp(16px, 4.4vw, 20px); white-space: nowrap; }
.board-purchase .purchase-source { flex-basis: 100%; font-size: 12px; }
.board-funds-hint {
  grid-column: 1 / -1;
  grid-row: 5;
  margin: 8px 0 0;
  color: #e3efe9;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
}
.board-funds-hint-compact { display: none; }
.teacher-view .school-card:has(.board-funds-hint:not([hidden])) .board-mascot {
  grid-row: 3 / 5;
  margin-block-end: -3px;
}
@media (max-width: 560px) {
  .board-funds-hint { font-size: 12px; }
  .board-funds-hint-wide { display: none; }
  .board-funds-hint-compact { display: inline; }
}
.teacher-setup { max-width: min(540px, calc(100vw - 24px)); }
.teacher-setup section { padding: 12px 0; }
.teacher-setup section + section { border-top: 1px solid #d4e3db; }
.teacher-setup h3, .teacher-setup p { margin: 0 0 8px; }
.teacher-setup h3 small { font-weight: normal; color: #4f685c; }
.teacher-setup label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.teacher-setup input { width: 100%; font-size: 16px; }
.teacher-setup #teacher-year-form { display: grid; gap: .65rem; }
.teacher-setup #teacher-year-form select { width: 100%; font-size: 16px; }
.teacher-setup #teacher-year-form + p { margin-top: .65rem; }
.teacher-setup .billing-actions { margin-block: 8px; }
.teacher-setup [role="status"]:empty { display: none; }
#teacher-browser-qr {
  display: block;
  width: min(270px, 100%);
  height: auto;
  margin: 12px auto;
}
#teacher-browser-qr[hidden] { display: none; }
.teacher-view .billing-back { min-height: 44px; margin: 0 0 12px; font-size: 15px; }
#billing-heading { scroll-margin-top: 14px; }
#order-budget-warning:not(:empty) {
  padding: 12px 14px;
  border: 1px solid #e2aba3;
  border-radius: 8px;
  background: #fff1ee;
  color: #852d26;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
}
