:root {
  --bg: #eef4ff;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(180, 200, 235, 0.65);
  --text: #17345f;
  --text-soft: #5873a3;
  --text-muted: #7f96bd;
  --primary: #2f6fe4;
  --primary-dark: #1f4fa8;
  --primary-soft: #eaf2ff;
  --success-bg: #e9fbef;
  --success-text: #23854c;
  --danger-bg: #fff1f1;
  --danger-text: #b42318;
  --chip-bg: #f4f7fd;
  --chip-border: #dce6f7;
  --shadow: 0 10px 28px rgba(43, 92, 180, 0.10);
  --shadow-soft: 0 6px 18px rgba(43, 92, 180, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --container: 1440px;

  --font-size-base: 14px;
  --font-size-sm: 13px;
  --font-size-xs: 12px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 28px;

  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
  --space-6: 32px;

  --border: 1px solid var(--panel-border);
  --app-vh: 1vh;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(111, 165, 255, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(130, 212, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #f7faff 0%, var(--bg) 100%);
  min-height: 100vh;
  line-height: 1.45;
  font-size: var(--font-size-base);
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

img,
svg,
iframe,
video,
canvas {
  max-width: 100%;
  height: auto;
}

.page-shell {
  width: min(calc(100% - 24px), var(--container));
  margin: 16px auto 28px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  padding: 18px 20px;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.site-header__left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #edf4ff 100%);
  border: 1px solid rgba(174, 198, 237, 0.8);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
  overflow: hidden;
}

.site-logo__image,
.site-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo-text-fallback {
  font-weight: 800;
  color: var(--primary);
  font-size: 11px;
  text-align: center;
  padding: 6px;
  line-height: 1.1;
}

.site-branding {
  min-width: 0;
}

.site-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  font-weight: 800;
  color: #173d78;
  letter-spacing: -0.03em;
}

.site-subtitle {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: var(--font-size-sm);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.sidebar,
.content {
  min-width: 0;
}

.content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.panel {
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 18px 18px 20px;
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header--events,
.panel-header--calendar {
  align-items: center;
}

.panel-title {
  margin: 0;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.1;
  font-weight: 800;
  color: #173d78;
  letter-spacing: -0.02em;
}

.panel-subtitle {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: var(--font-size-sm);
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: #36598f;
}

.form-label--inline {
  margin-bottom: 6px;
  display: inline-block;
}

.form-control {
  width: 100%;
  min-height: 44px;
  border-radius: 16px;
  border: 1px solid #cfdbf2;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-size: var(--font-size-sm);
  min-width: 0;
}

.form-control:focus {
  border-color: rgba(47, 111, 228, 0.55);
  box-shadow: 0 0 0 4px rgba(47, 111, 228, 0.10);
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  border: none;
  border-radius: 16px;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--font-size-sm);
  min-width: 0;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #3f7bf0 0%, #2f6fe4 100%);
  box-shadow: 0 8px 20px rgba(47, 111, 228, 0.25);
}

.btn-secondary {
  color: #fff;
  background: linear-gradient(180deg, #1f3768 0%, #152b56 100%);
  box-shadow: 0 8px 20px rgba(21, 43, 86, 0.24);
}

.btn-light {
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #edf3ff 100%);
  border: 1px solid #d6e1f4;
  box-shadow: var(--shadow-soft);
}

.btn-icon {
  min-width: 54px;
  padding: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  border: 1px solid #dae5f7;
  padding: 14px;
  min-width: 0;
}

.metric-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: #173d78;
}

.analytics-block + .analytics-block {
  margin-top: 18px;
}

.analytics-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: #274d86;
}

.analytics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #dce7f8;
  background: #f9fbff;
  border-radius: 14px;
  width: 100%;
  text-align: left;
}

.analytics-row--interactive {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
}

.analytics-row--interactive:hover {
  background: #eef4ff;
}

.analytics-row--interactive:focus-visible {
  outline: 2px solid rgba(47, 111, 228, 0.35);
  outline-offset: 2px;
}

.analytics-row-name {
  min-width: 0;
  font-size: var(--font-size-sm);
  color: var(--text);
  text-align: left;
  justify-self: start;
  align-self: start;
}

.analytics-row-value {
  flex-shrink: 0;
  min-width: 30px;
  text-align: center;
  font-weight: 800;
  color: var(--primary);
  background: #eef4ff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: var(--font-size-xs);
  justify-self: end;
  align-self: start;
}

.events-toolbar,
.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
}

.sort-wrap {
  min-width: 220px;
}

.results-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 16px;
}

