/*
 * Murzilka cabinets: design tokens, layouts and components.
 * Source of truth for colours and sizes: the "Murzilka cabinet redesign" canvas.
 * No framework and no build step; the file is served as is.
 */

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */

:root {
  /* Surfaces */
  --color-bg: #FFF7E8;
  --color-surface: #FFFFFF;
  --color-surface-muted: #F7F8FA;
  --color-surface-selected: #FFF8F2;
  --color-border: #F2E3CB;
  --color-divider: #EEF0F3;
  --color-input-border: #B9C0CA;

  /* Text */
  --color-text: #1D2330;
  --color-text-muted: #5B6472;
  --color-text-disabled: #7A828E;
  --color-text-on-brand: #FFFFFF;
  --color-text-on-brand-muted: #EAF0FF;

  /* Brand and accent */
  --color-brand: #3D62D4;
  --color-accent: #C8400A;
  --color-accent-strong: #8F3606;
  --color-accent-soft: #FDEDE0;

  /* Status: text colour on its soft background */
  --color-success: #1B6B43;
  --color-success-soft: #E3F3EA;
  --color-warning: #6E4700;
  --color-warning-soft: #FFF1CC;
  --color-danger: #9A1F18;
  --color-danger-soft: #FBE9E7;
  --color-info: #1F4E8C;
  --color-info-soft: #E6EEFB;
  --color-neutral-soft: #EEF0F3;
  --color-disabled: #E5E7EB;

  /* Summary tiles */
  --color-tile-peach: #FFD9C2;
  --color-tile-blue: #CFE8FF;
  --color-tile-green: #D9F7E6;

  /* Charts */
  --color-chart-income: #2B5FA8;
  --color-chart-teachers: #E8873A;
  --color-chart-taxes: #7A3208;
  --color-chart-other: #F6D3B5;

  /* Type */
  --font-sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 28px;
  --text-3xl: 30px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Shape */
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --shadow-menu: 0 10px 28px rgba(29, 35, 48, .18);
  --shadow-logo: 0 16px 40px rgba(16, 30, 84, .25);

  /* Controls: 44px is the minimum touch target */
  --control-height: 44px;
  --control-height-lg: 48px;
  --control-height-xl: 52px;

  /* Layout */
  --sidebar-width: 232px;
  --mobile-content-width: 640px;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.45;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--color-accent);
}

a:hover {
  color: var(--color-accent-strong);
}

img,
svg {
  vertical-align: middle;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* Brand-blue surfaces need a light focus ring to stay visible */
.sidebar :focus-visible,
.app__header :focus-visible,
.auth__brand :focus-visible {
  outline-color: #FFFFFF;
}

/* Components set display: flex; the hidden attribute must still win */
[hidden] {
  display: none !important;
}

/* Turbo Frames (lists, the admin day, the teacher journal) hold block content. */
turbo-frame {
  display: block;
}

/* Not <html>: Turbo marks the whole document busy during a visit, and its progress bar shows that. */
[aria-busy="true"]:not(html) {
  opacity: .6;
  pointer-events: none;
  transition: opacity .15s;
}

.icon {
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-md);
  font-weight: 800;
}

.skip-link:focus {
  top: var(--space-4);
}

/* ------------------------------------------------------------------ */
/* Layout helpers                                                      */
/* ------------------------------------------------------------------ */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack--xs {
  gap: var(--space-1);
}

.stack--sm {
  gap: var(--space-2);
}

.stack--lg {
  gap: var(--space-6);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.cluster--lg {
  gap: var(--space-3) var(--space-5);
}

.spacer {
  flex-grow: 1;
}

/* Responsive columns: children wrap when they get narrower than their basis */
.columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-5);
}

.columns--stretch {
  align-items: stretch;
}

.columns > * {
  flex: 1 1 340px;
  min-width: 0;
}

.columns > .col-narrow {
  flex: 2 1 320px;
}

.columns > .col-wide {
  flex: 3 1 440px;
}

.columns > .col-side {
  flex: 1 1 260px;
}

/* ------------------------------------------------------------------ */
/* Admin shell: side navigation + main column                          */
/* ------------------------------------------------------------------ */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5) 14px;
  background: var(--color-brand);
  color: var(--color-text-on-brand);
}

.sidebar__top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2) 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  color: var(--color-text-on-brand);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-text-on-brand);
}

.brand__logo {
  width: 48px;
  height: 40px;
  object-fit: contain;
}

.brand__name {
  font-size: 19px;
  font-weight: 800;
}

.sidebar .sidebar__toggle {
  display: none;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex-grow: 1;
}

.nav-heading {
  padding: 18px var(--space-3) 6px;
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-on-brand-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-height);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text-on-brand);
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .14);
  color: var(--color-text-on-brand);
}

.nav-link[aria-current="page"] {
  background: var(--color-surface);
  color: var(--color-text);
}

.nav-link__label {
  flex-grow: 1;
}

.nav-link__badge {
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: #FFFFFF;
  font-size: var(--text-xs);
  font-weight: 800;
}

.sidebar__account {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, .24);
}

.shell__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-8) 40px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}

.page-header__text {
  flex-grow: 1;
  min-width: 0;
}

.page-header__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.page-header__title {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.2;
}

.page-header__subtitle {
  color: var(--color-text-muted);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-muted);
  font-weight: 700;
}

.breadcrumbs a {
  display: inline-block;
  padding: var(--space-2) 0;
  text-decoration: none;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: var(--space-2);
}

@media (max-width: 900px) {
  .shell {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    flex-basis: auto;
    height: auto;
    max-height: 100vh;
    padding: 10px var(--space-3);
  }

  .sidebar__top {
    padding: 0;
  }

  .brand__logo {
    width: 38px;
    height: 32px;
  }

  .sidebar .sidebar__toggle {
    display: inline-flex;
  }

  /* nav.js adds .is-collapsible; if the script never runs the menu stays visible */
  .sidebar.is-collapsible:not(.is-open) .sidebar__nav {
    display: none;
  }

  .sidebar__nav {
    padding-top: var(--space-2);
  }

  .shell__main {
    padding: var(--space-5) var(--space-4) var(--space-8);
  }

  .page-header__title {
    font-size: 24px;
  }
}

/* ------------------------------------------------------------------ */
/* Mobile-first shell for parents and teachers                         */
/* ------------------------------------------------------------------ */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.4;
}

.app__header {
  background: var(--color-brand);
  color: var(--color-text-on-brand);
}

.app__header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: var(--mobile-content-width);
  margin: 0 auto;
  padding: 14px var(--space-4);
}

.app__header--sub .app__header-inner {
  gap: 6px;
  padding: 10px var(--space-4) 10px 6px;
}

