.workspace { min-width: 0; width: 100%; }
.workspace main { width: 100%; }
.schedule-heading { align-items: flex-end; }
.schedule-controls { display: grid; gap: 9px; justify-items: end; }
.schedule-view-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: #eef2f7; }
.schedule-view-switch a { min-width: 66px; padding: 7px 11px; border-radius: 8px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 800; }
.schedule-view-switch a.active { color: var(--blue); background: #fff; box-shadow: 0 1px 4px #14243b18; }
.week-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.week-nav a { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 9px 12px; color: var(--ink); font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.calendar-grid.view-day { grid-template-columns: minmax(300px, 760px); }
.calendar-grid.view-month { gap: 7px; overflow-x: visible; }
.calendar-grid.view-month .calendar-day { min-height: 160px; }
.calendar-grid.view-month .calendar-day > header { padding: 9px 10px; }
.calendar-grid.view-month .calendar-jobs { padding: 6px; gap: 5px; }
.calendar-grid.view-month .calendar-job { padding: 7px; }
.calendar-grid.view-month .calendar-job small:not(.job-time), .calendar-grid.view-month .dispatch-panel { display: none; }
.calendar-day { min-height: 320px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.calendar-day > header { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.calendar-day > header span { font-size: 12px; color: var(--muted); font-weight: 700; }
.calendar-day > header strong { font-size: 14px; }
.selected-day { border-color: var(--blue); box-shadow: 0 0 0 2px #1268e518; }
.selected-day > header { background: #eff5ff; }
.calendar-jobs { display: grid; gap: 8px; padding: 9px; }
.calendar-entry { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.calendar-entry.has-conflict { border-color: #e2564d; box-shadow: 0 0 0 2px #e2564d18; }
.calendar-entry.has-conflict .job-time, .calendar-entry.has-conflict .job-time b { color: #b9342c; }
.calendar-entry .calendar-job { border: 0; border-radius: 0; }
.calendar-job { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--ink); background: #fff; text-decoration: none; }
.calendar-job:hover { border-color: var(--blue); background: #f8fbff; text-decoration: none; }
.calendar-job div { display: grid; gap: 3px; min-width: 0; }
.calendar-job strong { font-size: 13px; line-height: 1.25; }
.calendar-job small { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.calendar-job strong, .calendar-job small { text-decoration: none; }
.calendar-job em { grid-column: 2; font-size: 10px; color: #277a48; font-style: normal; font-weight: 800; }
.calendar-visit { border-color: #f3d7b5; background: #fffaf4; }
.calendar-visit:hover { border-color: var(--orange); background: #fff7ec; }
.calendar-visit em { color: #b05b12; }
.visit-icon { width: 8px; height: 8px; margin-top: 5px; color: var(--orange); font-size: 8px; }
.dispatch-panel { border-top: 1px solid #edf0f4; background: #f8fafc; }
.dispatch-panel summary { cursor: pointer; padding: 8px 10px; color: var(--blue); font-size: 11px; font-weight: 800; list-style: none; }
.dispatch-panel summary::-webkit-details-marker { display: none; }
.dispatch-panel summary::before { content: "+"; margin-right: 5px; }
.dispatch-panel[open] summary::before { content: "−"; }
.dispatch-panel form { display: grid; gap: 7px; padding: 0 10px 10px; }
.dispatch-panel label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.dispatch-panel select { width: 100%; min-height: 36px; border: 1px solid #ccd5e1; border-radius: 8px; background: #fff; padding: 6px 8px; font: inherit; font-size: 11px; }
.dispatch-panel input { width: 100%; min-height: 36px; border: 1px solid #ccd5e1; border-radius: 8px; background: #fff; padding: 6px 8px; font: inherit; font-size: 11px; }
.dispatch-panel button { min-height: 36px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 800; cursor: pointer; }
.status-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #87909d; }
.status-in_progress { background: #1268e5; }
.status-paused { background: #e69226; }
.status-completed { background: #27824d; }
.empty-day { padding: 20px 8px; text-align: center; color: var(--muted); font-size: 12px; }
.schedule-note { margin-top: 18px; }
.unscheduled-card { margin-bottom: 18px; }
.unscheduled-list { display: grid; gap: 9px; }
.unscheduled-item { display: grid; grid-template-columns: minmax(190px, 1.4fr) repeat(3, minmax(130px, 1fr)) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.unscheduled-item > div, .unscheduled-item label { display: grid; gap: 4px; }
.unscheduled-item small, .unscheduled-item label span, .unscheduled-item > div span { color: var(--muted); font-size: 11px; }
.unscheduled-item input, .unscheduled-item select { min-height: 40px; border: 1px solid #ccd5e1; border-radius: 9px; background: #fff; padding: 7px 9px; min-width: 0; }
.unscheduled-item button { min-height: 40px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; padding: 8px 16px; font-weight: 800; cursor: pointer; }
.empty-queue { margin: 0; padding: 12px; border-radius: 10px; background: #f7f9fc; color: var(--muted); }
.capacity-section { margin: 0 0 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 12px; }
.capacity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 9px; }
.capacity-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.capacity-card > div:first-child { display: grid; gap: 3px; }
.capacity-card span { color: var(--muted); font-size: 11px; }
.capacity-bar { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 10px; background: #e8edf4; }
.capacity-bar i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.capacity-card.over-capacity { border-color: #e2564d; }
.capacity-card.over-capacity .capacity-bar i { background: #e2564d; }
.route-heading { align-items: flex-end; }
.route-filter { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(170px, .6fr) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.route-filter label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.route-filter select, .route-filter input { min-height: 42px; border: 1px solid #ccd5e1; border-radius: 9px; background: #fff; padding: 8px 10px; font: inherit; }
.route-filter button { min-height: 42px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; padding: 8px 18px; font-weight: 800; cursor: pointer; }
.route-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.route-kpis article { display: grid; gap: 3px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.route-kpis strong { font-size: 22px; }
.route-kpis span { color: var(--muted); font-size: 11px; }
.route-layout { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(420px, 1.1fr); gap: 16px; align-items: start; }
.route-map-card { position: sticky; top: 16px; }
.route-full-link { border: 1px solid #bfd2ef; border-radius: 9px; padding: 8px 10px; color: var(--blue); font-size: 12px; font-weight: 800; }
.route-map { position: relative; min-height: 430px; overflow: hidden; border: 1px solid #dce5ef; border-radius: 15px; background-color: #edf4ef; background-image: linear-gradient(28deg, transparent 46%, #fff 47%, #fff 53%, transparent 54%), linear-gradient(118deg, transparent 47%, #d7e5db 48%, #d7e5db 52%, transparent 53%), radial-gradient(circle at 20% 25%, #dcebdc 0 9%, transparent 10%), radial-gradient(circle at 78% 70%, #dcebdc 0 12%, transparent 13%); }
.route-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.route-map polyline { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.route-marker { position: absolute; z-index: 2; width: 34px; height: 34px; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 50% 50% 50% 10%; background: var(--blue); color: #fff; box-shadow: 0 5px 14px #10243d44; rotate: -45deg; }
.route-marker span { display: grid; place-items: center; width: 100%; height: 100%; font-size: 12px; font-weight: 900; rotate: 45deg; }
.route-map-empty { display: grid; place-items: center; min-height: 430px; color: var(--muted); font-weight: 700; }
.route-warning { margin: 10px 0 0; padding: 9px 11px; border-radius: 9px; background: #fff5e7; color: #985011; font-size: 12px; font-weight: 700; }
.route-timeline { display: grid; gap: 0; }
.route-stop { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 15px; }
.route-stop-number { display: grid; place-items: center; align-self: start; width: 34px; height: 34px; border-radius: 10px; background: #eaf2ff; color: var(--blue); font-weight: 900; }
.route-stop-content { display: grid; gap: 10px; min-width: 0; }
.route-stop-content h3, .route-stop-content p { margin: 0; }
.route-stop-content small { color: var(--blue); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.route-stop-meta { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.route-stop-meta span { overflow-wrap: anywhere; }
.route-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.route-actions a { border: 1px solid #cbd7e6; border-radius: 8px; padding: 7px 9px; color: var(--ink); font-size: 11px; font-weight: 800; }
.route-actions a:nth-last-child(-n+2) { color: var(--blue); background: #f4f8ff; }
.route-leg { display: grid; grid-template-columns: 40px 1fr; gap: 12px; min-height: 48px; align-items: center; padding: 0 15px; color: var(--muted); }
.route-leg span { text-align: center; color: var(--blue); font-size: 22px; }
.route-leg strong { font-size: 11px; }
.route-empty { text-align: center; }
.route-notices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.route-comparison { margin-bottom: 16px; }
.route-comparison .pill { max-width: 240px; text-align: center; }
.route-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.route-compare-grid article { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfd; }
.route-compare-grid h3 { margin: 0 0 9px; font-size: 13px; }
.route-compare-grid ol { display: grid; gap: 6px; margin: 0; padding-left: 25px; color: var(--muted); font-size: 12px; }
.route-compare-actions, .route-move-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 11px; }
.route-compare-actions button, .route-move-actions button { min-height: 36px; border: 1px solid #bfd0e8; border-radius: 8px; background: #f5f9ff; color: var(--blue); padding: 7px 11px; font-size: 11px; font-weight: 800; cursor: pointer; }
.route-compare-actions form:first-child button { border-color: var(--blue); background: var(--blue); color: #fff; }
.route-compare-actions span { color: #277a48; font-size: 12px; font-weight: 800; }
.coordinate-confirm { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.coordinate-confirm summary { cursor: pointer; color: #a75610; font-size: 12px; font-weight: 800; }
.coordinate-confirm > p { margin: 7px 0; color: var(--muted); font-size: 11px; }
.coordinate-confirm > a { color: var(--blue); font-size: 11px; font-weight: 800; }
.coordinate-confirm form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.coordinate-confirm label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.coordinate-confirm input, .coordinate-confirm select, .coordinate-confirm textarea { width: 100%; min-height: 36px; border: 1px solid #ccd5e1; border-radius: 8px; background: #fff; padding: 7px 8px; font: inherit; }
.coordinate-confirm textarea { min-height: 70px; resize: vertical; }
.coordinate-confirm .wide-field { grid-column: 1 / -1; }
.coordinate-confirm button { grid-column: 1 / -1; min-height: 38px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 800; cursor: pointer; }

@media (max-width: 900px) {
  .schedule-heading { align-items: flex-start; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(220px, 1fr)); scroll-snap-type: x proximity; }
  .calendar-day { scroll-snap-align: start; }
  .calendar-grid.view-month { grid-template-columns: repeat(7, minmax(130px, 1fr)); overflow-x: auto; }
  .unscheduled-item { grid-template-columns: 1fr 1fr; }
  .unscheduled-item > div, .unscheduled-item label:last-of-type { grid-column: 1 / -1; }
  .route-layout { grid-template-columns: 1fr; }
  .route-map-card { position: static; }
  .route-kpis { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .schedule-heading { display: grid; gap: 14px; }
  .schedule-controls { width: 100%; justify-items: stretch; }
  .schedule-view-switch { display: flex; }
  .schedule-view-switch a { flex: 1; }
  .week-nav { width: 100%; }
  .week-nav a { flex: 1; text-align: center; }
  .calendar-grid { grid-template-columns: repeat(7, calc(100vw - 70px)); }
  .calendar-day { min-height: 270px; }
  .calendar-grid.view-day { grid-template-columns: 1fr; }
  .calendar-grid.view-month { grid-template-columns: repeat(7, calc(100vw - 70px)); }
  .unscheduled-item { grid-template-columns: 1fr; }
  .unscheduled-item > div, .unscheduled-item label:last-of-type { grid-column: auto; }
  .route-heading { display: grid; gap: 14px; }
  .route-filter { grid-template-columns: 1fr; }
  .route-kpis { grid-template-columns: 1fr 1fr; }
  .route-kpis strong { font-size: 18px; }
  .route-map { min-height: 300px; }
  .route-notices { grid-template-columns: 1fr; }
  .route-compare-grid, .coordinate-confirm form { grid-template-columns: 1fr; }
  .coordinate-confirm .wide-field, .coordinate-confirm button { grid-column: auto; }
}
