body[data-section="scheduler"] .workspace > :not(.topbar):not(#scheduler) {
  display: none !important;
}

.scheduler-shell {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.scheduler-shell svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scheduler-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.scheduler-heading h2,
.scheduler-section-heading h3 {
  margin: 2px 0 0;
  color: #111827;
  letter-spacing: 0;
}

.scheduler-heading h2 {
  font-size: 1.35rem;
}

.scheduler-heading p:last-child {
  margin: 5px 0 0;
  color: #647281;
}

.scheduler-heading-actions,
.scheduler-settings-actions,
.scheduler-period-controls,
.scheduler-filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scheduler-heading-actions .primary-button svg,
.scheduler-heading-actions .secondary-button svg {
  width: 17px;
  height: 17px;
}

.scheduler-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-left: 4px solid #d7a519;
}

.scheduler-gate span {
  color: #647281;
}

#schedulerWorkspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

#schedulerWorkspace[hidden] {
  display: none;
}

.scheduler-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  border: 1px solid #d6dee5;
  background: #ffffff;
}

.scheduler-metric {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid #d6dee5;
}

.scheduler-metric:last-child {
  border-right: 0;
}

.scheduler-metric span {
  display: block;
  color: #647281;
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.scheduler-metric strong {
  display: block;
  margin-top: 3px;
  color: #111827;
  font-size: 1.55rem;
  line-height: 1.1;
}

.scheduler-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
}

.scheduler-period-controls strong {
  min-width: 150px;
  margin-left: 4px;
  color: #1f2937;
  font-size: 1rem;
}

.scheduler-view-toggle {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  min-height: 38px;
  padding: 3px;
  border: 1px solid #c9d3dd;
  border-radius: 6px;
  background: #eef2f4;
}

.scheduler-view-toggle button {
  min-width: 72px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #596776;
  font-weight: 800;
}

.scheduler-view-toggle button.active {
  background: #ffffff;
  color: #0f5267;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14);
}

.scheduler-filter-controls select,
.scheduler-search input {
  min-height: 40px;
  border: 1px solid #c9d3dd;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
}

.scheduler-filter-controls select {
  padding: 0 30px 0 10px;
}

.scheduler-search {
  position: relative;
  display: block;
}

.scheduler-search svg {
  position: absolute;
  top: 11px;
  left: 10px;
  width: 17px;
  height: 17px;
  color: #718092;
  pointer-events: none;
}

.scheduler-search input {
  width: min(220px, 28vw);
  padding: 0 10px 0 34px;
}

.scheduler-work-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 460px);
  gap: 14px;
  align-items: start;
}

.scheduler-work-area:not(.editor-open) {
  grid-template-columns: minmax(0, 1fr);
}

.scheduler-calendar,
.scheduler-agenda,
.scheduler-editor,
.scheduler-settings {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.scheduler-weekdays,
.scheduler-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
}

.scheduler-calendar {
  overflow-x: auto;
}

.scheduler-weekdays {
  min-width: 784px;
  border-bottom: 1px solid #d6dee5;
  background: #f5f7f8;
}

.scheduler-weekdays span {
  padding: 9px 10px;
  color: #62707e;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.scheduler-calendar-grid {
  min-width: 784px;
  grid-auto-rows: minmax(112px, 1fr);
}

.scheduler-day {
  position: relative;
  min-width: 0;
  padding: 7px;
  border-right: 1px solid #e0e5e9;
  border-bottom: 1px solid #e0e5e9;
  background: #ffffff;
}

.scheduler-day:nth-child(7n) {
  border-right: 0;
}

.scheduler-day.outside-month {
  background: #f7f8f9;
}

.scheduler-day.today {
  box-shadow: inset 0 0 0 2px #0f6f86;
}

.scheduler-day-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  margin: 0 0 5px auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #52606f;
  font-size: 0.78rem;
  font-weight: 800;
}

.scheduler-day.today .scheduler-day-number {
  background: #0f6f86;
  color: #ffffff;
}

.scheduler-day-events {
  display: grid;
  gap: 4px;
}

.scheduler-event-chip {
  display: grid;
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 3px;
  background: #edf4f5;
  color: #155e75;
  text-align: left;
}

.scheduler-event-chip strong,
.scheduler-event-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scheduler-event-chip strong {
  font-size: 0.71rem;
}

.scheduler-event-chip span {
  margin-top: 1px;
  color: #536271;
  font-size: 0.67rem;
}

