/* Courtbook — оболочка Telegram Mini App.
   Цвета приходят из themeParams (tma_shell.js) в CSS-переменные --tg-*;
   значения ниже — фолбэк для отладки в браузере. Ширина вёрстки 360–430px. */

:root {
  --tg-bg: #17212b;
  --tg-text: #ffffff;
  --tg-hint: #708499;
  --tg-secondary-bg: #232e3c;
  --tg-button: #5288c1;
  --tg-button-text: #ffffff;
  /* Опасное действие: отмена записи. Текст белый — контраст 4.6:1. */
  --danger: #e5484d;
  --danger-text: #ffffff;

  --radius: 16px;
  --radius-sm: 12px;
  --gap: 12px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --tg-bg: #ffffff;
    --tg-text: #0f0f0f;
    --tg-hint: #707579;
    --tg-secondary-bg: #f4f4f5;
    --tg-button: #3390ec;
    --tg-button-text: #ffffff;
    /* На светлом фоне красный чуть темнее: белый текст остаётся читаемым. */
    --danger: #d93a3f;
    --danger-text: #ffffff;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: var(--tg-bg);
  color: var(--tg-text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding:
    calc(16px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Контент ────────────────────────────────────────────────────────────── */
.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--tg-secondary-bg);
  border-radius: var(--radius);
  padding: 16px;
}

.card h1 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tg-hint);
}

.lead {
  margin: 0;
  font-size: 15px;
  color: var(--tg-text);
  opacity: 0.92;
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--tg-hint);
}

.hint code {
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(127, 127, 127, 0.18);
}

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

.steps li {
  position: relative;
  padding-left: 22px;
}

.steps li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tg-button);
  opacity: 0.85;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 16px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.button:active { opacity: 0.8; }

/* ── Статус окружения ───────────────────────────────────────────────────── */
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 4px;
  font-size: 12px;
  color: var(--tg-hint);
}

.dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--tg-hint);
}

html.tg-inside .dot { background: #31c48d; }

/* ── Шлюз «Откройте через Telegram» ─────────────────────────────────────── */
body.is-guest .app.is-locked { display: none; }

.gate {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(32px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
}

.gate[hidden] { display: none; }

.gate-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.gate-card h1 {
  font-size: 22px;
  margin: 12px 0 10px;
}

.gate-mark {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 26px;
}

/* ── Навигация по разделам ──────────────────────────────────────────────── */
body.is-authed .app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  max-width: 520px;
  margin: 0 auto;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--tg-secondary-bg);
  border-top: 1px solid rgba(127, 127, 127, 0.18);
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 12px;
  color: var(--tg-hint);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab svg { width: 22px; height: 22px; }

.tab.is-active {
  color: var(--tg-button);
  background: rgba(82, 136, 193, 0.14);
  font-weight: 600;
}

.tab:active { background: rgba(127, 127, 127, 0.16); }

/* ── Секции и события ───────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tg-hint);
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  color: var(--tg-hint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--tg-secondary-bg);
}

.event-time {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Первая строка карточки: время и чипы «Сегодня/Завтра» и типа события. */
.event-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.event-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.event-title {
  font-size: 15px;
  font-weight: 550;
  line-height: 1.3;
}

.event-top + .event-title { margin-top: 4px; }

.event-where {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--tg-hint);
  overflow-wrap: anywhere;
}

.event-meta {
  font-size: 12px;
  color: var(--tg-hint);
}

.event-arrow {
  flex: 0 0 auto;
  color: var(--tg-hint);
  font-size: 20px;
  line-height: 1;
}

/* ── Профиль ────────────────────────────────────────────────────────────── */
/* Карточка профиля: строка «аватар + имя» и раскрывающаяся форма имени. */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Обёртка не обрезает содержимое: бейдж-карандаш выходит за круг аватара. */
.avatar-wrap {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
}

/* Форма — только носитель для input[type=file]: клик по бейджу открывает выбор. */
.avatar-form {
  position: absolute;
  right: -14px;
  bottom: -14px;
  margin: 0;
  line-height: 0;
}

