:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #dbe3ee;
  --line-strong: #b7c5d8;
  --text: #172033;
  --muted: #617088;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --yellow: #facc15;
  --yellow-soft: #fff7c2;
  --weekly-yellow-fill: #fde68a;
  --red: #ef4444;
  --red-soft: #ffe1e1;
  --weekly-red-fill: #fecaca;
  --purple: #7c3aed;
  --purple-soft: #ede4ff;
  --weekly-purple-fill: #ddd6fe;
  --critical: #dc2626;
  --coverage: #f59e0b;
  --coverage-soft: #fff1d6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 17px;
}

.topbar-actions,
.company-tabs,
.facility-tabs,
.button-row,
.legend,
.week-toolbar,
.output-toolbar,
.inline-checks,
.membership-picker,
.quick-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-danger {
  color: var(--critical);
  background: #fff1f1;
  border-color: #fecaca;
}

.primary-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  padding: 10px 24px 0;
  background: var(--panel);
}

.tab-button,
.company-tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 8px 8px 0 0;
  font-weight: 700;
}

.tab-button.is-active,
.company-tab.is-active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--line);
}

.facility-tabs {
  gap: 6px;
  margin-bottom: 10px;
}

.workspace.is-schedule > .facility-tabs {
  flex-shrink: 0;
}

.management-panel .facility-tabs {
  margin-top: 12px;
}

.facility-tab {
  display: grid;
  grid-template-columns: auto;
  align-content: center;
  min-width: 54px;
  min-height: 40px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.facility-tab strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.05;
}

.facility-tab span {
  max-width: 92px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-tab.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.facility-tab.is-active strong,
.facility-tab.is-active span {
  color: var(--blue);
}

.workspace {
  padding: 18px 24px 28px;
}

.workspace.is-schedule {
  padding-bottom: 14px;
}

.workspace.is-schedule > .toolbar {
  margin-bottom: 10px;
}

.workspace.is-schedule > .schedule-layout {
  grid-template-rows: auto;
}

.toolbar,
.output-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar-spacer {
  flex: 1;
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.combo-field .combo {
  position: relative;
}

.combo-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.combo-field.is-open .combo-trigger {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.combo-chevron {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.combo-list {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  left: 0;
  z-index: 40;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.combo-option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.combo-option:hover,
.combo-option.is-active {
  background: var(--blue-soft);
}

.field input,
.field select,
.table-input,
.order-input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
}

.inline-field {
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.quick-code {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  padding: 7px 12px;
  font-weight: 800;
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.ghost-button,
.quick-code,
.icon-button {
  background: white;
  color: var(--text);
}

.danger-button {
  background: #fff1f1;
  border-color: #fecaca;
  color: var(--critical);
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.workspace.is-schedule .sheet-panel,
.workspace.is-schedule .side-panel {
  align-self: stretch;
}

.workspace.is-schedule .sheet-panel {
  min-width: 0;
  overflow: hidden;
}

.workspace.is-schedule .desktop-sheet {
  display: block;
}

.sheet-panel,
.side-panel,
.management-panel,
.print-sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sheet-title-row,
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sheet-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.yellow {
  background: var(--yellow);
}

.dot.red {
  background: var(--red);
}

.dot.purple {
  background: var(--purple);
}

.dot.critical {
  background: var(--critical);
}

.sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  --shift-date-header-height: 38px;
  --shift-coverage-row-height: 42px;
}

.shift-table,
.management-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.shift-table th,
.shift-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.shift-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.shift-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
}

.sticky-name {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 128px;
  min-width: 128px;
  max-width: 128px;
  background: #f8fafc;
  box-shadow: 1px 0 0 var(--line);
}

.shift-table thead tr:first-child .sticky-name {
  top: 0;
  z-index: 24;
}

.date-header {
  position: sticky;
  top: 0;
  z-index: 21;
  min-width: 72px;
  min-height: 38px;
  box-shadow: 0 1px 0 var(--line);
}

.staff-name {
  height: 52px;
  padding: 0 8px;
  text-align: left;
}

.coverage-row .sticky-name,
.coverage-row .coverage-cell {
  position: sticky;
  top: var(--shift-date-header-height);
  z-index: 21;
  background: #fff;
  box-shadow: 0 1px 0 var(--line);
}

.coverage-row .sticky-name {
  z-index: 24;
  background: #f8fafc;
  box-shadow:
    1px 0 0 var(--line),
    0 1px 0 var(--line);
}

.coverage-cell {
  min-width: 72px;
  min-height: 42px;
  height: auto;
  padding: 4px;
  background: #fff;
  vertical-align: middle;
}

.coverage-row .coverage-cell.has-coverage-alert {
  background: #fff7ed;
}

.facility-pill {
  width: 24px;
  height: 22px;
  margin: 1px;
  border-radius: 4px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 900;
  cursor: grab;
  touch-action: none;
}

.facility-pill.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.shift-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.14),
    0 2px 6px rgba(15, 23, 42, 0.06);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 8px)) scale(0.97);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.shift-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 8px)) scale(1);
}