.app__logo {
  width: 38px;
  height: 32px;
  object-fit: contain;
}

.app__heading {
  flex-grow: 1;
  min-width: 0;
}

.app__title {
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1.2;
}

.app__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-on-brand-muted);
}

.app__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: var(--control-height);
  border-radius: var(--radius-md);
  color: var(--color-text-on-brand);
}

.app__back:hover {
  color: var(--color-text-on-brand);
  background: rgba(255, 255, 255, .14);
}

.app__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: var(--mobile-content-width);
  margin: 0 auto;
  padding: var(--space-4);
}

.tabbar {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.tabbar__inner {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  max-width: var(--mobile-content-width);
  margin: 0 auto;
  padding: 6px var(--space-2) calc(10px + env(safe-area-inset-bottom, 0px));
}

.tabbar__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--control-height-xl);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 800;
  text-decoration: none;
}

.tabbar__link:hover,
.tabbar__link[aria-current="page"] {
  color: var(--color-accent-strong);
}

/* ------------------------------------------------------------------ */
/* Sign-in layout                                                      */
/* ------------------------------------------------------------------ */

.auth {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
  font-size: 16px;
}

.auth__brand {
  flex: 1 1 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 56px;
  background: var(--color-brand);
  color: var(--color-text-on-brand);
  text-align: center;
}

.auth__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 220px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-logo);
}

.auth__logo img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.auth__name {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
}

.auth__tagline {
  font-size: 18px;
  color: var(--color-text-on-brand-muted);
}

.auth__main {
  flex: 1 1 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--space-8);
}

.auth__card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 420px;
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

.auth__title {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .auth {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .auth__brand {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 14px var(--space-5);
    text-align: left;
  }

  .auth__logo {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    box-shadow: none;
  }

  .auth__logo img {
    width: 38px;
    height: 38px;
  }

  .auth__name {
    font-size: 22px;
  }

  .auth__tagline {
    font-size: 14px;
  }

  .auth__main {
    flex: 1 1 auto;
    align-items: flex-start;
    padding: var(--space-5) var(--space-4) var(--space-8);
  }

  .auth__card {
    gap: var(--space-4);
    padding: 22px var(--space-5);
  }
}

/* ------------------------------------------------------------------ */
/* Cards and sections                                                  */
/* ------------------------------------------------------------------ */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

/* Card whose rows run edge to edge (lists, tables) */
.card--flush {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.card--flush > .card__header {
  padding: var(--space-5) var(--space-5) var(--space-3);
}

.card__note {
  padding: var(--space-3) var(--space-5) var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.card--flush > .card__footer {
  padding: var(--space-3) var(--space-5) var(--space-5);
  border-top: 1px solid var(--color-divider);
}

.card--highlight {
  border: 2px solid var(--color-accent);
}

.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.card__heading {
  flex-grow: 1;
  min-width: 0;
}

.card__title {
  font-size: var(--text-lg);
  font-weight: 800;
}

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Summary tiles: coloured blocks with one big number */
.tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.tile--peach {
  background: var(--color-tile-peach);
}

.tile--blue {
  background: var(--color-tile-blue);
}

.tile--green {
  background: var(--color-tile-green);
}

.tile__label {
  font-weight: 700;
}

.tile__value {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1.2;
}

.tile__link {
  margin-top: auto;
  padding-top: var(--space-2);
  color: var(--color-text);
  font-weight: 800;
  text-decoration: underline;
}

.tile__link:hover {
  color: var(--color-text);
}

/* Rows inside cards: separated by a thin top border */
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--color-divider);
}

.card--flush .list-row {
  padding: 10px var(--space-5);
}

.list-row__main {
  flex-grow: 1;
  min-width: 0;
}

.list-row__title {
  display: block;
  font-weight: 700;
}

.list-row__meta {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.list-row__value {
  font-weight: 800;
  white-space: nowrap;
  text-align: right;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-height);
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn--primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

.btn--primary:hover {
  background: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  color: #FFFFFF;
}

.btn--dark {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #FFFFFF;
}

.btn--dark:hover {
  background: #3A4252;
  color: #FFFFFF;
}

.btn--outline {
  border-color: var(--color-accent);
  color: var(--color-accent-strong);
}

.btn--outline:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.btn--secondary {
  border-color: var(--color-border);
}

.btn--secondary:hover {
  background: var(--color-surface-selected);
  color: var(--color-text);
}

.btn--ghost {
  padding: 0 var(--space-4);
  background: transparent;
  color: var(--color-text-muted);
}

.btn--ghost:hover {
  color: var(--color-text);
}

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

.btn--danger:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.btn--on-brand {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn--sm {
  height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.btn--lg {
  height: var(--control-height-xl);
  font-size: var(--text-lg);
}

.btn--block {
  width: 100%;
}

.btn--icon {
  width: var(--control-height);
  padding: 0;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  background: var(--color-disabled);
  border-color: var(--color-disabled);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
}

/* An empty #operation-feedback in a form (the sign-in form) stays in place for screen readers, since a live
   region must exist before it is filled, without adding a gap. */
.form > #operation-feedback:not(:has(*)) {
  margin-top: calc(-1 * var(--space-4));
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
}

.field__help {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.field__error {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-danger);
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.field > .field__label {
  padding: 0;
  margin-bottom: var(--space-1);
}

/* Fields side by side that wrap on narrow screens; .field--grow takes the spare room */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.field-row > .field {
  flex: 1 1 130px;
}

.field-row > .field--grow {
  flex: 2 1 220px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}

.textarea {
  height: auto;
  min-height: 120px;
  padding: 10px var(--space-3);
  resize: vertical;
}

.input--lg {
  height: var(--control-height-lg);
}

.input--short {
  max-width: 220px;
}

.input--number {
  max-width: 120px;
  font-weight: 800;
}

.input--mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

.input[readonly] {
  border-color: var(--color-divider);
  background: var(--color-surface-muted);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border: 2px solid var(--color-danger);
}

/* Bordered box holding an input plus an icon or a trailing button */
.input-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--control-height);
  padding-left: var(--space-3);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.input-group:focus-within {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.input-group > input {
  flex-grow: 1;
  min-width: 0;
  height: calc(var(--control-height) - 2px);
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.input-group > .icon {
  color: var(--color-text-muted);
}

.input-group__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: calc(var(--control-height) - 2px);
  border: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.input-group--pill {
  padding: 0 var(--space-4);
  border-color: var(--color-border);
  border-radius: var(--radius-pill);
}

.input-group--lg,
.input-group--lg > input,
.input-group--lg .input-group__button {
  min-height: var(--control-height-lg);
  height: var(--control-height-lg);
}

.search {
  width: 340px;
  max-width: 100%;
}

/* Checkbox or radio with its label */
.check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-height);
  font-weight: 700;
  cursor: pointer;
}

.check input,
.check-row input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-accent);
}

/* Selectable list row: the whole row is the label and highlights when checked */
.check-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: var(--space-1) var(--space-5);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface);
  cursor: pointer;
}

