/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #fcf3ef;
  --surface: #ffffff;
  --surface-soft: #fff9f7;

  --text: #1e1e1e;
  --text-muted: #7b7472;
  --text-faint: #a8a09d;

  --border: #f1e4df;
  --border-strong: #ecd2cb;

  --primary: #1e1e1e;
  --primary-hover: #383432;

  /* status palette */
  --coral: #d9625b;
  --coral-bg: #fdeceb;
  --coral-line: #e6827b;
  --coral-line-soft: #f3cdc9;
  --mint: #4b9a5c;
  --mint-bg: #edf7ef;
  --mint-line: #cfe7d4;
  --grey: #7b7472;
  --grey-bg: #f3f1f0;
  --grey-line: #c9c2bf;
  --lavender: #7a6cc0;
  --lavender-bg: #efecfa;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 2px 8px rgba(90, 50, 40, 0.05);
  --shadow: 0 8px 24px rgba(90, 50, 40, 0.06);
  --shadow-lg: 0 18px 40px rgba(90, 50, 40, 0.12);

  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --panel-width: 360px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--coral-line);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Page shell
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 28px 0;
}

.topbar__spacer {
  flex: 1;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
}

.icon-btn:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.page {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.page--narrow {
  max-width: 1340px;
  padding-top: 12vh;
}

@media (max-width: 640px) {
  .topbar {
    padding: 16px 16px 0;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .page {
    padding: 16px 16px 96px;
  }

  .page--narrow {
    padding-top: 32px;
  }
}

/* ==========================================================================
   Buttons, pills, tags
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, color 0.15s, opacity 0.15s;
}

.btn:disabled,
.btn.htmx-request {
  opacity: 0.6;
  cursor: progress;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--soft {
  box-shadow: var(--shadow-sm);
}

.btn--soft:hover {
  box-shadow: var(--shadow);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}

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

.btn--danger {
  background: var(--surface);
  border-color: var(--coral-line-soft);
  color: var(--coral);
}

.btn--danger:hover {
  background: var(--coral-bg);
}

.btn--link {
  background: transparent;
  color: var(--text-muted);
}

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

.btn--sm {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 14px;
}

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

.link-muted {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.link-muted:hover {
  background: var(--surface);
  color: var(--text);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 16px;
  border: 1px solid var(--coral-line);
  border-radius: var(--radius-sm);
  background: var(--coral-bg);
  color: var(--coral);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.pill--muted {
  border-color: transparent;
  background: transparent;
  color: var(--text-faint);
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--lavender-bg);
  color: var(--lavender);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ==========================================================================
   Cards & section labels
   ========================================================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.section-label {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form__title {
  font-size: 30px;
}

.form__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--coral-bg);
  color: var(--coral);
  font-size: 14px;
}

.form-error ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
}

fieldset.field > legend {
  margin-bottom: 8px;
  padding: 0;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field__help {
  margin: 0;
  font-size: 13px;
  color: var(--text-faint);
}

.field__error {
  margin: 0;
  font-size: 13px;
  color: var(--coral);
}

.field input:not([type="checkbox"], [type="radio"], [type="hidden"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming on focus */
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.field select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%231e1e1e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.field select[multiple] {
  padding-right: 16px;
  background-image: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--coral-line);
  box-shadow: 0 0 0 4px var(--coral-bg);
}

.field--error input,
.field--error select,
.field--error textarea {
  border-color: var(--coral-line);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover,
.chip.is-active {
  border-color: var(--coral-line);
  background: var(--coral-bg);
  color: var(--coral);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--grey-bg);
}

.segmented__item {
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.segmented__item.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: default;
}

/* ==========================================================================
   Workspace: side panel with forms + main content
   Desktop (>=1200px): panel is a sticky column on the left.
   Tablet: panel slides in from the left. Phone: bottom sheet.
   ========================================================================== */
.workspace {
  display: grid;
  grid-template-columns: var(--panel-width) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.panel__sheet {
  position: sticky;
  top: 24px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel__close,
.panel__grabber,
.panel-backdrop,
.fab {
  display: none;
}

.panel-loading {
  height: 360px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-soft), var(--grey-bg), var(--surface-soft));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 1199px) {
  .workspace {
    display: block;
  }

  .panel {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
  }

  .panel__sheet {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(420px, 92vw);
    overflow-y: auto;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 0.3s var(--ease);
    pointer-events: auto;
    overscroll-behavior: contain;
  }

  .panel-open .panel__sheet {
    transform: none;
  }

  .panel__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-grid;
    width: 40px;
    height: 40px;
    box-shadow: none;
    background: var(--grey-bg);
  }

  .panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    background: rgba(40, 25, 20, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .panel-open .panel-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .panel-open {
    overflow: hidden;
  }

  .fab {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 30;
    display: inline-grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
  }

  .fab svg {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 640px) {
  .panel__sheet {
    top: auto;
    right: 0;
    width: 100%;
    max-height: 90vh;
    padding: 28px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(105%);
  }

  .panel__grabber {
    display: block;
    width: 40px;
    height: 4px;
    margin: -12px auto 16px;
    border-radius: 4px;
    background: var(--border-strong);
  }

  .form__title {
    font-size: 26px;
  }
}

/* ==========================================================================
   Messages (toasts)
   ========================================================================== */
.toasts {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  animation: toast 4s var(--ease) forwards;
}

.toast--success {
  background: var(--mint-bg);
  color: var(--mint);
}

.toast--error {
  background: var(--coral-bg);
  color: var(--coral);
}

@keyframes toast {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  8%,
  85% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ==========================================================================
   Menu
   ========================================================================== */
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 56px;
}

.menu-header__title {
  font-size: 36px;
}

.menu-header__actions {
  display: flex;
  gap: 4px;
}

.menu-section {
  margin-bottom: 40px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
  padding: 26px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.menu-card__name {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
}

.menu-card__meta {
  font-size: 16px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .menu-header {
    margin-bottom: 32px;
  }

  .menu-header__title {
    font-size: 28px;
  }

  .menu-card {
    min-height: 0;
    padding: 20px;
  }

  .menu-card__name {
    font-size: 22px;
  }

  .menu-card__meta {
    font-size: 14px;
  }
}

/* ==========================================================================
   Schedule
   ========================================================================== */
.week-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  margin-bottom: 28px;
}

.week-nav__prev,
.week-nav__next {
  min-width: 128px;
}

.week-nav__prev {
  justify-self: start;
}

@media (max-width: 900px) {
  .week-nav__prev,
  .week-nav__next {
    min-width: 48px;
  }
}

.week-nav__next {
  justify-self: end;
}

.week-nav__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.week-nav__range {
  font-size: 20px;
  font-weight: 600;
}

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0 14px;
  padding: 28px 22px;
}

.day__head {
  display: flex;
  flex-direction: column;
  padding: 0 12px 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.day__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.day__date {
  font-size: 17px;
  font-weight: 600;
}

.day__today {
  display: none;
}

.day.is-today .day__name,
.day.is-today .day__date {
  color: var(--coral);
}

.day__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day__empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-faint);
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.slot:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.slot.is-active {
  box-shadow: 0 0 0 2px var(--primary);
}

.slot--free {
  align-items: center;
  gap: 2px;
  border: 1px solid var(--mint-line);
  background: var(--mint-bg);
  color: var(--mint);
  text-align: center;
}

.slot--free .slot__title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
}

