:root {
  --bg: #000000;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --event: rgba(255, 255, 255, 0.1);
  --event-strong: rgba(255, 255, 255, 0.28);
  --front: rgba(86, 151, 255, 0.42);
  --sport: rgba(55, 190, 126, 0.42);
  --social: rgba(208, 173, 90, 0.42);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.modal-open { overflow: hidden; }

button,
input,
select,
textarea { font: inherit; }

button {
  cursor: pointer;
  border: none;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.05), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 25%),
    var(--bg);
}

.site-header {
  max-width: 1440px;
  margin: 0 auto;
  padding: 44px 24px 10px;
}

.logo-slot {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: visible;
}

.logo-slot img {
  max-height: 165px;
  width: auto;
  object-fit: contain;
}

.calendar-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.calendar-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow);
}

.calendar-topbar {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 16px;
}

.month-title-wrap { text-align: center; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.month-title-wrap h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1;
}

.helper-text {
  margin: 14px auto 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.month-arrow {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 0;
  line-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  justify-self: center;
}

#prevMonthBtn::before,
#nextMonthBtn::before {
  display: block;
  font-size: 40px;
  line-height: 1;
  font-weight: 400;
  transform: translateY(-2px);
}

#prevMonthBtn::before { content: '‹'; }
#nextMonthBtn::before { content: '›'; }

.month-arrow:hover:not(:disabled) {
  transform: scale(1.04);
  background: rgba(255,255,255,0.16);
}

.month-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.category-filters {
  margin: 24px auto 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-pill,
.month-pill {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.category-pill:hover,
.month-pill:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.09);
  color: var(--text);
}

.category-pill.active,
.month-pill.active {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.28);
  color: #ffffff;
}

.months-switcher {
  margin: 18px auto 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.month-pill {
  padding: 9px 12px;
  font-size: 13px;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.weekdays {
  margin-top: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.weekday-cell { padding: 12px 8px; }

.calendar-grid { margin-top: 10px; }

.day-cell {
  position: relative;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(255,255,255,0.025);
  color: #ffffff;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.day-cell.clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.06);
}

.day-cell.other-month { opacity: 0.32; }

.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.day-cell.has-event {
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 18px 42px rgba(0,0,0,0.35);
}

.day-cell.has-event.category-front {
  background: linear-gradient(180deg, rgba(86,151,255,0.35), rgba(255,255,255,0.08));
  border-color: rgba(122,174,255,0.55);
}

.day-cell.has-event.category-sport {
  background: linear-gradient(180deg, rgba(55,190,126,0.34), rgba(255,255,255,0.08));
  border-color: rgba(94,220,153,0.52);
}

.day-cell.has-event.category-social {
  background: linear-gradient(180deg, rgba(208,173,90,0.34), rgba(255,255,255,0.08));
  border-color: rgba(236,203,123,0.52);
}

.day-cell.has-event.past-event {
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.055));
  border-color: rgba(255,255,255,0.22);
}

.day-cell.has-hidden-event {
  border-style: dashed;
  border-color: rgba(255,255,255,0.2);
}

.event-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.34);
  border: 1px solid rgba(255,255,255,0.15);
  min-height: 86px;
  max-height: calc(100% - 46px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}

.event-card strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.25;
  color: #ffffff;
}

.event-card span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #ffffff;
}

