/* Jhon's Classroom — the "Sticker Journal" look shared with Jhon's apps:
   warm paper, pastel fills, a 2px ink outline and a hard 4px offset shadow on every sticker,
   Fredoka for titles, Nunito for text, washi tape as the one decoration.
   Russian is set in Nunito (Fredoka has no Russian letters), Arabic in Baloo Bhaijaan 2 and
   Cairo, Chinese in the fonts every phone and computer already has.
   Colours come from PastelTheme.swift. Deep button colours are slightly darker here so that
   white text on them passes the WCAG AA contrast check on the web. */

/* ───────────── fonts (self-hosted: nothing is loaded from other companies) ───────────── */
@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-latin-ext.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-latin-ext.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-latin.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Russian (and other Cyrillic) letters. Like every font here, it is only downloaded by a
   page that really shows such letters. */
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-cyrillic.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Arabic: Baloo Bhaijaan 2 is round and friendly like Fredoka (titles and buttons),
   Cairo is calm and clear like Nunito (text). */
@font-face {
  font-family: 'Baloo Bhaijaan 2';
  src: url('/fonts/baloo-bhaijaan-2-arabic.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF,
    U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  src: url('/fonts/cairo-arabic.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF,
    U+FE70-FE74, U+FE76-FEFC;
}

/* ───────────── lettering ───────────── */
:root {
  /* Each list goes on with a font that has the letters the one before it lacks. */
  --text: 'Nunito', 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fredoka', 'Baloo Bhaijaan 2', 'Nunito', 'Cairo', system-ui, sans-serif;
  --dw: 600; /* how bold titles and buttons are */
}
/* Russian: titles in extra-bold Nunito, so Russian and English words in one title match. */
:root:lang(ru) {
  --display: var(--text);
  --dw: 800;
}
/* Chinese: the simplified-Chinese font of the device (Apple, Windows, Android, Linux). */
:root:lang(zh) {
  --cjk: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', 'Source Han Sans SC';
  --text: 'Nunito', var(--cjk), system-ui, sans-serif;
  /* Nunito before the Chinese font: it has the Russian letters Fredoka lacks. The Chinese
     fonts draw Russian letters as wide as Chinese signs, so a Russian name ran out of its box. */
  --display: 'Fredoka', 'Nunito', var(--cjk), system-ui, sans-serif;
}

/* ───────────── colours ───────────── */
:root {
  --paper: #fff8f1;
  --card: #ffffff;
  --ink: #3b2e36;
  --soft: #6e5f68;
  --line: #3b2e36;
  --drop: #3b2e36;
  --hair: rgba(59, 46, 54, 0.14);
  --veil: rgba(59, 46, 54, 0.45);

  --strawberry: #ffb3c1;
  --matcha: #a8d6b8;
  --blueberry: #b9d4f5;
  --lemon: #ffe8a3;
  --lavender: #d9ccf7;
  --peach: #ffd5b0;
  --mint: #bdebdd;
  --bubblegum: #fbd3dc;
  --sky: #cfe5f9;
  --cream: #fff4cc;

  --blue: #4470bd;
  --rose: #c9415f;
  --green: #2f7d54;
  --link: #2f5ba8;
  --danger: #b23250;
  --focus: #4470bd;

  --radius: 22px;
  --radius-btn: 18px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .23 0 0 0 0 .18 0 0 0 0 .21 0 0 0 .10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #1a1522;
  --card: #2b2437;
  --ink: #f5eef3;
  --soft: #c3b6c4;
  --line: #e8dce6;
  --drop: rgba(0, 0, 0, 0.85);
  --hair: rgba(232, 220, 230, 0.16);
  --veil: rgba(8, 5, 12, 0.66);
  --blue: #4470bd;
  --rose: #c9415f;
  --green: #2f7d54;
  --link: #9cc0f5;
  --danger: #f29aa9;
  --focus: #9cc0f5;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .93 0 0 0 0 .94 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ───────────── base ───────────── */
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  font: 500 17px/1.5 var(--text);
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--grain);
  overflow-wrap: anywhere;
}
h1,
h2,
h3,
.display {
  font-family: var(--display);
  font-weight: var(--dw);
  line-height: 1.2;
  margin: 0;
}
h1 {
  font-size: clamp(26px, 6vw, 32px);
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 19px;
}
p {
  margin: 0;
}
a {
  color: var(--link);
  font-weight: 700;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.soft {
  color: var(--soft);
}
.small {
  font-size: 14.5px;
}
.strong {
  font-weight: 800;
}
.center {
  text-align: center;
}
.pre {
  white-space: pre-wrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ───────────── layout ───────────── */
.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 16px 6px;
}
.brand {
  font: var(--dw) 21px/1.2 var(--display);
  color: var(--ink);
  text-decoration: none;
}
.page {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px calc(104px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page.wide {
  max-width: 1120px;
}
.page.public {
  padding-bottom: 40px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stack.tight {
  gap: 6px;
}
.stack.loose {
  gap: 18px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.row.top {
  align-items: flex-start;
}
.row.nowrap {
  flex-wrap: nowrap;
}
.grow {
  flex: 1 1 0;
  min-width: 0;
}
/* Three answers next to each other ("It took place · The student did not come · Note, cancel
   or move"): on a phone each one gets its own line instead of being squeezed into a few letters. */
.row.answers > .btn {
  flex: 1 1 11em;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

/* "Student view": the strip the teacher sees on every page while looking at the site as
   their test student. It stays at the top of the window, above the menu. */
.preview-strip {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--lemon);
  border-bottom: 2px solid var(--line);
  color: #3b2e36;
}
.preview-strip > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
}
.preview-strip p {
  flex: 1 1 auto;
  font-weight: 600;
}
/* On a phone the strip must stay small: the name of the view and the way back, on one line
   when the words allow it. The sentence that explains it is for wider screens. */
@media (max-width: 639px) {
  .preview-strip > div {
    padding-inline: 12px;
  }
  .preview-strip .more {
    display: none;
  }
}
:root[data-theme='dark'] .preview-strip {
  background: color-mix(in srgb, var(--lemon) 24%, var(--card));
  color: var(--ink);
}

/* bottom tabs on phones, a top bar on wide screens */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 2px solid var(--line);
}
.tab {
  position: relative;
  flex: 1 1 0;
  max-width: 160px;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 4px;
  border: 2px solid transparent;
  border-radius: 14px;
  color: var(--soft);
  text-decoration: none;
  text-align: center;
  font: 800 12.5px/1.15 var(--text);
}
.tab svg {
  width: 24px;
  height: 24px;
}
.tab[aria-current='page'] {
  color: var(--ink);
  background: var(--sky);
  border-color: var(--line);
}
/* Five tabs on a small phone (a student who also has the Shop): a little less air at the
   sides, so that a word like "Messages" stays in one piece. */
@media (max-width: 420px) {
  .tabbar {
    gap: 2px;
    padding-inline: 4px;
  }
  .tab {
    padding-inline: 2px;
  }
  /* Five tabs on a phone: the words are a little smaller, so that long ones ("Estadísticas",
     "Portefeuille", "Статистика") stay inside their own tab. */
  .tabbar.five .tab {
    padding-inline: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }
}
:root[data-theme='dark'] .tab[aria-current='page'] {
  background: color-mix(in srgb, var(--sky) 18%, var(--card));
  border-color: var(--sky);
}
.tab .badge {
  position: absolute;
  top: 0;
  inset-inline-start: calc(50% + 6px);
  /* "10" stays on one line, whatever the width of the tab under it. */
  white-space: nowrap;
}
@media (min-width: 900px) {
  .tabbar {
    position: sticky;
    /* --strip: the height of the "Student view" strip, when it is there (set by main.js). */
    top: var(--strip, 0px);
    bottom: auto;
    border-top: 0;
    border-bottom: 2px solid var(--line);
    padding: 8px 16px;
    gap: 8px;
  }
  .tab {
    flex: 0 0 auto;
    max-width: none;
    min-height: 44px;
    flex-direction: row;
    gap: 8px;
    padding: 6px 16px;
    font-size: 15.5px;
  }
  .tab .badge {
    position: static;
  }
  .page {
    padding-bottom: 48px;
  }
}

/* ───────────── stickers: cards, chips, tape ───────────── */
.card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--drop);
  padding: 18px;
}
.card.flat {
  box-shadow: none;
}
.card.pad-lg {
  padding: 26px 22px;
}
.tint {
  background: var(--tint);
}
:root[data-theme='dark'] .tint {
  background: color-mix(in srgb, var(--tint) 13%, var(--card));
  border-color: var(--tint);
}
.t-strawberry {
  --tint: var(--strawberry);
}
.t-matcha {
  --tint: var(--matcha);
}
.t-blueberry {
  --tint: var(--blueberry);
}
.t-lemon {
  --tint: var(--lemon);
}
.t-lavender {
  --tint: var(--lavender);
}
.t-peach {
  --tint: var(--peach);
}
.t-mint {
  --tint: var(--mint);
}
.t-bubblegum {
  --tint: var(--bubblegum);
}
.t-sky {
  --tint: var(--sky);
}
.t-cream {
  --tint: var(--cream);
}

.tape {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 84px;
  height: 20px;
  margin-left: -42px;
  transform: rotate(-3deg);
  border-radius: 2px;
  background-color: var(--matcha);
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0 3px, transparent 3px 9px);
  opacity: 0.92;
  box-shadow: 0 1px 1px rgba(59, 46, 54, 0.14);
  pointer-events: none;
}
.has-tape {
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--drop);
  font: 800 13.5px/1.35 var(--text);
  color: var(--ink);
  max-width: 100%;
}
.chip.tint {
  background: var(--tint);
}
.chip.quiet {
  box-shadow: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font: 800 12px/1 var(--text);
}
:root[data-theme='dark'] .badge {
  border-color: var(--card);
}

.avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 2px solid var(--line);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--drop);
  background: var(--tint, var(--sky));
  color: #3b2e36;
  font: var(--dw) 17px/1 var(--display);
}

.avatar.photo {
  object-fit: cover;
  background: var(--card);
}
.avatar.big {
  width: 84px;
  height: 84px;
  font-size: 30px;
}
/* The badge of a school: square with round corners, so it is never taken for a person. */
.avatar.logo {
  border-radius: 14px;
  font-size: 22px;
}
.avatar.logo.photo {
  object-fit: contain;
  background: #fff;
}
.avatar.logo.big {
  border-radius: 22px;
  font-size: 40px;
}
/* …and very small, in front of the school's name inside a chip. */
.avatar.logo.tiny {
  width: 20px;
  height: 20px;
  border-width: 1.5px;
  border-radius: 6px;
  box-shadow: none;
  font-size: 12px;
}

/* The emoji button under a text box, and its board. */
.emoji-bar {
  display: flex;
  margin-top: 6px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 4px;
  margin-top: 6px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.emoji-grid button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-size: 24px;
  line-height: 1;
}
.emoji-grid button:hover {
  background: var(--hair);
}

/* ───────────── buttons ───────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 10px 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--drop);
  font: var(--dw) 17.5px/1.2 var(--display);
  text-align: center;
  text-decoration: none;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--drop);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.btn.primary {
  background: var(--blue);
  color: #fff;
}
.btn.rose {
  background: var(--rose);
  color: #fff;
}
.btn.green {
  background: var(--green);
  color: #fff;
}
.btn.soft {
  background: var(--tint, var(--sky));
  color: #3b2e36;
}
.btn.danger {
  color: var(--danger);
}
.btn.block {
  display: flex;
  width: 100%;
}
.btn.small {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 15.5px;
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--drop);
}
.btn.small:active:not(:disabled) {
  transform: translate(2px, 2px);
}
.linklike {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--link);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ───────────── forms ───────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field > label,
.label {
  font-weight: 800;
  font-size: 15.5px;
}
.input,
.field input:not([type='checkbox']):not([type='radio']),
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-size: 17px;
  line-height: 1.35;
}
.field textarea {
  resize: vertical;
  min-height: 96px;
}
.field .hint {
  font-size: 14.5px;
  color: var(--soft);
}
.field .error,
.error {
  font-size: 15px;
  font-weight: 800;
  color: var(--danger);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}
.check input {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}
.code-input {
  font: 700 30px/1.2 var(--display) !important;
  letter-spacing: 0.3em;
  text-align: center;
  direction: ltr;
}
.notice {
  padding: 12px 14px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--tint, var(--cream));
  color: #3b2e36;
  font-weight: 600;
}
:root[data-theme='dark'] .notice {
  background: color-mix(in srgb, var(--tint, var(--cream)) 14%, var(--card));
  color: var(--ink);
}
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow-x: auto;
}
.seg button {
  flex: 1 1 0;
  min-height: 42px;
  padding: 6px 12px;
  border: 2px solid transparent;
  border-radius: 11px;
  background: none;
  font: var(--dw) 15.5px/1.2 var(--display);
  color: var(--soft);
  white-space: nowrap;
}
.seg button[aria-pressed='true'] {
  background: var(--lemon);
  border-color: var(--line);
  color: #3b2e36;
}
/* Many choices (the five parts of the settings): all of them stay in view on a phone. */
.seg.wrap {
  flex-wrap: wrap;
  overflow-x: visible;
}
.seg.wrap button {
  flex: 1 1 auto;
}