/* Зона нажатия 44×44, а видимый кружок — 25px по центру. */
.avatar-edit {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
}

.avatar-edit-badge {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 2px solid var(--tg-secondary-bg);
  background: var(--tg-button);
  color: var(--tg-button-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.avatar-edit-badge svg { width: 12px; height: 12px; }

.avatar-edit:focus-within .avatar-edit-badge {
  outline: 2px solid var(--tg-button);
  outline-offset: 2px;
}

/* Скрыто визуально, но доступно клавиатуре: фокус на input рисует кольцо. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.profile-name {
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* Круглая кнопка-иконка: карандаш рядом с именем. */
.icon-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tg-hint);
  cursor: pointer;
}

.icon-button svg { width: 16px; height: 16px; }

.icon-button:hover { color: var(--tg-button); }
.icon-button:active { background: rgba(127, 127, 127, 0.2); }
.icon-button:focus-visible {
  outline: 2px solid var(--tg-button);
  outline-offset: 1px;
}

.profile-edit {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
}

.profile-edit[hidden] { display: none; }

.profile-handle {
  font-size: 14px;
  color: var(--tg-hint);
  overflow-wrap: anywhere;
}

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

.club-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(127, 127, 127, 0.12);
}

.club-name {
  font-size: 15px;
  font-weight: 550;
  min-width: 0;
}

.role-chip {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(82, 136, 193, 0.18);
  color: var(--tg-button);
  font-size: 12px;
  font-weight: 600;
}

.logout-form { margin: 0; }

.button-ghost {
  background: transparent;
  border: 1px solid rgba(127, 127, 127, 0.35);
  color: var(--tg-text);
  cursor: pointer;
  font-family: inherit;
}

.button-ghost:active { opacity: 0.6; }

@media (prefers-color-scheme: light) {
  .role-chip { background: rgba(51, 144, 236, 0.12); }
}

/* ── Секции с заголовком и пустые состояния ─────────────────────────────── */
.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--tg-secondary-bg);
}

.empty-compact { padding: 14px 16px; }

.empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.empty .hint { margin: 0; }

.empty .button {
  width: 100%;
  margin-top: 2px;
}

/* ── Полоска дней ───────────────────────────────────────────────────────── */
.daystrip {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.daystrip-arrow {
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--tg-secondary-bg);
  color: var(--tg-hint);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
}

.daystrip-arrow:active { opacity: 0.6; }