.scheduler-event-chip.status-complete,
.scheduler-event-chip.status-cancelled {
  opacity: 0.57;
}

.scheduler-event-chip.status-cancelled strong {
  text-decoration: line-through;
}

.scheduler-event-chip.needs-attention {
  box-shadow: inset -3px 0 #b42318;
}

.scheduler-more {
  color: #596776;
  font-size: 0.7rem;
  font-weight: 750;
}

.scheduler-legend {
  display: flex;
  gap: 16px;
  min-width: 784px;
  padding: 10px 12px;
  background: #f7f9fa;
  color: #52606f;
  font-size: 0.72rem;
  font-weight: 750;
}

.scheduler-legend span::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.type-fte { color: #0f6f86 !important; }
.type-ldl { color: #9a6700 !important; }
.type-clean-walk { color: #18794e !important; }
.type-pei-walk { color: #b54708 !important; }

.scheduler-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid #d6dee5;
}

.scheduler-section-heading h3 {
  font-size: 1rem;
}

.scheduler-agenda-list {
  display: grid;
}

.scheduler-agenda-day {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  border-bottom: 1px solid #e0e5e9;
}

.scheduler-agenda-date {
  padding: 15px;
  background: #f7f9fa;
  color: #52606f;
  font-size: 0.78rem;
  font-weight: 800;
}

.scheduler-agenda-items {
  display: grid;
}

.scheduler-agenda-row {
  display: grid;
  grid-template-columns: 78px 12px minmax(160px, 1.4fr) minmax(120px, 0.8fr) minmax(78px, auto) minmax(105px, auto) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf0f2;
  background: #ffffff;
  color: #334155;
  text-align: left;
}

.scheduler-agenda-row:last-child {
  border-bottom: 0;
}

.scheduler-agenda-row button {
  justify-self: end;
}

.scheduler-type-marker {
  width: 9px;
  height: 32px;
  border-radius: 2px;
  background: currentColor;
}

.scheduler-agenda-main {
  min-width: 0;
}

.scheduler-agenda-main strong,
.scheduler-agenda-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scheduler-agenda-main span,
.scheduler-agenda-meta {
  color: #647281;
  font-size: 0.76rem;
}

.scheduler-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #c9d3dd;
  border-radius: 999px;
  background: #f7f9fa;
  color: #455465;
  font-size: 0.7rem;
  font-weight: 800;
}

.scheduler-status.status-confirmed,
.scheduler-status.status-complete {
  border-color: #a7d6c2;
  background: #ecf8f2;
  color: #15603e;
}

.scheduler-status.status-cancelled {
  border-color: #e4b6b2;
  background: #fff1f0;
  color: #9b2c24;
}

.scheduler-status.status-checked-in,
.scheduler-status.status-in-progress {
  border-color: #9cc8d4;
  background: #eaf5f7;
  color: #0f6074;
}

.scheduler-status.status-delayed {
  border-color: #edc77b;
  background: #fff7e5;
  color: #8a5b00;
}

.scheduler-readiness-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid #a9d8c1;
  border-radius: 999px;
  background: #edf8f2;
  color: #15603e;
  font-size: 0.68rem;
  font-weight: 800;
}

.scheduler-readiness-badge.attention,
.scheduler-readiness-badge.blocked {
  border-color: #e4b6b2;
  background: #fff1f0;
  color: #9b2c24;
}

.scheduler-readiness-badge.warning {
  border-color: #edc77b;
  background: #fff7e5;
  color: #8a5b00;
}

.scheduler-empty {
  padding: 34px 18px;
  color: #647281;
  text-align: center;
}

.scheduler-editor {
  position: sticky;
  top: 12px;
}

.scheduler-editor form,
.scheduler-settings form {
  padding: 16px;
}

.scheduler-template-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 7px;
  align-items: end;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #dfe5e1;
}

.scheduler-template-bar label {
  display: grid;
  gap: 5px;
  color: #536171;
  font-size: 0.76rem;
  font-weight: 800;
}

.scheduler-template-bar select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c9d3dd;
  border-radius: 5px;
  background: #fff;
}

.scheduler-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scheduler-form-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #536171;
  font-size: 0.76rem;
  font-weight: 800;
}

.scheduler-form-grid .span-2 {
  grid-column: 1 / -1;
}

.scheduler-form-grid input,
.scheduler-form-grid select,
.scheduler-form-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c9d3dd;
  border-radius: 5px;
  background: #ffffff;
  color: #1f2937;
}

