:root {
  --duty-bg: #fff8dc;
  --duty-border: #f2d27a;
  --duty-text: #76520b;
  --duty-badge-bg: #f7cf58;
  --duty-badge-text: #5d4307;
}

.schedule-editor-page {
  --duty-bg: rgba(255, 196, 35, .18);
  --duty-border: rgba(255, 196, 35, .42);
  --duty-text: #a66c00;
}

.schedule-editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(360px, 1.1fr) minmax(420px, 1.45fr);
  gap: 18px;
  align-items: start;
}

.schedule-editor-card {
  padding: 22px;
}

.schedule-editor-card h2,
.schedule-editor-info h2 {
  margin: 0 0 18px;
  font-size: 18px;
}

.employee-picker label,
.schedule-editor-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.employee-picker input,
.employee-picker select,
.schedule-editor-form input,
.schedule-editor-form select,
.schedule-editor-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 14px;
  font: inherit;
  font-weight: 750;
}

.schedule-editor-employee-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.schedule-editor-employee-list button {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-card);
  color: var(--text);
  padding: 12px;
  cursor: pointer;
  transition: .18s ease;
}

.schedule-editor-employee-list button:hover,
.schedule-editor-employee-list button.selected {
  border-color: rgba(18, 170, 161, .42);
  background: linear-gradient(135deg, rgba(18, 170, 161, .12), rgba(255,255,255,.04));
  box-shadow: 0 10px 26px rgba(18, 170, 161, .12);
}

.schedule-editor-employee-list span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(18, 170, 161, .12);
  color: var(--brand);
  font-weight: 900;
}

.schedule-editor-employee-list b {
  display: grid;
  gap: 4px;
}

.schedule-editor-employee-list small {
  color: var(--muted);
  font-weight: 700;
}

.schedule-show-more {
  width: 100%;
  margin-top: 10px;
}

.schedule-editor-form {
  display: grid;
  gap: 16px;
}

.schedule-day-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.schedule-day-tabs button {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.schedule-day-tabs button:nth-child(3n) {
  border-right: 0;
}

.schedule-day-tabs button:nth-child(n+4) {
  border-top: 1px solid var(--line);
}

.schedule-day-tabs button.selected {
  background: rgba(18, 170, 161, .13);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(18, 170, 161, .45);
}

.schedule-editor-work-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.schedule-editor-duty-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--duty-border);
  border-radius: 16px;
  background: var(--duty-bg);
  padding: 12px 14px;
  color: var(--text);
}

.schedule-editor-duty-row input {
  width: 22px;
  height: 22px;
}

.schedule-editor-duty-row span {
  display: grid;
  gap: 2px;
}

.schedule-editor-duty-row small {
  color: var(--muted);
}

.schedule-editor-form textarea {
  min-height: 94px;
  resize: vertical;
}

.schedule-editor-calendar {
  padding: 22px;
}

.schedule-editor-calendar-head {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.schedule-editor-calendar-head strong {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  text-align: center;
}

.schedule-editor-calendar-head button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  min-height: 46px;
  font-size: 24px;
}

.schedule-editor-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(58px, 1fr));
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.schedule-editor-calendar-grid > b {
  padding: 12px 8px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
}

.schedule-editor-calendar-grid > button {
  min-height: 92px;
  border: 0;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface-card);
  color: var(--text);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  cursor: pointer;
}

.schedule-editor-calendar-grid > button:nth-child(7n + 7) {
  border-right: 0;
}

.schedule-editor-calendar-grid button.muted {
  opacity: .48;
}

.schedule-editor-calendar-grid button.selected {
  background: rgba(18, 170, 161, .12);
  box-shadow: inset 0 0 0 2px rgba(18, 170, 161, .42);
}

.schedule-editor-calendar-grid small,
.schedule-editor-calendar-grid em {
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.schedule-editor-calendar-grid .work small {
  background: rgba(18, 170, 161, .14);
  color: var(--brand);
}

.schedule-editor-calendar-grid .duty small,
.schedule-editor-calendar-grid .duty em {
  background: var(--duty-bg);
  color: var(--duty-text);
}

.schedule-editor-calendar-grid .weekend small,
.schedule-editor-calendar-grid .day-off small {
  background: rgba(118, 132, 157, .12);
  color: var(--muted);
}

.schedule-editor-calendar-grid .vacation small {
  background: rgba(45, 131, 255, .13);
  color: #2d83ff;
}

.schedule-editor-calendar-grid .sick small {
  background: rgba(255, 78, 78, .13);
  color: #e54848;
}

.schedule-editor-calendar-grid .training small {
  background: rgba(154, 91, 255, .14);
  color: #8d55f2;
}

.schedule-editor-calendar-grid .business-trip small {
  background: rgba(20, 180, 210, .13);
  color: #139ab5;
}

.schedule-editor-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 800;
}