.shift-tooltip.is-below.is-visible {
  transform: translate(-50%, 8px) scale(1);
}

.shift-tooltip.is-below {
  transform: translate(-50%, 8px) scale(0.97);
}

.shift-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  transform: translateX(-50%) rotate(45deg);
}

.shift-tooltip.is-below::before {
  top: -6px;
  bottom: auto;
  transform: translateX(-50%) rotate(225deg);
}

.cell-picker {
  position: fixed;
  display: grid;
  grid-template-columns: minmax(168px, 1fr) 150px;
  gap: 10px;
  z-index: 10001;
  min-width: 330px;
  max-width: min(440px, calc(100vw - 24px));
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.16),
    0 4px 10px rgba(15, 23, 42, 0.08);
}

.cell-picker-facilities,
.cell-picker-shift-panel {
  min-width: 0;
}

.cell-picker-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.cell-picker-header strong {
  font-size: 13px;
}

.cell-picker-header span {
  color: var(--muted);
  font-weight: 700;
}

.cell-picker-section-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.cell-picker-section-label.is-missing {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffedd5;
  color: #9a3412;
  letter-spacing: 0.02em;
}

.cell-picker-section-label.is-assigned {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  letter-spacing: 0.02em;
}

.cell-picker-section-label:not(:first-of-type) {
  margin-top: 8px;
}

.cell-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.cell-picker-option {
  display: grid;
  gap: 1px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.cell-picker-option strong {
  font-size: 14px;
  line-height: 1.1;
}

.cell-picker-option span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.cell-picker-option.is-missing {
  border-color: #fb923c;
  background: #ffedd5;
  color: #9a3412;
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.18);
}

.cell-picker-option.is-missing span {
  color: #9a3412;
  opacity: 0.78;
}

.cell-picker-option.is-covered {
  border-color: #a7f3d0;
  background: #edfdf5;
  color: #047857;
}

.cell-picker-option.is-assigned {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.cell-picker-option:hover {
  filter: brightness(0.97);
}

.cell-picker-shift-panel {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.cell-picker-shift-list {
  display: grid;
  gap: 6px;
}

.cell-picker-shift-type {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.cell-picker-shift-type strong {
  font-size: 12px;
  line-height: 1.15;
}

.cell-picker-shift-type span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.cell-picker-shift-type.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.cell-picker-shift-type.is-active span {
  color: #1d4ed8;
}

.facility-pill.is-covered {
  background: #edfdf5;
  color: #047857;
}

.facility-pill.is-missing {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fb923c;
}

.has-coverage-alert {
  background: #fff7ed !important;
}

.shift-cell {
  min-width: 72px;
  height: 52px;
  background: #fff;
  padding: 0;
}

.cell-button {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  border: 0;
  background: transparent;
  padding: 4px;
  overflow: hidden;
}

.shift-cell.has-other-location .cell-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.98));
}

