/* Недельная сетка кабинета: ось X — время, ось Y — дни */


#week-schedule {
  scroll-margin-top: 6.5rem;
}
[data-week-frame] {
  overflow-anchor: none;
}
[data-week-frame][aria-busy="true"] {
  cursor: wait;
}
[data-week-frame][aria-busy="true"] .cal-scroll {
  pointer-events: none;
}

.schedule-chart {
  --sched-label-width: 4.5rem;
  --sched-track-height: 2.75rem;
  --sched-border: #dee2e6;
  --sched-grid: #e9ecef;
  font-size: 0.8125rem;
}

.schedule-chart .sched-scroll {
  border: 1px solid var(--sched-border);
  border-radius: 0.375rem;
  background: #fff;
}

.schedule-chart .sched-inner {
  min-width: 52rem;
}

.schedule-chart .sched-x-axis {
  display: flex;
  margin-left: var(--sched-label-width);
  position: relative;
  height: 1.75rem;
  border-bottom: 1px solid var(--sched-border);
  background: #f8f9fa;
}

.schedule-chart .sched-x-tick {
  position: absolute;
  transform: translateX(-50%);
  top: 0.25rem;
  color: #6c757d;
  white-space: nowrap;
}

.schedule-chart .sched-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--sched-border);
}

.schedule-chart .sched-row:last-child {
  border-bottom: none;
}

.schedule-chart .sched-row--anchor .sched-y-label {
  background: #e7f1ff;
}

.schedule-chart .sched-row--anchor .sched-track {
  background-color: rgba(13, 110, 253, 0.06);
}

.schedule-chart .sched-y-label {
  width: var(--sched-label-width);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  font-weight: 600;
  color: #495057;
  background: #f8f9fa;
  border-right: 1px solid var(--sched-border);
}

.schedule-chart .sched-track {
  flex: 1;
  position: relative;
  height: var(--sched-track-height);
  background: repeating-linear-gradient(
    to right,
    var(--sched-grid) 0,
    var(--sched-grid) 1px,
    transparent 1px,
    transparent calc(100% / 64)
  );
  background-size: 100% 100%;
  cursor: crosshair;
  user-select: none;
}

.schedule-chart .sched-track.is-dragging {
  cursor: grabbing;
}

.schedule-chart .sched-block {
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  border-radius: 0.25rem;
  min-width: 4px;
  box-sizing: border-box;
}

.schedule-chart .sched-block--open {
  background: rgba(13, 110, 253, 0.35);
  border: 1px solid rgba(13, 110, 253, 0.85);
}

.schedule-chart .sched-block--free {
  background: rgba(25, 135, 84, 0.35);
  border: 1px solid rgba(25, 135, 84, 0.9);
  cursor: pointer;
  transition: filter 0.12s ease;
}

.schedule-chart .sched-block--free:hover {
  filter: brightness(1.05);
}

.schedule-chart .sched-block--free.is-selected {
  background: rgba(25, 135, 84, 0.65);
  box-shadow: 0 0 0 2px #198754;
}

/* Узкая метка времени начала (клиентская сетка) — без ширины «длительность услуги» */
.schedule-chart .sched-block--marker {
  width: 2.85rem;
  min-width: 2.85rem;
  max-width: 2.85rem;
  left: var(--marker-left, 0%);
  transform: translateX(-50%);
  padding: 0 2px;
  box-sizing: border-box;
  z-index: 1;
}

