.schedule-sync-trigger[data-tone="attention"] { color: #9a3412; background: #fff7ed; }
.schedule-sync-trigger[data-tone="ready"] { color: #166534; }
.schedule-sync-panel { min-width: 0; border: 1px solid #d7e1e7; border-radius: 9px; padding: 14px; background: #fff; margin-bottom: 14px; }
.schedule-sync-panel p { margin: 8px 0; overflow-wrap: anywhere; line-height: 1.45; }
.schedule-sync-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.schedule-sync-state { font-size: 12px; border-radius: 5px; padding: 4px 7px; background: #f1f5f9; }
.schedule-sync-state.is-attention { color: #9a3412; background: #fff7ed; }
.schedule-sync-state.is-ready { color: #166534; background: #f0fdf4; }
.schedule-sync-timestamp { color: #64748b; font-size: 12px; }
.schedule-sync-exceptions { list-style: none; margin: 14px 0; padding: 0; }
.schedule-sync-exceptions li { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid #e2e8f0; min-width: 0; }
.schedule-sync-exceptions strong { display: block; overflow-wrap: anywhere; }
.schedule-sync-exceptions span { display: block; font-size: 12px; color: #64748b; margin-top: 3px; }
.schedule-sync-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-sync-actions .button { white-space: normal; max-width: 100%; }
.schedule-sync-notice { color: #334155; }
@media (max-width: 760px) {
  .schedule-sync-panel { padding: 12px; }
  .schedule-sync-heading { align-items: flex-start; flex-direction: column; }
  .schedule-sync-trigger { flex: 0 0 auto; }
}

/* Service color remains stable across completion, provider and crew ownership. */
.schedule-category-cleaning { --calendar-color: #0f766e; --calendar-bg: #e3f5f1; }
.schedule-category-christmas { --calendar-color: #7141ac; --calendar-bg: #f1e9fb; }
.schedule-category-time_off { --calendar-color: #94600a; --calendar-bg: #fff2ce; }
.schedule-category-activity { --calendar-color: #245fad; --calendar-bg: #e8f0fc; }
.schedule-view [data-schedule-job-id][class*="schedule-category-"] {
  background: var(--calendar-bg); color: #153548;
  border-color: color-mix(in srgb, var(--calendar-color) 30%, white);
  border-left: 5px solid var(--calendar-color); box-shadow: none;
}
.schedule-view [data-schedule-job-id].schedule-category-time_off { border-style: dashed; border-left-style: solid; }
.schedule-view [data-schedule-job-id].is-custom-schedule-rule { border-top: 3px solid var(--schedule-rule-color); }
.schedule-view [data-schedule-job-id][class*="schedule-category-"] .schedule-card-title { color: var(--calendar-color); font-weight: 650; }
.schedule-category-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 12px 0; color: #425b6d; font-size: 12px; }
.schedule-category-legend span { display: inline-flex; align-items: center; gap: 6px; }
.schedule-category-legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--calendar-color); }
.schedule-category-legend small { color: #607586; }
.schedule-view .schedule-source-health:not(.needs-work):not([open]) { margin-block: 8px; }
@media (max-width: 760px) {
  .schedule-category-legend { gap: 8px 12px; }
  .schedule-category-legend small { flex-basis: 100%; }
}

@media (max-width: 760px) {
  .schedule-view .schedule-command-filters { flex-wrap: wrap; overflow: visible; gap: 6px; }
  .schedule-view .schedule-command-filters > * { min-width: 0; }
}

/* Calendar and map share the workspace; keep secondary detail compact. */
.schedule-view .schedule-command-bar { flex-wrap: wrap; gap: 8px; border: 0; padding: 0 0 8px; background: transparent; }
.schedule-view .schedule-date-cluster { flex: 1 1 auto; }
.schedule-view .schedule-view-cluster { flex-wrap: wrap; margin-left: auto; }
.schedule-view .schedule-command-filters { order: 3; flex: 1 1 100%; gap: 8px; }
.schedule-view .schedule-category-legend { margin: 0; padding: 4px 0; gap: 12px; color: var(--muted); }
.schedule-view .schedule-dispatch-head { background: var(--paper); color: var(--ink); border-color: var(--line); }
.schedule-view .schedule-dispatch-head span { color: var(--muted); }
.schedule-view .schedule-dispatch-layout { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: 12px; }
.schedule-view .schedule-dispatch-layout.has-unscheduled { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.schedule-view .schedule-dispatch-layout.has-unscheduled .schedule-unscheduled-drawer { position: static; grid-column: 1 / -1; grid-row: 2; max-height: 260px; }
.schedule-view .schedule-dispatch-map .schedule-map-canvas { height: clamp(380px, calc(100dvh - 290px), 800px); min-height: 0; }
.schedule-view .schedule-dispatch-calendar .schedule-month-calendar { max-height: calc(100dvh - 240px); grid-template-columns: repeat(7, minmax(0, 1fr)); }
.schedule-view .month-job-pill .christmas-dispatch-badge { padding: 2px 4px; font-size: 10px; background: transparent; border: 0; }
.schedule-view .month-job-pill .christmas-dispatch-badge strong { color: inherit; }
.schedule-map-missing { padding: 8px; background: var(--soft); color: var(--ink); border-radius: 6px; }
.schedule-map-missing summary { cursor: pointer; font-size: 12px; font-weight: 700; }
.schedule-map-missing p { font-size: 12px; color: var(--muted); }
.schedule-map-missing ul { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow: auto; }
.schedule-map-missing button { display: grid; width: 100%; gap: 3px; padding: 8px; text-align: left; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; }
.schedule-map-missing button span { color: var(--muted); font-size: 12px; }
.schedule-map-missing .is-map-highlight { outline: 2px solid var(--teal-dark); }
@media (max-width: 1050px) {
  .schedule-view .schedule-dispatch-layout, .schedule-view .schedule-dispatch-layout.has-unscheduled { grid-template-columns: minmax(0, 1fr); }
  .schedule-view .schedule-dispatch-map { position: static; grid-column: 1; grid-row: 1; }
  .schedule-view .schedule-dispatch-calendar { grid-column: 1; grid-row: 2; }
  .schedule-view .schedule-dispatch-layout.has-unscheduled .schedule-unscheduled-drawer { grid-row: 3; }
  .schedule-view .schedule-dispatch-map .schedule-map-canvas { height: clamp(260px, 38dvh, 400px); }
  .schedule-view .schedule-dispatch-calendar .schedule-month-calendar { max-height: none; }
  .schedule-view .schedule-command-bar { position: static; }
  .schedule-view .schedule-view-cluster { margin-left: 0; flex: 1 1 100%; }
  .schedule-view .schedule-command-filters { flex-wrap: wrap; overflow: visible; }
}

.schedule-view .schedule-map-legend { position: static; background: var(--paper); color: var(--ink); }
.schedule-view .schedule-map-legend span { color: var(--ink); }
.schedule-view .schedule-month-cell.is-outside-month { background: var(--soft); }
@media (max-width: 760px) {
  .schedule-view .schedule-command-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .schedule-view .schedule-command-filters > * { min-width: 0; }
  .schedule-view .schedule-select-filter { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 4px 6px; }
  .schedule-view .schedule-select-filter select { width: 100%; max-width: 100%; min-width: 0; font-size: 11px; }
  .schedule-view .schedule-filter-popover > summary { display: grid; gap: 3px; padding: 4px 6px; min-height: 52px; }
  .schedule-view .schedule-filter-popover > summary strong { overflow: hidden; text-overflow: ellipsis; }
  .schedule-view .schedule-category-legend { gap: 6px 10px; font-size: 11px; }
  .schedule-view .schedule-category-legend small { display: none; }
  .schedule-view .schedule-toolbar { flex: 0 1 auto; }
  .schedule-view .schedule-range { min-width: 48px; padding-inline: 7px; }
}
.schedule-view .schedule-dispatch-map .schedule-map-canvas { order: 0; }
.schedule-view .schedule-dispatch-calendar .schedule-month-cell { min-width: 0; height: auto; grid-template-rows: auto minmax(min-content, auto); }
.schedule-view .schedule-month-jobs { grid-auto-rows: max-content; }
.schedule-view .month-job-pill { min-height: max-content; }
html[data-app-theme="dark"] body .schedule-view [data-schedule-job-id] :is(h3, strong, .schedule-address, .schedule-card-time, .christmas-dispatch-badge) { color: #153548; }
html[data-app-theme="dark"] body .schedule-view .mobile-day-chip { background: var(--paper); color: var(--ink); border-color: var(--line); }
html[data-app-theme="dark"] body .schedule-view .mobile-day-chip.is-selected,
html[data-app-theme="dark"] body .schedule-view .mobile-selected-day > header { background: var(--soft); color: var(--ink); }
.schedule-view .schedule-dispatch-calendar .schedule-month-weekday { min-width: 0; padding-inline: 3px; }

.schedule-view .schedule-dispatch-calendar .schedule-month-cell { min-height: 128px; }
.schedule-view .schedule-month-jobs { min-height: min-content; }
.schedule-view[data-display="map"] .month-job-pill { padding: 4px; gap: 3px; }
.schedule-view[data-display="map"] .month-job-pill .schedule-card-time { padding-right: 0; }
.schedule-view[data-display="map"] .month-job-pill .christmas-dispatch-badge { grid-template-columns: minmax(0, 1fr); padding: 0; }
.schedule-view[data-display="map"] .month-job-pill .christmas-dispatch-badge > svg { display: none; }