.slot--free svg {
  width: 14px;
  height: 14px;
}

.slot--free .slot__time {
  font-size: 14px;
}

.slot--lesson {
  border-left: 4px solid var(--coral-line);
  background: var(--coral-bg);
  color: var(--coral);
}

.slot--finished {
  border-left-color: var(--grey-line);
  background: var(--grey-bg);
  color: var(--grey);
}

.slot--canceled {
  border-left-color: var(--grey-line);
  background: transparent;
  outline: 1px dashed var(--grey-line);
  outline-offset: -1px;
  color: var(--text-faint);
}

.slot--canceled .slot__name {
  text-decoration: line-through;
}

.slot__time {
  font-size: 17px;
  font-weight: 600;
}

.slot__name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.slot__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 13px;
  opacity: 0.75;
}

/* Desktop: the schedule is exactly as tall as the form panel; days scroll inside the card. */
@media (min-width: 1200px) {
  .workspace--fit .workspace__main {
    align-self: stretch;
    /* size containment: the main column doesn't grow the grid row, so the panel defines its height */
    contain: size;
    min-height: 0;
  }

  .schedule {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .week {
    flex: 1;
    min-height: 0;
    padding-top: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }

  .day__head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 28px;
    background: var(--surface);
  }

  .legend {
    flex-shrink: 0;
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--coral-line);
}

.legend__dot--finished {
  background: var(--grey-line);
}

.legend__dot--canceled {
  background: transparent;
  border: 1px dashed var(--grey-line);
}