/* ───────────── lists ───────────── */
.list {
  display: flex;
  flex-direction: column;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 6px;
  border: 0;
  border-bottom: 1.5px solid var(--hair);
  background: none;
  color: inherit;
  text-align: start;
  text-decoration: none;
  font-weight: 500;
}
.list-item:last-child {
  border-bottom: 0;
}
a.list-item:hover,
button.list-item:hover {
  background: var(--hair);
  border-radius: 14px;
}
/* (the :hover line keeps the chosen row readable while the mouse rests on it) */
.list-item[aria-current='true'],
a.list-item[aria-current='true']:hover {
  background: var(--sky);
  border-radius: 14px;
  color: #3b2e36;
}
/* Dark theme: a dark row with a light-blue edge, so that the small grey words on it (the
   last message, the time) stay easy to read. A pale row made them almost invisible. */
:root[data-theme='dark'] .list-item[aria-current='true'],
:root[data-theme='dark'] a.list-item[aria-current='true']:hover {
  background: color-mix(in srgb, var(--sky) 16%, var(--card));
  box-shadow: inset 0 0 0 2px var(--sky);
  color: var(--ink);
}
.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty {
  padding: 22px 12px;
  text-align: center;
  color: var(--soft);
  font-weight: 600;
}

/* ───────────── chat ───────────── */
.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.chat-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* As tall as the screen allows, so the box to write in stays visible below it. */
  height: clamp(230px, calc(100dvh - 440px), 640px);
  overflow-y: auto;
  padding: 14px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overscroll-behavior: contain;
}
/* Inside the teacher's student page there is more above the chat. */
.chat.deep .chat-scroll {
  height: clamp(230px, calc(100dvh - 560px), 600px);
}
.day-mark {
  align-self: center;
  margin: 6px 0;
  padding: 1px 12px;
  border-radius: 999px;
  background: var(--hair);
  font: 800 12.5px/1.6 var(--text);
  color: var(--soft);
}
.bubble {
  max-width: min(86%, 520px);
  padding: 9px 13px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--drop);
  align-self: flex-start;
  border-end-start-radius: 6px;
}
.bubble.mine {
  align-self: flex-end;
  background: var(--sky);
  color: #3b2e36;
  border-end-start-radius: 18px;
  border-end-end-radius: 6px;
}
:root[data-theme='dark'] .bubble.mine {
  background: color-mix(in srgb, var(--sky) 20%, var(--card));
  border-color: var(--sky);
  color: var(--ink);
}
.bubble .text {
  white-space: pre-wrap;
}
.bubble .meta {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.72;
  text-align: end;
}
.bubble a {
  color: inherit;
}
.shot {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border: 2px solid var(--line);
  border-radius: 12px;
  margin: 2px 0 6px;
  background: var(--hair);
}
.filechip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.filechip .ext {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 4px 6px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--lemon);
  color: #3b2e36;
  font: 800 11.5px/1.2 var(--text);
  text-align: center;
  text-transform: uppercase;
}
.bubble audio {
  display: block;
  width: 260px;
  max-width: 100%;
  margin: 4px 0;
}
.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 4px 4px 0 var(--drop);
}
.composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 17px;
  resize: none;
}
/* On a narrow phone the two buttons stack and each fills the row: big, clear targets. */
.composer .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.composer .actions .btn {
  flex: 1 1 auto;
}
.composer .actions .btn.rose {
  flex: 1 1 110px;
}
@media (max-width: 899px) {
  .chat-scroll,
  .chat.deep .chat-scroll {
    height: clamp(220px, calc(100dvh - 505px), 640px);
  }
  .composer .quiet-hint {
    display: none;
  }
}
.composer.dragging {
  outline: 3px dashed var(--focus);
  outline-offset: 3px;
}
.pending-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
}
.bar {
  height: 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--matcha);
}