.results-counter {
  color: #3f5f94;
  font-weight: 700;
  font-size: var(--font-size-sm);
}

.results-counter--muted {
  color: #6f84aa;
}

.events-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.events-grid--archive {
  margin-top: 4px;
}

.event-card {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #d9e5f8;
  box-shadow: var(--shadow-soft);
  padding: 18px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.event-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.event-top-left,
.event-top-right {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: 800;
  border: 1px solid transparent;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
}

.chip-category {
  background: #edf4ff;
  color: #3c69a8;
  border-color: #d6e5fb;
}

.chip-status {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #caefd7;
}

.chip-ended {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #f3c7c7;
}

.chip-archive {
  background: #f3f5f8;
  color: #667a96;
  border-color: #dde4ee;
}

.event-card--past {
  opacity: 0.96;
}

.event-card--past .event-title {
  color: #5f769b;
}

.event-card--past .event-date-badge {
  background: #f3f5f8;
  color: #6d7f99;
  border-color: #dde4ee;
}

.chip-muted {
  background: var(--chip-bg);
  color: #5775a7;
  border-color: var(--chip-border);
  font-weight: 700;
}

.event-date-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f4f8ff;
  border: 1px solid #dee9fb;
  color: #45689c;
  font-size: var(--font-size-xs);
  font-weight: 800;
  white-space: normal;
  line-height: 1.2;
}

.event-title {
  margin: 0 0 14px;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #153868;
  min-width: 0;
}

.event-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  min-width: 0;
}

.event-meta-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #395d95;
  font-size: var(--font-size-sm);
  min-width: 0;
}

.event-meta-icon {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  line-height: 1.2;
}

.event-meta-row span {
  min-width: 0;
}

.event-description {
  color: var(--text-soft);
  font-size: var(--font-size-sm);
  margin-bottom: 14px;
  min-width: 0;
}

.event-professions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-width: 0;
}