.event-card .event-category {
  opacity: 0.78;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.event-card.past { background: rgba(0,0,0,0.25); }

.empty-hint {
  position: absolute;
  inset: auto 12px 12px 12px;
  color: rgba(255,255,255,0.32);
  font-size: 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  z-index: 50;
}

.hidden { display: none; }

.modal {
  position: relative;
  width: min(760px, 100%);
  background: #0b0b0c;
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-modal,
.admin-modal {
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 26px;
  z-index: 2;
}

.modal-image-wrap {
  aspect-ratio: 16 / 8;
  background: #111;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-content { padding: 24px; }

.modal-date,
.modal-category {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.modal-category {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}

.modal-content h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
}

.modal-description {
  margin: 16px 0 0;
  color: #d4d4d8;
  line-height: 1.65;
  white-space: pre-wrap;
}

.modal-actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.primary-action {
  background: #ffffff;
  color: #000000;
  font-weight: 700;
}

.primary-action:hover,
.secondary-action:hover { transform: translateY(-1px); }

.secondary-action {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.event-form {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.event-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.event-form input,
.event-form select,
.event-form textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

.event-form select option {
  background: #111;
  color: #fff;
}

.event-form textarea { resize: vertical; }

.event-form input:focus,
.event-form select:focus,
.event-form textarea:focus { border-color: rgba(255,255,255,0.28); }

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

@media (max-width: 1000px) {
  .calendar-card { padding: 20px; }
  .day-cell { min-height: 120px; }
  .event-card { min-height: 76px; max-height: calc(100% - 42px); }
  .event-card strong { font-size: 14px; -webkit-line-clamp: 2; }
}

@media (max-width: 720px) {
  .site-header,
  .calendar-page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .site-header { padding-top: 24px; }

  .logo-slot { min-height: 140px; }
  .logo-slot img { max-height: 128px; }

  .calendar-card {
    padding: 16px;
    border-radius: 22px;
  }

  .calendar-topbar {
    grid-template-columns: 44px 1fr 44px;
    gap: 10px;
  }

  .month-arrow {
    width: 44px;
    height: 44px;
  }

  #prevMonthBtn::before,
  #nextMonthBtn::before {
    font-size: 30px;
    transform: translateY(-1px);
  }

  .month-title-wrap h1 { font-size: clamp(24px, 8vw, 32px); }
  .helper-text { display: none; }

  .category-filters {
    margin-top: 18px;
    gap: 8px;
  }

  .category-pill {
    flex: 1 1 calc(50% - 8px);
    padding: 9px 10px;
    font-size: 12px;
    text-align: center;
  }

  .months-switcher {
    margin-top: 16px;
    gap: 7px;
  }

  .month-pill {
    flex: 1 1 calc(25% - 7px);
    padding: 8px 8px;
    font-size: 12px;
    text-align: center;
  }

  .weekdays,
  .calendar-grid { gap: 8px; }

  .weekday-cell {
    padding: 8px 4px;
    font-size: 12px;
  }

  .day-cell {
    min-height: 96px;
    padding: 8px;
  }

  .event-card {
    padding: 8px;
    min-height: 54px;
    max-height: calc(100% - 40px);
    gap: 4px;
  }

  .event-card .event-category,
  .event-card span:not(.event-category) {
    display: none;
  }

  .event-card strong {
    -webkit-line-clamp: 2;
    font-size: 13px;
    line-height: 1.15;
  }

  .overlay { padding: 12px; }
  .modal { border-radius: 22px; }
  .modal-content { padding: 18px; }

  .modal-actions,
  .form-actions { flex-direction: column; }

  .primary-action,
  .secondary-action { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .event-card strong {
    display: block;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .weekdays,
  .calendar-grid { gap: 6px; }
  .weekdays { margin-top: 20px; }

  .weekday-cell {
    padding: 4px 0;
    font-size: 11px;
  }

  .day-cell {
    aspect-ratio: 1 / 1;
    min-height: 0;
    padding: 0;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
  }

  .day-cell.has-event {
    background: rgba(255,255,255,0.26);
    border-color: rgba(255,255,255,0.48);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.14);
  }

  .day-cell.has-event.category-front { background: rgba(86,151,255,0.46); }
  .day-cell.has-event.category-sport { background: rgba(55,190,126,0.46); }
  .day-cell.has-event.category-social { background: rgba(208,173,90,0.48); }
  .day-cell.has-event.past-event { background: rgba(255,255,255,0.18); }

  .day-cell.other-month { opacity: 0.24; }

  .day-cell .event-card,
  .day-cell .empty-hint { display: none; }

  .day-number {
    width: auto;
    height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
  }
}

@media (max-width: 390px) {
  .site-header,
  .calendar-page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .site-header { padding-top: 18px; }
  .logo-slot { min-height: 120px; }
  .logo-slot img { max-height: 110px; }

  .calendar-card { padding: 12px; }

  .calendar-topbar {
    grid-template-columns: 38px 1fr 38px;
    gap: 8px;
  }

  .month-arrow {
    width: 38px;
    height: 38px;
  }

  #prevMonthBtn::before,
  #nextMonthBtn::before {
    font-size: 24px;
    transform: translateY(-1px);
  }

  .month-title-wrap h1 { font-size: 22px; }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 6px;
  }

  .category-pill,
  .month-pill {
    font-size: 11px;
    padding: 7px 7px;
  }

  .weekdays,
  .calendar-grid { gap: 5px; }
  .weekday-cell { font-size: 10px; }
  .day-number { font-size: 14px; }
}

.admin-header {
  display: grid;
  gap: 18px;
}

.admin-status-panel {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.035);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.login-card {
  max-width: 560px;
  margin: 0 auto 40px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
}

.small-action {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
}

.danger-action {
  background: rgba(255, 80, 80, 0.16);
  color: #fff;
}

.form-error {
  margin: 0;
  color: #ffb4b4;
  line-height: 1.45;
}

body[data-mode="guest"] .empty-hint {
  display: none;
}

@media (max-width: 560px) {
  .admin-status-panel {
    border-radius: 18px;
    font-size: 13px;
  }

  .login-card {
    padding: 18px;
    border-radius: 22px;
  }
}

/* === Enhanced version additions === */
@keyframes softFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.calendar-card,
.upcoming-card,
.admin-panel-card,
.admin-table-card,
.login-card {
  animation: softFadeUp 0.35s ease both;
}

.modal { animation: modalPop 0.22s ease both; }

.section-heading h2,
.admin-panel-head h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.1;
}

.helper-text.compact {
  margin-left: 0;
  margin-right: 0;
  max-width: 680px;
}

.upcoming-card {
  margin-bottom: 22px;
  padding: 26px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  box-shadow: var(--shadow);
}

.upcoming-list {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.upcoming-item,
.upcoming-empty {
  min-height: 140px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: #fff;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 9px;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.upcoming-item:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.34);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 18px 38px rgba(0,0,0,0.28);
}

.upcoming-item.category-front { background: linear-gradient(180deg, rgba(86,151,255,0.24), rgba(255,255,255,0.05)); }
.upcoming-item.category-sport { background: linear-gradient(180deg, rgba(55,190,126,0.23), rgba(255,255,255,0.05)); }
.upcoming-item.category-social { background: linear-gradient(180deg, rgba(208,173,90,0.23), rgba(255,255,255,0.05)); }

.upcoming-date,
.upcoming-item span,
.upcoming-empty span {
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.35;
}

.upcoming-item strong,
.upcoming-empty strong {
  color: #fff;
  font-size: 18px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.upcoming-empty {
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  border-style: dashed;
}

.toolbar-row {
  margin: 22px auto 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  width: min(520px, 100%);
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-box input,
.admin-filters input,
.admin-filters select,
.file-import-label input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #fff;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.search-box input:focus,
.admin-filters input:focus,
.admin-filters select:focus,
.file-import-label input:focus {
  border-color: rgba(255,255,255,0.34);
  background: rgba(255,255,255,0.065);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.045);
}

.admin-workspace {
  display: grid;
  gap: 22px;
}

.admin-panel-card,
.admin-table-card {
  padding: 26px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow: var(--shadow);
}

.admin-panel-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}

.admin-actions-row,
.admin-import-row,
.admin-view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-import-row,
.admin-view-switcher,
.admin-filters {
  margin-top: 18px;
}

.file-import-label {
  flex: 1 1 280px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-note.warning {
  color: #ffcc88;
}

.view-pill {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.view-pill:hover { transform: translateY(-1px); color: #fff; background: rgba(255,255,255,0.08); }
.view-pill.active { color: #000; background: #fff; }

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.admin-filters label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.events-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.events-table th,
.events-table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  color: #fff;
  text-align: left;
  vertical-align: middle;
}

.events-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.events-table td strong {
  display: block;
  max-width: 360px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.events-table td span:not(.table-category) {
  display: block;
  max-width: 440px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.table-category {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  white-space: nowrap;
}

.table-category.category-front { background: rgba(86,151,255,0.25); }
.table-category.category-sport { background: rgba(55,190,126,0.25); }
.table-category.category-social { background: rgba(208,173,90,0.25); }

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

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.wide-admin-modal {
  width: min(1120px, 100%);
}

.admin-form-layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.86fr);
  gap: 20px;
  align-items: start;
}

.preview-panel {
  position: sticky;
  top: 12px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  background: rgba(255,255,255,0.035);
}

.preview-card {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  background: rgba(0,0,0,0.28);
}

.preview-image-wrap {
  aspect-ratio: 16 / 9;
  background: #111;
}

.preview-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-content { padding: 16px; }
.preview-content h3 { margin: 8px 0 0; color: #fff; font-size: 22px; line-height: 1.16; }
.preview-button { margin-top: 14px; width: 100%; pointer-events: none; }

.danger-action {
  color: #ffb4b4;
}

.day-cell,
.event-card,
.primary-action,
.secondary-action,
.category-pill,
.month-pill,
.view-pill,
.upcoming-item {
  will-change: transform;
}

.event-form input:invalid {
  border-color: rgba(255, 120, 120, 0.55);
}

@media (max-width: 1080px) {
  .upcoming-list { grid-template-columns: 1fr; }
  .admin-panel-head { grid-template-columns: 1fr; }
  .admin-actions-row .primary-action,
  .admin-actions-row .secondary-action { flex: 1 1 180px; }
  .admin-filters { grid-template-columns: 1fr 1fr; }
  .admin-form-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}

@media (max-width: 720px) {
  .upcoming-card,
  .admin-panel-card,
  .admin-table-card {
    padding: 16px;
    border-radius: 22px;
  }

  .upcoming-list { gap: 10px; }
  .upcoming-item,
  .upcoming-empty { min-height: 112px; padding: 15px; border-radius: 18px; }
  .upcoming-item strong { font-size: 16px; }
  .guest-toolbar { margin-top: 16px; }

  .admin-actions-row,
  .admin-import-row,
  .admin-view-switcher,
  .admin-filters { gap: 8px; }

  .admin-filters { grid-template-columns: 1fr; }
  .admin-actions-row .primary-action,
  .admin-actions-row .secondary-action,
  .admin-import-row .secondary-action { width: 100%; }
  .file-import-label { flex-basis: 100%; }
  .wide-admin-modal { max-height: 94vh; }
  .table-wrap { margin: 0 -6px; }
}

@media (max-width: 560px) {
  .upcoming-card { margin-bottom: 16px; }
  .section-heading h2,
  .admin-panel-head h1 { font-size: 24px; }
  .upcoming-date,
  .upcoming-item span,
  .upcoming-empty span { font-size: 12px; }
  .events-table { min-width: 720px; }
}

/* === V3 fixes: admin alignment, table symmetry, calendar/filter animations, import help === */
.month-arrow {
  display: grid !important;
  place-items: center !important;
  text-align: center;
}
#prevMonthBtn::before,
#nextMonthBtn::before {
  display: grid !important;
  place-items: center !important;
  width: 1em;
  height: 1em;
  line-height: 1 !important;
  transform: translateY(-0.04em) !important;
}

.calendar-grid {
  transform-origin: center;
  transition: opacity 0.24s ease, transform 0.24s ease, filter 0.24s ease;
}
.calendar-exit-left { opacity: 0; transform: translateX(-18px); filter: blur(3px); }
.calendar-exit-right { opacity: 0; transform: translateX(18px); filter: blur(3px); }
.calendar-enter-left { animation: calendarEnterLeft 0.28s ease both; }
.calendar-enter-right { animation: calendarEnterRight 0.28s ease both; }
.calendar-filter-out { opacity: 0.35; transform: scale(0.992); filter: blur(2px); }
.calendar-enter-filter { animation: calendarFilterIn 0.28s ease both; }

@keyframes calendarEnterLeft {
  from { opacity: 0; transform: translateX(-18px); filter: blur(3px); }
  to { opacity: 1; transform: translateX(0); filter: blur(0); }
}
@keyframes calendarEnterRight {
  from { opacity: 0; transform: translateX(18px); filter: blur(3px); }
  to { opacity: 1; transform: translateX(0); filter: blur(0); }
}
@keyframes calendarFilterIn {
  from { opacity: 0.45; transform: scale(0.992); filter: blur(2px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}
.event-visible-cell { animation: eventCellAppear 0.32s ease both; }
.event-hidden-by-filter { animation: eventCellDim 0.26s ease both; }
@keyframes eventCellAppear {
  from { opacity: 0.45; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes eventCellDim {
  from { opacity: 0.8; }
  to { opacity: 0.55; }
}

.admin-panel-head {
  grid-template-columns: minmax(0, 1fr) minmax(320px, auto);
  align-items: center;
}
.admin-actions-row {
  justify-content: flex-end;
  align-items: stretch;
}
.admin-actions-row .primary-action,
.admin-actions-row .secondary-action,
.admin-import-row .secondary-action,
.table-actions .secondary-action {
  white-space: nowrap;
  line-height: 1;
  text-align: center;
}
.admin-actions-row .primary-action,
.admin-actions-row .secondary-action {
  min-width: 172px;
}
.admin-import-row {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 14px;
}
.admin-import-row .form-note,
.admin-import-row .import-help {
  grid-column: 1 / -1;
}
.file-import-label.compact-import-label { flex: 1 1 260px; }

.events-table {
  table-layout: fixed;
  min-width: 980px;
}
.events-table th:nth-child(1), .events-table td:nth-child(1) { width: 155px; }
.events-table th:nth-child(2), .events-table td:nth-child(2) { width: auto; }
.events-table th:nth-child(3), .events-table td:nth-child(3) { width: 185px; }
.events-table th:nth-child(4), .events-table td:nth-child(4) { width: 145px; }
.events-table th:nth-child(5), .events-table td:nth-child(5) { width: 270px; }
.events-table th,
.events-table td {
  vertical-align: middle;
}
.events-table td strong,
.events-table td span:not(.table-category) {
  max-width: 100%;
}
.table-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.table-actions .small-action {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
}

.preview-card,
.upcoming-item,
.modal,
.admin-panel-card,
.admin-table-card,
.day-cell,
.event-card {
  transition: transform 0.24s ease, opacity 0.24s ease, border-color 0.24s ease, background 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}
.modal-close:hover,
.primary-action:hover,
.secondary-action:hover,
.view-pill:hover,
.category-pill:hover,
.month-pill:hover {
  filter: brightness(1.08);
}

@media (max-width: 1180px) {
  .admin-panel-head { grid-template-columns: 1fr; }
  .admin-actions-row { justify-content: flex-start; }
  .admin-import-row { grid-template-columns: 1fr 1fr; }
  .admin-import-row .secondary-action { min-height: 48px; }
}

@media (max-width: 760px) {
  .admin-import-row { grid-template-columns: 1fr; }
  .admin-actions-row .primary-action,
  .admin-actions-row .secondary-action,
  .admin-import-row .secondary-action { width: 100%; min-width: 0; }
  .events-table { min-width: 860px; }
  .events-table th:nth-child(5), .events-table td:nth-child(5) { width: 235px; }
  .table-actions .small-action { font-size: 13px; padding: 0 10px; }
}

/* === V4 fixes: centered arrows, private admin login, table dates, dark selects === */
.month-arrow {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  font-size: 0 !important;
  text-indent: 0 !important;
}
#prevMonthBtn::before,
#nextMonthBtn::before {
  display: block !important;
  width: auto !important;
  height: auto !important;
  line-height: 1 !important;
  margin: 0 !important;
  transform: translateY(-0.02em) !important;
  color: currentColor;
  font-size: 34px;
  font-weight: 400;
}
#prevMonthBtn::before { content: '‹'; }
#nextMonthBtn::before { content: '›'; }

body[data-mode="admin"]:not(.admin-unlocked) .site-header.admin-header {
  display: none !important;
}
body[data-mode="admin"]:not(.admin-unlocked) .page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
body[data-mode="admin"]:not(.admin-unlocked) .calendar-page {
  width: min(560px, 100%);
  padding: 24px;
  margin: 0;
}
body[data-mode="admin"]:not(.admin-unlocked) .login-card {
  margin: 0 auto;
  width: 100%;
}
body[data-mode="admin"]:not(.admin-unlocked) .admin-workspace,
body[data-mode="admin"]:not(.admin-unlocked) .overlay:not(.hidden) {
  display: none !important;
}

select,
.event-form select,
.admin-filters select {
  color-scheme: dark;
  background: rgba(18, 18, 20, 0.98) !important;
  color: #ffffff !important;
}
select option,
.event-form select option,
.admin-filters select option {
  background: #121214 !important;
  color: #ffffff !important;
}
select option:checked,
select option:hover {
  background: #2a2a2e !important;
  color: #ffffff !important;
}

.table-date {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  white-space: nowrap;
  line-height: 1.18;
}
.table-date-daymonth,
.table-date-year {
  display: block;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.table-date-year {
  color: var(--muted);
  font-size: 13px;
}
.events-table th:nth-child(1),
.events-table td:nth-child(1) {
  width: 132px !important;
  min-width: 132px;
}
.events-table th:nth-child(5),
.events-table td:nth-child(5) {
  width: 280px !important;
}

@media (max-width: 760px) {
  #prevMonthBtn::before,
  #nextMonthBtn::before { font-size: 28px; }
  .events-table th:nth-child(1),
  .events-table td:nth-child(1) { width: 118px !important; min-width: 118px; }
  .table-date-year { font-size: 12px; }
}

/* === V5 fixes: mobile swipe support, stronger centered arrows, upcoming image backgrounds === */
.month-arrow {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden;
}
#prevMonthBtn,
#nextMonthBtn {
  color: #ffffff;
}
#prevMonthBtn::before,
#nextMonthBtn::before {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: auto !important;
  height: auto !important;
  display: block !important;
  line-height: 1 !important;
  transform: translate(-50%, -54%) !important;
  margin: 0 !important;
  text-align: center !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 36px !important;
}

.calendar-grid {
  touch-action: pan-y;
}

.upcoming-item {
  position: relative;
  isolation: isolate;
  background: rgba(255,255,255,0.06) !important;
}
.upcoming-item::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--upcoming-bg);
  background-size: cover;
  background-position: center;
  filter: blur(10px) saturate(0.95);
  transform: scale(1.08);
  opacity: 0.62;
}
.upcoming-item::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,0.40), rgba(0,0,0,0.78));
}
.upcoming-item.category-front::after {
  background: linear-gradient(180deg, rgba(86,151,255,0.33), rgba(0,0,0,0.80));
}
.upcoming-item.category-sport::after {
  background: linear-gradient(180deg, rgba(55,190,126,0.32), rgba(0,0,0,0.80));
}
.upcoming-item.category-social::after {
  background: linear-gradient(180deg, rgba(208,173,90,0.34), rgba(0,0,0,0.80));
}
.upcoming-item:hover::before {
  opacity: 0.76;
  transform: scale(1.12);
}
.upcoming-item > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 760px) {
  #prevMonthBtn::before,
  #nextMonthBtn::before {
    font-size: 30px !important;
    transform: translate(-50%, -55%) !important;
  }
}

/* Navigation and About page additions */
.header-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 14px auto 4px;
  flex-wrap: wrap;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 34px rgba(0,0,0,0.26);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.nav-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.28);
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.07));
}