/* ───────────── sheets (dialogs) and toasts ───────────── */
.veil {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--veil);
  padding: 12px 10px 0;
}
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  border: 2px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: var(--paper);
  background-image: var(--grain);
  overscroll-behavior: contain;
}
@media (min-width: 640px) {
  .veil {
    align-items: center;
    padding: 20px;
  }
  .sheet {
    border-bottom: 2px solid var(--line);
    border-radius: 26px;
    box-shadow: 6px 6px 0 var(--drop);
    padding-bottom: 22px;
  }
}
.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  pointer-events: none;
}
.toast {
  max-width: 520px;
  padding: 10px 16px;
  border: 2px solid #3b2e36;
  border-radius: 16px;
  background: var(--lemon);
  color: #3b2e36;
  box-shadow: 4px 4px 0 var(--drop);
  font-weight: 800;
  pointer-events: auto;
}
.toast.bad {
  background: var(--strawberry);
}
@media (min-width: 900px) {
  .toasts {
    bottom: 28px;
  }
}

/* ───────────── packages and the wallet ───────────── */
/* "K7QF2M-03": the number of one lesson. Always in one piece, digits of equal width. */
.lesson-id {
  flex: none;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.money-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
/* Four numbers (when schools get a share) sit two by two instead of three and one. */
.money-grid.four {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.money {
  font: var(--dw) clamp(26px, 6vw, 32px) / 1.15 var(--display);
  overflow-wrap: anywhere;
}
.money-sums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 14px;
}
/* One line of the books. On a narrow screen the amount moves under the text instead of
   squeezing it. */
.move-line {
  align-items: flex-start;
  flex-wrap: wrap;
}
.move-icon {
  flex: none;
  font-size: 20px;
  line-height: 1.3;
}
.move-line .grow {
  flex: 1 1 200px;
}
.move-amount {
  flex: none;
  margin-inline-start: auto;
  text-align: end;
}

/* ───────────── the shop ───────────── */
.shop-cover {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--hair);
}
/* A file of a product: its name and buttons on one line, its player (audio, video) below. */
.file-line {
  flex-wrap: wrap;
}
.shop-player {
  display: block;
  flex: 1 1 100%;
  width: 100%;
  border-radius: 12px;
}
video.shop-player {
  max-height: 60vh;
  background: #000;
}

