.events-section-active .topbar .search-box,
.events-section-active .topbar .filter-control,
.events-section-active .topbar .generation-filter,
.events-section-active .topbar .share-button {
  visibility: hidden;
}

.events-workspace {
  height: calc(100vh - 75px);
  padding: clamp(22px, 4vw, 48px) clamp(18px, 5vw, 64px) 48px;
  overflow: auto;
  color: var(--ink);
  background:
    linear-gradient(rgba(244, 235, 210, 0.82), rgba(226, 205, 162, 0.8)),
    url('/assets/images/parchment.png') center / 630px repeat;
}

.events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1160px, 100%);
  margin: 0 auto 24px;
}

.events-header h1 {
  margin: -4px 0 5px;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 500;
  line-height: 1;
}

.events-header p:last-child {
  margin: 0;
  color: var(--ink-soft);
}

.events-header .button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.events-header .button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.events-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(130px, 170px) minmax(150px, 210px);
  align-items: end;
  gap: 12px;
  width: min(1160px, 100%);
  margin: 0 auto 26px;
  padding: 12px;
  border: 1px solid rgba(86, 63, 27, 0.25);
  border-radius: 14px;
  background: rgba(255, 247, 221, 0.35);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.35);
}

.events-toolbar > label {
  display: grid;
  gap: 4px;
  color: #695334;
  font-size: 11px;
}

.events-toolbar input,
.events-toolbar select {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid rgba(86, 63, 27, 0.33);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  background: rgba(255, 249, 230, 0.55);
}

.events-toolbar input:focus,
.events-toolbar select:focus,
.event-dialog input:focus,
.event-dialog select:focus,
.event-dialog textarea:focus {
  border-color: #9c762f;
  box-shadow: 0 0 0 3px rgba(156, 118, 47, 0.15);
}

.event-search {
  position: relative;
  display: block !important;
}

.event-search input { padding-left: 35px; }

.event-search svg {
  position: absolute;
  top: 11px;
  left: 11px;
  width: 17px;
  height: 17px;
}

.event-view-switcher {
  display: flex;
  height: 39px;
  padding: 3px;
  border: 1px solid rgba(86, 63, 27, 0.29);
  border-radius: 10px;
  background: rgba(107, 82, 43, 0.08);
}

.event-view-switcher button {
  padding: 0 12px;
  border-radius: 7px;
  color: #6b5637;
  font-size: 12px;
  background: transparent;
}

.event-view-switcher button.active {
  color: #45351f;
  background: rgba(249, 233, 196, 0.9);
  box-shadow: 0 1px 4px rgba(77, 55, 24, 0.18);
}

.events-results,
.events-state,
.events-calendar-nav {
  width: min(1160px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.events-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 30px;
  border: 1px dashed rgba(91, 68, 32, 0.35);
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 247, 221, 0.22);
}

.events-state strong {
  margin-bottom: 7px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
}

.events-state span {
  max-width: 520px;
  color: var(--ink-soft);
}

.events-state .button { margin-top: 18px; }
.events-state.loading { color: var(--ink-soft); font-style: italic; }
.events-state.error { border-color: rgba(126, 55, 42, 0.42); }

.event-timeline {
  position: relative;
  display: grid;
  gap: 20px;
  max-width: 880px;
  margin: 0 auto;
  padding: 5px 0 24px;
}

.event-timeline::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 2px;
  content: '';
  background: linear-gradient(rgba(128, 94, 43, 0.08), rgba(128, 94, 43, 0.5) 5% 95%, rgba(128, 94, 43, 0.08));
}

.event-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
}

.event-marker {
  position: relative;
  z-index: 1;
  display: block;
  width: 15px;
  height: 15px;
  margin: 28px 0 0 14px;
  border: 3px solid #ead9ac;
  border-radius: 50%;
  background: #8b6932;
  box-shadow: 0 0 0 1px rgba(89, 62, 26, 0.35);
}

.event-card-body {
  display: block;
  width: 100%;
  padding: 20px 22px;
  border: 1px solid rgba(88, 64, 29, 0.3);
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
  background:
    linear-gradient(rgba(249, 236, 201, 0.82), rgba(234, 212, 167, 0.75)),
    url('/assets/images/parchment.png') center / 500px;
  box-shadow: 0 7px 18px rgba(72, 52, 25, 0.13), inset 0 0 0 3px rgba(255, 244, 217, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.event-card-body:hover,
.event-card-body:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(72, 52, 25, 0.2), inset 0 0 0 3px rgba(255, 244, 217, 0.3);
}

.event-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.event-card-top time {
  color: #745b36;
  font-size: 12px;
}

.event-type-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 12px;
  color: #584326;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(126, 104, 57, 0.15);
}

.event-card h2 {
  margin: 9px 0 5px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
}

.event-description {
  display: -webkit-box;
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--ink-soft);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  color: #6a5537;
  font-size: 12px;
}

.event-card-details span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.event-card-details svg { width: 14px; height: 14px; }

.event-list {
  overflow: hidden;
  border: 1px solid rgba(86, 63, 27, 0.28);
  border-radius: 14px;
  background: rgba(255, 247, 221, 0.28);
  box-shadow: 0 6px 18px rgba(72, 52, 25, 0.1);
}

.event-list-heading,
.event-list-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.15fr) minmax(180px, 1.6fr) minmax(110px, 0.8fr) minmax(150px, 1.2fr) minmax(150px, 1.2fr);
  gap: 14px;
  align-items: center;
}

