:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-soft: #faf7f0;
  --ink: #20252b;
  --muted: #667085;
  --line: #ddd6ca;
  --line-strong: #c7bdaf;
  --blue: #246bfe;
  --blue-soft: #e8f0ff;
  --red: #e13b3b;
  --red-soft: #fff0ef;
  --gold: #c28a19;
  --green: #14845c;
  --shadow: 0 18px 60px rgba(32, 37, 43, 0.1);
  --name-col: 174px;
  --day-col: 110px;
  --month-day-count: 31;
  --row-height: 94px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(135deg, rgba(36, 107, 254, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(225, 59, 59, 0.06), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.scheduler-shell {
  display: grid;
  gap: 12px;
  min-height: 100vh;
  padding: 14px;
}

.app-bar,
.board-panel {
  margin: 0 auto;
  max-width: min(1880px, 100%);
  min-width: 0;
  width: 100%;
}

.app-bar {
  align-items: center;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: space-between;
  min-height: 72px;
  overflow: hidden;
  padding: 10px 12px;
}

.brand-block {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  min-width: 188px;
}

.modal-kicker,
.field-label,
.rank-room-title span,
.day-name {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-block h1,
.modal-head h2 {
  letter-spacing: 0;
  margin: 0;
}

.brand-block h1 {
  font-size: 24px;
  line-height: 1.1;
}

.date-tools {
  align-items: center;
  display: flex;
  flex: 1 1 620px;
  flex-wrap: nowrap;
  gap: 7px;
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: thin;
}

.date-tools::-webkit-scrollbar {
  height: 5px;
}

.date-tools::-webkit-scrollbar-thumb {
  background: rgba(102, 112, 133, 0.26);
}

.month-timeline {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  flex: 0 0 auto;
  display: flex;
  gap: 5px;
  min-height: 40px;
  padding: 5px;
}

.month-timeline button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
  min-height: 28px;
  min-width: 28px;
  padding: 4px 8px;
}

.month-timeline button:hover {
  border-color: var(--line-strong);
}

.month-timeline label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.month-timeline span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.month-timeline input {
  font-size: 13px;
  min-height: 28px;
  padding: 3px 6px;
  width: 118px;
}

.room-focus-control {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  flex: 0 0 196px;
  gap: 5px;
  min-height: 40px;
  min-width: 196px;
  padding: 6px 9px;
}

.focus-labels {
  align-items: center;
  display: flex;
  font-size: 11px;
  font-weight: 900;
  justify-content: space-between;
}

.focus-labels span:first-child {
  color: var(--blue);
}

.focus-labels span:last-child {
  color: var(--red);
}

#roomFocusInput {
  --focus-602: 50%;
  accent-color: var(--red);
  background: linear-gradient(90deg, var(--blue) 0, var(--blue) calc(100% - var(--focus-602)), var(--red) calc(100% - var(--focus-602)), var(--red) 100%);
  border: 0;
  height: 10px;
  min-height: 10px;
  padding: 0;
}

.sync-status {
  align-items: center;
  background: #eef8f3;
  border: 1px solid rgba(20, 132, 92, 0.22);
  color: var(--green);
  flex: 0 0 auto;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  min-height: 40px;
  padding: 6px 9px;
  white-space: nowrap;
}

.sync-status.warn {
  background: #fff8e8;
  border-color: rgba(194, 138, 25, 0.3);
  color: #8a5d08;
}

.sync-status.offline {
  background: #f1eee7;
  border-color: var(--line);
  color: var(--muted);
}

input,
select {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 36px;
  outline: none;
  padding: 7px 8px;
}

input:focus,
select:focus {
  border-color: #8fb2ff;
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.12);
}