.scheduler-form-grid select[multiple] {
  min-height: 92px;
  padding: 5px;
}

.scheduler-inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
}

.scheduler-equipment-field .scheduler-inline-input {
  grid-template-columns: minmax(0, 1fr) auto;
}

.scheduler-chain-preview {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border-left: 3px solid #0f6f86;
  background: #edf5f6;
  color: #244653;
  font-size: 0.76rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.scheduler-chain-preview strong,
.scheduler-chain-preview span {
  display: block;
}

.scheduler-chain-preview span {
  padding-top: 5px;
  border-top: 1px solid #c9dfe3;
  color: #355966;
}

.scheduler-readiness-card {
  margin-top: 14px;
  padding: 11px 12px;
  border-left: 4px solid #2f7d57;
  background: #edf8f2;
  color: #244d39;
  font-size: 0.78rem;
}

.scheduler-readiness-card.blocked {
  border-left-color: #b42318;
  background: #fff1f0;
  color: #7e251f;
}

.scheduler-readiness-card.warning {
  border-left-color: #b77900;
  background: #fff7e5;
  color: #6f4d0a;
}

.scheduler-readiness-card ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.scheduler-form-grid input,
.scheduler-form-grid select {
  min-height: 40px;
  padding: 0 10px;
}

.scheduler-form-grid textarea {
  padding: 9px 10px;
  resize: vertical;
}

.scheduler-fieldset {
  display: flex;
  gap: 12px;
  margin: 14px 0 0;
  padding: 11px 12px;
  border: 1px solid #d6dee5;
  border-radius: 5px;
}

.scheduler-fieldset legend {
  padding: 0 5px;
  color: #536171;
  font-size: 0.72rem;
  font-weight: 800;
}

.scheduler-fieldset label,
.scheduler-setting-switches label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #3f4d5c;
  font-size: 0.76rem;
  font-weight: 750;
}

.scheduler-recipient-fields {
  margin-top: 14px;
}

.scheduler-form-actions,
.scheduler-settings-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  margin-top: 16px;
}

.scheduler-settings-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.scheduler-setting-switches {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e0e5e9;
}

.scheduler-readiness-list,
.scheduler-lookahead-list {
  display: grid;
}

.scheduler-readiness-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(220px, 1.5fr);
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 70px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid #e0e5e9;
  background: #fff;
  color: #334155;
  text-align: left;
}

.scheduler-readiness-row:hover {
  background: #f7f9fa;
}

.scheduler-readiness-row > span,
.scheduler-readiness-row strong,
.scheduler-readiness-row small {
  display: block;
  min-width: 0;
}

.scheduler-readiness-row small {
  margin-top: 4px;
  color: #647281;
  font-size: 0.72rem;
}

.scheduler-lookahead-actions,
.scheduler-tool-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.scheduler-lookahead-day > header {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid #d6dee5;
  background: #eef2f1;
  color: #485750;
  font-size: 0.76rem;
}

.scheduler-activity-tools {
  display: grid;
  margin-top: 16px;
  border-top: 1px solid #d6dee5;
}

.scheduler-tool-section {
  display: grid;
  gap: 9px;
  padding: 13px 0;
  border-bottom: 1px solid #e0e5e9;
}

.scheduler-tool-section > input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #c9d3dd;
  border-radius: 5px;
}

.scheduler-file-button {
  position: relative;
  overflow: hidden;
}

.scheduler-file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.scheduler-signature {
  display: grid;
  gap: 8px;
}

.scheduler-signature canvas {
  width: 100%;
  height: 145px;
  border: 1px solid #aeb9b3;
  background: #fff;
  touch-action: none;
}

.scheduler-evidence-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scheduler-evidence-list figure {
  min-width: 0;
  margin: 0;
  border: 1px solid #d6dee5;
  background: #fff;
}

.scheduler-evidence-list img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.scheduler-evidence-list figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 7px;
  font-size: 0.68rem;
}

.scheduler-evidence-list figcaption span {
  grid-column: 1;
  color: #647281;
}

.scheduler-evidence-list figcaption button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.scheduler-qr-history {
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: start;
}

#schedulerQrCode {
  width: 116px;
  height: 116px;
  margin: 7px 0;
}

#schedulerQrCode svg {
  display: block;
  width: 116px;
  height: 116px;
}

.scheduler-history-list {
  display: grid;
  max-height: 230px;
  overflow: auto;
}

.scheduler-history-list > div {
  display: grid;
  gap: 2px;
  padding: 7px 0;
  border-bottom: 1px solid #e7ebea;
  font-size: 0.72rem;
}