.check-row:has(input:checked) {
  background: var(--color-surface-selected);
}

.check-row--compact {
  min-height: 52px;
  padding: 0 var(--space-4);
  font-weight: 700;
}

/* Row with a title and an explanation: the box lines up with the title */
.check-row--top {
  align-items: flex-start;
  padding-block: var(--space-3);
}

.check-row--top input {
  margin-top: 2px;
}

/* Checkboxes in two columns, separated from the fields above */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-1) var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

/* Days of the week as square toggles */
.chips--days .chip {
  justify-content: center;
  min-width: 52px;
  border-radius: var(--radius-md);
}

/* Segmented choice of two or three options (radio buttons) */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-self: flex-start;
  min-inline-size: 0;
  margin: 0;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-neutral-soft);
}

.segmented label,
.segmented > a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Links as options, e.g. the analytics period: the current one has aria-current */
.segmented > a {
  color: inherit;
  text-decoration: none;
}

.segmented label:has(input:checked),
.segmented > a[aria-current] {
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(29, 35, 48, .12);
}

.segmented label:has(input:focus-visible) {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Badges, tags, avatars                                               */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}

.badge--success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge--info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.badge--accent {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

/* Small square label, e.g. payment method in a list */
.tag {
  display: inline-block;
  min-width: 58px;
  padding: 2px var(--space-2);
  border-radius: 6px;
  background: var(--color-neutral-soft);
  font-size: var(--text-xs);
  font-weight: 800;
  text-align: center;
}

.tag--card {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.tag--cash {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-size: var(--text-sm);
  font-weight: 800;
}

.avatar--lg {
  width: 44px;
  height: 44px;
  font-size: var(--text-md);
}

.avatar--on-brand {
  width: 40px;
  height: 40px;
  background: var(--color-surface);
  font-size: 14px;
}

.avatar--teacher {
  background: var(--color-tile-blue);
  color: var(--color-info);
}

/* ------------------------------------------------------------------ */
/* Alerts                                                              */
/* ------------------------------------------------------------------ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--space-3) 14px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  font-size: 14px;
}

.alert > .icon {
  margin-top: 2px;
}

.alert--success,
.alert--warning,
.alert--danger,
.alert--info {
  font-size: inherit;
  font-weight: 700;
}

.alert--success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.alert--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.alert--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert--info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.table-wrap {
  /* Keep visually hidden header labels inside the scroll container. */
  position: relative;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table th {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 11px var(--space-3);
  border-top: 1px solid var(--color-divider);
  vertical-align: middle;
}

.table th:first-child,
.table td:first-child {
  padding-left: 0;
}

.table th:last-child,
.table td:last-child {
  padding-right: 0;
}

.card--flush .table th:first-child,
.card--flush .table td:first-child {
  padding-left: var(--space-5);
}

.card--flush .table th:last-child,
.card--flush .table td:last-child {
  padding-right: var(--space-5);
}

.table .num,
.table th.num {
  text-align: right;
}

.table tbody tr:hover {
  background: var(--color-surface-selected);
}

.table__link {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.table__link:hover {
  color: var(--color-accent-strong);
  text-decoration: underline;
}

.empty {
  padding: var(--space-8) var(--space-5);
  color: var(--color-text-muted);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Dropdown menu built on <details>                                    */
/* ------------------------------------------------------------------ */

.menu {
  position: relative;
  flex-shrink: 0;
}

.menu > summary {
  list-style: none;
  cursor: pointer;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: 20;
  width: 240px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: var(--shadow-menu);
  color: var(--color-text);
}

.menu--up .menu__panel {
  top: auto;
  bottom: calc(100% + var(--space-2));
  left: 0;
  right: auto;
}

.menu__header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-height-lg);
  padding: 0 var(--space-4);
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.menu__item + .menu__item,
.menu__item + .menu__form {
  border-top: 1px solid var(--color-divider);
}

/* An item that submits a form (sign out) looks like the links around it */
button.menu__item {
  width: 100%;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.menu__item:hover {
  background: var(--color-surface-selected);
  color: var(--color-text);
}

.menu__item--danger,
.menu__item--danger:hover {
  color: var(--color-danger);
}

/* Account button in the admin sidebar */
.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-height);
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text-on-brand);
  font-weight: 700;
}

.account-button:hover {
  background: rgba(255, 255, 255, .14);
}

/* ------------------------------------------------------------------ */
/* Lists: filters, sortable headers, paging                            */
/* ------------------------------------------------------------------ */

.filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: var(--space-4);
}

.filters__method .segmented {
  flex-wrap: nowrap;
}

.filters__method {
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.filter-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--control-height-xl);
  padding-inline: var(--space-5);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.filter-panel > summary::-webkit-details-marker {
  display: none;
}

.filter-panel > summary:focus-visible {
  outline-offset: -3px;
}

.filter-panel[open] > summary .icon {
  transform: rotate(90deg);
}

.filter-panel > form {
  padding: var(--space-3) var(--space-5) var(--space-5);
}

/* The apply button is only needed when filters cannot submit themselves */
.js .no-js-only {
  display: none;
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: inherit;
  text-decoration: none;
}

.sort-link:hover,
.sort-link.is-current {
  color: var(--color-text);
}

.sort-link__arrow {
  font-size: 11px;
  opacity: .5;
}

.sort-link.is-current .sort-link__arrow {
  opacity: 1;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  width: 100%;
}