/* ───────────── classes and booking ───────────── */
.when {
  font: var(--dw) 19px/1.25 var(--display);
}
/* "czwartek, 19 listopada" / "jueves, 19 de noviembre" start with a capital when they open a line. */
.when::first-letter,
.day-title::first-letter {
  text-transform: uppercase;
}
.cancelled .when,
.cancelled h3 {
  text-decoration: line-through;
  opacity: 0.7;
}
.dates {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
}
.date-pill {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  text-align: center;
  font-weight: 800;
  line-height: 1.2;
  scroll-snap-align: start;
}
.date-pill small {
  display: block;
  font-size: 12.5px;
  color: var(--soft);
  text-transform: capitalize;
}
.date-pill[aria-pressed='true'] {
  background: var(--lemon);
  color: #3b2e36;
  box-shadow: 3px 3px 0 var(--drop);
}
.date-pill[aria-pressed='true'] small {
  color: #3b2e36;
}
.times {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.time-pill {
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font: var(--dw) 16.5px/1 var(--display);
}
.time-pill[aria-pressed='true'] {
  background: var(--rose);
  color: #fff;
  box-shadow: 3px 3px 0 var(--drop);
}
/* A time that is free is green; one that cannot be taken is crossed out. */
.time-pill.free {
  background: var(--mint);
  color: #3b2e36;
}
/* Dark theme: a real green (not a grey with a green edge), with light words on it. */
:root[data-theme='dark'] .time-pill.free {
  background: color-mix(in srgb, var(--green) 58%, var(--card));
  border-color: var(--mint);
  color: var(--ink);
}
.time-pill.free[aria-pressed='true'],
:root[data-theme='dark'] .time-pill.free[aria-pressed='true'] {
  background: var(--rose);
  border-color: var(--line);
  color: #fff;
}
.time-pill.taken {
  display: grid;
  place-items: center;
  border-style: dashed;
  border-color: var(--soft);
  background: repeating-linear-gradient(135deg, var(--hair) 0 6px, transparent 6px 12px);
  color: var(--soft);
  cursor: not-allowed;
}
.time-pill.taken s {
  text-decoration-thickness: 2px;
}
/* A day with no free time left: still there to look at, but crossed out. */
.date-pill.full {
  border-style: dashed;
  border-color: var(--soft);
  color: var(--soft);
  text-decoration: line-through;
}
.legend.free {
  background: var(--mint);
}
:root[data-theme='dark'] .legend.free {
  background: color-mix(in srgb, var(--green) 58%, var(--card));
  border-color: var(--mint);
}
.legend.taken {
  border-style: dashed;
  border-color: var(--soft);
  background: repeating-linear-gradient(135deg, var(--hair) 0 4px, transparent 4px 8px);
}
/* The booking rules, as a short list. */
.rules ul,
.notice ul {
  margin: 0;
  padding-inline-start: 20px;
  display: grid;
  gap: 4px;
}

/* ───────────── lessons as cards: one per name, in its own colour ─────────────
   A tap on the title opens the card: its lengths with their prices. */
.lesson-card {
  padding: 0;
  overflow: hidden;
}
.lesson-card h3 {
  margin: 0;
}
/* Dark theme: more of the card's own colour than other tinted cards get, so that "the blue
   card" and "the red card" can still be told apart. The words on it stay light. */
:root[data-theme='dark'] .lesson-card.tint {
  background: color-mix(in srgb, var(--tint) 30%, var(--card));
}
.lesson-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  width: 100%;
  min-height: 64px;
  padding: 14px 18px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
}
.lesson-head .from {
  font: 700 15px/1.3 var(--text);
}
.lesson-head svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  transition: transform 0.15s ease;
}
.lesson-card.open .lesson-head svg {
  transform: rotate(180deg);
}
.lesson-rows {
  display: grid;
  gap: 8px;
  padding: 0 14px 16px;
}
.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: start;
}
.lesson-row:hover {
  box-shadow: 3px 3px 0 var(--drop);
}
.lesson-row svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}
[dir='rtl'] .lesson-row svg {
  transform: scaleX(-1);
}
/* The colour of a card, chosen by the teacher: round dots, one of them ticked. */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.swatch {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--tint, var(--card));
}
.swatch[aria-checked='true'] {
  box-shadow:
    0 0 0 3px var(--card),
    0 0 0 6px var(--focus);
}
.platform-row + .platform-row {
  padding-top: 14px;
  border-top: 2px dashed var(--hair);
}

/* ───────────── week calendar ───────────── */
.week {
  --hour: 46px;
  display: grid;
  grid-template-columns: 54px repeat(7, minmax(0, 1fr));
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--drop);
  overflow: hidden;
}
.week-day {
  padding: 8px 2px;
  border-bottom: 2px solid var(--line);
  border-inline-start: 1.5px solid var(--hair);
  text-align: center;
  font: 800 13.5px/1.2 var(--text);
  text-transform: capitalize;
}
.week-day.today {
  background: var(--lemon);
  color: #3b2e36;
}
.week-day b {
  display: block;
  font: var(--dw) 19px/1.1 var(--display);
}
.week-corner {
  border-bottom: 2px solid var(--line);
}
.week-hours,
.week-col {
  position: relative;
}
.week-col {
  border-inline-start: 1.5px solid var(--hair);
  background-image: linear-gradient(var(--hair) 1.5px, transparent 1.5px);
  background-size: 100% var(--hour);
  cursor: cell;
}
.week-hours span {
  position: absolute;
  inset-inline-end: 6px;
  transform: translateY(-50%);
  font: 700 11.5px/1 var(--text);
  color: var(--soft);
  white-space: nowrap;
}
/* Hours that are open for bookings: one green, in the week and in its legend. An hour is
   either open (green) or closed (like the rest of the page), nothing else. The green lets
   the lines of the hours show through; it is always one layer (see openNow in calendar.js). */