.event-card-footer {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.event-card-note {
  color: #45689c;
  font-size: var(--font-size-sm);
  min-width: 0;
}

.archive-panel .event-card-note {
  color: #667a96;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.calendar-title {
  min-width: 190px;
  text-align: center;
  font-weight: 800;
  color: #173d78;
  font-size: 15px;
}

.view-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-switcher__btn {
  border: 1px solid #d6e2f5;
  background: linear-gradient(180deg, #ffffff 0%, #edf3ff 100%);
  color: var(--text);
  border-radius: 16px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.view-switcher__btn.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, #3f7bf0 0%, #2f6fe4 100%);
  box-shadow: 0 8px 20px rgba(47, 111, 228, 0.24);
}

.calendar-container {
  min-height: 220px;
  min-width: 0;
  overflow: hidden;
}

.calendar-month {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.calendar-month-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.calendar-weekday {
  text-align: center;
  font-weight: 800;
  color: #4b6ea2;
  font-size: var(--font-size-xs);
  padding: 8px 0;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.calendar-day {
  min-height: 170px;
  border: 1px solid #d9e5f8;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-radius: 18px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  overflow: hidden;
}

.calendar-day.is-other-month {
  opacity: 0.5;
}

.calendar-day.is-today {
  border-color: rgba(47, 111, 228, 0.45);
  box-shadow: 0 0 0 2px rgba(47, 111, 228, 0.08), var(--shadow-soft);
}

.calendar-day-number {
  font-weight: 800;
  color: #173d78;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.calendar-event-pill {
  border: 1px solid #dbe7f9;
  background: #edf4ff;
  color: #2c5ca2;
  border-radius: 12px;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  min-width: 0;
  width: 100%;
  display: block;
  overflow: hidden;
}

.calendar-event-pill--past {
  background: #f3f5f8;
  border-color: #dde4ee;
  color: #677c98;
}

.calendar-event-pill:hover {
  background: #e4efff;
}

.calendar-event-pill--past:hover {
  background: #eceff4;
}

.calendar-more {
  color: #6886b3;
  font-size: 11px;
  font-weight: 700;
  padding-top: 2px;
}

.calendar-week {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 10px;
}

.calendar-week-column {
  border: 1px solid #d9e5f8;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.calendar-week-column-head {
  border-bottom: 1px solid #e5edf9;
  padding-bottom: 8px;
}

.calendar-weekday-name {
  font-weight: 800;
  color: #173d78;
  font-size: var(--font-size-sm);
}

.calendar-weekday-date {
  color: var(--text-soft);
  font-size: var(--font-size-xs);
  margin-top: 2px;
}

.calendar-week-column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.calendar-week-event {
  border: 1px solid #dbe7f9;
  background: #edf4ff;
  color: #1f467e;
  border-radius: 14px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.calendar-week-event--past {
  background: #f3f5f8;
  border-color: #dde4ee;
  color: #627894;
}

.calendar-week-event:hover {
  background: #e4efff;
}

.calendar-week-event--past:hover {
  background: #eceff4;
}

.calendar-week-event-time {
  font-size: 11px;
  font-weight: 800;
  color: #5071a6;
}

.calendar-week-event-title {
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: #173d78;
  line-height: 1.25;
  min-width: 0;
}

.calendar-week-event--past .calendar-week-event-title {
  color: #5f769b;
}

.calendar-week-event-meta {
  font-size: var(--font-size-xs);
  color: #5e7daa;
  min-width: 0;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.timeline-item-date {
  border: 1px solid #dbe7f9;
  background: #f4f8ff;
  border-radius: 18px;
  padding: 14px;
}

.timeline-item--past .timeline-item-date {
  background: #f3f5f8;
  border-color: #dde4ee;
}

.timeline-date-day {
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: #173d78;
  margin-bottom: 4px;
}

.timeline-item--past .timeline-date-day {
  color: #5f769b;
}

.timeline-date-time {
  font-size: var(--font-size-xs);
  color: #5c7ca9;
  font-weight: 700;
}

.timeline-item-card {
  width: 100%;
  text-align: left;
  border: 1px solid #d9e5f8;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
  cursor: pointer;
  color: inherit;
  min-width: 0;
  overflow: hidden;
}

.timeline-item--past .timeline-item-card {
  background: linear-gradient(180deg, #fafbfc 0%, #f4f6f9 100%);
  border-color: #dde4ee;
}

.timeline-item-title {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  color: #173d78;
  margin-bottom: 6px;
  min-width: 0;
}

.timeline-item--past .timeline-item-title {
  color: #5f769b;
}

.timeline-item-meta {
  color: #4e6fa3;
  font-size: var(--font-size-sm);
  min-width: 0;
}

.map-container {
  min-height: 100px;
}

.empty-state,
.loading,
.placeholder-message,
.calendar-empty {
  border: 1px dashed #d5e2f5;
  background: #f9fbff;
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  color: var(--text-soft);
  font-size: var(--font-size-sm);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal.is-hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 34, 68, 0.46);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(920px, calc(100% - 24px));
  max-height: calc(var(--app-vh, 1vh) * 100 - 32px);
  overflow: auto;
  margin: 16px auto;
  background: #fff;
  border-radius: 24px;
  border: 1px solid #dbe6f7;
  box-shadow: 0 24px 60px rgba(13, 38, 82, 0.22);
  padding: 20px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal__title {
  margin: 0;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.15;
  font-weight: 800;
  color: #173d78;
}

.modal__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.modal__close {
  border: 1px solid #d7e2f4;
  background: #f7faff;
  color: #1f467e;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.modal__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-info-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #edf2fb;
}

.modal-label {
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: #35588d;
}

.modal-value {
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  min-width: 0;
}

.modal-text-block {
  border: 1px solid #e2ebfa;
  background: #f9fbff;
  border-radius: 16px;
  padding: 14px;
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  min-width: 0;
}

.debug-access {
  width: min(calc(100% - 24px), var(--container));
  margin: 0 auto 24px;
}

.debug-access__form {
  margin-top: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid #dce7f8;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.debug-access__row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.debug-panel {
  margin-top: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid #dce7f8;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.debug-panel.is-hidden {
  display: none;
}

.debug-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.debug-panel__title {
  margin: 0;
  font-size: 18px;
  color: #173d78;
}

.debug-panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.debug-item {
  border: 1px solid #dce7f8;
  border-radius: 16px;
  padding: 12px;
  background: #f9fbff;
}

.debug-label {
  font-size: var(--font-size-xs);
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 6px;
}

.debug-value {
  font-size: var(--font-size-sm);
  color: var(--text);
  word-break: break-word;
}

.debug-output {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: #0f1d37;
  color: #d8e7ff;
  font-size: 12px;
  overflow: auto;
  line-height: 1.45;
}

.site-footer {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 20px;
  border: 1px solid #dce7f8;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.site-footer__text {
  color: #35588d;
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.site-footer__link {
  color: var(--primary);
  font-size: var(--font-size-sm);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.modal-open {
  overflow: hidden;
}

.analytics-row-name,
.event-title,
.event-description,
.event-meta-row span,
.event-card-note,
.modal-value,
.modal-text-block,
.debug-value,
.debug-output,
.calendar-event-pill,
.calendar-week-event-title,
.calendar-week-event-meta,
.timeline-item-title,
.timeline-item-meta,
.site-footer__text,
.site-footer__link,
.panel-title,
.panel-subtitle,
.calendar-title {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-text-block a,
.modal-value a,
.debug-value a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 1201px) {
  .events-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .events-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 140px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
  }

  .panel {
    padding: 16px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-header__right {
    width: 100%;
    justify-content: flex-start;
  }

  .calendar-toolbar,
  .events-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .calendar-nav {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-title {
    min-width: 0;
    flex: 1;
  }

  .calendar-month-head,
  .calendar-month-grid {
    gap: 8px;
  }

  .calendar-day {
    min-height: 128px;
    padding: 8px;
  }

  .modal-info-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .debug-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --font-size-base: 13px;
    --font-size-sm: 12px;
    --font-size-xs: 11px;
  }

  .page-shell,
  .debug-access {
    width: min(calc(100% - 16px), var(--container));
    margin-left: auto;
    margin-right: auto;
  }

  .site-header {
    padding: 14px;
    border-radius: 20px;
  }

  .site-header__left {
    align-items: flex-start;
  }

  .site-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }

  .site-header__right {
    display: none;
  }

  .layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .content {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .debug-access {
    display: none !important;
  }

  .panel {
    border-radius: 20px;
    padding: 14px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .event-card {
    padding: 14px;
    border-radius: 18px;
  }

  .event-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .event-top-left,
  .event-top-right {
    width: 100%;
    align-items: flex-start;
  }

  .chip,
  .event-date-badge {
    min-height: 28px;
    padding: 6px 10px;
  }

  .event-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .event-card-footer .btn {
    width: 100%;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .site-footer {
    padding: 14px;
    border-radius: 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .modal__dialog {
    width: calc(100% - 16px);
    max-height: calc(var(--app-vh, 1vh) * 100 - 16px);
    margin: 8px auto;
    border-radius: 20px;
    padding: 14px;
  }
}

@media (max-width: 560px) {
  .site-title {
    font-size: 24px;
  }

  .panel-title {
    font-size: 18px;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-item-title {
    font-size: 15px;
  }

  .calendar-month {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-month-head,
  .calendar-month-grid {
    min-width: 700px;
  }

  .calendar-week {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-week-grid {
    min-width: 980px;
  }
}

@media (max-width: 420px) {
  .page-shell,
  .debug-access {
    width: calc(100% - 12px);
  }

  .site-header,
  .panel,
  .site-footer {
    border-radius: 16px;
  }

  .site-header {
    padding: 12px;
  }

  .panel {
    padding: 12px;
  }

  .site-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .site-title {
    font-size: 20px;
  }

  .event-title {
    font-size: 16px;
  }

  .event-card {
    padding: 12px;
    border-radius: 16px;
  }

  .chip,
  .event-date-badge {
    font-size: 10px;
    padding: 5px 9px;
  }

  .calendar-title {
    font-size: 13px;
  }

  .btn-icon {
    min-width: 40px;
    min-height: 40px;
  }

  .modal__dialog {
    width: calc(100% - 12px);
    max-height: calc(var(--app-vh, 1vh) * 100 - 12px);
    margin: 6px auto;
    padding: 12px;
    border-radius: 16px;
  }

  .modal__title {
    font-size: 18px;
  }

  .modal__close {
    width: 36px;
    height: 36px;
    font-size: 20px;
    border-radius: 10px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-header,
  .sidebar,
  .calendar-panel,
  .map-panel,
  .debug-access,
  .filter-actions,
  .events-toolbar,
  .calendar-toolbar,
  .btn,
  .modal,
  .site-footer {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    margin: 0;
  }

  .layout {
    display: block;
  }

  .content {
    display: block;
  }

  .panel {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
    padding: 0;
  }

  .events-grid {
    display: block;
  }

  .event-card {
    break-inside: avoid;
    margin-bottom: 16px;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}