.scheduler-history-list span,
.scheduler-muted {
  color: #647281;
  font-size: 0.72rem;
}

.scheduler-settings .scheduler-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scheduler-notice {
  min-height: 0;
  margin: 0;
}

@media (max-width: 1180px) {
  .scheduler-heading,
  .scheduler-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .scheduler-heading-actions,
  .scheduler-filter-controls {
    width: 100%;
  }

  .scheduler-search {
    flex: 1;
  }

  .scheduler-search input {
    width: 100%;
  }

  .scheduler-work-area,
  .scheduler-work-area.editor-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .scheduler-editor {
    position: static;
    grid-row: 1;
  }
}

@media (max-width: 760px) {
  .scheduler-heading {
    padding: 14px;
  }

  .scheduler-heading-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .scheduler-heading-actions button {
    min-width: 0;
    padding: 0 8px;
  }

  .scheduler-heading-actions button span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .scheduler-gate {
    align-items: flex-start;
    flex-direction: column;
  }

  .scheduler-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .scheduler-metric:nth-child(even) {
    border-right: 0;
  }

  .scheduler-metric:nth-child(-n + 4) {
    border-bottom: 1px solid #d6dee5;
  }

  .scheduler-period-controls,
  .scheduler-filter-controls {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
  }

  .scheduler-period-controls strong {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    margin: 0 0 3px;
  }

  .scheduler-filter-controls .scheduler-view-toggle,
  .scheduler-filter-controls label {
    min-width: 0;
  }

  .scheduler-filter-controls {
    grid-template-columns: 1fr 1fr;
  }

  .scheduler-search {
    grid-column: 1 / -1;
  }

  .scheduler-form-grid,
  .scheduler-settings .scheduler-form-grid {
    grid-template-columns: 1fr;
  }

  .scheduler-form-grid .span-2 {
    grid-column: auto;
  }

  .scheduler-agenda-day {
    grid-template-columns: 1fr;
  }

  .scheduler-agenda-date {
    padding: 9px 12px;
  }

  .scheduler-agenda-row {
    grid-template-columns: 62px 8px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .scheduler-agenda-row .scheduler-agenda-meta,
  .scheduler-agenda-row .scheduler-status,
  .scheduler-agenda-row .scheduler-readiness-badge {
    display: none;
  }

  .scheduler-readiness-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .scheduler-section-heading:has(.scheduler-lookahead-actions) {
    align-items: flex-start;
    flex-direction: column;
  }

  .scheduler-lookahead-actions {
    width: 100%;
  }

  .scheduler-lookahead-actions .scheduler-view-toggle {
    flex: 1;
  }

  .scheduler-inline-input,
  .scheduler-equipment-field .scheduler-inline-input {
    grid-template-columns: 1fr;
  }

  .scheduler-template-bar {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .scheduler-template-bar .icon-button {
    grid-column: 3;
  }

  .scheduler-fieldset {
    flex-wrap: wrap;
  }

  .scheduler-settings-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scheduler-settings-actions button:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .scheduler-heading-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scheduler-form-actions {
    grid-template-columns: 1fr 1fr;
  }

  .scheduler-form-actions span {
    display: none;
  }

  .scheduler-template-bar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .scheduler-template-bar label {
    grid-column: 1 / -1;
  }

  .scheduler-qr-history,
  .scheduler-evidence-list {
    grid-template-columns: 1fr;
  }
}

@media print {
  body[data-section="scheduler"] .sidebar,
  body[data-section="scheduler"] .topbar,
  body[data-section="scheduler"] .scheduler-heading-actions,
  body[data-section="scheduler"] .scheduler-toolbar,
  body[data-section="scheduler"] .scheduler-metrics,
  body[data-section="scheduler"] .scheduler-calendar,
  body[data-section="scheduler"] .scheduler-editor,
  body[data-section="scheduler"] .scheduler-settings,
  body[data-section="scheduler"] .scheduler-notice {
    display: none !important;
  }

  body[data-section="scheduler"] .app-shell,
  body[data-section="scheduler"] .workspace,
  body[data-section="scheduler"] .scheduler-work-area {
    display: block;
    padding: 0;
  }

  body[data-section="scheduler"] .scheduler-heading,
  body[data-section="scheduler"] .scheduler-agenda {
    display: block !important;
    border: 0;
  }

  .scheduler-agenda-day,
  .scheduler-agenda-row {
    break-inside: avoid;
  }
}