.open-block {
  position: absolute;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--mint) 62%, transparent);
}
:root[data-theme='dark'] .open-block {
  background: color-mix(in srgb, #3fa672 44%, transparent);
}
/* The hours being dragged over, to open or close them. */
.drag-block {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 4;
  padding: 2px 5px;
  border: 2px dashed var(--blue);
  border-radius: 10px;
  background: color-mix(in srgb, var(--blueberry) 55%, transparent);
  color: #3b2e36;
  font: 800 12px/1.2 var(--text);
  pointer-events: none;
}
:root[data-theme='dark'] .drag-block {
  background: color-mix(in srgb, var(--blueberry) 30%, var(--card));
  border-color: var(--blueberry);
  color: var(--ink);
}
.week-col {
  user-select: none;
  -webkit-user-select: none;
}
/* The green of the open hours as a little square, in the legend. */
.legend.open {
  background: color-mix(in srgb, var(--mint) 62%, var(--card));
}
:root[data-theme='dark'] .legend.open {
  background: color-mix(in srgb, #3fa672 44%, var(--card));
}
/* Phone: a closed time as one line of its day. */
.off-line {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 2px dashed var(--hair);
  border-radius: var(--radius-btn);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2.5px solid var(--rose);
  z-index: 3;
  pointer-events: none;
}
.event {
  position: absolute;
  inset-inline: 3px;
  z-index: 2;
  min-height: 22px;
  padding: 2px 5px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--sky);
  color: #3b2e36;
  font: 800 12px/1.2 var(--text);
  text-align: start;
  overflow: hidden;
}
.event.waiting {
  background: var(--lemon);
  border-style: dashed;
}
/* A time kept for a student whose payment is on its way: not a class yet. */
.event.kept {
  background: var(--peach);
  border-style: dashed;
  z-index: 1;
}
.event.off {
  background: var(--card);
  color: var(--soft);
  text-decoration: line-through;
  border-style: dotted;
}
.event span {
  display: block;
  font-weight: 600;
}
.legend {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-radius: 5px;
  vertical-align: -2px;
  margin-inline-end: 5px;
}

/* ───────────── languages: flags as round stickers ───────────── */
.flag {
  position: relative;
  flex: 0 0 auto;
  display: block;
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--drop);
}
.flag img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.flag.big {
  width: 40px;
  height: 40px;
  box-shadow: 3px 3px 0 var(--drop);
}
/* A country's flag beside a name: small, and in the line of the text. */
.flag.mini {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-width: 1.5px;
  box-shadow: 1px 1px 0 var(--drop);
  vertical-align: -3px;
  margin-inline-end: 6px;
}
h1 > .flag {
  display: inline-block;
  vertical-align: -3px;
  margin-inline-end: 8px;
}
/* The list of countries, with the flag of the one chosen beside it. */
.country-pick {
  align-items: center;
  gap: 10px;
}
.country-pick select {
  flex: 1 1 auto;
  min-width: 0;
}
/* The tick on the corner of the flag that is in use. */
.flag .tick {
  position: absolute;
  inset-block-end: -7px;
  inset-inline-end: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid #3b2e36;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}
.flag .tick svg {
  width: 13px;
  height: 13px;
  stroke-width: 3.2;
}
.lang-button {
  gap: 9px;
  padding-inline: 9px 12px;
}
.lang-button svg {
  width: 16px;
  height: 16px;
}
/* Two flags side by side even on a small phone; one under the other only on the narrowest. */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  gap: 10px;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 64px;
  padding: 9px 11px;
  border: 2px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--drop);
  font: var(--dw) 17px/1.25 var(--display);
  text-align: start;
  white-space: nowrap;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
/* The Russian name is set in Nunito, which needs more weight to sit well next to the others. */
.lang-option :lang(ru),
.lang-button :lang(ru) {
  font-family: var(--text);
  font-weight: 800;
}
/* A name never leaves its button: it may shrink onto two lines instead. */
.lang-option .grow {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.lang-option:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--drop);
}
.lang-option:disabled {
  cursor: progress;
}
.lang-option[aria-pressed='true'] {
  background: var(--lemon);
  color: #3b2e36;
}

/* ───────────── right-to-left languages (Arabic) ─────────────
   The layout mirrors by itself, because it is built with "start" and "end" instead of
   "left" and "right". These are the few things that need a word of their own. */
[dir='rtl'] svg.mirror {
  transform: scaleX(-1);
}
/* Email addresses, phone numbers, links and amounts are still typed left to right, and a
   name may be typed in another alphabet than the page: either way the words in a box sit on
   the same side as its label, so a form stays tidy. (Longer texts, like a chat message,
   keep the side of their own language.) */
:root[dir='rtl'] input[dir='ltr'],
:root[dir='rtl'] input[dir='auto'] {
  text-align: right;
}
:root[dir='ltr'] input[dir='auto'] {
  text-align: left;
}
/* Arabic letters are taller and carry marks above and below, so lines get more air. */
body:lang(ar) {
  line-height: 1.7;
}
:lang(ar) h1,
:lang(ar) h2,
:lang(ar) h3,
:lang(ar) .brand,
:lang(ar) .btn,
:lang(ar) .when,
:lang(ar) .lang-option {
  line-height: 1.5;
}
:lang(ar) .tab,
:lang(ar) .chip,
:lang(ar) .seg button {
  line-height: 1.5;
}

/* ───────────── teacher: two panes on wide screens ───────────── */
.panes {
  display: grid;
  gap: 18px;
  align-items: start;
}
@media (min-width: 980px) {
  .panes.split {
    grid-template-columns: 360px minmax(0, 1fr);
  }
  .panes .pane-list {
    position: sticky;
    top: 76px;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
  }
}
@media (max-width: 979px) {
  .panes.split.has-detail .pane-list {
    display: none;
  }
}

/* ───────────── misc ───────────── */
.boot {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  font: var(--dw) 20px var(--display);
  color: var(--soft);
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--hair);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 18px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
hr {
  border: 0;
  border-top: 1.5px solid var(--hair);
  margin: 4px 0;
}
details > summary {
  cursor: pointer;
  font-weight: 800;
  padding: 6px 0;
}
.devbar {
  padding: 8px 12px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--lavender);
  color: #3b2e36;
  font-weight: 800;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}