.primary-button,
.tool-button,
.text-button {
  align-items: center;
  border: 1px solid transparent;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  min-height: 42px;
  padding: 9px 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.date-tools > .tool-button {
  flex: 0 0 auto;
  min-height: 40px;
  min-width: 74px;
  padding: 8px 11px;
}

.primary-button {
  background: #1f2937;
  color: #fffdf8;
}

.tool-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.text-button {
  background: transparent;
  color: #2b61d1;
  min-height: 32px;
  padding: 5px 7px;
}

.primary-button.compact {
  min-height: 36px;
  padding: 7px 10px;
}

.danger-text {
  color: #b42318;
}

.primary-button:hover,
.tool-button:hover,
.text-button:hover {
  box-shadow: 0 10px 28px rgba(32, 37, 43, 0.12);
  transform: translateY(-1px);
}

.board-panel {
  background: rgba(255, 253, 248, 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: calc(100vh - 112px);
  padding: 10px;
}

.mobile-day-panel {
  display: none;
}

.mobile-day-card {
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.mobile-day-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.mobile-day-head strong {
  display: block;
  font-size: 21px;
  line-height: 1.15;
}

.mobile-kicker,
.mobile-day-sub {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 900;
}

.mobile-lock-button {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  width: 38px;
}

.mobile-lock-button.locked {
  background: #f1eee7;
  color: var(--ink);
}

.mobile-date-strip {
  display: flex;
  gap: 6px;
  margin: 0 -10px;
  overflow-x: auto;
  padding: 0 10px 4px;
  scrollbar-width: thin;
}

.mobile-date-pill {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  flex: 0 0 42px;
  gap: 1px;
  min-height: 46px;
  padding: 4px 2px;
  place-items: center;
}

.mobile-date-pill span {
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.mobile-date-pill small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.mobile-date-pill.selected {
  background: #1f2937;
  border-color: #1f2937;
  color: #fffdf8;
}

.mobile-date-pill.selected small {
  color: rgba(255, 253, 248, 0.76);
}

.mobile-date-pill.filled {
  box-shadow: inset 0 -3px 0 rgba(36, 107, 254, 0.24);
}

.mobile-date-pill.locked {
  background: #f1eee7;
}

.mobile-date-pill.selected.locked {
  background: #1f2937;
}

.mobile-day-actions {
  display: grid;
  gap: 7px;
  grid-template-columns: 0.8fr 1.2fr 1fr;
}

.mobile-day-actions .primary-button,
.mobile-day-actions .tool-button {
  min-height: 40px;
  padding: 8px 9px;
  width: 100%;
}

.mobile-anchor-list {
  display: grid;
  gap: 7px;
}

.mobile-anchor-card {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 4px 8px;
  grid-template-columns: minmax(62px, 0.9fr) auto;
  min-height: 58px;
  padding: 8px;
  text-align: left;
}

.mobile-anchor-card.off {
  background: #f7f2e8;
}

.mobile-anchor-name {
  font-size: 15px;
  font-weight: 950;
  min-width: 0;
}

.mobile-anchor-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: right;
}

.mobile-anchor-shifts {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  grid-column: 1 / -1;
  justify-content: flex-start;
  min-height: 24px;
}

.mobile-shift {
  background: #fff;
  border: 1px solid var(--line);
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  min-height: 24px;
  padding: 3px 6px;
}

.mobile-shift.room-503-text {
  border-color: rgba(36, 107, 254, 0.28);
  color: var(--blue);
}

.mobile-shift.room-602-text {
  border-color: rgba(225, 59, 59, 0.32);
  color: var(--red);
}

.mobile-shift.shoot {
  background: #fff8e8;
  border-color: rgba(194, 138, 25, 0.34);
  color: #8a5d08;
}

.mobile-shift.rest,
.mobile-empty.cell-status-strong {
  color: var(--ink);
}

.mobile-empty {
  color: rgba(102, 112, 133, 0.34);
  font-size: 12px;
  font-weight: 900;
}

.modal-head h2 {
  font-size: 20px;
  line-height: 1.2;
}

.room-dot {
  display: inline-block;
  height: 9px;
  width: 9px;
}

.room-503 {
  background: var(--blue);
}

.room-602 {
  background: var(--red);
}

.schedule-board {
  border: 1px solid var(--line);
  max-height: calc(100vh - 170px);
  overflow: auto;
  position: relative;
  scroll-behavior: smooth;
}

.month-grid {
  display: grid;
  grid-template-columns: var(--name-col) repeat(var(--month-day-count), var(--day-col));
  min-width: max-content;
  width: max-content;
}

.grid-corner,
.day-header,
.anchor-cell,
.day-cell,
.handoff-label-cell,
.handoff-cell {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.grid-corner,
.day-header {
  background: #f8f5ee;
  min-height: 58px;
  padding: 7px;
  position: sticky;
  top: 0;
  z-index: 8;
}

.grid-corner {
  left: 0;
  position: sticky;
  z-index: 12;
}

.grid-corner-main {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  min-width: 0;
}

.grid-corner strong {
  display: block;
  font-size: 15px;
  min-width: 0;
}

.grid-corner-month {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 900;
  margin-top: 5px;
}

.board-date-control {
  align-items: center;
  display: grid;
  gap: 3px;
  grid-template-columns: 22px minmax(0, 1fr) 22px;
  margin-top: 5px;
}

.board-date-control button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  min-height: 24px;
  padding: 0;
}

.board-date-control input {
  font-size: 11px;
  min-height: 24px;
  padding: 2px 3px;
}

.day-header {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr) 34px;
  min-height: 56px;
  position: sticky;
}

.day-header.locked {
  background: #efe9dd;
}

.date-lock-button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: #a89e91;
  display: grid;
  height: 15px;
  left: 4px;
  padding: 0;
  place-items: center;
  position: absolute;
  top: 4px;
  width: 15px;
  z-index: 2;
}

.date-lock-button.locked {
  background: rgba(31, 41, 55, 0.07);
  border-color: rgba(31, 41, 55, 0.12);
  color: #1f2937;
}

.date-lock-button:hover {
  background: rgba(31, 41, 55, 0.05);
  border-color: rgba(31, 41, 55, 0.1);
  color: var(--ink);
}

.date-lock-button.locked:hover {
  background: rgba(31, 41, 55, 0.12);
  color: #1f2937;
}

.lock-icon {
  fill: none;
  height: 11px;
  overflow: visible;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
  width: 11px;
}

.day-date {
  font-size: 15px;
  font-weight: 900;
}

.day-title {
  padding-left: 10px;
}

.day-name.weekend {
  color: #b42318;
}

.day-actions {
  display: grid;
  gap: 2px;
}

.day-actions button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  min-height: 17px;
  padding: 1px 2px;
}