.schedule-chart .sched-block--marker .sched-marker-time {
  font-size: 0.65rem;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.schedule-chart .sched-marker-sub {
  font-size: 0.55rem;
  line-height: 1;
  font-weight: 600;
}

.schedule-chart .sched-slot-full {
  background: rgba(108, 117, 125, 0.2);
  border: 1px dashed rgba(108, 117, 125, 0.55);
  cursor: default;
}

.schedule-chart .sched-block--busy {
  background: rgba(220, 53, 69, 0.2);
  border: 1px dashed rgba(220, 53, 69, 0.6);
}

.schedule-chart .sched-drag-preview {
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  background: rgba(13, 202, 240, 0.45);
  border: 1px dashed #0dcaf0;
  border-radius: 0.25rem;
  pointer-events: none;
  z-index: 2;
}

.schedule-chart .sched-block-actions {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}

.schedule-chart .sched-legend {
  font-size: 0.75rem;
  color: #6c757d;
}

/* Неделя как в Google Calendar: X — дни, Y — 00:00…00:00 */
.schedule-chart--week {
  --cal-gutter: 3.4rem;
  --cal-hour-h: 3.5rem;
}

.schedule-chart--week .cal-scroll {
  border: 1px solid var(--sched-border);
  border-radius: 0.5rem;
  background: #fff;
  max-height: min(72vh, 46rem);
  overflow: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
}

.schedule-chart--week .cal-head,
.schedule-chart--week .cal-body {
  display: grid;
  grid-template-columns: var(--cal-gutter) repeat(7, minmax(0, 1fr));
  min-width: 0;
}

.schedule-chart--week .cal-head {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
  border-bottom: 1px solid var(--sched-border);
}

.schedule-chart--week .cal-gutter {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}

.schedule-chart--week .cal-head .cal-gutter {
  z-index: 5;
  border-right: 1px solid var(--sched-border);
}

.schedule-chart--week .cal-day-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 3rem;
  padding: 0.35rem 0.25rem;
  border-left: 1px solid var(--sched-border);
  font-weight: 600;
  background: #f8f9fa;
}

.schedule-chart--week .cal-day-title.is-anchor {
  background: #e7f1ff;
}

.schedule-chart--week .cal-day-title.is-today .cal-day-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #0d6efd;
  color: #fff;
  font-size: 0.8rem;
}

.sched-mode {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.06);
}

.sched-mode form {
  display: contents;
}

.sched-mode__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5b6573;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.4rem 0.9rem;
  border-radius: 0.7rem;
  cursor: pointer;
}

.sched-mode__btn.is-active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.sched-mode__btn:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.schedule-chart--week .cal-day-name {
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.schedule-chart--week .cal-day-date {
  font-size: 0.8rem;
  font-weight: 650;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}

.schedule-chart--week .cal-body {
  position: relative;
}

.schedule-chart--week .cal-body .cal-gutter {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sched-border);
  min-height: calc(24 * var(--cal-hour-h));
}

.schedule-chart--week .cal-hour-label {
  box-sizing: border-box;
  height: var(--cal-hour-h);
  flex-shrink: 0;
  padding: 0.15rem 0.35rem 0 0;
  font-size: 0.7rem;
  line-height: 1;
  color: #6c757d;
  text-align: right;
  white-space: nowrap;
}

.schedule-chart--week .cal-hour-label.is-end {
  height: 0;
  padding: 0 0.35rem 0 0;
  overflow: visible;
  transform: translateY(-100%);
}

.schedule-chart--week .cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(24 * var(--cal-hour-h));
  height: calc(24 * var(--cal-hour-h));
  border-left: 1px solid var(--sched-border);
}

.schedule-chart--week .cal-day.is-anchor {
  background-color: rgba(13, 110, 253, 0.04);
}

.schedule-chart--week .cal-hour {
  box-sizing: border-box;
  height: var(--cal-hour-h);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 3px;
  overflow: auto;
  position: relative;
  z-index: 0;
  border-top: 1.5px solid #aacef2;
  background-image: linear-gradient(
    to bottom,
    transparent calc(50% - 1px),
    #edf0f2 calc(50% - 1px),
    #edf0f2 50%,
    transparent 50%
  );
}

.schedule-chart--week .cal-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid #dc3545;
  z-index: 4;
  pointer-events: none;
}

.schedule-chart--week .cal-now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc3545;
}

.schedule-chart--week .cal-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem;
  flex: 1 1 auto;
  min-height: 1.15rem;
  margin: 0;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.68rem;
  line-height: 1;
  overflow: hidden;
  box-sizing: border-box;
}

.schedule-chart--week .cal-event--free {
  background: #198754;
  border: 1px solid #146c43;
  color: #fff;
  cursor: pointer;
}

.schedule-chart--week .cal-event--free:hover {
  filter: brightness(1.06);
}