.pagination__range {
  margin-right: auto;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Toggle chips: radios (one of) or checkboxes (any of) styled as pills */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

a.chip {
  color: var(--color-text);
  text-decoration: none;
}

a.chip:hover {
  border-color: var(--color-text);
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip[aria-current],
.chip:has(input:checked) {
  border-color: var(--color-text);
  background: var(--color-text);
  color: #FFFFFF;
}

.chip:has(input:focus-visible) {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.chip__count {
  font-weight: 700;
  opacity: .75;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.list-toolbar .search {
  flex: 1 1 260px;
}

.list-toolbar__select {
  position: relative;
  max-width: 100%;
}

.list-toolbar__select .select {
  appearance: none;
  width: auto;
  max-width: 100%;
  padding-inline: var(--space-4) var(--space-8);
  border-color: var(--color-border);
  border-radius: var(--radius-pill);
}

.list-toolbar__select::after {
  position: absolute;
  top: 50%;
  inset-inline-end: var(--space-4);
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
  content: "";
}

.row-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: var(--control-height);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.row-open:hover {
  background: var(--color-surface-selected);
  color: var(--color-accent-strong);
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

/* Show labeled records when the table columns no longer fit. */
.responsive-list__mobile {
  display: none;
}

.regular-payments__label,
.regular-payments .responsive-list__profile .icon {
  display: none;
}

@media screen and (max-width: 760px) {
  .responsive-list__table {
    display: none;
  }

  .responsive-list__mobile {
    display: block;
  }

  .responsive-list__sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--space-3);
    padding-inline: var(--space-5);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 700;
  }

  .responsive-list__sort .sort-link {
    justify-content: center;
    min-width: var(--control-height);
    min-height: var(--control-height);
  }

  .responsive-list__sort .sort-link.is-current {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .responsive-list__items {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .responsive-list__item {
    padding: var(--space-2) var(--space-5);
    border-top: 1px solid var(--color-divider);
    overflow-wrap: anywhere;
  }

  .responsive-list__profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    padding-block: var(--space-1);
  }

  .responsive-list__profile .icon {
    flex: none;
    color: var(--color-text-muted);
  }

  .responsive-list__profile .list-row__meta {
    font-weight: 400;
  }

  .responsive-list__details {
    display: grid;
    gap: var(--space-2);
    margin: var(--space-2) 0 0;
  }

  .responsive-list__details > div {
    display: grid;
    grid-template-columns: min(40%, 7rem) minmax(0, 1fr);
    align-items: baseline;
    gap: var(--space-2);
  }

  .responsive-list__details dt {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
  }

  .responsive-list__details dd {
    margin: 0;
  }

  .responsive-list__details .num {
    white-space: normal;
  }

  .adult-record__balance {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-2);
  }

  .responsive-list__details a {
    display: inline-flex;
    align-items: center;
    min-width: var(--control-height);
    max-width: 100%;
    min-height: var(--control-height);
  }

  .regular-payments {
    overflow: visible;
  }

  .regular-payments .table,
  .regular-payments tbody {
    display: block;
  }

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

  .regular-payments tbody tr {
    display: grid;
    gap: var(--space-2);
  }

  .card--flush .regular-payments .table td {
    padding: 0;
    border: 0;
    text-align: start;
    white-space: normal;
  }

  .regular-payments__detail {
    display: grid;
    grid-template-columns: min(40%, 7rem) minmax(0, 1fr);
    align-items: baseline;
    justify-items: start;
    gap: var(--space-2);
  }

  .regular-payments__label,
  .regular-payments .responsive-list__profile .icon {
    display: block;
    font-weight: 400;
  }

  .regular-payments__action button {
    min-height: var(--control-height);
  }

  .analytics__profit-months .responsive-list__item {
    padding-inline: 0;
  }

  .analytics__profit-months dl > div {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .analytics__profit-months dd {
    text-align: end;
  }
}

/* ------------------------------------------------------------------ */
/* Overview                                                            */
/* ------------------------------------------------------------------ */

.dashboard__when {
  flex-shrink: 0;
  width: 72px;
}

.dashboard__deposit {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
}

.dashboard__amount {
  font-size: var(--text-lg);
}

/* "Дитини не було" under a lesson in the parent's cabinet: opens a short form */
.lesson-dispute > summary {
  display: inline-block;
  margin-top: var(--space-1);
  list-style: none;
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.lesson-dispute > summary::-webkit-details-marker {
  display: none;
}

.lesson-dispute__form {
  margin-top: var(--space-2);
}

/* A parent's words in a lesson dispute */
.dashboard__quote {
  margin: 0;
  padding-left: var(--space-3);
  border-left: 3px solid var(--color-border);
}

/* "Залишити" opens the reason the parent will see */
.dashboard__reject > summary {
  list-style: none;
}

.dashboard__reject > summary::-webkit-details-marker {
  display: none;
}

.dashboard__reject[open] {
  flex-basis: 100%;
}

.dashboard__reject > form {
  margin-top: var(--space-2);
}

.dashboard__row .list-row__main {
  overflow-wrap: anywhere;
}

/* The analytics headline under the overview's turnover chart */
.dashboard__trend {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

/* ------------------------------------------------------------------ */
/* Analytics                                                           */
/* ------------------------------------------------------------------ */

.analytics__group {
  overflow-wrap: anywhere;
  white-space: normal;
}

.analytics__profit-groups > summary {
  list-style: none;
}

.analytics__profit-groups > summary::-webkit-details-marker {
  display: none;
}

.analytics__profit-groups[open] > summary .icon {
  transform: rotate(90deg);
}

.analytics__profit-group-names {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
}

.legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend__swatch--income,
.bars__bar--income {
  background: var(--color-chart-income);
}

.legend__swatch--teachers,
.bars__bar--teachers {
  background: var(--color-chart-teachers);
}

.legend__swatch--taxes,
.bars__bar--taxes {
  background: var(--color-chart-taxes);
}

.legend__swatch--other,
.bars__bar--other {
  background: var(--color-chart-other);
}

/* Paired bars per month: income on the left, outgoings stacked on the right */
.bars {
  display: grid;
  grid-template-columns: repeat(var(--bar-columns, 6), minmax(max-content, 1fr));
  gap: var(--space-3);
  overflow-x: auto;
}

.bars__month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 52px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.bars__month:focus-visible {
  outline-offset: -3px;
}

.bars__month.is-active {
  background: var(--color-surface-selected);
}

.bars__plot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  align-self: stretch;
  height: 190px;
  border-bottom: 1px solid var(--color-border);
}

.bars__bar {
  display: block;
  width: 28px;
  border-radius: 4px 4px 0 0;
}

.bars__stack {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

/* A thin gap between stacked parts that does not add to the height */
.bars__stack .bars__bar + .bars__bar {
  box-shadow: inset 0 2px 0 var(--color-surface);
}

.bars__stack .bars__bar {
  border-radius: 0;
}

.bars__stack .bars__bar:first-child {
  border-radius: 4px 4px 0 0;
}

.bars__label {
  font-weight: 700;
}

.bars__values {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.bars__net {
  font-size: var(--text-sm);
  font-weight: 800;
}

.bars__tooltip {
  position: fixed;
  z-index: 20;
  width: max-content;
  max-width: calc(100% - 16px);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-menu);
  font-size: var(--text-sm);
}

.bars__tooltip-values {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-2) 0 0;
}

.bars__tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.bars__tooltip-row dt {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bars__tooltip-row dd {
  margin: 0;
  white-space: nowrap;
}

.bars__tooltip-row--balance {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
  font-weight: 800;
}

@media screen and (max-width: 760px) {
  .bars {
    grid-template-columns: repeat(var(--bar-columns, 6), minmax(0, 1fr));
    gap: var(--space-2);
    overflow: visible;
  }

  .bars__month {
    min-width: 0;
  }

  .bars__month .num {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media screen and (max-width: 600px) {
  .bars {
    grid-template-columns: repeat(var(--bar-columns-narrow, 3), minmax(0, 1fr));
    row-gap: var(--space-4);
  }

  .bars__plot {
    gap: var(--space-1);
    height: 128px;
  }

  .bars__bar {
    width: 20px;
  }

  .bars__values {
    font-size: var(--text-xs);
  }
}

/* Income and expenses of a period against a year ago, and the cash kept or burned */
.trend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--space-5);
}

.trend__figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.trend__label {
  font-weight: 700;
}

.trend__change {
  font-size: var(--text-xl);
  font-weight: 800;
}

.trend__net {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1.2;
}

.trend__rows {
  display: grid;
  grid-template-columns: minmax(48px, 1fr) auto;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.trend__track {
  display: block;
  height: 12px;
}

.trend__bar {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.trend__bar--income {
  background: var(--color-chart-income);
}

.trend__bar--expenses {
  background: var(--color-chart-teachers);
}

.trend__bar--year-ago {
  opacity: 0.35;
}

/* ------------------------------------------------------------------ */
/* Payment matching                                                    */
/* ------------------------------------------------------------------ */

.map__amount {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
}

.map__reason-hint {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
}

.map__details {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
}

.map__details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.map__actions {
  align-items: center;
}

/* ------------------------------------------------------------------ */
/* Day page: schedule and attendance                                   */
/* ------------------------------------------------------------------ */

.day-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.day-nav__date {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.day-nav__input {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
}

.day-nav__icon {
  display: none;
}

@media screen and (max-width: 600px) {
  .day-nav {
    display: grid;
    grid-template-columns: var(--control-height) minmax(0, 1fr) var(--control-height);
  }

  .day-nav__date {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--control-height);
    gap: 0;
    min-width: 0;
    padding: 0 var(--space-1) 0 var(--space-2);
    border: 0;
    box-shadow: inset 0 0 0 1px var(--color-border);
    text-align: center;
  }

  .day-nav__date > .no-js-only {
    grid-column: 1 / -1;
    justify-self: center;
    margin-bottom: var(--space-2);
  }

  .day-nav__picker {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--control-height);
    height: var(--control-height);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
  }

  .day-nav__picker:focus-within {
    outline: 3px solid var(--color-brand);
    outline-offset: -4px;
  }

  .day-nav__icon {
    display: flex;
  }

  .day-nav__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }

  /* Let the native calendar indicator handle taps anywhere over the icon. */
  .day-nav__input::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    cursor: pointer;
  }

  .day-nav__today {
    display: none;
  }
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
}

.tabs__tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height-lg);
  padding: 0 var(--space-4);
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
  font-weight: 700;
  text-decoration: none;
}

.tabs__tab:hover {
  color: var(--color-text);
}

.tabs__tab[aria-current="page"] {
  border-bottom-color: var(--color-accent);
  color: var(--color-accent-strong);
  font-weight: 800;
}

.schedule-section__heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-4);
  font-weight: 800;
}

.schedule-disclosure > summary,
.schedule-row summary {
  cursor: pointer;
  list-style: none;
}

.schedule-disclosure > summary::-webkit-details-marker,
.schedule-row summary::-webkit-details-marker {
  display: none;
}

.schedule-disclosure > summary:focus-visible,
.schedule-row__details > summary:focus-visible,
.schedule-row:focus-visible {
  outline-offset: -3px;
}

.schedule-disclosure > summary .icon {
  margin-inline-start: auto;
}

.schedule-disclosure[open] > summary .icon,
.schedule-row__details[open] > summary .icon {
  transform: rotate(90deg);
}

.schedule-row {
  border-top: 1px solid var(--color-divider);
}

.schedule-row[data-schedule-status="unassigned"] {
  background: var(--color-danger-soft);
}

.schedule-row:last-of-type {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.schedule-row__summary {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  align-items: start;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-4);
}

.schedule-row__details > summary {
  grid-template-columns: 3.25rem minmax(0, 1fr) auto;
}

.schedule-row__details > summary .icon {
  align-self: center;
}

.schedule-row__time {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.schedule-row__label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.schedule-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-1) var(--space-2);
  grid-column: 2;
  min-width: 0;
}

