.calendar-page {
  max-width: 1350px;
  margin: 0 auto;
  padding: 30px 20px 50px;
  color: #142d45;
}

.calendar-heading {
  text-align: center;
  margin-bottom: 30px;
}

.calendar-heading h1 {
  margin-bottom: 10px;
}

.calendar-heading p {
  color: #64748b;
}

.calendar-shell {
  background: white;
  border: 1px solid #d9e0e7;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(15,35,55,.08);
}

.calendar-toolbar {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  background: #f5f7fa;
  border-bottom: 1px solid #d9e0e7;
}

.calendar-controls,
.calendar-view-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.calendar-page button,
.calendar-dialog button {
  font-family: inherit;
  cursor: pointer;
}

.cal-control {
  border: 1px solid #ccd5df;
  background: white;
  color: #142d45;
  border-radius: 6px;
  padding: 10px 15px;
  font-weight: 700;
  font-size: 14px;
}

.cal-control:hover {
  background: #e7edf4;
}

.cal-control.selected {
  background: #142d45;
  color: white;
  border-color: #142d45;
}

.calendar-month {
  font-size: 25px;
  font-weight: 800;
  margin: 0;
  text-align: center;
}

.calendar-scroll {
  overflow-x: auto;
}

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

.calendar-weekday {
  background: #142d45;
  color: white;
  padding: 13px 5px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.calendar-day {
  min-height: 125px;
  padding: 8px;
  box-sizing: border-box;
  border-right: 1px solid #dce3ea;
  border-bottom: 1px solid #dce3ea;
  background: white;
  min-width: 0;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day.weekend {
  background: #f8fafc;
}

.calendar-day.outside {
  background: #f1f3f5;
}

.calendar-day.outside .day-number {
  color: #a1aab4;
}

.calendar-day.today {
  background: #fff5f5;
  box-shadow: inset 0 0 0 2px #b82035;
}

.day-number {
  display: inline-flex;
  width: 29px;
  height: 29px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.today .day-number {
  background: #b82035;
  color: white;
  border-radius: 50%;
}

.calendar-event {
  display: block;
  width: 100%;
  text-align: left;
  background: #142d45;
  color: white;
  border: 0;
  border-left: 4px solid #b82035;
  border-radius: 5px;
  padding: 8px;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.calendar-event:hover {
  background: #244c70;
}

.calendar-event.continuation {
  background: #365873;
}

.calendar-event-time {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: .9;
  margin-bottom: 2px;
}

.calendar-status {
  text-align: center;
  padding: 20px;
  color: #64748b;
}

.calendar-status.error {
  background: #fff0f0;
  color: #a51c30;
}

.calendar-list {
  padding: 20px;
}

.calendar-list-card {
  display: flex;
  align-items: stretch;
  gap: 20px;
  background: #f6f8fb;
  border: 1px solid #dce3ea;
  border-left: 5px solid #142d45;
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 20px;
}

.calendar-list-date {
  flex: 0 0 85px;
  text-align: center;
  border-right: 1px solid #dce3ea;
  padding-right: 18px;
}

.calendar-list-date strong {
  display: block;
  font-size: 35px;
  line-height: 1.1;
}

.calendar-list-date span {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-list-content {
  flex: 1;
  min-width: 0;
}

.calendar-list-content h3 {
  margin: 0 0 8px;
  color: #142d45;
}

.calendar-list-content p {
  margin: 6px 0 12px;
  color: #526477;
}

.calendar-empty {
  text-align: center;
  padding: 45px 20px;
  color: #64748b;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 5px;
  font-size: 13px;
  color: #64748b;
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
}

.calendar-dialog {
  width: min(560px,90vw);
  max-height: 85vh;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #142d45;
  box-shadow: 0 20px 70px rgba(0,0,0,.3);
}

.calendar-dialog::backdrop {
  background: rgba(10,25,40,.65);
}

.calendar-dialog-header {
  background: #142d45;
  color: white;
  padding: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.calendar-dialog-header h2 {
  color: white;
  margin: 0;
  overflow-wrap: anywhere;
}

.calendar-close {
  border: 0;
  background: transparent;
  color: white;
  font-size: 25px;
  padding: 0 5px;
}

.calendar-dialog-body {
  padding: 25px;
}

.calendar-dialog-body p {
  margin: 8px 0 18px;
}

.calendar-notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.calendar-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.calendar-link {
  display: inline-block;
  background: #142d45;
  color: white !important;
  text-decoration: none;
  padding: 11px 17px;
  border-radius: 6px;
  font-weight: 700;
}

.calendar-link:hover {
  background: #244c70;
}

.calendar-dialog [hidden],
.calendar-page [hidden] {
  display: none !important;
}

@media(max-width:850px) {
  .calendar-toolbar {
    justify-content: center;
  }

  .calendar-month {
    order: -1;
    width: 100%;
  }

  .calendar-day {
    min-height: 100px;
    padding: 5px;
  }

  .calendar-event {
    font-size: 11px;
    padding: 5px;
  }
}

@media(max-width:600px) {
  .calendar-page {
    padding: 20px 8px 35px;
  }

  .calendar-toolbar {
    padding: 12px 8px;
    gap: 10px;
  }

  .calendar-month {
    font-size: 22px;
  }

  .cal-control {
    padding: 9px 11px;
    font-size: 12px;
  }

  .calendar-grid {
    min-width: 560px;
  }

  .calendar-day {
    min-height: 95px;
  }

  .calendar-list {
    padding: 10px;
  }

  .calendar-list-card {
    gap: 12px;
    padding: 14px;
  }

  .calendar-list-date {
    flex-basis: 55px;
    padding-right: 10px;
  }

  .calendar-list-date strong {
    font-size: 28px;
  }

  .calendar-dialog-body {
    padding: 18px;
  }
}