.about-page { padding-top: 24px; }

.about-card {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.10), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025));
  box-shadow: var(--shadow);
}

.about-card h1 {
  margin: 0 0 26px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.about-text {
  color: rgba(244,244,245,0.88);
  font-size: 16px;
  line-height: 1.72;
}

.about-text p { margin: 0 0 18px; }
.about-text ul {
  margin: 0 0 20px;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.about-text li {
  position: relative;
  padding-left: 26px;
  color: rgba(244,244,245,0.86);
}
.about-text li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text);
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.contact-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.045);
}

.contact-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.contact-card a {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.contact-card a:hover { text-decoration: underline; }

.status-control-group {
  display: grid;
  gap: 10px;
}

.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px !important;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.045);
  color: rgba(244,244,245,0.86);
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  margin-top: 0;
  accent-color: #ffffff;
}

.checkbox-label.hidden { display: none !important; }

@media (max-width: 760px) {
  .contacts-grid { grid-template-columns: 1fr; }
  .about-card { border-radius: 22px; }
  .header-nav { margin-top: 10px; }
}


/* === V1.2 admin adaptive layout and editor polish === */
.admin-status-row {
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.status-control-group {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
}

.status-select-field {
  min-width: 0;
}

.auto-status-field {
  min-height: 58px;
  padding: 10px 12px !important;
  align-items: center !important;
  gap: 9px !important;
}

.auto-status-field span {
  display: block;
  max-width: 220px;
  margin: 0 !important;
  color: rgba(244,244,245,0.78) !important;
  font-size: 12px !important;
  line-height: 1.22 !important;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
}

.auto-status-field input {
  flex: 0 0 18px;
  margin: 0 !important;
}

.button-label-field {
  min-height: 100%;
  display: grid !important;
  grid-template-rows: auto 1fr;
}

.button-label-field input {
  height: 100%;
  min-height: 116px;
}

.events-table td > .table-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.events-table td.table-actions {
  display: table-cell !important;
}

.admin-panel-card,
.admin-table-card,
.calendar-card.admin-calendar-view {
  max-width: 100%;
}

@media (max-width: 1080px) {
  .admin-form-layout {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  body[data-mode="admin"] .site-header,
  body[data-mode="admin"] .calendar-page {
    padding-left: 14px;
    padding-right: 14px;
  }
  .admin-panel-card,
  .admin-table-card,
  .calendar-card.admin-calendar-view {
    padding: 18px;
    border-radius: 22px;
  }
  .admin-filters {
    grid-template-columns: 1fr 1fr;
  }
  .wide-admin-modal {
    width: min(720px, 100%);
  }
}

@media (max-width: 720px) {
  .admin-panel-head,
  .admin-import-row,
  .admin-filters,
  .admin-status-row {
    grid-template-columns: 1fr !important;
  }
  .admin-panel-head {
    gap: 14px;
  }
  .admin-actions-row,
  .admin-view-switcher {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .admin-actions-row .primary-action,
  .admin-actions-row .secondary-action,
  .admin-view-switcher .view-pill {
    width: 100%;
    min-width: 0;
  }
  .admin-import-row .file-import-label,
  .file-import-label.compact-import-label {
    width: 100%;
    flex-basis: auto;
  }
  .button-label-field {
    min-height: auto;
  }
  .button-label-field input {
    min-height: 52px;
    height: 52px;
  }
  .auto-status-field {
    min-height: 54px;
  }
  .auto-status-field span {
    max-width: none;
  }
  .events-table {
    min-width: 820px;
  }
}

@media (max-width: 520px) {
  body[data-mode="admin"] .calendar-page {
    padding-left: 10px;
    padding-right: 10px;
  }
  .admin-panel-card,
  .admin-table-card,
  .calendar-card.admin-calendar-view,
  .preview-panel {
    padding: 14px;
    border-radius: 18px;
  }
  .admin-panel-head h1 {
    font-size: clamp(28px, 9vw, 38px);
  }
  .wide-admin-modal .modal-content {
    padding: 14px;
  }
  .events-table th,
  .events-table td {
    padding: 12px 10px;
  }
  .events-table th:nth-child(5),
  .events-table td:nth-child(5) {
    width: 235px !important;
  }
  .events-table td > .table-actions {
    gap: 8px;
  }
  .table-actions .small-action {
    min-height: 38px;
    font-size: 12px;
    padding: 0 9px;
  }
}

/* === V1.3 admin mobile fit and status/button height fixes === */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body[data-mode="admin"],
body[data-mode="admin"] .page-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--bg);
}

body[data-mode="admin"] .site-header,
body[data-mode="admin"] .calendar-page,
body[data-mode="admin"] .admin-workspace,
body[data-mode="admin"] .admin-panel-card,
body[data-mode="admin"] .admin-table-card,
body[data-mode="admin"] .calendar-card,
body[data-mode="admin"] .admin-panel-head,
body[data-mode="admin"] .admin-actions-row,
body[data-mode="admin"] .admin-import-row,
body[data-mode="admin"] .admin-filters,
body[data-mode="admin"] .table-wrap,
body[data-mode="admin"] .event-form,
body[data-mode="admin"] .form-row,
body[data-mode="admin"] label,
body[data-mode="admin"] input,
body[data-mode="admin"] select,
body[data-mode="admin"] textarea,
body[data-mode="admin"] button,
body[data-mode="admin"] a.secondary-action,
body[data-mode="admin"] a.primary-action {
  min-width: 0;
  max-width: 100%;
}

body[data-mode="admin"] .calendar-page {
  width: 100%;
  padding-left: clamp(10px, 3.2vw, 24px);
  padding-right: clamp(10px, 3.2vw, 24px);
}

body[data-mode="admin"] .admin-panel-card,
body[data-mode="admin"] .admin-table-card,
body[data-mode="admin"] .calendar-card.admin-calendar-view {
  width: 100%;
  overflow: hidden;
}

body[data-mode="admin"] .helper-text,
body[data-mode="admin"] .form-note,
body[data-mode="admin"] .admin-panel-head h1,
body[data-mode="admin"] .file-import-label span {
  overflow-wrap: anywhere;
}

/* Текст кнопки: высокая правая колонка только когда видна галочка авто-статуса */
.admin-status-row:not(.has-auto-status) .button-label-field input {
  min-height: 52px;
  height: 52px;
}
.admin-status-row.has-auto-status .button-label-field input {
  min-height: 116px;
  height: 100%;
}

@media (max-width: 720px) {
  body[data-mode="admin"] .site-header {
    padding-left: 10px;
    padding-right: 10px;
  }

  body[data-mode="admin"] .logo-slot {
    min-height: 126px;
  }

  body[data-mode="admin"] .logo-slot img {
    max-height: 116px;
  }

  body[data-mode="admin"] .admin-status-panel {
    width: 100%;
    border-radius: 18px;
  }

  body[data-mode="admin"] .admin-panel-card,
  body[data-mode="admin"] .admin-table-card,
  body[data-mode="admin"] .calendar-card.admin-calendar-view {
    padding: 14px;
    border-radius: 18px;
  }

  body[data-mode="admin"] .admin-panel-head h1 {
    font-size: clamp(26px, 8vw, 34px);
    line-height: 1.08;
  }

  body[data-mode="admin"] .admin-actions-row,
  body[data-mode="admin"] .admin-view-switcher {
    grid-template-columns: 1fr;
  }

  body[data-mode="admin"] .primary-action,
  body[data-mode="admin"] .secondary-action,
  body[data-mode="admin"] .view-pill {
    width: 100%;
  }

  body[data-mode="admin"] .file-import-label input[type="file"] {
    width: 100%;
    max-width: 100%;
    font-size: 12px;
  }

  /* На телефоне таблица превращается в компактные карточки без горизонтального скролла */
  body[data-mode="admin"] .table-wrap {
    overflow-x: visible;
    margin: 0;
  }

  body[data-mode="admin"] .events-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
  }

  body[data-mode="admin"] .events-table thead {
    display: none;
  }

  body[data-mode="admin"] .events-table tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  body[data-mode="admin"] .events-table tr {
    display: grid;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 18px;
    background: rgba(255,255,255,0.035);
  }

  body[data-mode="admin"] .events-table th,
  body[data-mode="admin"] .events-table td,
  body[data-mode="admin"] .events-table th:nth-child(1),
  body[data-mode="admin"] .events-table td:nth-child(1),
  body[data-mode="admin"] .events-table th:nth-child(5),
  body[data-mode="admin"] .events-table td:nth-child(5) {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0;
    border: 0;
    vertical-align: initial;
  }

  body[data-mode="admin"] .events-table td::before {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body[data-mode="admin"] .events-table td:nth-child(1)::before { content: 'Дата'; }
  body[data-mode="admin"] .events-table td:nth-child(2)::before { content: 'Название'; }
  body[data-mode="admin"] .events-table td:nth-child(3)::before { content: 'Категория'; }
  body[data-mode="admin"] .events-table td:nth-child(4)::before { content: 'Статус'; }
  body[data-mode="admin"] .events-table td:nth-child(5)::before { content: 'Действия'; }

  body[data-mode="admin"] .events-table td strong,
  body[data-mode="admin"] .events-table td span:not(.table-category),
  body[data-mode="admin"] .table-date {
    max-width: 100%;
    min-width: 0;
  }

  body[data-mode="admin"] .events-table td strong,
  body[data-mode="admin"] .events-table td span:not(.table-category) {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-mode="admin"] .events-table td > .table-actions {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  body[data-mode="admin"] .table-actions .small-action {
    min-height: 38px;
  }
}

@media (max-width: 420px) {
  body[data-mode="admin"] .calendar-page {
    padding-left: 8px;
    padding-right: 8px;
  }

  body[data-mode="admin"] .admin-panel-card,
  body[data-mode="admin"] .admin-table-card,
  body[data-mode="admin"] .calendar-card.admin-calendar-view {
    padding: 12px;
  }

  body[data-mode="admin"] .events-table tr {
    padding: 12px;
  }

  body[data-mode="admin"] .events-table td,
  body[data-mode="admin"] .events-table th,
  body[data-mode="admin"] .events-table th:nth-child(1),
  body[data-mode="admin"] .events-table td:nth-child(1),
  body[data-mode="admin"] .events-table th:nth-child(5),
  body[data-mode="admin"] .events-table td:nth-child(5) {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

/* === V1.4 mobile admin event description row fix === */
@media (max-width: 720px) {
  body[data-mode="admin"] .events-table td:nth-child(2) {
    align-items: start;
  }

  body[data-mode="admin"] .events-table td:nth-child(2)::before {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding-top: 3px;
  }

  body[data-mode="admin"] .events-table td:nth-child(2)::after {
    content: 'Описание';
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    padding-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body[data-mode="admin"] .events-table td:nth-child(2) > strong {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  body[data-mode="admin"] .events-table td:nth-child(2) > span:not(.table-category) {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin-top: 0;
  }
}

/* === V1.5 dynamic years and admin sorting === */
.year-select-wrap {
  margin: 14px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  color: var(--muted);
  font-size: 13px;
}

.year-select-wrap span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

.year-select-wrap select {
  min-width: 92px;
  min-height: 36px;
  padding: 0 34px 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.24);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  outline: none;
}

.year-select-wrap select:focus {
  border-color: rgba(255,255,255,0.34);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}

.year-select-wrap select option,
#adminSortFilter option {
  background: #111;
  color: #fff;
}

.admin-filters {
  grid-template-columns: minmax(220px, 1.25fr) repeat(4, minmax(145px, 1fr));
}

@media (max-width: 1180px) {
  .admin-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .year-select-wrap {
    width: 100%;
    max-width: 220px;
    justify-content: space-between;
    margin-top: 12px;
  }

  .year-select-wrap select {
    flex: 0 0 96px;
  }

  .month-title-wrap h1 {
    line-height: 1.05;
  }
}

@media (max-width: 720px) {
  .admin-filters {
    grid-template-columns: 1fr;
  }
}

/* === V1.6 mobile year dropdown fix === */
.year-select-wrap select {
  width: 122px;
  min-width: 122px;
  max-width: 122px;
  padding-left: 16px;
  padding-right: 28px;
  box-sizing: border-box;
  text-align: center;
  text-align-last: center;
}

@media (max-width: 640px) {
  .year-select-wrap {
    max-width: 260px;
    padding: 8px 12px 8px 16px;
    gap: 12px;
  }

  .year-select-wrap select {
    flex: 0 0 126px;
    width: 126px;
    min-width: 126px;
    max-width: 126px;
    padding-left: 14px;
    padding-right: 30px;
    font-size: 17px;
  }
}

@media (max-width: 380px) {
  .year-select-wrap {
    max-width: 240px;
  }

  .year-select-wrap select {
    flex-basis: 118px;
    width: 118px;
    min-width: 118px;
    max-width: 118px;
    font-size: 16px;
    padding-left: 12px;
    padding-right: 28px;
  }
}
