:root {
  --bg: #ffffff;
  --surface: #f4f7fb;
  --surface-card: #ffffff;
  --primary: #004b93;
  --primary-dark: #003366;
  --primary-light: #e8f0f8;
  --accent: #0066cc;
  --text: #1a202c;
  --text-muted: #4a5568;
  --border: #d1d9e6;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 51, 102, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

body.admin-body {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.offline-banner {
  background: var(--warning);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
}

/* Шапка */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 2px solid var(--primary);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  color: var(--primary-dark);
  line-height: 1.2;
}

.brand-text small {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.burger-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.burger-btn span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--primary);
}

.main-nav {
  display: none;
  position: fixed;
  top: calc(66px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 2px solid var(--primary);
  padding: 12px 16px 20px;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}

.main-nav.open {
  display: flex;
}

.main-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
  border-radius: 6px;
}

.main-nav a:hover, .main-nav a:focus-visible {
  background: var(--primary-light);
  color: var(--primary);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-sm {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

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

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

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

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

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--primary-light) 0%, #ffffff 100%);
  padding: 28px 0 36px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.2;
  color: var(--primary-dark);
}

.hero-lead {
  margin: 0 0 16px;
  color: var(--text-muted);
}

.hero-quote {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #fff;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow);
  font-style: italic;
}

.hero-quote footer {
  margin-top: 8px;
  font-style: normal;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-placeholder img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Секции и карточки */
.section {
  padding: 36px 0;
}

.section-alt {
  background: var(--surface);
}

.section-title {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--primary-dark);
}

.section-subtitle {
  margin: 0 0 18px;
  color: var(--text-muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card, .wizard-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
  color: var(--primary-dark);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}

.badge-blue {
  background: var(--primary-light);
  color: var(--primary-dark);
}

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

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

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

.meta-list {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.meta-list li + li {
  margin-top: 4px;
}

/* Фильтры */
.filter-bar, .tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.event-card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Пошаговая форма */
.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 8px;
  background: var(--surface);
}

.step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  flex-shrink: 0;
}

.step.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.step.active span {
  background: var(--primary);
  color: #fff;
}

.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

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

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin-top: 2px;
}

.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.event-preview, .summary-box, .result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.turnstile-box {
  margin: 12px 0;
  min-height: 65px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin: 12px 0;
  font-weight: 600;
}

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

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

/* Репертуар */
.repertoire-grid {
  margin: 0;
  padding-left: 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.repertoire-grid li {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

/* Подвал */
.site-footer {
  background: var(--primary-dark);
  color: #e2e8f0;
  padding: 32px 0;
  font-size: 14px;
}

.site-footer a {
  color: #90cdf4;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* Липкая кнопка на мобильном */
.mobile-sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}

/* Админка */
.admin-main {
  padding-top: 24px;
}

.login-card {
  max-width: 420px;
  margin: 32px auto;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-cards-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.admin-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cancel-code-pill {
  font-family: monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Планшет и десктоп */
@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }

  .mobile-sticky-cta {
    display: none;
  }

  .burger-btn {
    display: none;
  }

  .main-nav {
    display: flex;
    position: static;
    flex-direction: row;
    border: 0;
    box-shadow: none;
    padding: 0;
    gap: 4px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }

  .cards-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .cards-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .fields-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-full {
    grid-column: 1 / -1;
  }

  .repertoire-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