.event-list-heading {
  padding: 10px 16px;
  color: #77613f;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: rgba(107, 82, 43, 0.09);
}

.event-list-row {
  width: 100%;
  min-height: 62px;
  padding: 10px 16px;
  border-top: 1px solid rgba(86, 63, 27, 0.17);
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.event-list-row:hover,
.event-list-row:focus-visible { background: rgba(255, 244, 213, 0.42); }
.event-list-row time,
.event-list-row > span { overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; }

.events-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: -8px;
  margin-bottom: 14px;
}

.events-calendar-nav h2 {
  min-width: 220px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  text-align: center;
}

.events-calendar-nav button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(86, 63, 27, 0.28);
  border-radius: 50%;
  background: rgba(255, 247, 221, 0.35);
}

.events-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(86, 63, 27, 0.28);
  border-radius: 14px;
  background: rgba(255, 247, 221, 0.3);
}

.calendar-weekday {
  padding: 9px 5px;
  color: #745c39;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  background: rgba(107, 82, 43, 0.1);
}

.calendar-day {
  min-height: 108px;
  padding: 7px;
  overflow: hidden;
  border-top: 1px solid rgba(86, 63, 27, 0.16);
  border-left: 1px solid rgba(86, 63, 27, 0.16);
}

.calendar-day:nth-child(7n + 1) { border-left: 0; }
.calendar-day.outside-month { opacity: 0.38; background: rgba(90, 67, 32, 0.04); }
.calendar-day-number { display: block; margin-bottom: 5px; color: #715a38; font-size: 11px; }

.calendar-event {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 5px 6px;
  overflow: hidden;
  border-left: 3px solid #8a6833;
  border-radius: 4px;
  color: #49371f;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(193, 157, 84, 0.2);
}

.approximate-events {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed rgba(86, 63, 27, 0.3);
  border-radius: 12px;
}

.approximate-events h3 {
  width: 100%;
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
}

.approximate-events button {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 245, 213, 0.5);
}

.event-dialog { width: min(660px, calc(100vw - 30px)); }

.event-dialog input,
.event-dialog select,
.event-dialog textarea {
  width: 100%;
  padding: 0 13px;
  border: 1px solid rgba(86, 63, 27, 0.38);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  font: inherit;
  background: rgba(255, 248, 222, 0.58);
  box-shadow: inset 0 2px 4px rgba(71, 50, 23, 0.08);
}

.event-dialog input,
.event-dialog select { height: 44px; }
.event-dialog textarea { min-height: 96px; padding-top: 11px; resize: vertical; }

.event-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.event-form-grid > label {
  display: grid;
  gap: 6px;
  color: #58452d;
  font-size: 13px;
}

.event-form-grid small { color: #806947; font-weight: 400; }
.event-form-grid .wide { grid-column: 1 / -1; }

.event-date-mode,
.event-people-field {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid rgba(86, 63, 27, 0.25);
  border-radius: 10px;
}

.event-date-mode legend,
.event-people-field legend {
  padding: 0 5px;
  color: #58452d;
  font-size: 13px;
}

.event-date-mode {
  display: flex;
  gap: 22px;
}

.event-date-mode label,
.event-people-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #58452d;
  font-size: 12px;
}

.event-date-mode input,
.event-people-options input {
  width: 16px;
  height: 16px;
  padding: 0;
  box-shadow: none;
}

.event-exact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.event-exact-fields label { display: grid; gap: 6px; color: #58452d; font-size: 13px; }

.event-people-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 14px;
  max-height: 150px;
  overflow-y: auto;
}

.event-people-options label {
  padding: 6px 7px;
  border-radius: 7px;
}

.event-people-options label:hover { background: rgba(116, 87, 42, 0.08); }

@media (max-width: 900px) {
  .events-toolbar { grid-template-columns: 1fr 1fr; }
  .event-view-switcher { grid-column: 1 / -1; }
  .event-view-switcher button { flex: 1; }
  .event-list { overflow-x: auto; }
  .event-list-heading,
  .event-list-row { min-width: 820px; }
  .calendar-day { min-height: 90px; padding: 5px; }
}

@media (max-width: 700px) {
  .events-workspace { height: calc(100vh - 64px); padding: 20px 12px 32px; }
  .events-section-active .topbar .topbar-actions { display: none; }
  .events-header { align-items: flex-end; margin-bottom: 18px; }
  .events-header p:last-child { display: none; }
  .events-header .button { min-width: 42px; padding: 0 12px; }
  .events-header .button span { display: none; }
  .events-toolbar { grid-template-columns: 1fr; margin-bottom: 18px; }
  .event-view-switcher { grid-column: auto; }
  .event-timeline::before { left: 11px; }
  .event-card { grid-template-columns: 24px minmax(0, 1fr); }
  .event-marker { margin-left: 5px; }
  .event-card-body { padding: 16px; }
  .event-card-top { align-items: flex-start; flex-direction: column; gap: 6px; }
  .event-card h2 { font-size: 21px; }
  .calendar-weekday { font-size: 8px; }
  .calendar-day { min-height: 65px; padding: 3px; }
  .calendar-event { min-height: 8px; padding: 2px; border-left-width: 2px; font-size: 0; }
  .calendar-day-number { font-size: 9px; }
  .event-form-grid,
  .event-exact-fields { grid-template-columns: 1fr; }
  .event-form-grid .wide { grid-column: auto; }
  .event-people-options { grid-template-columns: 1fr; }
  .event-dialog form { padding: 27px 20px 22px; }
  .event-dialog .dialog-actions .button-danger { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .event-card-body { transition: none; }
}