.schedule-row__actions > .schedule-row__picker[open] {
  flex-basis: 100%;
}

.schedule-row__summary:has(.schedule-row__picker[open]) :is(.schedule-row__quick-confirm, .schedule-row__quick-additional) {
  display: none;
}

.schedule-row__body,
.schedule-row__teacher-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: var(--space-2);
}

.schedule-row__body {
  padding: 0 var(--space-4) var(--space-4);
}

.schedule-row__picker {
  min-width: 0;
  max-width: 100%;
}

.schedule-row__teacher-form {
  width: min(100%, 320px);
  margin-block-start: var(--space-2);
}

.schedule-row__teacher-form .select {
  min-width: 0;
  font-size: 16px;
}

.schedule-row__additional-options {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-wrap: anywhere;
}

.schedule-row__additional {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.schedule-row__error {
  padding: 0 var(--space-4) var(--space-3);
}

.schedule-row .btn,
.schedule-others__group {
  max-width: 100%;
  min-height: var(--control-height);
  height: auto;
  padding-block: var(--space-2);
  line-height: 1.25;
  white-space: normal;
}

.schedule-others__group {
  overflow-wrap: anywhere;
}

.schedule-others__body {
  padding: 0 var(--space-4) var(--space-4);
}

@media (max-width: 600px) {
  #schedule-day-tabs {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  #schedule-day-tabs > .tabs__tab {
    min-width: 0;
    flex-wrap: wrap;
    align-content: center;
    padding: var(--space-1) var(--space-2);
  }
}

@media (max-width: 360px) {
  .schedule-row__actions {
    grid-column: 1 / -1;
  }
}

@media (min-width: 940px) {
  .schedule-row > .schedule-row__summary {
    grid-template-columns: 3.25rem minmax(0, 1fr) minmax(200px, auto);
  }

  .schedule-row__actions {
    grid-column: auto;
    justify-content: end;
    max-width: 320px;
  }
}

.lesson {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  padding: 6px var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  border-left: 4px solid transparent;
  color: var(--color-text);
  text-decoration: none;
}

.lesson:hover {
  background: var(--color-surface-selected);
  color: var(--color-text);
}

.lesson.is-selected {
  border-left-color: var(--color-accent);
  background: var(--color-surface-selected);
}

.lesson__time {
  width: 48px;
  font-weight: 800;
}

.attendance {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.attendance__child {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-height-lg);
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
}

.attendance__child input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-accent);
}