.day-actions button:not(:disabled):hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.day-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

.column-resizer {
  bottom: 0;
  cursor: col-resize;
  position: absolute;
  right: -4px;
  top: 0;
  width: 8px;
  z-index: 20;
}

.name-column-resizer {
  bottom: 0;
  cursor: col-resize;
  position: absolute;
  right: -4px;
  top: 0;
  width: 8px;
  z-index: 22;
}

.name-column-resizer:hover {
  background: rgba(36, 107, 254, 0.12);
}

.column-resizer:hover {
  background: rgba(36, 107, 254, 0.12);
}

.row-resizer {
  bottom: -4px;
  cursor: row-resize;
  height: 8px;
  left: 0;
  position: absolute;
  right: 0;
  z-index: 18;
}

.row-resizer:hover {
  background: rgba(36, 107, 254, 0.12);
}

.anchor-cell {
  align-content: center;
  background: #fffaf1;
  display: grid;
  gap: 2px;
  left: 0;
  min-height: var(--row-height);
  padding: 6px 8px;
  position: sticky;
  z-index: 7;
}

.board-anchor-name {
  border: 0;
  border-bottom: 1px solid transparent;
  flex: 1 1 50px;
  font-size: 17px;
  font-weight: 950;
  line-height: 1.12;
  min-height: 23px;
  min-width: 0;
  padding: 2px 0;
  width: auto;
}

