.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 10px;
}

.schedule-quick-help {
  color: #27399b;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.schedule-sync-status {
  color: var(--gray-400);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.schedule-sync-status.is-error {
  color: #b42318;
}

.inactive-provider-badge {
  display: inline-block;
  margin: 0 4px 2px 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: var(--fw-bold);
}

#toggleSchedulePivot.active {
  border-color: #405fc5;
  color: #27399b;
  background: #eef2ff;
}

.kind-tabs { display: flex; gap: 5px; flex-wrap: wrap; }

.kind-filter-button {
  padding: 6px 11px;
  border: 1px solid #d8dde5;
  border-radius: 7px;
  color: var(--gray-500);
  background: #fff;
  cursor: pointer;
  font-size: var(--fs-sm);
}

#kindFilter {
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
}

.kind-filter-button.active {
  border-color: #182039;
  color: #fff;
  background: #182039;
  font-weight: var(--fw-bold);
}

.schedule-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 7px 1px 10px;
  color: var(--gray-500);
  font-size: var(--fs-xs);
}

.schedule-legend span { display: inline-flex; align-items: center; gap: 4px; }
.schedule-legend small { color: var(--gray-400); }

.legend-box {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.legend-box.status-done { background: #c8f4df; }
.legend-box.status-noshow { background: #fee0e4; }
.legend-box.status-planned { background: #e0e7ff; }
.legend-box.status-blocked { background: #e2e7ee; }
.legend-box.status-break { background: #fff5d9; }

.matrix-card { padding: 0; overflow: hidden; }

.matrix-card .table-wrap {
  position: relative;
  border: 0;
  border-radius: 0;
  max-height: calc(100vh - 180px);
}

.matrix-card .table-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #ffffffcc);
}

.loading-state { padding: 35px; text-align: center; }

.matrix {
  min-width: 1120px;
  table-layout: fixed;
  font-size: var(--fs-xs);
}

.matrix.pivot-time {
  width: max-content;
  min-width: max(1120px, calc(150px + 108px * var(--pivot-provider-count, 12)));
}

.matrix.pivot-time th:not(:first-child),
.matrix.pivot-time td:not(:first-child) { width: 108px; min-width: 108px; }
.matrix .provider-heading { display: block; margin-top: 3px; white-space: normal; line-height: 1.15; }

.matrix th,
.matrix td {
  padding: 4px;
  text-align: center;
  vertical-align: middle;
}

.matrix th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 36px;
  color: var(--muted);
  background: #fafbfc;
}

.matrix th:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 215px;
  text-align: left;
  padding-left: 10px;
}

.matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 215px;
  padding: 7px 9px;
  text-align: left;
  background: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

.matrix td:first-child .badge { margin-right: 5px; }

.slot-end {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--fw-medium);
}

.matrix-cell {
  position: relative;
  min-width: 70px;
  min-height: 29px;
  padding: 2px;
  border: 0;
  border-radius: 5px;
  background: #fbfcfd;
}

.matrix-cell.blocked {
  display: grid;
  place-items: center;
  background: #e2e7ee;
  color: var(--gray-500);
}

.matrix-cell.break-cell { color: #c98400; background: #fff6dd; }
.matrix-cell.drag-over { outline: 3px solid #3451b255; background: #eef2ff; }
.cell-label { color: inherit; font-size: 10px; }

.reservation-chip {
  display: block;
  min-height: 25px;
  padding: 5px;
  border: 1px solid #b8c6ff;
  border-radius: 5px;
  color: #27399b;
  background: #e2e8ff;
  cursor: grab;
  font-size: var(--fs-sm);
  line-height: var(--lh-tight);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reservation-chip + .reservation-chip { margin-top: 4px; }
.reservation-chip.dragging { opacity: .45; cursor: grabbing; }
.reservation-chip b { font-size: 10px; }
.reservation-chip small { display: block; margin-top: 2px; opacity: .7; font-size: 8px; }
.reservation-chip.status-done { border-color: #a9e9cd; color: #086a4a; background: #cdf5e3; }
.reservation-chip.status-noshow { border-color: #fac2c9; color: #a51c30; background: #fee1e5; }
.reservation-chip.status-canceled { border-color: #d6dae0; color: var(--gray-500); background: #eceff3; text-decoration: line-through; }

.schedule-add-assignment {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 1px solid #91a4e8;
  border-radius: 50%;
  color: #3448a5;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: var(--fw-bold);
  line-height: 17px;
  box-shadow: 0 1px 3px #10182833;
  opacity: .38;
}

.schedule-add-assignment::before {
  content: "";
  position: absolute;
  inset: -14px;
}

.schedule-add-assignment:hover,
.schedule-add-assignment:focus-visible {
  color: #fff;
  background: #405fc5;
  opacity: 1;
}

.schedule-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 20px;
  background: #10182899;
}

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

.schedule-modal {
  width: min(620px, 100%);
  padding: 22px;
  border-radius: var(--sp-3);
  background: #fff;
  box-shadow: var(--sh-modal);
}

.assignment-modal-grid { margin-top: 18px; }

.assignment-auto-table {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #c9d3f3;
  border-radius: 6px;
  color: #27399b;
  background: #f4f6ff;
}

.assignment-auto-table[hidden] { display: none; }
.assignment-auto-table button { padding: 0; border: 0; color: #3451b2; background: transparent; cursor: pointer; text-decoration: underline; }
.assignment-field-help { display: block; min-height: 18px; margin-top: 4px; color: var(--gray-500); }

body.schedule-tv-open { overflow: hidden; }

.schedule-tv-overlay {
  --schedule-tv-scale: 1;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 20);
  display: grid;
  grid-template-rows: auto 8px minmax(0, 1fr) auto;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  color: #f8fbff;
  background: radial-gradient(circle at 80% 0, #213b78 0, #0c1b3e 36%, #071127 75%);
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

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

.schedule-tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(14px, 2vw, 28px);
  min-height: 92px;
  padding: 14px clamp(18px, 2.2vw, 34px);
  border-bottom: 1px solid #ffffff20;
  background: #071127e8;
}

.schedule-tv-title { min-width: 230px; }
.schedule-tv-title p {
  margin: 0 0 4px;
  color: #8fb2ff;
  font-size: 12px;
  font-weight: var(--fw-bold);
  letter-spacing: .12em;
}

.schedule-tv-title h1 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(22px, 2.25vw, 38px);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-tv-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.schedule-tv-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9eb5e4;
  font-size: 12px;
  font-weight: var(--fw-bold);
}

.schedule-tv-controls button,
.schedule-tv-controls select {
  width: auto;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #ffffff2b;
  border-radius: 8px;
  color: #edf3ff;
  background: #ffffff12;
  font: inherit;
}

.schedule-tv-controls select option { color: #101828; background: #fff; }
.schedule-tv-controls button { cursor: pointer; font-weight: var(--fw-bold); }
.schedule-tv-controls button:hover,
.schedule-tv-controls button:focus-visible,
.schedule-tv-controls select:focus-visible { border-color: #8fb2ff; outline: 3px solid #8fb2ff33; }
.schedule-tv-controls button[aria-pressed="true"] { border-color: #52e0af; color: #b8ffe6; background: #0f684f66; }

.schedule-tv-clock {
  min-width: 86px;
  color: #fff;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.schedule-tv-page-label {
  min-width: 88px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #dbe7ff;
  background: #ffffff12;
  font-size: 13px;
  font-weight: var(--fw-bold);
  text-align: center;
}

.schedule-tv-progress { overflow: hidden; background: #ffffff16; }
.schedule-tv-progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #52e0af, #8fb2ff);
  box-shadow: 0 0 14px #52e0afaa;
  transition: width .2s linear;
}

.schedule-tv-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 8px clamp(12px, 1vw, 16px) 6px;
}

.schedule-tv-loading,
.schedule-tv-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: #bcd0ff;
  font-size: clamp(22px, 2vw, 34px);
}

.schedule-tv-matrix {
  width: 100%;
  height: auto;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: #fff;
  background: #08152f;
  font-size: calc(12px * var(--schedule-tv-scale));
}

.schedule-tv-matrix.schedule-tv-fill {
  flex: 1 1 auto;
  height: 100%;
}

.schedule-tv-matrix th,
.schedule-tv-matrix td {
  padding: calc(5px * var(--schedule-tv-scale));
  border: 0;
  border-right: 1px solid #ffffff16;
  border-bottom: 1px solid #ffffff16;
  text-align: center;
  vertical-align: middle;
}

.schedule-tv-matrix thead th {
  height: calc(50px * var(--schedule-tv-scale));
  color: #bcd0ff;
  background: #142a59;
}

.schedule-tv-matrix thead th:first-child {
  width: clamp(175px, 15vw, 285px);
  color: #fff;
  text-align: left;
}

.schedule-tv-matrix thead strong,
.schedule-tv-matrix thead span { display: block; }
.schedule-tv-matrix thead strong { color: #fff; font-size: 1.08em; }
.schedule-tv-matrix thead span { margin-top: 2px; color: #91a8d9; font-size: .76em; }

.schedule-tv-matrix tbody th {
  padding: calc(7px * var(--schedule-tv-scale)) calc(10px * var(--schedule-tv-scale));
  background: #11234b;
  text-align: left;
}

.schedule-tv-matrix tbody th > span {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #bcd0ff;
  background: #ffffff12;
  font-size: .72em;
}

.schedule-tv-matrix tbody th > strong {
  font-size: 1.1em;
  line-height: 1.2;
}

.schedule-tv-matrix .current-slot {
  background: #173f58;
  box-shadow: inset 3px 0 #52e0af, inset -3px 0 #52e0af;
}

.schedule-tv-matrix thead .current-slot {
  color: #072b23;
  background: #52e0af;
  box-shadow: none;
}

.schedule-tv-matrix thead .current-slot strong,
.schedule-tv-matrix thead .current-slot span { color: #072b23; }
.schedule-tv-matrix .break-cell { color: #ffe29a; background: #76561266; }
.schedule-tv-matrix .blocked-cell { color: #c4ccdb; background: #65708666; }

.schedule-tv-reservation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-height: calc(25px * var(--schedule-tv-scale));
  padding: calc(4px * var(--schedule-tv-scale));
  border: 1px solid #7895e5;
  border-radius: 5px;
  color: #fff;
  background: #29438b;
  text-align: left;
}

.schedule-tv-reservation + .schedule-tv-reservation { margin-top: 3px; }
.schedule-tv-reservation strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-tv-reservation span { color: #c9d7ff; font-size: .78em; }
.schedule-tv-reservation.status-done { border-color: #52c79d; color: #d9fff0; background: #12664f; }
.schedule-tv-reservation.status-noshow { border-color: #f58b9a; color: #fff0f2; background: #852c3c; }
.schedule-tv-cell-label { font-size: .85em; font-weight: var(--fw-bold); }
.schedule-tv-cell-label.empty { color: #ffffff42; font-size: 1.3em; }

.schedule-tv-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 8px clamp(18px, 2vw, 30px);
  color: #91a8d9;
  background: #071127e8;
  font-size: 12px;
}

.schedule-tv-footer kbd {
  margin: 0 2px;
  padding: 1px 5px;
  border: 1px solid #ffffff2e;
  border-radius: 4px;
  color: #dbe7ff;
  background: #ffffff12;
  font: inherit;
}

.schedule-tv-footer strong { min-width: 58px; color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.schedule-tv-footer .error { color: #ff9fae; }
.schedule-tv-sync { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-tv-fallback { color: #ffd27d; }
.schedule-tv-fallback[hidden] { display: none; }
.schedule-tv-layout-heading span.ended { color: #ffd27d; }

.schedule-tv-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.schedule-tv-layout-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 0;
  margin-bottom: 6px;
}
.schedule-tv-layout-heading h2 { margin: 0; color: #fff; font-size: clamp(20px, 1.8vw, 30px); }
.schedule-tv-layout-heading span { color: #bcd0ff; font-size: clamp(14px, 1.1vw, 20px); }

.schedule-tv-overlay .schedule-tv-layout-grid {
  --tv-layout-scale: 1;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(var(--layout-cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--layout-rows, 1), minmax(0, 1fr));
  gap: calc(6px * var(--tv-layout-scale));
  max-width: none;
  padding: calc(8px * var(--tv-layout-scale));
  overflow: hidden;
  border-color: #ffffff20;
  background-color: #08152f;
  background-image: none;
}

.schedule-tv-overlay .schedule-tv-layout-grid .layout-cell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  overflow: hidden;
  padding: calc(16px * var(--tv-layout-scale)) calc(6px * var(--tv-layout-scale)) calc(5px * var(--tv-layout-scale));
  border-width: max(1px, calc(2px * var(--tv-layout-scale)));
  border-radius: calc(8px * var(--tv-layout-scale));
  font-size: calc(12px * var(--tv-layout-scale));
}

.schedule-tv-overlay .schedule-tv-layout-grid .layout-cell > .muted {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.schedule-tv-overlay .schedule-tv-layout-grid .layout-assignment {
  flex: 0 0 auto;
  margin-top: auto;
}

.schedule-tv-layout-grid .layout-cell > b { font-size: calc(14px * var(--tv-layout-scale)); }
.schedule-tv-layout-grid .layout-cell > .muted { font-size: calc(10px * var(--tv-layout-scale)); }
.schedule-tv-layout-grid .layout-cell-type { font-size: calc(8px * var(--tv-layout-scale)); }
.schedule-tv-layout-grid .layout-assignment { padding: calc(5px * var(--tv-layout-scale)); }
.schedule-tv-layout-grid .layout-assignment strong { font-size: calc(10px * var(--tv-layout-scale)); }
.schedule-tv-layout-grid .layout-assignment span,
.schedule-tv-layout-grid .layout-assignment small { font-size: calc(7px * var(--tv-layout-scale)); }

@media (max-width: 1200px) {
  .schedule-tv-header { align-items: flex-start; }
  .schedule-tv-title { min-width: 190px; }
  .schedule-tv-footer > span:nth-child(2) { display: none; }
}

@media (max-width: 820px) {
  .schedule-tv-overlay { grid-template-rows: auto 6px minmax(0, 1fr) auto; }
  .schedule-tv-header { flex-direction: column; gap: 8px; min-height: 0; }
  .schedule-tv-controls { justify-content: flex-start; }
  .schedule-tv-title h1 { white-space: normal; }
  .schedule-tv-footer { flex-wrap: wrap; }
}

@media (min-width: 1441px) {
  .matrix:not(.pivot-time) {
    min-width: 0;
    width: 100%;
  }
  .matrix-card .table-wrap:has(.matrix:not(.pivot-time)) {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .schedule-toolbar { flex-wrap: wrap; }
  .schedule-toolbar .header-spacer { display: none; }
  .schedule-quick-help { width: 100%; order: 3; }
  .schedule-modal {
    width: 100%;
    min-height: 100%;
    border-radius: 0;
  }
  .schedule-modal-backdrop { padding: 0; place-items: stretch; }
}

@media (max-width: 480px) {
  .kind-tabs { width: 100%; }
}
