.schedule-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.schedule-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-toolbar .schedule-search {
  width: 320px;
  max-width: 100%;
  margin: 0;
}

.schedule-navigation .icon-button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.schedule-range {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.schedule-range:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.schedule-range .icon {
  width: 17px;
  height: 17px;
  color: var(--text-soft);
}

.schedule-search {
  width: min(320px, 100%);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.schedule-search .icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--muted);
}

.schedule-search input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
}

.schedule {
  padding: 0;
  overflow: auto;
}

.schedule-grid {
  min-width: 1040px;
}

.schedule-header,
.schedule-row {
  display: grid;
  grid-template-columns: 220px repeat(7, minmax(115px, 1fr));
}

.schedule-header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 70px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.schedule-employee-head {
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-right: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.schedule-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.schedule-day-head:last-child {
  border-right: 0;
}

.schedule-day-head strong {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 650;
}

.schedule-day-head.today {
  margin: 5px;
  border-radius: 10px;
  border-right: 0;
  background: var(--calendar-today-head);
}

.schedule-day-head.today strong,
.schedule-day-head.today span {
  color: var(--blue);
}

.schedule-row {
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.schedule-row:last-child {
  border-bottom: 0;
}

.schedule-row[hidden] {
  display: none;
}

.schedule-person {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.schedule-person-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--nav-icon);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.schedule-person-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.schedule-free-avatar .icon {
  width: 16px;
  height: 16px;
}

.schedule-person-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.schedule-person-info strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-person-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.schedule-cell:last-child {
  border-right: 0;
}

.schedule-cell.today {
  background: var(--calendar-today);
}

.schedule-empty {
  display: grid;
  width: 100%;
  min-height: 32px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.schedule-shift {
  width: 100%;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: var(--shift-bg);
  color: var(--shift-text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}

.schedule-shift:hover {
  transform: translateY(-1px);
  background: var(--shift-bg-hover);
}

.schedule-shift strong {
  display: block;
  color: var(--shift-strong);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.schedule-shift span {
  display: block;
  overflow: hidden;
  color: var(--shift-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-shift .schedule-shift-duration {
  margin-top: 2px;
  color: var(--shift-duration);
  font-size: 8px;
  font-weight: 550;
}

.schedule-shift.done {
  background: var(--shift-done-bg);
}

.schedule-shift.done strong {
  color: var(--shift-done-strong);
}

.schedule-shift.done span {
  color: var(--shift-done-text);
}

.schedule-shift.done .schedule-shift-duration {
  color: var(--shift-done-muted);
}

.schedule-shift.cancelled {
  background: var(--shift-cancelled-bg);
  opacity: 0.7;
  text-decoration: line-through;
}

.schedule-shift.cancelled strong,
.schedule-shift.cancelled span {
  color: var(--shift-cancelled-text);
}

.schedule-free-row .schedule-person {
  background: var(--surface-soft);
}

.schedule-cell-addable {
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}

.schedule-cell-addable:hover {
  background: var(--calendar-today);
}

.schedule-cell-addable:hover .schedule-empty::after {
  content: '+';
  color: var(--blue);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

/* Компактный календарь.
   На desktop скрыт. */

.schedule-compact {
  display: none;
}

/* Создание смены */

.shift-create-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.shift-create-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 0;
}

.shift-create-field > span:first-child {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.shift-time-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.shift-time-separator {
  color: var(--muted);
}

.shift-create-employees {
  align-items: start;
}

.shift-create-employees > span:first-child {
  padding-top: 13px;
}

.shift-employee-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.shift-employee-option {
  display: grid;
  grid-template-columns: auto 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin: 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.shift-employee-option:last-child {
  border-bottom: 0;
}

.shift-employee-option:hover {
  background: var(--surface-hover);
}

.shift-employee-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.shift-employee-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--nav-icon);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
}

.shift-employee-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shift-employee-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shift-employee-meta strong {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
}

.shift-employee-meta > span {
  color: var(--muted);
  font-size: 10px;
}

.shift-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Mobile */

@media (max-width: 800px) {
  .schedule-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .schedule-navigation {
    width: 100%;
  }

  .schedule-range {
    min-width: 0;
    flex: 1;
    justify-content: center;
  }

  .schedule-toolbar .schedule-search {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  /*
   * Desktop-таблица скрывается.
   * Для сотрудника и работодателя используется
   * компактный мобильный календарь.
   */
  .schedule {
    display: none;
  }

  /*
   * Базовый компактный календарь сотрудника:
   * одна цельная белая карточка недели.
   */
  .schedule-compact {
    display: block;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  /*
   * У работодателя внутри находятся отдельные
   * карточки сотрудников, поэтому общий контейнер
   * должен быть прозрачным и без рамки.
   */
  .schedule-compact:has(.schedule-compact-employee) {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .schedule-compact-day {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 82px;
    border-bottom: 1px solid var(--line);
  }

  .schedule-compact-day:last-child {
    border-bottom: 0;
  }

  .schedule-compact-date {
    padding: 17px 10px 15px 18px;
  }

  .schedule-compact-date strong,
  .schedule-compact-date span {
    display: block;
  }

  .schedule-compact-date strong {
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 650;
  }

  .schedule-compact-date span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
  }

  .schedule-compact-day.today .schedule-compact-date strong {
    color: var(--primary);
  }

  .schedule-compact-shifts {
    min-width: 0;
    padding: 7px 7px 7px 0;
  }

  .schedule-compact-shift,
  .schedule-compact-empty {
    width: 100%;
    min-height: 68px;
    border: 0;
    border-radius: 11px;
  }

  .schedule-compact-shift {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
    padding: 10px 38px 10px 12px;
    background: var(--shift-bg);
    color: var(--shift-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .schedule-compact-shift + .schedule-compact-shift {
    margin-top: 6px;
  }

  .schedule-compact-time {
    font-size: 12px;
    font-weight: 650;
  }

  .schedule-compact-duration {
    color: var(--shift-duration);
    font-size: 11px;
  }

  .schedule-compact-branch {
    grid-column: 1 / -1;
    overflow: hidden;
    color: var(--shift-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .schedule-compact-arrow {
    position: absolute;
    top: 50%;
    right: 12px;
    display: flex;
    transform: translateY(-50%);
  }

  .schedule-compact-arrow svg {
    width: 15px;
    height: 15px;
  }

  .schedule-compact-empty {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--surface-hover);
    color: var(--muted);
    font-size: 11px;
  }

  /*
   * Работодатель:
   * каждый сотрудник — отдельная карточка.
   */
  .schedule-compact-employee {
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  .schedule-compact-employee:last-child {
    margin-bottom: 0;
  }

  .schedule-compact-person {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .schedule-compact-employee-days .schedule-compact-day:last-child {
    border-bottom: 0;
  }

  .schedule-compact-no-week {
    padding: 18px 16px;
    color: var(--muted);
    font-size: 11px;
  }
}

@media (max-width: 600px) {
  .shift-create-field {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .shift-create-employees > span:first-child {
    padding-top: 0;
  }
}

.shift-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.shift-detail-actions .btn {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
}

.shift-detail-actions #assign-person {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 50px;
}

.shift-detail-actions #edit-shift {
  grid-column: 1;
  grid-row: 2;
}

.shift-detail-actions #cancel-shift {
  grid-column: 2;
  grid-row: 2;
}

.shift-detail-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.shift-detail-team h3 {
  margin: 0;
}

.shift-detail-avatars {
  display: flex;
  align-items: center;
  padding-left: 8px;
}

.shift-detail-avatar {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  overflow: hidden;
  margin-left: -8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--nav-icon);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.shift-detail-avatar:first-child {
  margin-left: 0;
}

.shift-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Calendar controls */
.schedule-toolbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.schedule-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.schedule-actions .btn {
  min-height: 44px;
}

.schedule-actions .btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Calendar day headers: neutral cells, date-only today marker */
.schedule-day-head {
  font-size: 11px;
  font-weight: 600;
}

.schedule-day-head strong {
  font-size: 13px;
  font-weight: 700;
}

.schedule-day-head.today {
  margin: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.schedule-day-head.today strong {
  color: var(--text-strong);
}

.schedule-day-head.today span {
  padding: 3px 7px;
  border-radius: 8px;
  background: var(--calendar-today-head);
  color: var(--blue);
  font-weight: 700;
}

.schedule-day-head.weekend strong,
.schedule-day-head.weekend span,
.schedule-compact-day.weekend .schedule-compact-date strong,
.schedule-compact-day.weekend .schedule-compact-date span {
  color: var(--text-strong);
}

.schedule-day-head.weekend.today span {
  color: var(--blue);
}

.schedule-cell.today {
  background: var(--calendar-today);
}

/* Scheduled-time progress: blue at start, green fills toward the end */
.schedule-shift.shift-progress {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--shift-bg);
}

.schedule-shift.shift-progress::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: var(--shift-progress, 0%);
  background: var(--shift-done-bg);
  transition: width 30s linear;
  pointer-events: none;
}

.schedule-shift.shift-progress:hover {
  background: var(--shift-bg);
}

@media (max-width: 800px) {
  .schedule-toolbar-head {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-navigation {
    flex-wrap: wrap;
  }

  .schedule-actions {
    width: 100%;
    margin-left: 0;
  }

  .schedule-actions .btn {
    flex: 1;
  }
}

.schedule-shift.shift-progress::before {
  z-index: 0;
}

.schedule-shift.shift-progress > * {
  position: relative;
  z-index: 1;
}
/* Calendar dates: unified typography */

.schedule-day-head strong,
.schedule-day-head span,
.schedule-day-head.today strong,
.schedule-day-head.today span,
.schedule-day-head.weekend strong,
.schedule-day-head.weekend span,
.schedule-day-head.weekend.today strong,
.schedule-day-head.weekend.today span {
  color: var(--muted);
  font-weight: 500;
}

/* Schedule wizard */

.schedule-wizard {
  display: grid;
  gap: 24px;
}

.schedule-wizard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.schedule-wizard-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.schedule-wizard-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.schedule-wizard-head .btn {
  flex: 0 0 auto;
}

.schedule-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.schedule-type-card {
  width: 100%;
  min-width: 0;
  min-height: 112px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--field-border);
  border-radius: 14px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.schedule-type-card:hover {
  border-color: var(--focus);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.schedule-type-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.schedule-type-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-hover);
  color: var(--focus);
}

.schedule-type-icon svg {
  width: 17px;
  height: 17px;
}

.schedule-type-content {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.schedule-type-content strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.schedule-type-content > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.schedule-type-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

@media (max-width: 620px) {
  .schedule-wizard {
    gap: 18px;
  }

  .schedule-wizard-head {
    align-items: center;
  }

  .schedule-wizard-head h2 {
    font-size: 18px;
  }

  .schedule-type-grid {
    grid-template-columns: 1fr;
  }

  .schedule-type-card {
    min-height: 0;
  }
}