.legend__dot--free {
  background: var(--mint-line);
}

/* Tablet: tighter columns */
@media (max-width: 1100px) and (min-width: 901px) {
  .week {
    gap: 0 8px;
    padding: 20px 12px;
  }

  .day__head {
    padding: 0 6px 14px;
  }

  .slot {
    padding: 8px;
  }

  .slot__time,
  .slot__name {
    font-size: 15px;
  }
}

/* Phone / small tablet: days become a vertical list of cards */
@media (max-width: 900px) {
  .week {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    background: none;
    box-shadow: none;
  }

  .day {
    padding: 18px 16px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    scroll-margin-top: 16px;
  }

  .day__head {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    padding: 0 0 12px;
    margin-bottom: 14px;
  }

  .day__today {
    display: inline;
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--coral);
  }

  .slot {
    padding: 12px 14px;
  }

  .slot--free {
    flex-direction: row;
    justify-content: space-between;
  }

  .week-nav {
    margin-bottom: 18px;
  }

  .week-nav__label {
    display: none;
  }

  .week-nav__range {
    font-size: 17px;
  }
}

.week-nav__range {
  font-family: var(--font-sans);
}

/* ==========================================================================
   Text helpers
   ========================================================================== */
.text-success {
  color: var(--mint);
}

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

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

.tag--mint {
  background: var(--mint-bg);
  color: var(--mint);
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-faint);
}

.breadcrumbs a {
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

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

/* ==========================================================================
   List card: title + search, rows, pagination.
   Behaviour comes from [data-list] in app.js.
   ========================================================================== */
.list-card {
  padding: 32px;
}

.list-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 24px;
}

.list-card__title {
  font-size: 34px;
}

.list-card__subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.list-card__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search {
  position: relative;
  flex: 0 1 320px;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.search input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px 10px 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus {
  outline: none;
  border-color: var(--coral-line);
  box-shadow: 0 0 0 4px var(--coral-bg);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--bg);
  transition: box-shadow 0.15s;
}

.item-row:hover {
  box-shadow: var(--shadow-sm);
}

.item-row.is-active {
  box-shadow: 0 0 0 2px var(--primary);
}

.item-row__body {
  flex: 1;
  min-width: 0;
}

.item-row__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.item-row__title a {
  text-decoration: none;
}

.item-row__title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.item-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--text-muted);
}

.item-row__meta strong {
  font-weight: 600;
}

.meta-sep {
  color: var(--text-faint);
}

.item-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.empty-state {
  padding: 40px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
}

.empty-state__title {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--text);
}

.empty-state p {
  margin: 0;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pager__btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.pager__btn:hover:not(:disabled) {
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.pager__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pager__btn[aria-current="page"] {
  background: var(--primary);
  color: #fff;
}

.pager__gap {
  align-self: center;
  color: var(--text-faint);
}

@media (max-width: 640px) {
  .list-card {
    padding: 20px 16px;
  }

  .list-card__title {
    font-size: 28px;
  }

  .search {
    flex-basis: 100%;
  }

  .item-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }

  .item-row__actions {
    justify-content: flex-start;
  }

  .item-row__actions .btn--danger {
    margin-left: auto;
  }
}

/* ==========================================================================
   Option cards: styled checkbox / radio choices
   ========================================================================== */
.option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: none;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option-card:hover {
  border-color: var(--coral-line-soft);
}

.option-card:has(input:checked) {
  border-color: var(--coral-line);
  background: var(--coral-bg);
}

.option-card:has(input:focus-visible) {
  box-shadow: 0 0 0 4px var(--coral-bg);
}

.option-card input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--coral);
}

.option-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-card__title {
  font-weight: 600;
}

.option-card__meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   Auth pages (layouts/auth.html)
   ========================================================================== */
.page--auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.auth-card {
  width: min(440px, 100%);
  padding: 40px;
}

.auth-card__subtitle {
  margin: -8px 0 0;
  color: var(--text-muted);
}

.auth-card__switch {
  margin: 4px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-card__switch a,
.form__link {
  font-weight: 600;
  color: var(--coral);
  text-decoration: none;
}

.auth-card__switch a:hover,
.form__link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form__link {
  align-self: flex-end;
  margin-top: -8px;
  font-size: 14px;
}

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--mint-bg);
  color: var(--mint);
  font-size: 14px;
}

@media (max-width: 640px) {
  .page--auth {
    min-height: 100svh;
    padding-bottom: 32px;
  }

  .auth-card {
    padding: 28px 20px;
  }
}

