:root {
  --crimson: #7a1128;
  --crimson-dark: #56081b;
  --parchment: #faf6f0;
  --card: #ffffff;
  --ink: #24211e;
  --slate: #6b6560;
  --gold: #a3791f;
  --line: #e4dccf;
  --success-bg: #eef4ea;
  --success-ink: #395c2a;
  --error-bg: #fbeaea;
  --error-ink: #8a2626;
  --info-bg: #eef1f6;
  --info-ink: #35455c;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: "PT Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: "PT Serif", serif; font-weight: 700; margin: 0 0 0.5em; }

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

.topbar {
  background: var(--crimson);
  color: #fff;
  border-bottom: 3px solid var(--crimson-dark);
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { text-decoration: none; color: #fff; display: flex; flex-direction: column; }
.brand-eyebrow {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}
.brand-title { font-family: "PT Serif", serif; font-size: 20px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.link-muted { color: #f0d9d9; text-decoration: underline; }
.link-muted:hover { color: #fff; }

.page { padding: 32px 0 60px; min-height: 60vh; }
.container { max-width: 720px; margin: 0 auto; padding: 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 1px 3px rgba(36, 33, 30, 0.05);
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 6px;
}

.subtitle { color: var(--slate); margin: -4px 0 20px; }

.rule {
  display: block;
  height: 1px;
  background: repeating-linear-gradient(to right, var(--line) 0 6px, transparent 6px 10px);
  margin: 20px 0;
}

/* формы */
label { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="text"], input[type="email"], textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, button:focus, .choice input:focus + span {
  outline: 3px solid #c9a2ac;
  outline-offset: 1px;
}
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 18px; }
.hint { color: var(--slate); font-size: 13px; margin-top: 6px; }

button, .btn {
  display: inline-block;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--crimson);
  background: var(--crimson);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
button:hover, .btn:hover { background: var(--crimson-dark); border-color: var(--crimson-dark); }
.btn-secondary {
  background: transparent;
  color: var(--crimson);
}
.btn-secondary:hover { background: #f4e7e9; }
.actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* выбор направлений/недель — список карточек-кнопок */
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.choice-btn:hover { border-color: var(--gold); background: #fbf6ea; }

/* мультивыбор (дни / пары) — стилизованные чекбоксы */
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice {
  position: relative;
  display: block;
}
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}
.choice input:checked + span {
  border-color: var(--crimson);
  background: #f6e9eb;
  color: var(--crimson-dark);
}
.choice input:checked + span::after {
  content: " ✓";
}

/* формат */
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }

/* сводка подтверждения */
.summary-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.summary-table th, .summary-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.summary-table th { color: var(--slate); font-weight: 700; width: 40%; }

.step-indicator { color: var(--slate); font-size: 13px; margin-bottom: 14px; }

/* мои предпочтения */
.pref-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pref-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
}
.pref-item .direction { color: var(--gold); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.pref-item .meta { color: var(--slate); font-size: 13px; }

/* меню */
.menu-grid { display: grid; gap: 12px; }
.menu-item {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
}
.menu-item:hover { border-color: var(--gold); background: #fbf6ea; }
.menu-item .title { font-family: "PT Serif", serif; font-weight: 700; font-size: 17px; }
.menu-item .desc { color: var(--slate); font-size: 14px; margin-top: 3px; }

/* flash */
.flash-stack { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.flash-success { background: var(--success-bg); color: var(--success-ink); }
.flash-error { background: var(--error-bg); color: var(--error-ink); }
.flash-info { background: var(--info-bg); color: var(--info-ink); }

.footer { padding: 20px 0 40px; color: var(--slate); font-size: 13px; }

/* чат поддержки */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}
.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.45;
}
.chat-bubble .meta {
  display: block;
  font-size: 12px;
  color: var(--slate);
  margin-top: 4px;
}
.chat-teacher {
  align-self: flex-end;
  background: #f6e9eb;
  border: 1px solid #e6c9ce;
  color: var(--ink);
}
.chat-admin {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
.chat-empty { color: var(--slate); padding: 10px 0 20px; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { min-height: 60px; }
.chat-form button { white-space: nowrap; }

/* админ-панель: список переписок */
.admin-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.admin-list-item {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
}
.admin-list-item:hover { border-color: var(--gold); background: #fbf6ea; }
.admin-list-item .name { font-weight: 700; }
.admin-list-item .preview { color: var(--slate); font-size: 14px; margin-top: 3px; }
.admin-list-item .when { color: var(--slate); font-size: 12px; margin-top: 4px; }
.badge-sender {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  background: var(--gold);
  color: #fff;
}

@media (max-width: 480px) {
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 20px; }
}
