:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --line: #d7dce5;
  --text: #18202a;
  --muted: #647082;
  --accent: #0f766e;
  --accent-strong: #22a69a;
  --accent-soft: #dff5f1;
  --theme-wash: rgba(15, 118, 110, 0.08);
  --theme-ring: rgba(15, 118, 110, 0.22);
  --danger: #b42318;
  --danger-soft: #fde7e5;
  --info-soft: #e8f1fd;
  --shadow: 0 16px 40px rgba(18, 30, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, var(--theme-wash), transparent 32%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
.button-group button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

button.ghost {
  background: #eef2f6;
  color: var(--text);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.label {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.level-choice {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
}

.checkbox input {
  width: auto;
}

.level-choice input {
  width: auto;
}

.service-choice span {
  display: grid;
  gap: 2px;
}

.service-choice small {
  color: var(--muted);
  font-weight: 500;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    radial-gradient(circle at top left, var(--theme-ring), transparent 36%),
    linear-gradient(180deg, var(--accent), #102030 62%);
  color: #edf5ff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-top,
.sidebar-bottom {
  display: grid;
  gap: 18px;
}

.sidebar-top {
  align-content: start;
}

.sidebar-bottom {
  margin-top: 24px;
}

.sidebar-heading {
  display: grid;
  gap: 4px;
}

.sidebar-logo {
  width: 62px;
  height: 62px;
  margin-bottom: 8px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 34px rgba(8, 18, 30, 0.22);
}

.sidebar-logo-fallback {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
}

.sidebar-year {
  color: #fff;
  font-size: clamp(1.8rem, 2.5vw, 1.8rem);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.sidebar-subtitle {
  color: #c8d6e6;
  font-size: 0.95rem;
}

.muted {
  color: var(--muted);
}

.sidebar .muted {
  color: #adc0d5;
}

.sidebar .panel .eyebrow,
.sidebar .panel .label,
.sidebar .panel .muted {
  color: var(--muted);
}

.sidebar .panel .strong {
  color: var(--text);
  font-weight: 700;
}

.language-switcher {
  display: grid;
  gap: 8px;
}

.language-switcher span {
  color: var(--muted);
  font-size: 0.92rem;
}

.login-form-head {
  display: grid;
}

.theme-color-field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.theme-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px var(--theme-ring);
  vertical-align: -1px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-group-label {
  padding: 0 6px;
  color: rgba(237, 245, 255, 0.76);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-submenu {
  display: grid;
  gap: 8px;
}

.nav-sublink {
  margin-left: 16px;
  width: calc(100% - 16px);
}

button.nav-link {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  border: 1px solid rgba(237, 245, 255, 0.12);
  background: rgba(237, 245, 255, 0.08);
  color: #edf5ff;
  box-shadow: none;
}

button.nav-link:hover,
button.nav-link.active {
  background: #edf5ff;
  color: var(--accent);
}

.top-space {
  margin-top: 24px;
}

.main {
  padding: 24px;
}

.topbar {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 20px;
}

.topbar h1,
.panel h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 120px));
  gap: 12px;
}

.stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat {
  padding: 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat strong {
  font-size: 1.4rem;
}

.panel {
  padding: 18px;
}

.panel.compact {
  padding: 14px;
}

.admin-home {
  display: grid;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at top right, var(--theme-wash), transparent 35%),
    var(--panel);
  box-shadow: var(--shadow);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 2rem;
}

.chart-list {
  display: grid;
  gap: 14px;
}

.chart-list-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chart-row {
  display: grid;
  gap: 8px;
}

.chart-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-row-head strong {
  color: var(--text);
}

.chart-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf4;
}

.chart-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.chart-fill.success {
  background: linear-gradient(90deg, #15803d, #4ade80);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.section-grid.wide-left {
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.8fr);
}

.section-grid.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.section-head.flush {
  margin-bottom: 0;
}

.table-list {
  display: grid;
  gap: 12px;
}

.table-list.compact-list {
  gap: 8px;
}

.row,
.student-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.student-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.student-service-editor,
.student-editor {
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fff;
}

.row-wrap {
  flex-wrap: wrap;
}

.row-meta,
.eyebrow {
  font-size: 0.88rem;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
}

.gap-sm {
  gap: 10px;
}

.top-space-sm {
  margin-top: 10px;
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.class-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.class-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 700;
}

.payment-method-row {
  align-items: flex-start;
}

.payment-method-config-form {
  flex-basis: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.payment-method-builtins {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-entry-lines {
  display: grid;
  gap: 12px;
}

.payment-entry-line {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.payment-line-head {
  align-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: rgba(8, 18, 30, 0.62);
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(8, 18, 30, 0.28);
}

.modal-card.large {
  width: min(1080px, 100%);
}

.modal-actions {
  justify-content: flex-end;
}

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.receipt-grid > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.receipt-grid .receipt-card-wide {
  grid-column: 1 / -1;
}

.payment-report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.receipt-detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.receipt-detail-list div,
.receipt-allocations div {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.receipt-detail-list div:last-child,
.receipt-allocations div:last-child {
  border-bottom: 0;
}

.receipt-detail-list dt,
.receipt-detail-list dd {
  margin: 0;
}

.receipt-detail-list dd,
.receipt-allocations span {
  color: var(--muted);
  text-align: right;
}

.receipt-document h2 {
  margin-top: 0;
}

.receipt-template {
  color: #111;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  min-height: 980px;
}

.receipt-template-head {
  display: grid;
  grid-template-columns: 1fr 1fr 0.9fr;
  border: 2px solid #1b1b1b;
}

.receipt-template-col {
  min-height: 75px;
  padding: 5px 10px;
  border-right: 2px solid #1b1b1b;
  display: grid;
  align-content: start;
  gap: 2px;
}

.receipt-template-col:last-child {
  border-right: 0;
}

.receipt-template-school {
  justify-items: center;
  text-align: center;
}

.receipt-template-school h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
}

.receipt-template-logo {
  width: 55px;
  height: 55px;
  object-fit: contain;
  margin-top: 5px;
}

.receipt-template-logo-placeholder {
  border: 1px solid #888;
  background: #fff;
}

.receipt-template-meta h3 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.1;
}

.receipt-template-number {
  margin: 10px 0 14px;
  text-align: center;
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: 0.01em;
}

.receipt-template-subnumber {
  margin: -8px 0 10px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.2;
}

.receipt-template-body {
  display: grid;
  gap: 14px;
  flex: 1;
}

.receipt-template-group {
  display: grid;
  gap: 8px;
}

.receipt-template-group-title {
  border: 2px solid #1b1b1b;
  padding: 3px 8px;
  line-height: 1.15;
  min-height: 0;
  height: auto;
  font-size: 13px;
  font-weight: 400;
}

.receipt-template-method {
  border: 2px solid #1b1b1b;
  padding: 3px 8px;
  line-height: 1.15;
  min-height: 0;
  height: auto;
  font-size: 13px;
  font-weight: 400;
}

.receipt-template-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
}

.receipt-template-table th,
.receipt-template-table td {
  border: 2px solid #1b1b1b;
  padding: 10px 8px;
  vertical-align: top;
}

.receipt-template-table th {
  text-align: center;
}

.receipt-template-table td:last-child,
.receipt-template-table th:last-child {
  width: 200px;
  white-space: nowrap;
}

.receipt-template-amount-words {
  margin-top: 8px;
  font-size: 0.95rem;
}

.receipt-template-group-total td {
  font-weight: 700;
  background: #f7f7f7;
  height: 22px;
  min-height: 22px;
  max-height: 22px;
  padding: 2px 8px;
  line-height: 1.1;
  text-align: right;
  vertical-align: middle;
}

.receipt-template-net {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 18px;
  margin: 18px 0 8px;
  font-size: 1.05rem;
}

.receipt-template-signature {
  margin-top: 18px;
}

.receipt-template-signature-line {
  border-top: 2px solid #1b1b1b;
  height: 1px;
}

.receipt-template-signature-label {
  margin-top: 10px;
  text-align: right;
  font-weight: 600;
}

.receipt-template-footer {
  margin-top: auto;
  padding-top: 12px;
  font-size: 0.73rem;
  line-height: 1.25;
}

.receipt-template-footer p {
  margin: 3px 0;
}

@media (max-width: 900px) {
  .receipt-template-head {
    grid-template-columns: 1fr;
  }

  .receipt-template-col {
    border-right: 0;
    border-bottom: 2px solid #1b1b1b;
  }

  .receipt-template-col:last-child {
    border-bottom: 0;
  }
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.unpaid-list-page-header {
  display: none;
}

.report-table th,
.report-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #f7fafc;
}

.report-total-row td {
  background: #f8fffd;
}

.parent-situation-table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

.parent-situation-table {
  min-width: 760px;
  margin-top: 0;
}

.parent-situation-table th:first-child {
  white-space: nowrap;
}

.parent-situation-table thead th:not(:first-child),
.parent-situation-table td {
  min-width: 180px;
}

.parent-situation-value,
.parent-situation-total {
  display: grid;
  gap: 3px;
}

.parent-situation-value strong {
  font-size: 0.85rem;
}

.parent-situation-value span,
.parent-situation-total span {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.parent-situation-value.paid strong {
  color: var(--accent);
}

/* Whether a school issues bills, on its card in the schools list. Stated in
   both states rather than only when it is off: a school that bills is the
   normal case, and a line that appears only for the exception makes its absence
   ambiguous - nobody can tell "billing is on" from "this version has no such
   setting". */
.billing-state {
  font-size: 0.86rem;
  font-weight: 600;
}

.billing-state.on {
  color: var(--accent);
}

.billing-state.off {
  color: var(--danger);
}

.parent-situation-value.partial strong {
  color: #9a3412;
}

.parent-situation-value.pending strong {
  color: #183a5a;
}

.parent-situation-total strong {
  color: var(--accent);
}

/* A payable cell. It has to look pressable without redrawing the table: the
   figures inside stay exactly where they were, and the button is the frame. */
.parent-situation-payable {
  display: block;
  width: 100%;
  padding: 6px;
  margin: -6px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.parent-situation-payable:hover,
.parent-situation-payable:focus-visible {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.06);
}

.parent-situation-payable::after {
  content: "Click to record";
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.72rem;
}

.service-students-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.service-students-table-wrap {
  overflow-x: auto;
}

.service-students-table {
  min-width: 620px;
}

.service-situation-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.service-situation-status.pending {
  background: #e8f1fd;
  color: #183a5a;
}

.service-situation-status.partial {
  background: #fff7ed;
  color: #9a3412;
}

.service-situation-status.paid {
  background: #dff5f1;
  color: var(--accent);
}

.payment-report-summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  padding: 10px 12px;
}

.bill-total {
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 800;
  white-space: nowrap;
}

.bill-card-button {
  width: 100%;
  display: block;
  color: var(--text);
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.bill-card-button:hover,
.bill-card-button:focus-visible {
  border-color: var(--accent);
  background: #fff;
  outline: none;
}

.payment-history-card {
  display: grid;
  gap: 4px;
  max-width: 320px;
}

.payment-method-field-list {
  display: grid;
  gap: 10px;
}

.payment-method-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(130px, 0.7fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-field-required {
  align-self: center;
  margin-bottom: 8px;
}

.payment-search-toolbar,
.payment-search-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.payment-search-filter-list {
  display: grid;
  gap: 10px;
}

.payment-search-filter-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-search-filter-row-full {
  grid-template-columns: minmax(0, 1fr);
}

.payment-search-filter-row-full label {
  width: 100%;
}

.payment-search-results {
  margin-top: 14px;
}

.payment-search-result-head {
  padding: 4px 0 10px;
}

.payment-search-result-head h3 {
  margin: 0;
  font-size: 1rem;
}

.service-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.alert.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert.success {
  background: var(--accent-soft);
  color: #115e59;
}

.alert.info {
  background: var(--info-soft);
  color: #1d4f91;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 460px);
}

.hero {
  background:
    linear-gradient(rgba(10, 23, 35, 0.66), rgba(10, 23, 35, 0.66)),
    url("https://images.unsplash.com/photo-1509062522246-3755977927d7?auto=format&fit=crop&w=1400&q=80") center/cover;
  color: #fff;
  padding: 56px;
  display: flex;
  align-items: end;
}

.hero h1 {
  margin: 10px 0 12px;
  font-size: 2.4rem;
  max-width: 14ch;
}

.hero p {
  max-width: 52ch;
  line-height: 1.5;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.login-panel form {
  width: min(100%, 360px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.bill-grid,
.payment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payment-grid button,
.payment-state {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.payment-state {
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
}

.payment-grid small,
.payment-state small {
  color: currentColor;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.78;
}

.payment-grid button.pending,
.payment-state.pending {
  background: #183a5a;
  color: #fff;
}

.payment-grid button.partial,
.payment-state.partial {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.payment-grid button.paid,
.payment-state.paid {
  background: #dff5f1;
  color: #0f766e;
}

.empty,
.fatal {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.inline-empty {
  padding: 12px 14px;
  text-align: left;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

code {
  background: rgba(17, 24, 39, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .shell,
  .login-layout,
  .section-grid,
  .section-grid.wide-left {
    grid-template-columns: 1fr;
  }

  .level-grid,
  .bill-grid,
  .service-students-filters,
  .payment-method-field-row,
  .payment-search-toolbar,
  .payment-search-filter-row,
  .payment-grid,
  .metric-grid,
  .chart-list-four,
  .receipt-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 20px;
  }

  .topbar {
    flex-direction: column;
  }

  .student-head {
    flex-direction: column;
  }
}

@media print {
  @page {
    margin: 10mm;
  }

  body.printing-receipt {
    background: #fff;
  }

  body.printing-receipt #app {
    display: none;
  }

  body.printing-receipt .modal-backdrop {
    position: static;
    display: block;
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  body.printing-receipt .modal-card {
    width: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.printing-receipt .modal-card.large {
    width: 100%;
    max-width: none;
  }

  body.printing-receipt .receipt-document {
    width: 100%;
    max-width: 100%;
  }

  body.printing-receipt .receipt-template {
    color: #000;
    min-height: 277mm;
  }

  body.printing-receipt .receipt-template-head {
    grid-template-columns: 1fr 1fr 0.9fr !important;
  }

  body.printing-receipt .receipt-template-col {
    border-right: 2px solid #1b1b1b !important;
    border-bottom: 0 !important;
  }

  body.printing-receipt .receipt-template-col:last-child {
    border-right: 0 !important;
  }

  body.printing-receipt .receipt-template-table {
    margin-top: 0;
  }

  body.printing-receipt .receipt-template-group {
    gap: 0 !important;
    margin: 0 !important;
  }

  body.printing-receipt .receipt-template-group-title,
  body.printing-receipt .receipt-template-method {
    display: flex !important;
    align-items: center !important;
    padding: 0 8px !important;
    margin: 0 !important;
    line-height: 1 !important;
    min-height: 22px !important;
    max-height: 22px !important;
    height: 22px !important;
    overflow: hidden !important;
    font-size: 13px !important;
    font-weight: 400 !important;
  }

  body.printing-receipt .receipt-template-group-title + .receipt-template-table,
  body.printing-receipt .receipt-template-method + .receipt-template-table {
    margin-top: 0 !important;
  }

  body.printing-receipt .receipt-grid,
  body.printing-receipt .payment-report-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
  }

  body.printing-receipt .report-table {
    width: 100%;
    table-layout: auto;
    font-size: 0.9rem;
  }

  body.printing-receipt .report-table thead {
    display: table-header-group;
  }

  body.printing-receipt .report-table tbody {
    display: table-row-group;
  }

  body.printing-receipt .unpaid-list-page-header {
    display: table-row;
  }

  body.printing-receipt .unpaid-list-page-header th {
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    border: 0;
    padding: 0 0 6px 0;
  }

  body.printing-receipt .report-table th,
  body.printing-receipt .report-table td {
    padding: 7px 9px;
  }

  body.printing-receipt .modal-card > .section-head,
  body.printing-receipt .modal-actions {
    display: none;
  }

  body.printing-history-page .sidebar,
  body.printing-history-page .topbar,
  body.printing-history-page .button-group,
  body.printing-history-page .stats {
    display: none !important;
  }

  body.printing-history-page .shell,
  body.printing-history-page .main {
    display: block;
    padding: 0;
  }

  body.printing-history-page .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  body.printing-history-page .receipt-grid,
  body.printing-history-page .payment-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.printing-history-page .report-table {
    width: 100%;
  }

  /* Printing one parent's situation. The card marks itself, so a page showing
     four parents prints the one whose button was pressed. */
  body.printing-parent-situation {
    background: #fff;
    color: #000;
  }

  body.printing-parent-situation .sidebar,
  body.printing-parent-situation .topbar,
  body.printing-parent-situation .stats,
  body.printing-parent-situation .payment-search-toolbar,
  body.printing-parent-situation .payment-search-filter-list,
  body.printing-parent-situation form,
  body.printing-parent-situation .button-group,
  body.printing-parent-situation .parent-situation-card:not(.printing-target) {
    display: none !important;
  }

  body.printing-parent-situation .shell,
  body.printing-parent-situation .main {
    display: block;
    padding: 0;
    min-height: auto;
  }

  body.printing-parent-situation .parent-situation-card.printing-target {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    border: none;
    box-shadow: none;
  }

  /* The cells are buttons now. On paper they are figures. */
  body.printing-parent-situation .parent-situation-payable {
    border: none;
    background: none;
    margin: 0;
    padding: 0;
  }

  body.printing-parent-situation .parent-situation-payable::after {
    content: none;
  }

  body.printing-situation-on-demand {
    background: #fff;
    color: #000;
  }

  body.printing-situation-on-demand .sidebar,
  body.printing-situation-on-demand .topbar,
  body.printing-situation-on-demand .button-group,
  body.printing-situation-on-demand .stats,
  body.printing-situation-on-demand .situation-print-page > .panel > .section-head {
    display: none !important;
  }

  body.printing-situation-on-demand .shell,
  body.printing-situation-on-demand .main {
    display: block;
    padding: 0;
    min-height: auto;
  }

  body.printing-situation-on-demand .situation-print-page,
  body.printing-situation-on-demand .situation-print-page .panel,
  body.printing-situation-on-demand .situation-print-page .receipt-document {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    color: #000;
  }

  body.printing-situation-on-demand .situation-print-page .receipt-document h2 {
    margin: 0 0 8px;
    color: #000;
    font-size: 18px;
  }

  body.printing-situation-on-demand .situation-print-page .muted {
    color: #333;
  }

  body.printing-situation-on-demand .situation-print-page .receipt-grid,
  body.printing-situation-on-demand .situation-print-page .payment-report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 10px 0 14px;
    border-top: 1px solid #222;
    border-left: 1px solid #222;
  }

  body.printing-situation-on-demand .situation-print-page .receipt-grid > div,
  body.printing-situation-on-demand .situation-print-page .payment-report-grid > div {
    padding: 6px 8px;
    border-right: 1px solid #222;
    border-bottom: 1px solid #222;
  }

  body.printing-situation-on-demand .situation-print-page .receipt-grid strong,
  body.printing-situation-on-demand .situation-print-page .payment-report-grid strong,
  body.printing-situation-on-demand .situation-print-page .receipt-grid span,
  body.printing-situation-on-demand .situation-print-page .payment-report-grid span {
    display: block;
    color: #000;
    font-size: 11px;
  }

  body.printing-situation-on-demand .situation-print-page .report-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    color: #000;
    font-size: 10.5px;
  }

  body.printing-situation-on-demand .situation-print-page .report-table thead {
    display: table-header-group;
  }

  body.printing-situation-on-demand .situation-print-page .report-table th,
  body.printing-situation-on-demand .situation-print-page .report-table td {
    padding: 6px 7px;
    border: 1px solid #222;
    color: #000;
    vertical-align: top;
  }

  body.printing-situation-on-demand .situation-print-page .report-table th {
    background: #f1f1f1;
    font-weight: 700;
    text-align: left;
  }

  body.printing-situation-on-demand .situation-print-page .report-table th:nth-child(1),
  body.printing-situation-on-demand .situation-print-page .report-table td:nth-child(1) {
    width: 14%;
  }

  body.printing-situation-on-demand .situation-print-page .report-table th:nth-child(2),
  body.printing-situation-on-demand .situation-print-page .report-table td:nth-child(2) {
    width: 14%;
  }

  body.printing-situation-on-demand .situation-print-page .report-table th:nth-child(3),
  body.printing-situation-on-demand .situation-print-page .report-table td:nth-child(3),
  body.printing-situation-on-demand .situation-print-page .report-table th:nth-child(4),
  body.printing-situation-on-demand .situation-print-page .report-table td:nth-child(4),
  body.printing-situation-on-demand .situation-print-page .report-table th:nth-child(5),
  body.printing-situation-on-demand .situation-print-page .report-table td:nth-child(5) {
    width: 12%;
  }
}

/* --- School servers ------------------------------------------------------ */

.sync-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-pill.ok {
  background: var(--accent-soft);
  color: #115e59;
}

.sync-pill.warn {
  background: #fdf0d5;
  color: #8a5a00;
}

.sync-pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.sync-pill.idle {
  background: #eef1f6;
  color: var(--muted);
}

.sync-credential {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}

.sync-credential h3 {
  margin: 0 0 10px;
}

/* Monospace and wrapped: these are long opaque strings an operator has to be
   able to check character by character against what they pasted elsewhere. */
.sync-secret {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: auto;
}

/* Destructive actions. Deleting a school is the only irreversible thing in the
   app, so its buttons do not look like the others. */
button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

button.ghost.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

button.danger:hover {
  filter: brightness(1.08);
}

/* The update, while it runs. A real bar rather than a spinner: the phases are
   read from whether the server is answering, so they mean something. */
.update-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin: 4px 0 2px;
}

.update-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
  transition: width 600ms ease;
}

.update-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
}

.update-step {
  color: var(--muted);
}

.update-step.current {
  color: var(--text);
  font-weight: 600;
}

.update-step.done {
  color: #115e59;
}

/* A class chip carries its student count and a way to rename it. */
.class-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.class-chip-count {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
}

.class-chip-edit {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.class-chip-edit:hover {
  color: var(--accent-strong);
}