/* ───────────── reviews: stars, and what students say ───────────── */
.stars {
  display: inline-flex;
  gap: 1px;
  font-size: 18px;
  line-height: 1;
  color: var(--hair);
  white-space: nowrap;
  /* stars read the same way in every language */
  direction: ltr;
}
.stars .on {
  color: #f0a81c;
}
.stars.pick {
  gap: 4px;
  font-size: 38px;
}
.stars.pick button {
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.stars.pick button.on {
  color: #f0a81c;
}
.stars.pick button:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 2px;
  border-radius: 8px;
}
.review .who,
.review-item .who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.review-item + .review-item {
  padding-top: 16px;
  border-top: 2px dashed var(--hair);
}

/* ───────────── an on/off switch ───────────── */
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--drop);
  cursor: pointer;
  transition: background 0.15s;
}
.switch .knob {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line);
  opacity: 0.45;
  transition: inset-inline-start 0.15s;
}
.switch.on {
  background: var(--green);
}
.switch.on .knob {
  inset-inline-start: 27px;
  background: #fff;
  opacity: 1;
}
.switch:disabled {
  opacity: 0.6;
  cursor: default;
}
.switch:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .switch,
  .switch .knob {
    transition: none;
  }
}

/* ───────────── the picture of a way to pay (a QR code) ─────────────
   The picture is only drawn smaller here. The file itself is never changed, and nothing of
   it is cut off: a QR code has to stay whole to be scanned. */
.pay-pic {
  display: block;
  box-sizing: border-box;
  width: fit-content;
  max-width: min(100%, 336px);
  padding: 6px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.pay-pic img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

/* A window with a long title: the title goes onto a second line, the Close button keeps its shape. */
.sheet > .row.nowrap > h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.sheet > .row.nowrap > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ───────── a clock that counts down to a class ───────── */
.countdown {
  font: 800 1.05em/1.2 var(--display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timer {
  font-weight: 700;
}
/* The teacher's next classes: who, what, and the clock. */
.upcoming.card {
  padding: 4px 14px;
}
.upcoming .list-item {
  cursor: pointer;
  flex-wrap: wrap;
}
.upcoming .starts {
  flex: 0 0 auto;
  min-width: 9.5em;
  text-align: end;
}
.upcoming .starts .countdown {
  font-size: 1.25em;
  color: var(--matcha-ink, var(--ink));
}
@media (max-width: 639px) {
  /* On a phone: who, then what and when, then the clock, each on its own line. */
  .upcoming .list-item > .grow,
  .upcoming .starts {
    flex-basis: 100%;
    text-align: start;
  }
}

/* "Your class starts in 12m 03s": on every page, from half an hour before the class. */
.soon-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--lemon);
  box-shadow: 3px 3px 0 var(--drop);
  color: #3b2e36;
}
.soon-strip .countdown {
  font-size: 1.2em;
}
/* The words get the room they need: on a phone the buttons go under them. */
.soon-strip > p {
  flex: 1 1 15em;
}
:root[data-theme='dark'] .soon-strip {
  background: color-mix(in srgb, var(--lemon) 22%, var(--card));
  border-color: var(--lemon);
  color: var(--ink);
}

/* A card about a class, between the messages of a conversation. */
.chat-card {
  align-self: center;
  width: min(100%, 420px);
  margin: 4px 0;
  padding: 10px 14px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: var(--cream);
  color: #3b2e36;
}
.chat-card .when {
  font-size: 17px;
}
.chat-card .meta {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.72;
  text-align: end;
}
:root[data-theme='dark'] .chat-card {
  background: color-mix(in srgb, var(--cream) 12%, var(--card));
  color: var(--ink);
}
/* The same cards in the teacher's list of lesson notifications. */
.card-row .meta {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.72;
}
.card-row .when {
  font-size: 16px;
}
.card-row.fresh {
  background: color-mix(in srgb, var(--lemon) 26%, transparent);
  border-radius: 12px;
}
:root[data-theme='dark'] .card-row.fresh {
  background: color-mix(in srgb, var(--lemon) 12%, transparent);
}

/* Several answers to tick (the learning profile): each one a button that is on or off. */
.picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pick {
  padding: 7px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 700 15px/1.3 var(--text);
  cursor: pointer;
}
.pick.on {
  background: var(--sky);
  color: #3b2e36;
  box-shadow: 2px 2px 0 var(--drop);
}
:root[data-theme='dark'] .pick.on {
  background: color-mix(in srgb, var(--sky) 30%, var(--card));
  border-color: var(--sky);
  color: var(--ink);
}

/* ───────── statistics: tiles, bars on one scale, small tables ─────────
   The two bar colours were checked for colour-blind readers and for contrast against the
   card, in the light and in the dark theme (the dark theme has its own two). Words and
   figures always keep the colour of the text. */
:root {
  --chart-1: #4470bd;
  --chart-2: #2f7d54;
}
:root[data-theme='dark'] {
  --chart-1: #6a94e0;
  --chart-2: #3fa672;
}
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 2px solid var(--hair);
  border-radius: 16px;
}
.stat-label {
  font-weight: 700;
  color: var(--soft);
}
.stat-value {
  font: 800 30px/1.15 var(--text);
}
.stat-tile.hero .stat-value {
  font-size: 48px;
}
.stat-sub {
  font-size: 14px;
  color: var(--soft);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px 28px;
}
.bar-list,
.pair-chart {
  display: grid;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 11em) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
  border-radius: 8px;
}
.bar-row:hover {
  background: var(--hair);
}
.bar-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.bar-track {
  display: block;
  height: 14px;
  border-radius: 0 4px 4px 0;
}
/* A share of a whole (percent): the empty part shows too, in a lighter step of the same colour. */
.bar-track.full.s1 {
  background: color-mix(in srgb, var(--chart-1) 20%, var(--card));
}
.bar-track.full.s2 {
  background: color-mix(in srgb, var(--chart-2) 20%, var(--card));
}
.sbar {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--chart-1);
}
.sbar.s2 {
  background: var(--chart-2);
}
[dir='rtl'] .sbar,
[dir='rtl'] .bar-track {
  border-radius: 4px 0 0 4px;
}
.bar-figure {
  min-width: 2.5em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: end;
  white-space: nowrap;
}
.pair-group {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--hair);
}
.pair-group:last-child {
  border-bottom: 0;
}
.pair-name {
  font-weight: 700;
  text-transform: capitalize;
}
.pair-group .bar-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-weight: 600;
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.key {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--chart-1);
}
.key.s2 {
  background: var(--chart-2);
}
.key.round {
  border-radius: 50%;
}
.table-scroll {
  overflow-x: auto;
}
.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.stat-table th,
.stat-table td {
  padding: 7px 8px;
  border-bottom: 1.5px solid var(--hair);
  text-align: end;
}
.stat-table th[scope='row'] {
  text-align: start;
  font-weight: 600;
}
.stat-table thead th {
  color: var(--soft);
  font-weight: 700;
  text-transform: capitalize;
}
/* Figures and the names of the months never break in the middle (the names of the rows may wrap). */
.stat-table td,
.stat-table thead th {
  white-space: nowrap;
}
@media (max-width: 479px) {
  /* On a phone the bar drops under its name, and the figure stays at the end of the line. */
  .bar-list .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .bar-list .bar-name {
    grid-column: 1 / -1;
  }
}

