/* 排期表 */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  table-layout: fixed;
}

.schedule-table th:not(:first-child),
.schedule-table td:not(:first-child) {
  min-width: 72px;
}

.schedule-table thead {
  background: var(--color-bg-alt);
  position: sticky;
  top: 0;
  z-index: 2;
}

.schedule-table th {
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.schedule-table th:first-child {
  width: 100px;
  text-align: left;
  padding-left: 14px;
}

.schedule-table td {
  border: 1px solid var(--color-border);
  padding: 0;
  text-align: center;
  vertical-align: middle;
  height: 42px;
}

.schedule-table td:first-child {
  text-align: left;
  padding: 8px 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: var(--font-size-xs);
  background: var(--color-bg-alt);
}

.schedule-table tbody tr:hover td {
  background: var(--azure-blue-lighter);
}
.schedule-table tbody tr:hover td:first-child {
  background: var(--color-bg-alt);
}

/* 排期单元格状态 */
.schedule-cell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 500;
  transition: background .15s, color .15s, box-shadow .15s;
  user-select: none;
  position: relative;
  padding: 4px 2px;
}

.schedule-cell--available {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.schedule-cell--available:hover {
  background: #c8eec6;
  box-shadow: inset 0 0 0 2px var(--color-success);
}

.schedule-cell--booked {
  background: var(--color-bg);
  color: var(--color-text-tertiary);
  cursor: context-menu;
}
.schedule-cell--booked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 15%;
  right: 15%;
  height: 1px;
  background: var(--color-text-disabled);
}

.schedule-cell--closed {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  cursor: not-allowed;
}
.schedule-cell--closed::before {
  content: "\00D7";
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.schedule-cell--advance {
  background: var(--color-info-bg);
  color: var(--azure-blue);
  cursor: context-menu;
}
.schedule-cell--advance:hover {
  background: #c7e0f4;
  box-shadow: inset 0 0 0 2px var(--azure-blue);
}

.schedule-cell--selected {
  background: var(--azure-blue) !important;
  color: #fff !important;
  font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--azure-blue-active);
}

.schedule-cell--mine {
  background: var(--azure-blue-light);
  color: var(--azure-blue);
  font-weight: 600;
  border-left: 3px solid var(--azure-blue);
}

.schedule-cell--pending {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  animation: az-pulse 2s ease-in-out infinite;
}

.schedule-cell__label {
  font-size: 10px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 右键菜单 */
.schedule-ctx-menu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .06);
  padding: 4px 0;
  font-size: 13px;
  user-select: none;
  animation: ctx-fade-in .12s ease-out;
}

@keyframes ctx-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.schedule-ctx-menu__header {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--color-text);
  transition: background .1s, color .1s;
  white-space: nowrap;
}

.schedule-ctx-menu__item:hover {
  background: var(--color-bg-hover);
  color: var(--azure-blue);
}

.schedule-ctx-menu__item--disabled {
  color: var(--color-text-disabled) !important;
  cursor: not-allowed;
}

.schedule-ctx-menu__item--disabled:hover {
  background: transparent;
  color: var(--color-text-disabled) !important;
}

.schedule-ctx-menu__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.schedule-ctx-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

/* 排期图例 */
.schedule-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  flex-wrap: wrap;
}

.schedule-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-legend__color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.schedule-legend__color--available { background: var(--color-success-bg); }
.schedule-legend__color--booked   { background: var(--color-bg); }
.schedule-legend__color--closed   { background: var(--color-danger-bg); }
.schedule-legend__color--advance  { background: var(--color-info-bg); }
.schedule-legend__color--selected { background: var(--azure-blue); border-color: var(--azure-blue); }
.schedule-legend__color--mine     { background: var(--azure-blue-light); border-color: var(--azure-blue); }

/* 日期选择行 */
.az-date-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.az-date-row__label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.az-date-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.az-date-nav__btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: background .12s, border-color .12s, color .12s;
}
.az-date-nav__btn:hover {
  background: var(--color-bg-alt);
  border-color: var(--azure-blue);
  color: var(--azure-blue);
}

.az-date-nav__current {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text-primary);
  padding: 0 12px;
  min-width: 120px;
  text-align: center;
  white-space: nowrap;
}

/* 周视图标题 */
.week-header {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 0;
}

.week-header__day {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.week-header__day--today {
  color: var(--azure-blue);
  background: var(--azure-blue-lighter);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.week-header__day-name {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.week-header__day-number {
  display: block;
  font-size: var(--font-size-lg);
  margin-top: 2px;
}