/* ==========================================================================
   Page header & generic grids
   ========================================================================== */
.page--contained {
  max-width: 1180px;
}

.page-head {
  margin-bottom: 32px;
}

.page-head__title {
  font-size: 36px;
}

.page-head__subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  align-items: start;
}

.notice--success {
  background: var(--mint-bg);
  color: var(--mint);
}

.notice--pending {
  background: var(--lavender-bg);
  color: var(--lavender);
}

.notice--error {
  background: var(--coral-bg);
  color: var(--coral);
}

.notice--banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 15px;
}

.notice__title {
  display: block;
  font-weight: 600;
}

.notice a {
  color: inherit;
  font-weight: 600;
}

@media (max-width: 640px) {
  .page-head {
    margin-bottom: 20px;
  }

  .page-head__title {
    font-size: 28px;
  }
}

/* ==========================================================================
   Stat (big number + label)
   ========================================================================== */
.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat__value {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 600;
  line-height: 1;
}

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

/* ==========================================================================
   Student profile card (payments/student_profiles_list.html)
   ========================================================================== */
.profile-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
}

.profile-card__name {
  margin-top: 10px;
  font-size: 26px;
}

.profile-card__meta {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.plan-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-list__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 14px;
}

.plan-list__name {
  font-weight: 600;
}

.plan-list__meta {
  color: var(--text-muted);
  text-align: right;
}

/* ==========================================================================
   Tariff card (payments/buy_lessons.html)
   ========================================================================== */
.tariff-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
}

.tariff-card__name {
  margin-top: 10px;
  font-size: 26px;
}

.tariff-card__price {
  margin: 0;
  color: var(--text-muted);
}

.tariff-card__amount {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.tariff-card__features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.tariff-card__features li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tariff-card__features li::before {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mint-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' fill='none'%3E%3Cpath d='M1 4l2.5 2.5L9 1' stroke='%234b9a5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat;
}

.tariff-card__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.tariff-card__total strong {
  font-size: 22px;
  color: var(--text);
}

.tariff-card .btn--primary {
  margin-top: auto;
}

/* ==========================================================================
   Stepper: [−][ number ][+]
   ========================================================================== */
.stepper {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 8px;
}

.stepper__btn {
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.stepper__btn:hover {
  border-color: var(--coral-line);
  background: var(--coral-bg);
}

.field .stepper input {
  text-align: center;
  font-weight: 600;
  -moz-appearance: textfield;
}

.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-note {
  margin: 24px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ==========================================================================
   Message (includes/message.html): icon + title + text + actions
   ========================================================================== */
.message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.message__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--lavender-bg);
  color: var(--lavender);
}

.message__icon svg {
  width: 30px;
  height: 30px;
}

.message__icon--success {
  background: var(--mint-bg);
  color: var(--mint);
}

.message__icon--error {
  background: var(--coral-bg);
  color: var(--coral);
}

.message__title {
  font-size: 28px;
}

.message__text {
  margin: 0 0 10px;
  color: var(--text-muted);
}

.message .btn {
  margin-top: 0;
}

/* Logged-in pages that use the centered card keep the topbar above it */
.topbar ~ .page--auth {
  min-height: calc(100vh - 72px);
}

/* ==========================================================================
   Time zone switch (schedule) and public offer
   ========================================================================== */
.tz-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.tz-switch__label {
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.tz-switch__btn {
  padding: 5px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tz-switch__btn.is-active {
  background: var(--primary);
  color: #fff;
}

.tz-switch__btn:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 2px;
}

.menu-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 13px;
}

.document {
  padding: 40px;
}

.document__title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

.document__meta {
  margin-bottom: 30px;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.document__text h2 {
  margin: 32px 0 14px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
}

.document__text p,
.document__text li {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.document__text p {
  margin: 0 0 14px;
  text-align: justify;
}

.document__text ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

.document__text li {
  margin-bottom: 6px;
}

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

.requisites {
  margin-top: 35px;
  padding: 20px;
  border-left: 3px solid var(--coral);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.6;
}

.requisites-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.consent input {
  margin-top: 2px;
}

@media (max-width: 700px) {
  .document {
    padding: 24px;
  }

  .document__title {
    font-size: 22px;
  }

  .document__text h2 {
    margin-top: 24px;
    font-size: 18px;
  }

  .document__text p,
  .document__text li,
  .requisites {
    font-size: 13px;
  }
}