.schedule-editor-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.schedule-editor-legend i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
}

.schedule-editor-legend .work { background: var(--brand); }
.schedule-editor-legend .duty { background: #ffc423; }
.schedule-editor-legend .vacation { background: #2d83ff; }

.schedule-editor-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin-top: 18px;
}

.schedule-editor-info {
  display: grid;
  gap: 18px;
  align-content: start;
}

.schedule-editor-info p {
  margin: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.schedule-editor-info span {
  color: var(--text);
  font-weight: 850;
}

.info-note {
  border-radius: 16px;
  padding: 16px;
  background: rgba(45, 131, 255, .10);
  color: var(--muted);
  font-weight: 750;
}

.schedule-editor-today {
  margin-top: 18px;
}

.schedule-editor-today-table {
  display: grid;
}

.schedule-editor-today-table > div {
  display: grid;
  grid-template-columns: 1.4fr 1.3fr 1fr .9fr .7fr;
  gap: 14px;
  align-items: center;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
}

.schedule-editor-today-table > div:first-child {
  color: var(--muted);
  font-size: 13px;
}

.schedule-editor-today-table em {
  justify-self: start;
  border-radius: 10px;
  padding: 7px 10px;
  background: rgba(18, 170, 161, .14);
  color: var(--brand);
  font-style: normal;
  font-weight: 900;
}

.duty-table-badge,
.duty-inline-badge {
  display: inline-flex;
  margin-right: 8px;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--duty-bg);
  color: var(--duty-text);
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}

.duty-inline-badge {
  margin-left: 8px;
  margin-right: 0;
}

.week-cell {
  gap: 5px;
}

.week-cell.duty {
  min-height: 72px;
  padding: 10px 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 16px;
  background: var(--duty-bg);
  color: var(--duty-text);
  box-shadow: inset 0 0 0 1px var(--duty-border);
  line-height: 1.2;
  white-space: normal;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.week-cell.duty:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--duty-border), 0 10px 22px rgba(132, 92, 13, .12);
}

.schedule-duty-cell__center {
  max-width: 100%;
  color: var(--duty-text);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
}

.schedule-duty-cell__time {
  color: var(--duty-text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.week-cell.duty .schedule-duty-cell__badge,
.schedule-duty-cell__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--duty-badge-bg);
  color: var(--duty-badge-text);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.week-cell em {
  display: block;
  width: max-content;
  margin: 4px auto 0;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--duty-bg);
  color: var(--duty-text);
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}

.week-cell.status.vacation { background: rgba(45, 131, 255, .10); color: #2d83ff; }
.week-cell.status.sick { background: rgba(255, 78, 78, .10); color: #e54848; }
.week-cell.status.training { background: rgba(154, 91, 255, .12); color: #8d55f2; }
.week-cell.status.business-trip { background: rgba(20, 180, 210, .12); color: #139ab5; }
.week-cell.status.weekend,
.week-cell.status.day-off { background: var(--surface-card-2); color: var(--muted); }

[data-theme="dark"] .schedule-editor-page {
  --duty-bg: rgba(255, 196, 35, .16);
  --duty-border: rgba(255, 196, 35, .30);
  --duty-text: #ffd569;
}

[data-theme="dark"] {
  --duty-bg: rgba(245, 174, 56, .16);
  --duty-border: rgba(245, 174, 56, .34);
  --duty-text: #ffd27a;
  --duty-badge-bg: rgba(245, 174, 56, .24);
  --duty-badge-text: #ffe4a7;
}

[data-theme="dark"] .schedule-editor-calendar-grid > button,
[data-theme="dark"] .schedule-editor-employee-list button,
[data-theme="dark"] .schedule-day-tabs button {
  background: var(--surface-card);
}

@media (max-width: 1180px) {
  .schedule-editor-layout,
  .schedule-editor-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .schedule-editor-card,
  .schedule-editor-calendar {
    padding: 16px;
  }

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

  .schedule-day-tabs button:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .schedule-day-tabs button:nth-child(2n) {
    border-right: 0;
  }

  .schedule-editor-work-fields,
  .schedule-editor-time {
    grid-template-columns: 1fr;
  }

  .schedule-editor-calendar-grid {
    overflow-x: auto;
    grid-template-columns: repeat(7, 86px);
  }

  .schedule-editor-today-table > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