/* A student's little calendar: the days with a class are marked. */
.mini-cal {
  display: grid;
  gap: 8px;
  max-width: 360px;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.mini-head {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--soft);
}
.mini-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mini-day.today {
  outline: 2px solid var(--line);
}
.mini-day.on {
  background: var(--chart-1);
  color: #ffffff;
  font-weight: 800;
}
:root[data-theme='dark'] .mini-day.on {
  color: #14101c;
}

/* Small grey words on a coloured card (light theme): a little darker, so they stay easy to
   read on yellow and on blue (the dark theme has its own colours). */
:root:not([data-theme='dark']) .tint .soft,
:root:not([data-theme='dark']) .tint.soft {
  color: #584a53;
}

/* ───────────── schools: the page of one school, its people, its students ───────────── */
/* A student of a school, folded: a tap on the name shows their classes. */
.fold {
  border: 2px solid var(--hair);
  border-radius: 16px;
  padding: 0 12px;
}
.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  list-style: none;
}
.fold > summary::-webkit-details-marker {
  display: none;
}
/* The little arrow that says "there is more": it points down once the student is open. */
.fold > summary::before {
  content: '▸';
  flex: 0 0 auto;
  color: var(--soft);
  font-size: 15px;
}
[dir='rtl'] .fold > summary::before {
  content: '◂';
}
.fold[open] > summary::before {
  content: '▾';
}
.fold > summary > .row {
  flex: 1 1 auto;
  min-width: 0;
}
.fold[open] > summary {
  border-bottom: 1.5px solid var(--hair);
  margin-bottom: 12px;
}
.fold > div {
  padding-bottom: 12px;
}
.fold h4 {
  margin: 0;
  font: 800 15px/1.3 var(--text);
  color: var(--soft);
}
/* A short list inside a card: closer lines. */
.tight-list .list-item {
  padding: 8px 2px;
}
/* A person of a school: what can be done with them sits under their details on a phone. */
.person-row {
  flex-wrap: wrap;
}
.person-row > .grow {
  flex: 1 1 16em;
}
ul.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* The words of a chip that holds a logo and a name: they break between words, not inside one. */
.chip-words {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}
.avatar.logo.tiny {
  flex: 0 0 20px;
}
/* The little arrow of a folded student, a bit bigger. */
.fold > summary::before {
  font-size: 18px;
}
/* A phone number stays in one piece. */
.keep {
  white-space: nowrap;
}
/* A link that looks like a chip (the school of a person, leading to its page). */
a.chip {
  text-decoration: none;
}

/* ───────────── the list of the emails the site sent ───────────── */
.mail-row {
  align-items: flex-start;
  flex-wrap: wrap;
}
.mail-row > .grow {
  flex: 1 1 14em;
  min-width: 0;
}

/* The switches for the kinds of emails: the two switches sit next to the words, and under
   them on a phone. */
.mail-switch {
  align-items: flex-start;
  flex-wrap: wrap;
}
.mail-switch > .grow {
  flex: 1 1 14em;
  min-width: 0;
}