.cell-watermarks {
  position: absolute;
  inset: 4px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.shift-watermark {
  display: grid;
  min-width: 48px;
  padding: 2px 6px;
  border: 1px dashed rgba(100, 116, 139, 0.45);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: #64748b;
  line-height: 1.05;
  text-align: center;
  opacity: 0.42;
}

.shift-watermark strong {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.shift-watermark small {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
}

.shift-cell.has-other-location:not(:has(.shift-badge)) .shift-watermark {
  opacity: 0.58;
}

.cell-button .shift-badge,
.cell-button .empty-cell,
.cell-button .cell-warning {
  position: relative;
  z-index: 1;
}

.shift-cell.is-selected {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.shift-cell.is-drop-column {
  background: #f8fbff;
}

.shift-cell.is-drop-target {
  outline: 3px dashed var(--blue);
  outline-offset: -3px;
  background: var(--blue-soft);
}

.shift-cell.is-drop-invalid {
  outline: 2px dashed #cbd5e1;
  outline-offset: -3px;
  background: #f8fafc;
}

.shift-badge {
  display: grid;
  min-width: 46px;
  padding: 3px 4px;
  border-radius: 5px;
  background: var(--facility-color);
  line-height: 1.1;
}

.shift-badge strong {
  font-size: 13px;
}

.shift-badge small {
  font-size: 10px;
  color: #334155;
}

.empty-cell {
  color: #cbd5e1;
  font-weight: 900;
}

.cell-warning {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--critical);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 16px;
}

.is-saturday {
  background: #eaf7ff;
}

.is-sunday {
  background: #fff0ed;
}

.alert-yellow {
  background: var(--yellow-soft);
}

.alert-red {
  background: var(--red-soft);
}

.alert-purple {
  background: var(--purple-soft);
}

.shift-cell.weekly-row-fill.alert-yellow,
.shift-cell.weekly-row-fill.alert-yellow.is-saturday,
.shift-cell.weekly-row-fill.alert-yellow.is-sunday,
.staff-name.weekly-row-fill.alert-yellow {
  background: var(--weekly-yellow-fill) !important;
}

.shift-cell.weekly-row-fill.alert-red,
.shift-cell.weekly-row-fill.alert-red.is-saturday,
.shift-cell.weekly-row-fill.alert-red.is-sunday,
.staff-name.weekly-row-fill.alert-red {
  background: var(--weekly-red-fill) !important;
}

.shift-cell.weekly-row-fill.alert-purple,
.shift-cell.weekly-row-fill.alert-purple.is-saturday,
.shift-cell.weekly-row-fill.alert-purple.is-sunday,
.staff-name.weekly-row-fill.alert-purple {
  background: var(--weekly-purple-fill) !important;
}

.staff-name.weekly-row-fill {
  color: #1e293b;
  font-weight: 800;
}

.alert-critical {
  background: #ffe4e6;
}

.shift-cell.is-duplicate {
  background: #ef4444 !important;
  box-shadow: inset 0 0 0 2px #b91c1c;
}

.shift-cell.is-duplicate .shift-badge {
  background: #ffffff !important;
  box-shadow: 0 0 0 2px #991b1b;
}

.shift-cell.is-duplicate .shift-badge strong {
  color: #b91c1c;
}

.shift-cell.is-duplicate .shift-badge small {
  color: #7f1d1d;
}

.shift-cell.is-duplicate .empty-cell {
  color: #fee2e2;
}

.shift-cell.is-duplicate .cell-warning {
  background: #fff;
  color: #dc2626;
  box-shadow: 0 0 0 2px #991b1b;
}

.shift-cell.is-duplicate.is-selected {
  outline-color: #ffffff;
}

.staff-name.is-duplicate {
  background: #ef4444 !important;
  color: #ffffff;
  box-shadow:
    1px 0 0 #b91c1c,
    inset 0 0 0 1px #b91c1c;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 0;
  background: transparent;
}

.workspace.is-schedule .side-panel {
  align-self: stretch;
}

.inspector {
  flex-shrink: 0;
}

.inspector,
.alert-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.workspace.is-schedule .alert-panel {
  display: block;
  flex-direction: column;
  min-height: auto;
}

@media (min-width: 901px) {
  .app-shell.is-schedule-shell {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 200dvh;
    min-height: 100vh;
    overflow: hidden;
  }

  .app-shell.is-schedule-shell .workspace.is-schedule {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .workspace.is-schedule > .schedule-layout {
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
  }

  .workspace.is-schedule .sheet-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .workspace.is-schedule .desktop-sheet {
    flex: 1;
    min-height: 0;
  }

  .workspace.is-schedule .sheet-scroll {
    height: 100%;
    min-height: 0;
    overflow: auto;
  }

  .workspace.is-schedule .side-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .workspace.is-schedule .alert-panel {
    display: flex;
    flex: 1;
    min-height: 0;
  }
}

.inspector form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.readonly output {
  display: grid;
  place-items: center start;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #f8fafc;
  color: var(--text);
}

.quick-code {
  min-width: 36px;
  padding: 7px 9px;
}

.quick-code.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.mini-alerts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 14px 14px;
}

.mini-alert,
.alert-item {
  border-radius: 6px;
}

.mini-alert {
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 800;
}

.mini-alert.yellow,
.alert-item.yellow {
  background: var(--yellow-soft);
  border-color: var(--yellow);
}

.mini-alert.red,
.alert-item.red {
  background: var(--red-soft);
  border-color: var(--red);
}

.mini-alert.purple,
.alert-item.purple {
  background: var(--purple-soft);
  border-color: var(--purple);
}

.mini-alert.critical,
.alert-item.critical {
  background: #ffe4e6;
  border-color: var(--critical);
}

.mini-alert.coverage,
.alert-item.coverage {
  background: var(--coverage-soft);
  border-color: var(--coverage);
}

.alert-list {
  display: grid;
  flex: 1;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.modal-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
}

.alert-item {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
}

.alert-item.alert-week-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-left-width: 6px;
}

.alert-item.alert-week-row strong {
  white-space: nowrap;
}

.alert-item.alert-week-row span {
  flex: 1;
  text-align: right;
}

.alert-item span {
  color: #475569;
  font-size: 12px;
}

.mobile-sheet {
  display: none;
}

.week-toolbar {
  justify-content: space-between;
  padding: 10px;
}

.management-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.management-panel {
  padding: 16px;
}

.management-panel.wide {
  overflow: auto;
}

.add-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.membership-picker,
.inline-checks {
  align-items: flex-start;
}

.membership-picker label,
.inline-checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #334155;
}