.schedule-chart--week .cal-event--free.is-selected,
.schedule-chart--week .cal-event--free:has(input:checked) {
  box-shadow: 0 0 0 2px #386dff, 0 0 0 3px #6f95ff;
}

.schedule-chart--week .cal-event--full {
  background: rgba(108, 117, 125, 0.18);
  border: 1px dashed rgba(108, 117, 125, 0.55);
  color: #6c757d;
}

.schedule-chart--week .cal-event-time {
  font-weight: 600;
  white-space: nowrap;
}

.schedule-chart--week .cal-event-seats {
  font-size: 0.62rem;
  opacity: 0.92;
  white-space: nowrap;
}

.schedule-chart--week .cal-event--mine {
  background: #0d6efd;
  border: 1px solid #0a58ca;
  color: #fff;
  min-height: 1.25rem;
}

.schedule-chart--week .cal-event--mine.is-pending {
  background: #fd7e14;
  border-color: #d96c0d;
}

.schedule-chart--week .cal-event--mine.is-past {
  background: rgba(13, 110, 253, 0.38);
  border-color: rgba(13, 110, 253, 0.45);
}

.schedule-chart--week .cal-event--mine.is-cancelled {
  background: rgba(108, 117, 125, 0.22);
  border: 1px dashed rgba(108, 117, 125, 0.55);
  color: #6c757d;
  text-decoration: line-through;
}

.schedule-chart--week .cal-event-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

.schedule-chart--week .cal-event-title:hover {
  text-decoration: underline;
}

.schedule-chart--week .cal-event-cancel {
  margin: 0;
  flex-shrink: 0;
}

.schedule-chart--week .cal-event-cancel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.schedule-chart--week .cal-event-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.schedule-chart--week .cal-event--stacked {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-height: 2.35rem;
  height: auto;
  padding: 0.2rem 0.3rem;
  gap: 0.08rem;
}

.schedule-chart--week .cal-event-person {
  font-size: 0.6rem;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.schedule-chart--week .cal-event--stacked .cal-event-title {
  font-size: 0.6rem;
  color: inherit;
}

.schedule-chart--week .cal-event--stacked .cal-event-seats {
  display: inline;
}

.schedule-chart--week .cal-day--edit {
  cursor: crosshair;
  user-select: none;
}

.schedule-chart--week .cal-day--edit.is-dragging {
  cursor: grabbing;
}

.schedule-chart--week[data-sched-locked="1"] .cal-day--edit {
  cursor: not-allowed;
}

.schedule-chart--week .cal-day--edit .cal-hour {
  pointer-events: none;
}

.schedule-chart--week .cal-window {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.2rem;
  border-radius: 0.35rem;
  background: #0d6efd;
  border: 1px solid #0a58ca;
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.15;
  padding: 0.2rem 0.3rem;
  overflow: hidden;
  box-sizing: border-box;
}

.schedule-chart--week .cal-window--movable {
  cursor: grab;
  touch-action: none;
}
.schedule-chart--week .cal-window--movable.is-moving {
  cursor: grabbing;
  z-index: 6;
  opacity: 0.95;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.schedule-chart--week .cal-window--offering,
.schedule-chart--week [data-slot-dialog] {
  cursor: pointer;
  margin: 0;
}

.schedule-chart--week .cal-window--offering:hover {
  filter: brightness(1.06);
}

.schedule-chart--week .cal-window--offering:has(input:checked),
.schedule-chart--week .cal-window--offering.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #386dff;
}

.schedule-chart--week .cal-window.is-full {
  opacity: 0.55;
  cursor: default;
}

.schedule-chart--week .cal-window.is-past {
  opacity: 0.38;
  cursor: default;
  filter: grayscale(0.35);
}

.schedule-chart--week .cal-window--specialist,
.schedule-chart--week .cal-window--solid.cal-window--specialist {
  background: #198754;
  border: 1px solid #146c43;
  color: #fff;
}

.schedule-chart--week .cal-window--tinted,
.schedule-chart--week .cal-window--solid.cal-window--tinted,
.schedule-chart--week .cal-window--specialist.cal-window--tinted {
  background: var(--slot-bg);
  border-color: var(--slot-border);
  color: #fff;
}

.schedule-chart--week .cal-event--tinted,
.schedule-chart--week .cal-event--free.cal-event--tinted {
  background: var(--slot-bg);
  border-color: var(--slot-border);
  color: #fff;
}

.sched-spec-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.sched-spec-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--ios-secondary, #6c757d);
}