.attendance__child:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* The child an adult's activity linked to (?child=): the mark to check or remove */
.attendance__child--highlighted {
  outline: 2px solid var(--color-warning);
  outline-offset: 2px;
}

.journal-attendance__mobile {
  display: none;
}

@media screen and (max-width: 760px) {
  .journal-attendance__desktop {
    display: none;
  }

  .journal-attendance__mobile {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .journal-lesson + .journal-lesson {
    border-top: 1px solid var(--color-divider);
  }

  .journal-lesson > .lesson {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-1) var(--space-2);
    padding: var(--space-3);
    border-bottom: 0;
    list-style: none;
    cursor: pointer;
    overflow-wrap: anywhere;
  }

  .journal-lesson > .lesson::-webkit-details-marker {
    display: none;
  }

  .journal-lesson > .lesson:focus-visible {
    outline-offset: -3px;
  }

  .journal-lesson .lesson__time {
    width: auto;
  }

  .journal-lesson > .lesson .badge {
    grid-area: 2 / 2;
    justify-self: start;
  }

  .journal-lesson > .lesson .icon {
    grid-area: 1 / 3;
    align-self: center;
  }

  .journal-lesson[open] > .lesson .icon {
    transform: rotate(90deg);
  }

  .journal-lesson > .form {
    gap: var(--space-3);
    padding: 0 var(--space-3) var(--space-3);
    overflow-wrap: anywhere;
  }

  .journal-lesson > .form .btn {
    max-width: 100%;
    min-height: var(--control-height);
    white-space: normal;
  }

  .journal-lesson .attendance__child {
    padding-block: var(--space-1);
  }
}

/* ------------------------------------------------------------------ */
/* Behaviour states (public/js/ui/*.js)                                */
/* ------------------------------------------------------------------ */

.btn--danger-solid {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #FFFFFF;
}

.btn--danger-solid:hover {
  background: #7A1812;
  color: #FFFFFF;
}

/* Copy button: check mark replaces the copy icon while .is-copied */
.copy-button__done,
.copy-button.is-copied .copy-button__idle {
  display: none;
}

.copy-button.is-copied .copy-button__done {
  display: inline-flex;
}

.copy-button.is-copied,
.btn.is-copied {
  border-color: var(--color-success);
  color: var(--color-success);
}

/* Dismissible alert, used by feedback.js */
.alert--dismissible {
  align-items: center;
}

.alert__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -6px -6px -6px 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.alert__close:hover {
  background: rgba(29, 35, 48, .08);
}

/* Password rules list: dot while unmet, check mark once met */
.rules {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.rules li::before {
  content: "•";
  display: inline-block;
  width: 1.1em;
}

.rules li[data-met="true"] {
  color: var(--color-success);
}

.rules li[data-met="true"]::before {
  content: "✓";
}

.match-status {
  min-height: 18px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-danger);
}

.match-status[data-met="true"] {
  color: var(--color-success);
}

/* Character counter */
.counter {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.counter.is-near {
  color: var(--color-warning);
  font-weight: 700;
}

.counter.is-over {
  color: var(--color-danger);
  font-weight: 800;
}

/* Confirm dialog (confirm.js) */
.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-menu);
}

.dialog::backdrop {
  background: rgba(29, 35, 48, .45);
}

.dialog__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-6);
}

.dialog__title {
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1.25;
}

.dialog__detail {
  color: var(--color-text-muted);
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--space-2);
}

/* Step indicator for multi-step pages (day page: schedule, then attendance) */
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 14px 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  font-weight: 800;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

.steps li[aria-current="step"] {
  background: var(--color-accent);
  color: #FFFFFF;
}

.steps li[aria-current="step"]::before {
  color: var(--color-accent-strong);
}

.steps li.is-done {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.steps li.is-done::before {
  content: "✓";
}

.steps a {
  color: inherit;
  text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Profile pages (adult, teacher)                                      */
/* ------------------------------------------------------------------ */

.avatar--xl {
  width: 56px;
  height: 56px;
  font-size: var(--text-lg);
}

.card--blue {
  border-color: transparent;
  background: var(--color-tile-blue);
}

/* A teacher's rate: group, price field and buttons on one row */
.rate-row {
  margin: 0;
}

.rate-row__price {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.rate-row__price .input {
  width: 110px;
}

.rate-row--add .select {
  max-width: 320px;
}

.card--green {
  border-color: transparent;
  background: var(--color-tile-green);
}

/* Balance with the payment form next to it */
.balance {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-5);
}

.balance__text {
  flex: 1 1 200px;
}

.balance__label {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text-muted);
}

.balance__value {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1.15;
}

.balance__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
}

.input--amount {
  width: 140px;
}

.input--phone {
  max-width: 260px;
}

/* Cards that are links, in two columns (e.g. an adult's children) */
.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
}

.link-card:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.link-card__title {
  font-weight: 800;
}

.cluster--xs {
  gap: 6px;
}

/* Event line: when, a coloured dot, what */
.event-row__when {
  flex-shrink: 0;
  width: 112px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--color-text-muted);
}

.dot--success {
  background: var(--color-success);
}

.dot--info {
  background: var(--color-info);
}

.dot--warning {
  background: var(--color-warning);
}

/* A code to copy, e.g. the payment code */
.code-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.code-box__text {
  flex-grow: 1;
}

.code-box__value {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: .08em;
}

/* Radio choices shown as bordered rows */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 6px 14px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.choice input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-accent);
}

.choice:has(input:checked) {
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent);
  background: var(--color-surface-selected);
}

.choice:has(input:focus-visible) {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* Summary tiles side by side */
.tile-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.tile-row > .tile {
  flex: 1 1 200px;
}

.table .table__total th,
.table .table__total td {
  border-top: 2px solid var(--color-border);
  background: var(--color-surface-selected);
  font-weight: 800;
}

/* Label and amount rows of a month summary */
.kv-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-divider);
}

.kv-row__label {
  flex-grow: 1;
  color: var(--color-text-muted);
  font-weight: 700;
}

.kv-row__value {
  font-weight: 800;
  white-space: nowrap;
}

.kv-row--total {
  border-top: 2px solid var(--color-border);
  background: var(--color-tile-peach);
}

.kv-row--total .kv-row__label {
  color: var(--color-text);
  font-weight: 800;
}

.kv-row--blue {
  align-items: center;
  flex-wrap: wrap;
  background: var(--color-tile-blue);
}

.kv-row__label .kv-row__value {
  display: block;
}

/* Tile with a button next to the number */
.tile--action {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}

.kv-row--total .kv-row__value {
  font-size: var(--text-xl);
}

/* A day of events: date and totals above a card of rows */
.day-heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 0 4px 6px;
}

.day-heading__title {
  flex-grow: 1;
  font-size: var(--text-md);
  font-weight: 800;
}