.management-table th,
.management-table td {
  border: 1px solid var(--line);
  padding: 7px;
  text-align: left;
}

.management-table th {
  background: #f8fafc;
}

.order-input {
  width: 70px;
}

.print-sheet {
  overflow: auto;
  padding: 18px;
}

.print-sheet-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.print-sheet-header p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.print-sheet-scroll {
  max-height: none;
  overflow: visible;
}

.print-shift-table {
  min-width: 1200px;
}

.print-shift-table thead,
.print-shift-table .sticky-name,
.print-shift-table .date-header,
.print-shift-table .coverage-row .sticky-name,
.print-shift-table .coverage-row .coverage-cell {
  position: static;
  top: auto;
  box-shadow: none;
}

.cell-button-static {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  padding: 4px;
}

.print-shift-table .facility-pill {
  cursor: default;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.36);
  z-index: 20;
  padding: 16px;
}

.modal {
  width: min(560px, 100%);
  max-height: 80vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.excel-preview-backdrop {
  z-index: 30;
}

.excel-preview-modal {
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100vw - 32px));
  height: min(82vh, 760px);
  max-height: calc(100vh - 32px);
}

.excel-preview-heading {
  align-items: flex-start;
}

.excel-preview-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.excel-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.excel-preview-body {
  flex: 1;
  min-height: 0;
  padding: 12px;
  background: #f8fafc;
}

