.page-content:has(.calendar-card) {
  max-width: none;
  padding-inline: clamp(12px, 1.25vw, 24px);
}
.calendar-card {
  container: calendar / inline-size;
  overflow: hidden;
  background: #f3f4f1;
  border: 0;
  border-radius: 24px;
  padding: 0 10px 10px;
  box-shadow: none;
}
.calendar-toolbar {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 16px;
  padding: 20px 16px;
}
.calendar-period {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.calendar-arrows {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}
.calendar-arrows .icon-button {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: #fff;
  color: #77896a;
}
.calendar-arrows .icon {
  width: 13px;
  height: 13px;
}
.calendar-period .calendar-date-button {
  min-height: 42px;
  padding: 10px 12px;
  border-color: #d5ddcc;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.calendar-date-button .icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.calendar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.calendar-filters .filters-right {
  display: grid;
  grid-template-columns: minmax(110px, 0.85fr) repeat(2, minmax(0, 1fr));
  flex: 1;
  gap: 8px;
  min-width: 0;
}
.calendar-filters .filter-select-trigger {
  max-width: none;
}
.calendar-filters #reset-calendar {
  flex-shrink: 0;
  padding: 10px 8px;
  white-space: nowrap;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f8f9f5;
  color: #7d8177;
}
.search-field:focus-within {
  border-color: #99ba68;
  background: #fff;
}
.search-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12px;
}
.search-field .icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.calendar-views {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: #e6ebde;
}
.calendar-views > button {
  padding: 9px 12px;
  border-radius: 9px;
  background: transparent;
  color: #869779;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.calendar-views > button.active {
  background: #fff;
  color: #526e38;
  box-shadow: none;
}
/* Adapt to the calendar's available width, including the cabinet sidebar. */
@container calendar (max-width: 1080px) {
  .calendar-toolbar {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 12px 16px;
  }
  .calendar-period {
    grid-column: 1;
    grid-row: 1;
  }
  .calendar-views {
    grid-column: 2;
    grid-row: 1;
  }
  .calendar-filters {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
@container calendar (max-width: 620px) {
  .calendar-toolbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 10px;
  }
  .calendar-period {
    gap: 8px;
  }
  .calendar-period .calendar-date-button {
    flex: 1;
    min-width: 0;
    white-space: normal;
    text-align: left;
  }
  .calendar-views {
    grid-column: 1;
    grid-row: 2;
  }
  .calendar-views > button {
    flex: 1;
  }
  .calendar-filters {
    grid-row: 3;
    flex-wrap: wrap;
  }
  .calendar-filters .filters-right {
    flex-basis: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search-field {
    grid-column: 1 / -1;
  }
  .calendar-filters #reset-calendar {
    margin-left: auto;
  }
}
@container calendar (max-width: 360px) {
  .calendar-filters .filters-right {
    grid-template-columns: minmax(0, 1fr);
  }
}
.week-calendar {
  display: grid;
  position: relative;
  width: 100%;
  min-width: 0;
}
.time-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  border-bottom: 1px solid #efefef;
}
.day-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  border-bottom: 1px solid #efefef;
  border-left: 1px solid #efefef;
  padding: 0;
}
.day-heading > span {
  text-transform: capitalize;
}
.day-heading > strong {
  font-weight: 550;
}
.time-column {
  position: relative;
}
.time-column > span {
  position: absolute;
  right: 11px;
  transform: translateY(-50%);
  z-index: 1;
}
.time-column > span:first-child {
  transform: translateY(7px);
}
.day-column {
  position: relative;
  min-width: 0;
  border-left: 1px solid #efefef;
  background: #ffffff;
}
.time-slot {
  display: block;
  background: none;
  width: 100%;
  height: var(--hour-height);
  border-bottom: 1px solid #efefef;
  padding: 0;
  position: relative;
}
.time-slot:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-bottom: 1px dashed #f6f6f6;
}
.time-slot:focus-visible {
  outline-offset: -3px;
}
.calendar-event {
  position: absolute;
  z-index: 2;
  text-align: left;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    filter 0.15s,
    box-shadow 0.15s;
  line-height: 1.3;
  min-width: 0;
}
.calendar-event:hover {
  z-index: 3;
}
.event-time {
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  white-space: nowrap;
}
.calendar-event > strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.calendar-scroll {
  background: #fff;
  border-radius: 17px;
}
.week-calendar {
  grid-template-columns: 57px repeat(var(--days), minmax(0, 1fr));
  grid-template-rows: 66px calc(var(--hours) * var(--hour-height));
}
.time-zone {
  background: #fff;
}
.time-column {
  background: #fff;
}
.time-zone {
  border-top: 0;
  border-bottom-color: #edf1e5;
}
.day-heading {
  background: #fff;
  border-top: 0;
  border-bottom-color: #eaf0e0;
  border-left-color: #eff4e8;
  gap: 8px;
}
.day-heading > span {
  font-size: 11px;
}
.day-heading > strong {
  font-size: 20px;
  letter-spacing: -0.7px;
}
.day-heading.is-today {
  background: #f5faed;
  color: #688648;
}
.day-heading.is-today > strong {
  background: #c7f464;
  color: #4a6c2c;
  font-size: 19px;
  border-radius: 10px;
  padding: 5px 9px;
}
.time-column > span {
  font-size: 9px;
}
.day-column {
  border-left-color: #eef2e6;
}
.day-column.is-today {
  background: #fcfef8;
}
.time-slot {
  border-bottom-color: #edf2e4;
}
.time-slot:after {
  border-color: #f5f8f0;
}
.time-slot:hover {
  background: #eef8de;
}
.calendar-event {
  border-radius: 9px;
  border-left: 3px solid var(--event-color);
  padding: 7px 8px 6px;
}
.calendar-event:hover {
  filter: none;
  box-shadow: 0 3px 10px #4a643019;
}
.calendar-event > strong {
  font-size: 11px;
  font-weight: 650;
}
.event-time {
  font-size: 9px;
  opacity: 0.8;
}
.event-compact {
  padding: 3px 6px;
}
.event-compact > .event-time {
  font-size: 8px;
}
.event-compact > strong {
  font-size: 9px;
  margin-top: 3px;
}
.time-column > span {
  color: #9ba48e;
}
.time-zone {
  color: #9ba48e;
}
.day-heading {
  color: #869577;
}
@media (min-width: 1500px) {
  .calendar-event {
    padding: 8px 11px;
  }

  .calendar-event > strong {
    font-size: 12px;
  }

  .event-time {
    font-size: 10px;
  }
}
@media (max-width: 900px) {
  .calendar-scroll {
    border-radius: 15px;
  }
}
@media (max-width: 700px) {
  .calendar-scroll {
    border-radius: 14px;
  }
}
.calendar-load-error {
  padding: 28px;
}
.calendar-load-error p {
  margin: 12px 0;
  color: #70776b;
}
.calendar-scroll {
  max-height: 1080px;
  overflow: auto;
}
.week-calendar .day-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
}
.week-calendar .time-zone {
  position: sticky;
  top: 0;
  background: #fff;
}
.time-add-button {
  position: absolute;
  left: 16px;
  width: 26px;
  height: 26px;
  padding: 5px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  background: #eef5e1;
  color: #6e8850;
  border: 1px solid #e2ecd4;
  border-radius: 9px;
}
.time-add-button > .icon {
  width: 14px;
  height: 14px;
}
.time-add-button:hover {
  background: #c7f464;
  color: #304420;
}
.time-add-button:focus-visible {
  background: #c7f464;
  color: #304420;
}
.week-calendar.staff-timeline {
  width: 100%;
  min-width: calc(57px + var(--days) * min(260px, calc(100% - 57px)));
  /* Fill the viewport; scroll only when the staff columns no longer fit.
     A single employee can also fit a narrow phone without horizontal scroll. */
  grid-template-columns: 57px repeat(var(--days), minmax(0, 1fr));
}
.week-calendar .time-column {
  position: sticky;
  left: 0;
  z-index: 4;
}
.week-calendar .time-zone {
  left: 0;
  z-index: 6;
}
.staff-heading {
  min-width: 0;
}
.staff-heading strong {
  font-size: 14px;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 10px;
}
.calendar-agenda {
  padding: 0 24px 24px;
}
.calendar-agenda section {
  margin-bottom: 20px;
}
.calendar-agenda h3 {
  padding: 16px 0 12px;
  font-size: 14px;
  text-transform: capitalize;
}
.agenda-row {
  display: grid;
  grid-template-columns:
    110px minmax(140px, 1.5fr) minmax(80px, 1fr) minmax(90px, 1fr)
    90px 16px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px;
  margin-bottom: 5px;
  border: 1px solid #ebeee7;
  border-radius: 14px;
  background: #f7f8f5;
  text-align: left;
  color: #272b25;
}
.agenda-row:hover {
  background: #eef6df;
}
.agenda-row small {
  display: block;
  color: #78816f;
  margin-top: 5px;
}
.agenda-time {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.agenda-staff {
  font-size: 12px;
  color: #66725b;
}
.agenda-status {
  font-size: 12px;
  color: #66725b;
}
.agenda-price {
  text-align: right;
  font-size: 13px;
}
.range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.range-presets button {
  padding: 10px 15px;
  border-radius: 10px;
  background: #f0f3ea;
}
.range-presets button:hover {
  background: #c7f464;
}
.range-month-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 10px;
  color: #828b7a;
  font-size: 12px;
}
.range-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.range-month h3 {
  text-align: center;
  text-transform: capitalize;
  font-size: 15px;
  margin: 8px 0 16px;
}
.range-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.range-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.range-weekdays {
  text-align: center;
  color: #8c9584;
  font-size: 11px;
  margin-bottom: 8px;
}
.range-days button {
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: #343c2b;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.range-days button.other-month {
  color: #b8bfb2;
}
.range-days button.in-range {
  background: #ecf7d9;
  border-radius: 4px;
}
.range-days button.selected {
  background: #c7f464;
  font-weight: 700;
  color: #253015;
}
.range-days button.today {
  box-shadow: inset 0 0 0 1px #92b45f;
}
.range-days button:hover {
  background: #e1f4bf;
}
.range-error {
  color: #a53a32;
  font-size: 13px;
}
@media (max-width: 1100px) {
  .agenda-row {
    grid-template-columns: 100px minmax(140px, 1fr) 80px 16px;
  }

  .agenda-staff {
    grid-column: 2;
  }

  .agenda-status {
    grid-column: 1;
  }

  .agenda-price {
    grid-column: 3;
    grid-row: 1;
  }

  .agenda-row > .icon {
    grid-column: 4;
    grid-row: 1;
  }
}
@media (max-width: 600px) {
  .calendar-agenda {
    padding: 0 10px 10px;
  }

  .agenda-row {
    padding: 12px;
    gap: 8px;
    grid-template-columns: 1fr 70px;
  }

  .agenda-time {
    grid-column: 1;
  }

  .agenda-row > span:nth-child(2) {
    grid-column: 1/-1;
  }

  .agenda-staff {
    grid-column: 1;
  }

  .agenda-status {
    grid-column: 1/-1;
  }

  .agenda-price {
    grid-column: 2;
    grid-row: 1;
  }

  .agenda-row > .icon {
    display: none;
  }

  .range-months {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .range-month:nth-child(2) {
    display: none;
  }

  .range-days button {
    max-height: 46px;
  }

  .calendar-scroll {
    max-height: 960px;
  }
}
.calendar-event > .event-time {
  flex-shrink: 0;
  line-height: 12px;
  color: #354031;
  font-size: 10px;
  white-space: nowrap;
}
.calendar-event {
  background: color-mix(in srgb, var(--event-color) 45%, white);
  color: #263021;
}
.calendar-event:hover {
  background: color-mix(in srgb, var(--event-color) 60%, white);
}
.calendar-event:focus-visible {
  background: color-mix(in srgb, var(--event-color) 60%, white);
}
.calendar-event.event-cancelled,
.agenda-row.event-cancelled {
  background: repeating-linear-gradient(
      100deg,
      #9aa1a633 0 5px,
      transparent 5px 28px
    )
    #e9ecee;
  border-left: 3px solid #9aa1a6;
  color: #30383e;
}
.calendar-event.event-completed,
.agenda-row.event-completed {
  background: repeating-linear-gradient(
      100deg,
      #63bb6b38 0 5px,
      transparent 5px 28px
    )
    #e1f4df;
  border-left: 3px solid #59b75a;
  color: #263021;
}
.calendar-event > strong {
  flex-shrink: 0;
  margin-top: 2px;
  line-height: 14px;
}
.calendar-event.event-compact > strong {
  margin-top: 2px;
  line-height: 14px;
  font-size: 11px;
  -webkit-line-clamp: 1;
}
.calendar-event:not(.event-compact) {
  padding-top: 5px;
  padding-bottom: 4px;
}
.calendar-event.event-single-line {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 2px 6px;
  border-radius: 6px;
}
.calendar-event.event-single-line > strong {
  display: block;
  min-width: 0;
  flex: 1;
  margin: 0;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event > .event-person {
  display: block;
  width: 100%;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 13px;
  margin-top: 2px;
  color: #354031;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-person > b {
  font-weight: 600;
}
.calendar-timezone-note {
  margin: 0 24px 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #eff5e5;
  color: #4d5c3d;
  font-size: 12px;
  line-height: 1.6;
}

/* All seven days share the available width; compact only the weekly view. */
.week-calendar:not(.staff-timeline) .day-column {
  overflow: hidden;
}
.week-calendar:not(.staff-timeline) .calendar-event {
  padding-inline: 6px;
}
.week-calendar:not(.staff-timeline) .event-time {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
@container calendar (max-width: 1100px) {
  .week-calendar:not(.staff-timeline) .event-single-line .event-time {
    display: none;
  }
  .week-calendar:not(.staff-timeline) .event-single-line {
    gap: 0;
  }
}
@container calendar (max-width: 760px) {
  .week-calendar:not(.staff-timeline) .day-heading {
    flex-direction: column;
    gap: 2px;
  }
  .week-calendar:not(.staff-timeline) .day-heading > strong {
    font-size: 16px;
    padding: 3px 5px;
  }
  .week-calendar:not(.staff-timeline) .calendar-event {
    padding-inline: 3px;
  }
  .week-calendar:not(.staff-timeline) .calendar-event > strong {
    font-size: 10px;
    overflow-wrap: anywhere;
  }
}
@container calendar (max-width: 420px) {
  .week-calendar:not(.staff-timeline) {
    grid-template-columns: 44px repeat(var(--days), minmax(0, 1fr));
  }
  .week-calendar:not(.staff-timeline) .time-add-button {
    left: 9px;
  }
  .week-calendar:not(.staff-timeline) .time-column > span {
    right: 6px;
  }
}