.event-row--payment {
  background: var(--color-success-soft);
}

.event-row--teacher-payout {
  background: var(--color-info-soft);
}

.event-row__time {
  flex-shrink: 0;
  width: 44px;
  font-weight: 800;
  color: var(--color-text-muted);
}

.event-row__amount {
  font-weight: 800;
  white-space: nowrap;
}

.event-row__action {
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  width: 44px;
}

.event-row__action form {
  display: contents;
}

/* Numbered "what happens next" list */
.next-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: next-step;
}

.next-steps__item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-left: 40px;
  counter-increment: next-step;
}

.next-steps__item::before {
  content: counter(next-step);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-success);
  font-weight: 800;
}

/* ------------------------------------------------------------------ */
/* Text utilities: last, so they win over component colours           */
/* ------------------------------------------------------------------ */

.muted {
  color: var(--color-text-muted);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-strong {
  font-weight: 800;
}

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

.text-success {
  color: var(--color-success);
}

.text-danger {
  color: var(--color-danger);
}

.text-warning {
  color: var(--color-warning);
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Month switcher: previous, a select, next */
.month-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.month-nav__select {
  width: auto;
  font-weight: 800;
}

.tile__note {
  color: var(--color-text-muted);
  font-size: var(--text-md);
  font-weight: 700;
}

/* A week of group attendance, with each child's monthly total at the end. */
.attendance-desktop,
.monthly-report__desktop {
  position: relative;
}

.attendance-week + .attendance-week {
  border-top: 1px solid var(--color-divider);
}

.attendance-week__summary {
  padding-inline: var(--space-5);
}

.attendance-week__summary:focus-visible {
  outline-offset: -3px;
}

.visit-grid {
  table-layout: fixed;
}

.visit-grid col:first-child {
  width: 25%;
}

.visit-grid col:last-child {
  width: 18%;
}

.visit-grid :is(th, td),
.monthly-report__table :is(th, td),
.monthly-report .badge {
  overflow-wrap: anywhere;
  white-space: normal;
}

.visit-grid th.visit-grid__day {
  color: var(--color-text);
  text-align: center;
  line-height: 1.2;
}

.visit-grid th.visit-grid__day.muted {
  color: var(--color-text-muted);
}

.visit-grid__weekday {
  display: block;
  color: var(--color-text-muted);
  font-weight: 700;
}

.visit-grid .visit-grid__child {
  color: var(--color-text);
  font-size: inherit;
  border-top: 1px solid var(--color-divider);
}

.visit-grid .visit-grid__child .badge {
  margin-left: var(--space-1);
}

.visit-grid td.visit-grid__cell {
  padding: var(--space-1) 3px;
  font-size: var(--text-sm);
  font-weight: 800;
  text-align: center;
}

.visit-grid__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

.visit-grid__mark--visit {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.visit-grid__mark--pending {
  background: var(--color-surface-muted);
}

.visit-grid__swatch {
  width: 22px;
  height: 16px;
  border-radius: 5px;
}

.attendance-mobile__summary,
.attendance-week__summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  list-style: none;
  cursor: pointer;
}

.attendance-mobile__summary--child {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.attendance-mobile__summary::-webkit-details-marker,
.attendance-week__summary::-webkit-details-marker {
  display: none;
}

.attendance-mobile details[open] > summary .icon,
.attendance-week[open] > summary .icon {
  transform: rotate(90deg);
}

.attendance-mobile__identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1);
}

.attendance-mobile__days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 96px), 1fr));
  gap: var(--space-2);
  margin: var(--space-2) 0;
  padding: 0;
  list-style: none;
}

.attendance-mobile__day {
  display: grid;
  align-content: start;
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.attendance-mobile .num {
  white-space: normal;
}

.attendance-mobile__profile {
  margin-top: var(--space-2);
}

.monthly-report__table {
  table-layout: fixed;
}

.monthly-report .badge {
  max-width: 100%;
  text-align: start;
}

.monthly-report__total {
  border-top: 2px solid var(--color-divider);
  background: var(--color-surface-selected);
}

.monthly-report__action {
  margin-top: var(--space-3);
}

/* A list of items to pick one from; the picked one has an accent bar */
.pick-row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 68px;
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  border-left: 4px solid transparent;
  color: var(--color-text);
  text-decoration: none;
}

a.pick-row:hover {
  background: var(--color-surface-selected);
  color: var(--color-text);
}

.pick-row[aria-current] {
  border-left-color: var(--color-accent);
  background: var(--color-surface-selected);
}

.pick-row:last-child {
  border-bottom: 0;
}

.pick-row__draft {
  color: var(--color-accent-strong);
  font-weight: 700;
}

.counter--pill {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-success-soft);
  color: var(--color-success);
  font-weight: 800;
}

.counter--pill.is-near {
  background: var(--color-warning-soft);
}

/* How an SMS will look to the recipient */
.sms-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
}

.sms-preview__sender {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 800;
}

.sms-preview__bubble {
  max-width: 420px;
  min-height: 1.45em;
  padding: 10px 14px;
  border-radius: 4px 16px 16px 16px;
  background: #DCEBFF;
  overflow-wrap: anywhere;
}

.sms-preview__bubble.is-empty {
  color: var(--color-text-muted);
}

/* Entrepreneurs: account rows, payment categories, the pay card and payment history */
.field-row--end {
  align-items: flex-end;
}

.account-row {
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  min-height: 60px;
  padding: var(--space-2) var(--space-5);
  border-top: 1px solid var(--color-divider);
  color: var(--color-text);
  text-decoration: none;
}

.account-row:hover {
  background: var(--color-surface-selected);
  color: var(--color-text);
}

.account-row__main {
  display: flex;
  flex: 1 1 260px;
  flex-direction: column;
  min-width: 0;
}

.account-row__main .mono {
  overflow-wrap: anywhere;
}

.account-row__purpose {
  flex: 1 1 200px;
}

.category {
  white-space: nowrap;
}

.category--salary {
  background: #FFE3C2;
  color: #7A3E00;
}

.category--utilities {
  background: #E9ECF0;
  color: #3A4252;
}

.category--taxes {
  background: #FBE9E7;
  color: #9A1F18;
}

.category--expenses {
  background: #EFE3FA;
  color: #5B2A86;
}

.card--peach {
  gap: var(--space-3);
  border-color: transparent;
  background: var(--color-tile-peach);
}

.pay-card__label {
  margin: 0;
  color: var(--color-accent-strong);
  font-size: var(--text-sm);
  font-weight: 800;
}

.pay-card__sent,
.notice-success {
  margin: 0;
  padding: var(--space-3) 14px;
  border-radius: var(--radius-md);
  background: var(--color-success-soft);
  color: var(--color-success);
  font-weight: 800;
}