.excel-preview-frame {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.icon-button {
  width: 34px;
  padding: 0;
  font-size: 22px;
}

.is-flashing {
  animation: flash 1.4s ease;
}

@keyframes flash {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 transparent;
  }
  25%,
  65% {
    box-shadow: inset 0 0 0 4px var(--blue);
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    align-items: center;
    flex-wrap: wrap;
  }

  .toolbar-spacer {
    display: none;
  }

  .workspace {
    padding: 12px;
  }

  .primary-tabs {
    overflow-x: auto;
    padding-inline: 12px;
  }

  .facility-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .facility-tab {
    flex: 0 0 auto;
  }

  .schedule-layout,
  .management-layout {
    grid-template-columns: 1fr;
  }

  .workspace.is-schedule {
    display: block;
    overflow: visible;
    padding-bottom: 28px;
  }

  .workspace.is-schedule > .schedule-layout {
    grid-template-rows: auto;
    overflow: visible;
  }

  .workspace.is-schedule .sheet-panel,
  .workspace.is-schedule .side-panel {
    height: auto;
  }

  .workspace.is-schedule .alert-panel {
    flex: none;
  }

  .desktop-sheet {
    display: none;
  }

  .mobile-sheet {
    display: block;
  }

  .sheet-scroll {
    max-height: 58vh;
  }

  .sticky-name {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
  }

  .date-header,
  .shift-cell,
  .coverage-cell {
    min-width: 58px;
  }

  .shift-badge {
    min-width: 42px;
  }

  .cell-picker {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .cell-picker-shift-panel {
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .cell-picker-shift-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .excel-preview-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .excel-preview-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .excel-preview-actions {
    justify-content: flex-start;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }

  body {
    background: white;
  }

  .topbar,
  .primary-tabs,
  .facility-tabs,
  .toolbar,
  .schedule-layout,
  .management-layout,
  .output-toolbar,
  .modal-backdrop,
  .shift-tooltip,
  .cell-picker {
    display: none !important;
  }

  .workspace {
    padding: 0;
  }

  .print-sheet {
    border: 0;
    padding: 0;
    overflow: visible;
  }

  .print-sheet-scroll {
    overflow: visible;
  }

  .print-shift-table {
    min-width: auto;
    width: 100%;
    font-size: 9px;
  }

  .print-shift-table .shift-cell,
  .print-shift-table .staff-name,
  .print-shift-table .coverage-cell {
    height: 44px;
    min-height: 44px;
  }

  .print-shift-table .cell-button-static {
    min-height: 44px;
  }

  .print-shift-table .shift-badge strong {
    font-size: 11px;
  }

  .print-shift-table .shift-badge small {
    font-size: 8px;
  }

  .print-shift-table .facility-pill {
    width: 20px;
    height: 18px;
    font-size: 9px;
    line-height: 18px;
  }

  .print-shift-table .sticky-name {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
  }

  .print-shift-table .date-header,
  .print-shift-table .shift-cell,
  .print-shift-table .coverage-cell {
    min-width: 48px;
  }

  .print-shift-table .is-saturday,
  .print-shift-table .is-sunday,
  .print-shift-table .has-coverage-alert,
  .print-shift-table .alert-yellow,
  .print-shift-table .alert-red,
  .print-shift-table .alert-purple,
  .print-shift-table .is-duplicate,
  .print-shift-table .shift-badge,
  .print-shift-table .facility-pill.is-covered,
  .print-shift-table .facility-pill.is-missing {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* 労務チェックタブ */
.labor-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.labor-note {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
}
.labor-note p {
  margin: 6px 0 0;
  color: #4a5568;
  line-height: 1.6;
  font-size: 13px;
}
.labor-company {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.labor-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.labor-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.labor-table-scroll {
  overflow-x: auto;
}
.labor-table th,
.labor-table td {
  white-space: nowrap;
  vertical-align: middle;
}
.labor-table .order-input {
  width: 84px;
}
.labor-table .wage-input {
  width: 110px;
}
.labor-table .table-select {
  min-width: 104px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}
.labor-name {
  font-weight: 600;
}
.labor-center {
  text-align: center;
}
.labor-36 {
  font-size: 12px;
  color: #4a5568;
  line-height: 1.55;
}
.labor-flag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #edf2f7;
  font-size: 11px;
}
.labor-flag.danger {
  background: #fed7d7;
  color: #9b2c2c;
}
.labor-judge {
  min-width: 148px;
  text-align: left;
}
.labor-judge small {
  display: block;
  margin-top: 3px;
  color: #4a5568;
  font-size: 11px;
  font-weight: 700;
}
.labor-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.labor-status.eligible {
  border-color: #9ae6b4;
  background: #c6f6d5;
  color: #22543d;
}
.labor-status.not_eligible {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
}
.labor-status.review {
  border-color: #f6ad55;
  background: #fffaf0;
  color: #9c4221;
}
.labor-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 220px;
  margin-top: 5px;
}
.labor-reason {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 6px;
  background: #edf2f7;
  color: #4a5568;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}
.labor-continuity {
  display: grid;
  grid-template-columns: 84px auto;
  gap: 4px 8px;
  align-items: center;
  min-width: 220px;
}
.labor-continuity label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #4a5568;
  font-size: 11px;
  font-weight: 700;
}
.legend-note {
  margin: 6px 0 0;
  font-size: 11px;
  color: #718096;
}
.labor-empty {
  color: #718096;
}