.sched-spec-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.sched-spec-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.schedule-chart--week .cal-window--busy,
.schedule-chart--week .cal-window--solid.cal-window--busy {
  background: #ced4da;
  border: 1px solid #adb5bd;
  color: #495057;
  z-index: 1;
  pointer-events: none;
}

.schedule-chart--week .cal-window--readonly {
  pointer-events: none;
}

.schedule-chart--week .cal-window-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.2rem;
  flex-shrink: 0;
}

.schedule-chart--week .cal-window-slots {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.2rem;
  min-height: 0;
  overflow: auto;
}

.schedule-chart--week .cal-window-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  margin: 0;
  padding: 0.12rem 0.3rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: inherit;
  cursor: pointer;
  font-size: 0.66rem;
}

.schedule-chart--week .cal-window-slot:hover {
  background: rgba(255, 255, 255, 0.28);
}

.schedule-chart--week .cal-window-slot:has(input:checked),
.schedule-chart--week .cal-window-slot.is-selected {
  background: #fff;
  color: #146c43;
  box-shadow: 0 0 0 2px #fff;
}

.schedule-chart--week .cal-window-slot.is-full {
  cursor: default;
  opacity: 0.72;
  background: rgba(0, 0, 0, 0.12);
}

.schedule-chart--week .cal-window--avail,
.schedule-chart--week .cal-window--solid.cal-window--avail {
  background: rgba(222, 226, 230, 0.7);
  border: 1px dashed #adb5bd;
  color: #6c757d;
  z-index: 1;
  pointer-events: none;
}

.schedule-chart--week .cal-window--spec-booking {
  z-index: 3;
}

.schedule-chart--week .cal-window--spec-booking.is-confirmed {
  background: #198754;
  border: 1px solid #146c43;
  color: #fff;
}

.schedule-chart--week .cal-window--spec-booking.is-pending {
  background: #fd7e14;
  border: 1px solid #d96c0d;
  color: #fff;
}

.schedule-chart--week .cal-window--spec-booking.is-cancelled {
  background: #adb5bd;
  border: 1px solid #868e96;
  color: #fff;
  text-decoration: line-through;
}

.schedule-chart--week .cal-window-actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
}

.schedule-chart--week .cal-event-confirm-btn {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  border: 0;
  border-radius: 0.25rem;
  width: 1.35rem;
  height: 1.35rem;
  line-height: 1;
  padding: 0;
}

.schedule-chart--week .cal-window--mine {
  background: #0d6efd;
  border-color: #0a58ca;
  flex-direction: row;
  align-items: flex-start;
}

.schedule-chart--week .cal-window--mine.is-pending {
  background: #fd7e14;
  border-color: #d96c0d;
}

.schedule-chart--week .cal-window--mine.is-past {
  background: rgba(13, 110, 253, 0.55);
  border-color: rgba(13, 110, 253, 0.45);
}

.schedule-chart--week .cal-window--mine.is-cancelled {
  background: rgba(108, 117, 125, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.55);
  text-decoration: line-through;
}

.schedule-chart--week .cal-window-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.schedule-chart--week .cal-window-label .cal-event-title {
  color: inherit;
}

.schedule-chart--week .cal-window-del {
  margin: 0;
  flex-shrink: 0;
}

.schedule-chart--week .cal-window .cal-event-cancel-btn {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}

.schedule-chart--week .cal-drag-preview {
  position: absolute;
  left: 3px;
  right: 3px;
  background: #0dcb8c;
  border: 1px solid #0aa371;
  border-radius: 0.35rem;
  pointer-events: none;
  z-index: 3;
  opacity: 0.85;
}

.schedule-chart--week .cal-window--movable {
  touch-action: none;
}

@media (max-width: 768px) {
  .schedule-chart--week {
    --cal-gutter: 2.6rem;
    --cal-hour-h: 2.85rem;
  }

  .schedule-chart--week .cal-event-seats {
    display: none;
  }
}