.history-row {
  min-height: 56px;
  padding: 6px var(--space-2) 6px var(--space-5);
  border-top: 1px solid var(--color-divider);
}

.history-row--new {
  background: var(--color-success-soft);
}

.history-row__destination {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* What parents see for an account: recipient, number and payment purpose */
.requisites {
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.requisites__row {
  padding: 10px 14px;
  border-top: 1px solid var(--color-divider);
}

.requisites__row:first-child {
  border-top: 0;
}

.requisites__value {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.text-normal {
  font-weight: 400;
}

.info-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 14px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.info-row > .icon {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* Parent and teacher cabinets */
.balance-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--space-5);
  border-radius: 20px;
  background: #1D4ED8;
  color: #FFFFFF;
}

.balance-hero__label {
  margin: 0;
  color: #EAF1FF;
  font-size: var(--text-md);
  font-weight: 700;
}

.balance-hero__amount {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
}

.balance-hero__note {
  color: #EAF1FF;
  font-size: 14px;
}

.balance-hero__split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #6D8DEB;
}

.balance-hero__split dt {
  color: #EAF1FF;
  font-size: var(--text-sm);
}

.balance-hero__split dd {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.btn--light {
  border-color: #FFFFFF;
  background: #FFFFFF;
  color: var(--color-text);
}

.btn--light:hover {
  background: #F4F6FB;
  color: var(--color-text);
}

.copy-row {
  padding: 10px var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.copy-row--highlight {
  background: var(--color-surface-selected);
}

.copy-row__value {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dot-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.dot-icon--success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.month-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: #DCEBFF;
}

.month-totals dt {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.month-totals dd {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
}

.text-accent-strong {
  color: var(--color-accent-strong);
}

.table--compact th,
.table--compact td {
  padding-block: var(--space-3);
}

.card--flush .table--compact th:first-child,
.card--flush .table--compact td:first-child {
  padding-left: var(--space-4);
}

.card--flush .table--compact th:last-child,
.card--flush .table--compact td:last-child {
  padding-right: var(--space-4);
}

.person {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-1) 0;
}

.month-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.month-switch__current {
  flex-grow: 1;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.earnings-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--color-tile-green);
}

.earnings-hero__label {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-md);
  font-weight: 700;
}

.earnings-hero__amount {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.15;
}

.earnings-hero__split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--color-divider);
}

.earnings-hero__split dt {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.earnings-hero__split dd {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 800;
}

.earnings-hero__split dd.text-sm {
  font-size: var(--text-sm);
  font-weight: 400;
}

/* Cabinet pages: one column on phones; on wide screens the parts sit side by side */
.cabinet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 960px) {
  /* Wider content; the tab bar moves from the bottom to a strip under the header. */
  .app {
    --mobile-content-width: 1120px;
  }

  .app__header {
    order: 1;
  }

  .tabbar {
    position: static;
    order: 2;
    margin-top: 0;
    border-top: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .app__main {
    order: 3;
    padding: var(--space-6) var(--space-4) var(--space-8);
  }

  .tabbar__inner {
    display: flex;
    gap: var(--space-2);
    padding: 0 var(--space-4);
  }

  .tabbar__link {
    flex-direction: row;
    gap: var(--space-2);
    min-height: 52px;
    padding: 0 var(--space-4);
    border-bottom: 3px solid transparent;
    border-radius: 0;
    font-size: var(--text-md);
  }

  .tabbar__link[aria-current="page"] {
    border-bottom-color: var(--color-accent);
  }

  .cabinet-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-5);
  }

  .cabinet-grid--payment {
    grid-template-areas:
      "hero details"
      "payments details";
  }

  .cabinet-grid__hero {
    grid-area: hero;
  }

  .cabinet-grid__details {
    grid-area: details;
  }

  .cabinet-grid__payments {
    grid-area: payments;
  }

  /* Month pages: the days on the left; the month switch and totals on the right. */
  .cabinet-grid--activity,
  .cabinet-grid--earnings {
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: auto auto 1fr;
  }

  .cabinet-grid--activity {
    grid-template-areas:
      "days switch"
      "days totals"
      "days summary";
  }

  .cabinet-grid--earnings {
    grid-template-areas:
      "days switch"
      "days hero"
      "days .";
  }

  .cabinet-grid__switch {
    grid-area: switch;
  }

  .cabinet-grid__totals {
    grid-area: totals;
  }

  .cabinet-grid__summary {
    grid-area: summary;
  }

  .cabinet-grid__days {
    grid-area: days;
  }

}

/* Print list: children to tick on the left, the A4 sheet on the right */
.print-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-5);
}

.print-picker__list {
  flex: 2 1 320px;
}

.print-picker__list > .card__header {
  flex-direction: column;
  align-items: stretch;
}

.print-picker__count,
.print-picker__group {
  flex: 1 1 0;
}

.print-picker__preview {
  display: flex;
  flex: 3 1 440px;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.print-sheet {
  min-height: 640px;
  padding: 36px 40px 48px;
  border: 1px solid #D9DDE3;
  background: #FFFFFF;
  box-shadow: 0 6px 20px rgba(29, 35, 48, .10);
  font-size: var(--text-sm);
}

.print-sheet__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.print-sheet__title {
  flex-grow: 1;
  font-size: var(--text-lg);
  font-weight: 800;
}

.print-sheet__table {
  width: 100%;
  border-collapse: collapse;
  counter-reset: print-row;
}

.print-sheet__table th,
.print-sheet__table td {
  padding: var(--space-2);
  border: 1px solid var(--color-input-border);
  text-align: left;
}

.print-sheet__table th {
  font-weight: 800;
}

.print-sheet__table th:first-child {
  width: 36px;
}

.print-sheet__table tbody tr {
  counter-increment: print-row;
}

.print-sheet__number {
  color: var(--color-text-muted);
}

.print-sheet__number::before {
  content: counter(print-row);
}

/* ------------------------------------------------------------------ */
/* Print                                                               */
/* ------------------------------------------------------------------ */

@media print {
  body {
    background: #FFFFFF;
  }

  .sidebar,
  .tabbar,
  .app__logo,
  .app__back,
  .app__header .menu,
  .skip-link,
  .no-print {
    display: none !important;
  }

  .app__header,
  .app__subtitle {
    background: none;
    color: var(--color-text);
  }

  .shell__main,
  .app__main {
    padding: 0;
  }

  .card {
    border-color: var(--color-divider);
    break-inside: avoid;
  }

  /* The print list prints its sheet alone. */
  .shell__main:has(.print-sheet) > :not(.print-picker),
  .print-picker > :not(.print-picker__preview) {
    display: none !important;
  }

  .print-sheet {
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