.anchor-name-line {
  align-items: center;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.anchor-month-stats {
  color: #81776c;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
  text-align: left;
  white-space: nowrap;
}

.anchor-stats-toggle {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  height: 19px;
  line-height: 1;
  min-height: 19px;
  padding: 0;
  width: 19px;
}

.grid-stats-toggle {
  flex: 0 0 auto;
}

.anchor-stats-toggle:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.anchor-room-labels {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 10px;
  font-weight: 850;
  gap: 3px;
  line-height: 1.1;
  opacity: 0.82;
}

.anchor-room-divider {
  color: #b9afa3;
  font-weight: 900;
}

.anchor-room-503 {
  color: var(--blue);
}

.anchor-room-602 {
  color: var(--red);
}

.day-cell {
  background: var(--surface);
  cursor: pointer;
  display: grid;
  align-items: center;
  min-height: var(--row-height);
  padding: 5px;
  position: relative;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.day-cell:hover,
.day-cell.drop-target {
  background: #f8fbff;
  box-shadow: inset 0 0 0 2px rgba(36, 107, 254, 0.22);
}

.day-cell.off {
  background: #f7f2e8;
}

.day-cell.past {
  background-image: linear-gradient(135deg, rgba(102, 112, 133, 0.06), transparent 42%);
}

.day-cell.locked {
  background-color: #f1eee7;
  cursor: default;
}

.day-cell.locked:hover {
  box-shadow: none;
}

.tail-spacer {
  background: rgba(250, 247, 240, 0.48);
  cursor: default;
  pointer-events: none;
}

.copy-selected {
  box-shadow: inset 0 0 0 2px rgba(31, 41, 55, 0.28);
}

.ops-corner {
  background: #f1f5f2;
}

.ops-day-header {
  background: #f6f7f3;
}

.ops-grid .day-header {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.ops-staff-cell,
.ops-cell {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.ops-staff-cell {
  align-content: center;
  background: #fbf6ea;
  display: grid;
  gap: 2px;
  justify-items: center;
  left: 0;
  min-height: var(--row-height);
  padding: 7px 8px;
  position: sticky;
  text-align: center;
  z-index: 7;
}

.ops-staff-cell strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.12;
}

.ops-staff-name-line {
  align-items: center;
  display: grid;
  gap: 6px;
  justify-content: center;
  justify-items: center;
  min-width: 0;
}

.ops-staff-name-line .anchor-month-stats {
  display: block;
  text-align: center;
  white-space: normal;
}

.ops-cell {
  align-items: center;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  justify-items: center;
  min-height: var(--row-height);
  padding: 5px;
  position: relative;
  text-align: center;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.ops-cell span {
  font-size: 14px;
  font-weight: 850;
  line-height: 1.25;
}

.ops-cell[draggable="true"] {
  cursor: grab;
}

.ops-cell:hover,
.ops-cell.drop-target {
  background: #f8fbff;
  box-shadow: inset 0 0 0 2px rgba(36, 107, 254, 0.22);
}

.ops-cell.off {
  background: #fbefc8;
}

.ops-cell.past {
  background-image: linear-gradient(135deg, rgba(102, 112, 133, 0.06), transparent 42%);
}

.ops-cell.locked {
  background-color: #f1eee7;
  cursor: default;
}

.ops-cell.locked:hover {
  box-shadow: none;
}

.room-503-text {
  color: var(--blue) !important;
}

.room-602-text {
  color: var(--red) !important;
}

.ops-room-none {
  color: var(--ink);
}

.ops-status-text {
  color: var(--ink);
}

.ops-mobile-card .mobile-shift.ops-status-text {
  color: var(--ink);
}

.cell-summary {
  align-content: center;
  display: grid;
  gap: 4px;
  grid-auto-rows: minmax(0, auto);
  height: 100%;
  justify-items: stretch;
  min-height: calc(var(--row-height) - 10px);
}

.cell-empty {
  color: #c9c0b5;
  display: grid;
  font-size: 12px;
  font-weight: 850;
  min-height: 30px;
  padding-top: 0;
  place-items: center;
  text-align: center;
}

.cell-status-faint {
  color: rgba(102, 112, 133, 0.34);
}

.cell-status-strong {
  color: var(--ink);
  font-weight: 950;
}

.assignment-chip {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  font-size: 12px;
  font-weight: 850;
  gap: 4px;
  justify-content: center;
  min-height: 22px;
  min-width: 0;
  padding: 3px 4px;
  text-align: center;
}

.half-day-chip {
  background: #f1eee7;
  border: 1px dashed var(--line-strong);
  color: var(--ink);
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  justify-content: center;
  min-height: 22px;
  padding: 3px 5px;
  text-align: center;
  width: 100%;
}

.assignment-chip[draggable="true"] {
  cursor: grab;
}

.assignment-chip[draggable="false"] {
  cursor: default;
}

.assignment-chip.drop-target {
  box-shadow: inset 0 0 0 2px rgba(31, 41, 55, 0.18);
  transform: translateY(-1px);
}

.assignment-chip.room-503-chip {
  border-color: rgba(36, 107, 254, 0.28);
  color: var(--blue);
}

.assignment-chip.room-602-chip {
  border-color: rgba(225, 59, 59, 0.32);
  color: var(--red);
}

.chip-time {
  color: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-badge {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  margin-left: 0;
  padding: 2px 4px;
}

.chip-badge.override {
  background: #fff4d7;
  color: #8f5f00;
}

.shoot-chip {
  align-items: center;
  background: #fff8e8;
  border: 1px solid rgba(194, 138, 25, 0.34);
  color: #8a5d08;
  display: flex;
  font-size: 10px;
  font-weight: 900;
  gap: 4px;
  justify-content: center;
  min-height: 22px;
  min-width: 0;
  padding: 3px 4px;
  text-align: center;
}

.shoot-time,
.shoot-content {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shoot-time {
  flex: 0 1 auto;
}

.shoot-content {
  flex: 1 1 auto;
}

.handoff-label-cell {
  align-content: center;
  background: #f4e1d0;
  display: grid;
  gap: 5px;
  left: 0;
  min-height: 116px;
  padding: 10px 8px;
  position: sticky;
  text-align: center;
  z-index: 6;
}

.handoff-label-cell strong {
  font-size: 13px;
  font-weight: 950;
}

.handoff-label-cell span {
  font-size: 12px;
  font-weight: 900;
}

.handoff-room-503 strong,
.handoff-room-503 span {
  color: var(--blue);
}

.handoff-room-602 strong,
.handoff-room-602 span {
  color: var(--red);
}

.handoff-cell {
  background: #f7e7d8;
  min-height: 116px;
  padding: 3px;
}

.handoff-cell.locked {
  background: #eee4da;
}

.handoff-cell textarea {
  background: transparent;
  border: 0;
  color: #3f4650;
  display: block;
  font-size: 10px;
  font-weight: 850;
  height: 100%;
  line-height: 1.25;
  min-height: 108px;
  overflow: auto;
  padding: 3px;
  resize: none;
  text-align: left;
  width: 100%;
}

.handoff-cell.manual textarea {
  color: var(--red);
}

.handoff-cell textarea:focus {
  background: rgba(255, 253, 248, 0.64);
  box-shadow: inset 0 0 0 2px rgba(36, 107, 254, 0.18);
}

.handoff-cell textarea:disabled {
  color: rgba(63, 70, 80, 0.68);
  cursor: not-allowed;
}

.handoff-cell.manual textarea:disabled {
  color: rgba(225, 59, 59, 0.72);
}

.modal-backdrop {
  align-items: center;
  background: rgba(21, 26, 31, 0.48);
  display: grid;
  inset: 0;
  padding: 18px;
  place-items: center;
  position: fixed;
  z-index: 40;
}

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

.wide-modal,
.cell-modal,
.confirm-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px rgba(21, 26, 31, 0.28);
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 16px;
  width: min(1120px, 100%);
}

.cell-modal,
.confirm-modal {
  width: min(560px, 100%);
}

.modal-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.add-anchor-form {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(160px, 1fr) 110px 110px auto auto;
  margin-bottom: 14px;
}

.ranking-board {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rank-room {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 12px;
}

.rank-room-title {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.rank-room-title strong {
  font-size: 18px;
}

.rank-list {
  display: grid;
  gap: 8px;
}

.rank-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 34px minmax(0, 1fr) 72px auto;
  min-height: 48px;
  padding: 7px;
}

.rank-card[draggable="true"] {
  cursor: grab;
}

.rank-card.drag-over {
  border-color: #1f2937;
  box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.1);
}

.rank-badge {
  align-items: center;
  background: #1f2937;
  color: #fffdf8;
  display: grid;
  font-weight: 950;
  height: 34px;
  place-items: center;
  width: 34px;
}

.anchor-name-input {
  border: 0;
  border-bottom: 1px solid transparent;
  font-size: 15px;
  font-weight: 850;
  min-width: 0;
  width: 100%;
}

.rank-input {
  width: 100%;
}

.delete-button,
.slot-remove,
.slot-action {
  background: #faf7f0;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 900;
  min-height: 32px;
  min-width: 32px;
}

.slot-editor {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ops-staff-editor {
  display: grid;
  gap: 8px;
}

.ops-staff-row {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(120px, 1fr) 150px 150px auto auto 34px;
  padding: 8px;
}

.ops-staff-row input,
.ops-staff-row select {
  min-width: 0;
  width: 100%;
}

.ops-excluded-check {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  gap: 5px;
  white-space: nowrap;
}

.slot-room-group {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 12px;
}

.slot-room-title {
  align-items: center;
  display: flex;
  font-weight: 900;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.slot-row {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px;
  margin-bottom: 7px;
}

.cell-editor {
  display: grid;
  gap: 12px;
}

.ops-editor {
  display: grid;
  gap: 10px;
}

.ops-editor-row {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding: 9px;
}

.ops-editor-summary {
  background: #f6f7f3;
  border: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding: 10px;
}

.ops-editor-summary strong {
  font-size: 16px;
}

.ops-editor-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.ops-split-editor {
  display: grid;
  gap: 8px;
}

.ops-segment-row {
  align-items: end;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr);
  padding: 9px;
}

.cell-status-row {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 9px;
}

.cell-status-row label {
  display: grid;
  gap: 6px;
}

.shoot-editor {
  background: #fff9ec;
  border: 1px solid rgba(194, 138, 25, 0.28);
  display: grid;
  gap: 8px;
  padding: 9px;
}

.shoot-editor-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.shoot-list {
  display: grid;
  gap: 8px;
}

.shoot-row {
  align-items: end;
  display: grid;
  gap: 7px;
  grid-template-columns: 92px 92px minmax(0, 1fr) auto;
}

.shoot-row input {
  width: 100%;
}

.day-settings-board {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ops-day-settings-board {
  grid-template-columns: 1fr;
}

.day-setting-row {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr) 112px;
  padding: 8px;
}

.ops-day-setting-row {
  grid-template-columns: minmax(80px, 0.75fr) minmax(90px, 0.85fr) 96px 132px 92px minmax(100px, 1fr);
}

.ops-day-segments {
  display: grid;
  gap: 5px;
}

.ops-day-segment {
  align-items: center;
  display: grid;
  gap: 5px;
  grid-template-columns: 18px minmax(72px, 1fr) minmax(72px, 1fr);
}

.ops-day-segment small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.day-setting-name {
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-setting-current {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-assignment-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.add-assignment-row.with-shoot {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.cell-assignment-list {
  display: grid;
  gap: 8px;
}

.cell-assignment {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto auto;
  min-height: 46px;
  padding: 8px;
}

.cell-assignment strong {
  display: block;
}

.cell-assignment span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 850;
}

:fullscreen body,
:fullscreen .scheduler-shell {
  background: var(--bg);
}

:fullscreen .scheduler-shell {
  gap: 8px;
  min-height: 100vh;
  padding: 8px;
}

:fullscreen .app-bar {
  min-height: 58px;
  padding: 8px 10px;
}

:fullscreen .brand-block {
  min-width: 190px;
}

:fullscreen .brand-block h1 {
  font-size: 20px;
}

:fullscreen .tool-button,
:fullscreen .primary-button {
  min-height: 36px;
  padding: 7px 10px;
}

:fullscreen .board-panel {
  min-height: calc(100vh - 78px);
}

:fullscreen .schedule-board {
  max-height: calc(100vh - 86px);
}

.rule-list,
.insight-list {
  display: grid;
  gap: 8px;
}

.rule-list {
  margin-bottom: 14px;
}

.rule-list p,
.insight-item {
  background: var(--surface-soft);
  border-left: 4px solid var(--line-strong);
  color: #4b5563;
  line-height: 1.5;
  margin: 0;
  padding: 9px 10px;
}

.insight-item.warning {
  border-left-color: var(--gold);
}

.insight-item.error {
  border-left-color: var(--red);
}

.insight-item.success {
  border-left-color: var(--green);
}

.confirm-modal p {
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
  white-space: pre-line;
}

.toast {
  background: #1f2937;
  bottom: 18px;
  box-shadow: 0 16px 44px rgba(21, 26, 31, 0.24);
  color: #fffdf8;
  left: 50%;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 20px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .scheduler-shell {
    gap: 8px;
    padding: 8px;
  }

  .app-bar {
    align-items: flex-start;
    gap: 8px;
    min-height: 0;
    padding: 9px;
  }

  .date-tools {
    flex: 1 1 auto;
    justify-content: flex-start;
    width: 100%;
  }

  .brand-block {
    min-width: 136px;
  }

  .brand-block h1 {
    font-size: 20px;
  }

  .month-timeline,
  .room-focus-control,
  .sync-status,
  .date-tools > .tool-button {
    min-height: 36px;
  }

  .room-focus-control {
    flex-basis: 178px;
    min-width: 178px;
  }

  .date-tools > .tool-button {
    min-width: auto;
    padding: 7px 9px;
  }

  .ranking-board,
  .slot-editor,
  .add-anchor-form,
  .day-settings-board,
  .day-setting-row,
  .add-assignment-row,
  .add-assignment-row.with-shoot,
  .shoot-row,
  .ops-segment-row,
  .ops-day-setting-row,
  .ops-day-segment {
    grid-template-columns: 1fr;
  }

  .schedule-board {
    max-height: 58vh;
  }
}

@media (max-width: 720px) {
  body {
    background: var(--bg);
  }

  .scheduler-shell {
    padding: 6px;
  }

  .app-bar {
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .date-tools {
    gap: 6px;
  }

  .month-timeline span,
  .sync-status,
  .date-tools > .tool-button {
    font-size: 10px;
  }

  .month-timeline input {
    width: 112px;
  }

  .room-focus-control {
    flex-basis: 164px;
    min-width: 164px;
  }

  .board-panel {
    box-shadow: none;
    display: grid;
    gap: 8px;
    min-height: auto;
    padding: 7px;
  }

  .mobile-day-panel {
    display: block;
  }

  .schedule-board {
    max-height: 44vh;
    -webkit-overflow-scrolling: touch;
  }

  .month-grid {
    grid-template-columns: 132px repeat(var(--month-day-count), minmax(92px, var(--day-col)));
  }

  .anchor-cell {
    padding: 6px;
  }

  .board-anchor-name {
    font-size: 13px;
  }

  .anchor-name-line {
    grid-template-columns: minmax(42px, 1fr) 17px;
  }

  .anchor-month-stats {
    display: none;
  }

  .anchor-room-labels {
    font-size: 10px;
    gap: 3px;
  }

  .day-header {
    min-height: 54px;
    padding: 6px;
  }

  .day-title {
    padding-left: 8px;
  }

  .day-date {
    font-size: 14px;
  }

  .day-actions button {
    font-size: 9px;
    min-height: 17px;
  }

  .day-cell {
    padding: 4px;
  }

  .assignment-chip,
  .shoot-chip {
    font-size: 10px;
    min-height: 22px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 8px;
  }

  .wide-modal,
  .cell-modal,
  .confirm-modal {
    border-radius: 0;
    max-height: 88vh;
    padding: 13px;
    width: 100%;
  }

  .modal-head {
    align-items: flex-start;
    gap: 8px;
  }

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

  .mobile-day-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .brand-block h1 {
    font-size: 18px;
  }

  .mobile-day-head strong {
    font-size: 19px;
  }

  .mobile-anchor-card {
    grid-template-columns: minmax(58px, 1fr) auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-bar,
  .modal-backdrop {
    display: none;
  }

  .scheduler-shell {
    padding: 0;
  }

  .board-panel {
    border: 0;
    box-shadow: none;
    max-width: none;
  }

  .schedule-board {
    max-height: none;
    overflow: visible;
  }
}