.daystrip-days {
  flex: 1 1 auto;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.day {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 9px;
  border-radius: 12px;
  background: var(--tg-secondary-bg);
  color: var(--tg-hint);
  text-decoration: none;
}

.day-dow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.day-num {
  font-size: 16px;
  font-weight: 650;
  color: var(--tg-text);
  font-variant-numeric: tabular-nums;
}

.day.is-today .day-num { color: var(--tg-button); }

.day.is-active { background: var(--tg-button); }

.day.is-active .day-dow,
.day.is-active .day-num { color: var(--tg-button-text); }

.schedule-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.schedule-head h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* ── Карточка события в списке ──────────────────────────────────────────── */
.event-item { margin: 0; }

.event-row {
  color: inherit;
  text-decoration: none;
}

.event-row:active { opacity: 0.75; }

.event-row.is-cancelled { opacity: 0.55; }

.event-row.is-cancelled .event-title { text-decoration: line-through; }

.event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.event-day {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.16);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.event-club {
  font-size: 12px;
  color: var(--tg-hint);
}

.kind-chip {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.kind-game { background: rgba(82, 136, 193, 0.18); color: #6aa8e6; }
.kind-training { background: rgba(49, 196, 141, 0.16); color: #35c48f; }
.kind-tournament { background: rgba(240, 173, 78, 0.18); color: #e0a44c; }

.badge-danger {
  background: rgba(232, 90, 90, 0.18);
  color: #e86a6a;
}

/* ── Бейджи записи в «Моих записях» ─────────────────────────────────────── */
.badge-ok { background: rgba(49, 196, 141, 0.16); color: #35c48f; }
.badge-queue { background: rgba(127, 127, 127, 0.18); color: var(--tg-hint); }
.badge-offer { background: rgba(240, 173, 78, 0.18); color: #e0a44c; }

.event-when-mine {
  font-size: 13px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

/* ── Карточка события целиком ───────────────────────────────────────────── */
.event-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.event-detail h1 { font-size: 22px; }

.event-when {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--tg-hint);
}

.facts {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.fact dt {
  margin: 0;
  color: var(--tg-hint);
}

.fact dd {
  margin: 0;
  text-align: right;
  font-weight: 550;
}

.fact-note {
  color: var(--tg-hint);
  font-weight: 400;
}

/* Ссылка «на карту» внутри факта: та же строка, но видно, что нажимается. */
.fact-link {
  display: inline-block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 550;
  color: var(--tg-button);
}

.description {
  margin: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

/* ── Страница клуба: тренеры и залы ─────────────────────────────────────── */
.club-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.club-contacts .button {
  padding: 8px 12px;
  font-size: 13px;
}

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

.coach-card {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--tg-secondary-bg);
}

.coach-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.coach-photo {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(127, 127, 127, 0.16);
}

.coach-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 650;
  color: var(--tg-hint);
}

.coach-body {
  min-width: 0;
  flex: 1 1 auto;
}

.coach-name {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.coach-position,
.coach-experience {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--tg-hint);
}

.coach-experience { font-size: 12px; }

/* Биография — вне шапки с фото: текст занимает всю ширину карточки. */
.coach-bio {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.court-card {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--tg-secondary-bg);
}

.court-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.court-name {
  font-size: 15px;
  font-weight: 650;
}

.court-sports {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--tg-hint);
}

/* Адрес — отдельной строкой: он важнее описания и не должен сливаться с ним. */
.court-address {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--tg-hint);
}

.court-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

.court-links .link-button { margin-top: 0; }

.court-description {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.court-card .link-button { margin-top: 8px; }

@media (prefers-color-scheme: light) {
  .kind-game { color: #1f6fc0; }
  .kind-training { color: #12855f; }
  .kind-tournament { color: #a76a12; }
  .badge-danger { color: #c94a4a; }
  .badge-ok { color: #12855f; }
  .badge-offer { color: #a76a12; }
}


/* ── Участники и запись ─────────────────────────────────────────────────── */
.participants-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.participants-head h2 { margin: 0; }

.seats-counter {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.seats-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--tg-hint);
}

.participant-list,
.waitlist {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.participant,
.waitlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Аватар в списке участников — уменьшенная копия аватара профиля. */
.avatar-sm {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.participant-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.participant-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 15px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.participant-meta {
  font-size: 12px;
  color: var(--tg-hint);
}

.subhead {
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tg-hint);
}

.waitlist-position {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.16);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.booking-notice {
  margin: 14px 0 0;
  font-size: 14px;
}

.booking-error {
  display: none;
  margin: 10px 0 0;
  font-size: 13px;
  color: #e86a6a;
}

.booking-error.is-visible { display: block; }

/* Кнопка действия записи: единственная (нативная MainButton не используется).
   Живёт в карточке участников, поэтому растянута на всю её ширину. */
.button-block { width: 100%; }

.booking-action {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.booking-action:disabled { opacity: 0.6; }

/* Красная кнопка — только у отмены: «Отписаться», «Выйти из очереди». */
.button-danger {
  background: var(--danger);
  color: var(--danger-text);
}

.button-danger:active { opacity: 0.8; }

.button-danger:disabled { opacity: 0.55; }

@media (prefers-color-scheme: light) {
  .booking-error { color: #c94a4a; }
}

/* ── Админка: клубы, площадки, закрытия ──────────────────────────────────── */
.admin-row {
  text-decoration: none;
  color: inherit;
}

.admin-row:active { opacity: 0.75; }

.admin-row-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

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

.admin-meta {
  font-size: 13px;
  color: var(--tg-hint);
  overflow-wrap: anywhere;
}

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

.admin-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(127, 127, 127, 0.12);
}

.admin-item.is-muted { opacity: 0.6; }

.admin-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.admin-item-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.admin-toggle { margin: 0; }

.status-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  color: var(--tg-hint);
  font-size: 11px;
  font-weight: 600;
}

.status-chip.is-on {
  background: rgba(49, 196, 141, 0.16);
  color: #35c48f;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--tg-button);
  cursor: pointer;
}

.link-button:active { opacity: 0.6; }

.link-danger { color: #e86a6a; }

.notice {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(49, 196, 141, 0.16);
  color: #35c48f;
  font-size: 14px;
  font-weight: 550;
}

/* ── Формы админки: одна колонка под узкий webview ───────────────────────── */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-hint);
}

.admin-form input[type='text'],
.admin-form input[type='number'],
.admin-form input[type='datetime-local'],
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(127, 127, 127, 0.28);
  border-radius: var(--radius-sm);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font: inherit;
  font-size: 15px;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: 2px solid var(--tg-button);
  outline-offset: 1px;
}

.admin-form textarea { resize: vertical; }

.admin-form .field.has-error input,
.admin-form .field.has-error textarea,
.admin-form .field.has-error select { border-color: #e86a6a; }

.field-hint {
  font-size: 12px;
  color: var(--tg-hint);
}

.field-error {
  font-size: 13px;
  color: #e86a6a;
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(232, 106, 106, 0.14);
  color: #e86a6a;
  font-size: 13px;
}

.field-check .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

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

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.admin-form input[type='checkbox'] {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  accent-color: var(--tg-button);
}

.readonly-value {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(127, 127, 127, 0.12);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-form .button { width: 100%; }

/* Пара кнопок в ряд: «Сохранить» и «Отмена» делят ширину поровну. */
.admin-form .form-actions {
  display: flex;
  gap: 10px;
}

.admin-form .form-actions .button {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin-top: 0;
}

@media (prefers-color-scheme: light) {
  .notice { color: #1f9d6d; }
  .link-danger,
  .field-error,
  .form-error { color: #c94a4a; }
}

/* ── Список событий и его фильтры ────────────────────────────────────────── */
.seg {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(127, 127, 127, 0.14);
}

.seg-item {
  padding: 6px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 550;
  color: var(--tg-hint);
  text-decoration: none;
  white-space: nowrap;
}

.seg-item.is-active {
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.filters { margin: 0 0 4px; }

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--tg-hint);
}

.filters-grid select,
.filters-grid input[type='date'] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(127, 127, 127, 0.28);
  border-radius: var(--radius-sm);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font: inherit;
  font-size: 14px;
}

.filters-grid .button {
  width: 100%;
  min-height: 42px;
  margin-top: 0;
  font-size: 14px;
}

.filter-reset { white-space: nowrap; }

.event-day-group + .event-day-group { margin-top: 16px; }

.event-day-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--tg-hint);
}

.event-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.event-time-strong {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.status-chip.is-draft { background: rgba(240, 173, 78, 0.18); color: #e0a44c; }
.status-chip.is-off { background: rgba(232, 90, 90, 0.18); color: #e86a6a; }

.event-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(127, 127, 127, 0.12);
}

@media (prefers-color-scheme: light) {
  .status-chip.is-draft { color: #b8802f; }
  .status-chip.is-off { color: #c94a4a; }
}

/* ── Журнал действий ────────────────────────────────────────────────────── */
/* Одна запись: время и действие в шапке, автор, детали строками. Карточки
   журнала живут и на экране события, и в админке клуба — стиль общий. */
.journal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.journal-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--tg-secondary-bg);
}

.journal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.journal-time {
  font-size: 12px;
  color: var(--tg-hint);
  font-variant-numeric: tabular-nums;
}

.journal-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-button);
  text-align: right;
}

.journal-actor {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.journal-handle {
  margin-left: 6px;
  font-weight: 500;
  color: var(--tg-hint);
}

.journal-details {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--tg-hint);
}

.journal-event {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--tg-button);
  text-decoration: none;
}

/* ── Страницы журнала клуба ─────────────────────────────────────────────── */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.pager-step,
.pager-num {
  min-width: 32px;
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(127, 127, 127, 0.14);
  color: var(--tg-text);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}

.pager-num.is-current {
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-weight: 600;
}
