:root {
  --bg: #f2f5f9; --panel: #ffffff; --line: #dde4ec; --text: #1c2733; --muted: #64748b;
  --accent: #1a5fb4; --accent-h: #144a8f; --ok: #1a7f37; --warn: #b45309; --err: #b91c1c;
  --side: #14212f; --side-text: #b8c7d9;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
#login-screen { display: flex; align-items: center; justify-content: center; height: 100vh;
  background: linear-gradient(135deg, #14212f, #1a5fb4); }
.login-box { background: #fff; padding: 34px 38px; border-radius: 12px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-box h1 { font-size: 19px; margin: 0 0 4px; }
.login-box .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
#app { display: none; grid-template-columns: 232px 1fr; min-height: 100vh; }
aside { background: var(--side); color: var(--side-text); padding: 14px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
aside .brand { color: #fff; font-weight: 600; font-size: 15px; padding: 4px 18px 12px; border-bottom: 1px solid #22344a; margin-bottom: 8px; }
aside .brand small { display: block; color: #7b93ad; font-weight: 400; font-size: 11px; }
aside .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #5f7690; padding: 12px 18px 4px; }
aside a { display: block; color: var(--side-text); text-decoration: none; padding: 7px 18px; font-size: 13.5px; border-left: 3px solid transparent; }
aside a:hover { background: #1b2c3f; color: #fff; }
aside a.active { background: #1b3552; color: #fff; border-left-color: #4da3ff; }
main { padding: 0; min-width: 0; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 22px;
  display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 17px; margin: 0; flex: 1; }
.userbox { color: var(--muted); font-size: 12.5px; text-align: right; }
.content { padding: 18px 22px 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 14.5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .num { font-size: 24px; font-weight: 650; }
.card .lbl { color: var(--muted); font-size: 12px; }
.card.warn .num { color: var(--warn); } .card.err .num { color: var(--err); } .card.ok .num { color: var(--ok); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; background: #fff; }
table.grid th { background: #eef3f9; border: 1px solid var(--line); padding: 6px 8px; text-align: left;
  position: sticky; top: 0; z-index: 5; font-weight: 600; white-space: nowrap;
  background-clip: padding-box; box-shadow: inset 0 1px 0 var(--line), inset 0 -1px 0 var(--line); }
table.grid td { border: 1px solid var(--line); padding: 5px 8px; vertical-align: top; }
table.grid tr:hover td { background: #f6faff; }
.tbl-wrap { overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--line); border-radius: 8px; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: none; border-radius: 7px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-h); }
.btn.sec { background: #e7edf5; color: var(--text); } .btn.sec:hover { background: #d8e2ee; }
.btn.danger { background: var(--err); } .btn.small { padding: 3px 9px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--accent); padding: 3px 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
input, select, textarea { border: 1px solid #c3cedd; border-radius: 7px; padding: 6px 9px; font: inherit; background: #fff; }
input:focus, select:focus { outline: 2px solid #bcd7f7; border-color: var(--accent); }
label.f { display: block; margin-bottom: 9px; font-size: 12.5px; color: var(--muted); }
label.f > * { display: block; width: 100%; margin-top: 3px; color: var(--text); }
.badge { display: inline-block; border-radius: 20px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; }
.b-ok { background: #dcf3e3; color: #14622b; } .b-warn { background: #fdeeda; color: #92400e; }
.b-err { background: #fde3e3; color: #991b1b; } .b-mut { background: #e8edf3; color: #475569; }
.b-inf { background: #dbeafe; color: #1e40af; }
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,35,.5); display: flex;
  align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; padding: 20px 22px; width: 640px; max-width: 96vw; box-shadow: 0 25px 70px rgba(0,0,0,.35); }
.modal h3 { margin: 0 0 14px; }
.modal .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal .cols .f-wide { grid-column: 1 / -1; }
.seg-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.seg-tabs button { border: 1px solid #c3cedd; border-radius: 7px; background: #fff; color: var(--muted); padding: 7px 11px; font: inherit; cursor: pointer; }
.seg-tabs button:hover { background: #f1f5f9; }
.seg-tabs button.on { background: #dbeafe; border-color: var(--accent); color: #1e40af; font-weight: 600; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.cell-btn { cursor: pointer; }
.roster-cell { text-align: center; min-width: 34px; padding: 2px 3px !important; font-size: 11.5px; cursor: pointer; }
.rc-work { background: #e8f3ff; } .rc-off { background: #f6f7f9; color: #94a3b8; }
.rc-abs { background: #fdf3e3; color: #92400e; } .rc-rz { background: #eefbe7; color: #3f6212; }
.vio { border-left: 4px solid var(--err); background: #fff5f5; padding: 8px 12px; margin-bottom: 8px; border-radius: 6px; font-size: 13px; }
.vio.w { border-color: var(--warn); background: #fffaf2; }
.vio b { display: block; }
.muted { color: var(--muted); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; background: #14212f; color: #fff; padding: 12px 18px;
  border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 200; max-width: 420px; font-size: 13.5px; white-space: pre-line; }
.toast.err { background: #7f1d1d; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 2px solid var(--line); }
.tabs button { background: none; border: none; padding: 8px 14px; font: inherit; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }

.schedule-hero { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.schedule-kpis { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
.schedule-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(330px, .8fr); gap: 14px; align-items: start; }
.trip-row-error td { background: #fff1f2; }
.trip-row-warning td { background: #fff8ed; }
.timeline { overflow-x: auto; padding-bottom: 4px; }
.timeline-scale { display: grid; gap: 6px; color: var(--muted); font-size: 11px; margin-bottom: 8px; min-width: 760px; }
.timeline-row { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; min-width: 760px; }
.timeline-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.timeline-track { position: relative; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #f8fbff; overflow: hidden; }
.timeline-trip { position: absolute; top: 4px; height: 24px; border: 0; border-radius: 6px; background: #dbeafe; color: #1e40af; font-size: 11px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 6px; }
.timeline-trip:hover { filter: brightness(.96); }
.timeline-trip.bad { background: #fee2e2; color: #991b1b; }
.timeline-trip.lunch { background: #dcf3e3; color: #14622b; }
.timeline-trip.split { background: #fdeeda; color: #92400e; }
.timeline-trip.tech { background: #ccfbf1; color: #0f766e; }
@media (max-width: 1100px) { .schedule-layout { grid-template-columns: 1fr; } }
@media (max-width: 900px) { #app { grid-template-columns: 1fr; } aside { position: relative; height: auto; }
  .topbar { flex-wrap: wrap; } }

.roster-modal { max-width: 960px; width: min(960px, calc(100vw - 40px)); }
.assign-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; }
.assign-list { display:grid; gap:8px; margin:8px 0 12px; }
.assign-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid #d8e2ef; border-radius:8px; background:#f8fafc; }
.assign-editor { border-top:1px solid #d8e2ef; margin-top:10px; padding-top:12px; }
.roster-check { margin-top: 14px; border: 1px solid var(--line, #d8e2ef); border-radius: 10px; background: #fff; }
.roster-check summary { cursor: pointer; font-weight: 700; padding: 12px 14px; }
.roster-check-body { max-height: 320px; overflow: auto; padding: 0 14px 12px; }
.roster-warning { position:relative; padding-right:92px; }
.roster-warning [data-act="close-warning"] { position:absolute; top:10px; right:10px; }
@media (max-width: 760px) {
  .assign-row { align-items:flex-start; flex-direction:column; }
  .roster-warning { padding-right:12px; }
  .roster-warning [data-act="close-warning"] { position:static; margin-bottom:6px; }
}



.summary-toolbar { gap: 10px; align-items: center; flex-wrap: wrap; }
.summary-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }
.summary-kpis > div { border: 1px solid #cbd8e6; border-radius: 8px; padding: 10px 12px; background: #fff; }
.summary-kpis b { display: block; font-size: 22px; color: #17365d; }
.summary-kpis span { color: #607087; font-size: 12px; }
.table-scroll { overflow: auto; max-width: 100%; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.summary-table th { background: #17365d; color: #fff; text-align: left; padding: 8px; position: sticky; top: 0; z-index: 1; }
.summary-table td { border: 1px solid #d8e2ee; padding: 6px 8px; vertical-align: top; }
.sum-ok { background: #e8f7ef; }
.sum-info { background: #eaf3ff; }
.sum-warning, .sum-row-error { background: #fff3cd; }
.sum-error { background: #ffe5d0; }
.sum-critical { background: #f8d7da; }
/* Полноэкранная карточка автобуса */
.vehicle-card { display: grid; gap: 14px; }
.vehicle-card-head { display: grid; grid-template-columns: 210px minmax(260px, 1fr) auto; gap: 18px; align-items: center; background: linear-gradient(135deg, #eef5fc, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.vehicle-cover { width: 210px; height: 135px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: #e7edf5; }
.vehicle-cover.placeholder { display: grid; place-items: center; color: var(--muted); }
.vehicle-identity h2 { margin: 6px 0; font-size: 24px; }
.vehicle-identity p { margin: 5px 0 10px; color: var(--muted); }
.vehicle-actions { display: flex; flex-wrap: wrap; gap: 7px; max-width: 330px; justify-content: flex-end; }
.vehicle-kpis { grid-template-columns: repeat(5, minmax(135px, 1fr)); margin-bottom: 0; }
.vehicle-kpis .num { font-size: 20px; }
.vehicle-report-period { display: flex; justify-content: flex-end; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); }
.vehicle-tabs { display: flex; overflow-x: auto; gap: 3px; border-bottom: 2px solid var(--line); }
.vehicle-tab { flex: 0 0 auto; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 10px 13px; color: var(--muted); cursor: pointer; }
.vehicle-tab:hover { background: #f1f6fb; }
.vehicle-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.vehicle-card-body { min-width: 0; }
.vehicle-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vehicle-empty { border: 1px dashed var(--line); border-radius: 9px; padding: 28px; text-align: center; grid-column: 1 / -1; }
.vehicle-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.vehicle-photo { margin: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 9px; display: grid; gap: 8px; align-content: start; }
.vehicle-photo.cover { box-shadow: 0 0 0 2px #3c88d1; }
.vehicle-photo img { width: 100%; height: 155px; object-fit: cover; border-radius: 7px; }
.vehicle-document { min-height: 135px; display: grid; place-items: center; text-align: center; background: #eef3f9; border-radius: 7px; color: var(--accent); text-decoration: none; padding: 10px; }
.vehicle-photo figcaption { min-height: 55px; }
.vehicle-timeline { position: relative; display: grid; gap: 0; padding-left: 18px; }
.vehicle-timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; border-left: 2px solid #b8cae0; }
.vehicle-timeline-item { position: relative; display: grid; grid-template-columns: 155px 1fr; gap: 14px; padding: 0 0 18px 10px; }
.vehicle-timeline-item::before { content: ""; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent); }
.vehicle-timeline-item time { color: var(--muted); font-size: 12px; }
.vehicle-timeline-item p { margin: 5px 0; }
.incident-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; margin-bottom: 12px; background: #fff; }
.incident-card header { display: flex; justify-content: space-between; gap: 12px; }
.damage-list { display: grid; gap: 6px; margin: 11px 0; }
.damage { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff8ed; border-radius: 7px; padding: 7px 9px; }
.damage.resolved { background: #e8f7ef; }
.incident-actions { display: flex; justify-content: flex-end; gap: 6px; }
.damage-editor { display: grid; grid-template-columns: 1fr 1.6fr 140px auto auto; gap: 6px; margin-bottom: 7px; align-items: center; }
.vehicle-incident-modal { width: 850px; }
@media (max-width: 900px) {
  .vehicle-card-head { grid-template-columns: 120px 1fr; }
  .vehicle-cover { width: 120px; height: 100px; }
  .vehicle-actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .vehicle-kpis { grid-template-columns: repeat(2, 1fr); }
  .vehicle-overview-grid { grid-template-columns: 1fr; }
  .damage-editor { grid-template-columns: 1fr; border: 1px solid var(--line); padding: 8px; border-radius: 8px; }
}
@media print { aside, .topbar, .vehicle-actions, .vehicle-tabs, .vehicle-report-period { display: none !important; } #app { display: block !important; } .content { padding: 0; } .vehicle-card-head { grid-template-columns: 150px 1fr; } }
/* Карточка маршрута */
.route-card { display: grid; gap: 14px; }
.route-card-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, #eef5fc, #fff); }
.route-card-head h2 { margin: 6px 0 3px; font-size: 23px; }
.route-card-head p { margin: 0; color: var(--muted); }
.route-card-status { align-self: flex-start; }
.route-card-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; align-items: flex-start; }
.route-document-open { white-space: nowrap; }
.route-kpis { grid-template-columns: repeat(4, minmax(140px, 1fr)); margin: 0; }
.route-kpis .num { font-size: 21px; }
.route-tabs { display: flex; overflow-x: auto; gap: 3px; border-bottom: 2px solid var(--line); }
.route-tab { flex: 0 0 auto; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 10px 14px; color: var(--muted); cursor: pointer; }
.route-tab:hover { background: #f1f6fb; }
.route-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.route-passport { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.route-direction-switch { display: flex; gap: 6px; margin-bottom: 10px; }
.route-card-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.route-card-toolbar > :first-child { margin-right: auto; }
.route-stop-list { display: grid; gap: 7px; }
.route-stop-row { display: grid; grid-template-columns: 36px minmax(220px, 1fr) minmax(185px, auto) auto; gap: 11px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.route-stop-seq { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #dbeafe; color: #1e40af; font-weight: 700; }
.route-stop-coords { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.route-stop-actions { display: flex; gap: 4px; }
.route-stop-actions button:disabled, .route-card button:disabled { cursor: not-allowed; opacity: .45; }
/* Keep Leaflet panes and controls below application dialogs. */
.route-map { position: relative; isolation: isolate; min-height: 460px; border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow: hidden; }
.route-map-canvas, .route-map-fallback { width: 100%; height: 460px; }
.route-map-canvas[hidden], .route-map-fallback[hidden] { display: none; }
.route-map-fallback { background: linear-gradient(#eef3f9 1px, transparent 1px), linear-gradient(90deg, #eef3f9 1px, transparent 1px), #fff; background-size: 28px 28px; }
.route-map-fallback svg { display: block; width: 100%; height: 100%; }
.route-map polyline { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.route-map-node circle { fill: #fff; stroke: var(--accent); stroke-width: 4; }
.route-map-node { cursor: grab; touch-action: none; }
.route-map-node text { font-size: 12px; fill: var(--text); paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.route-map-marker, .route-leaflet-marker { background: transparent; border: 0; }
.route-map-marker span, .route-leaflet-marker span { display: grid; place-items: center; width: 28px; height: 28px; border: 3px solid #fff; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 2px 7px #0f172a66; }
.route-map-marker-start span { background: #15803d; }
.route-map-marker-end span { background: #b91c1c; }
.route-geometry-control { background: transparent; border: 0; }
.route-geometry-control span { display: block; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; background: #f97316; box-shadow: 0 1px 5px #0f172a88; }
.route-geometry-control.is-selected span { width: 18px; height: 18px; margin: -3px; background: #dc2626; outline: 3px solid #fef08a; }
.route-geometry-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; padding: 10px; border: 1px solid #93c5fd; border-radius: 9px; background: #eff6ff; }
.route-geometry-editor [role="alert"] { flex-basis: 100%; color: var(--err); }
.route-osrm-preview { stroke-dasharray: 10 8; }
.route-map-warning { margin-bottom: 10px; }
.route-map-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 14px; color: var(--muted); font-size: 12px; }
.route-empty { display: grid; place-items: center; min-height: 120px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); text-align: center; padding: 20px; }
.route-map .route-empty { min-height: 460px; border: 0; }
.route-diff { margin: 10px 0; }
.route-diff .tbl-wrap { max-height: 330px; }
.route-card .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.route-card table input { width: 105px; }
.route-depot-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.route-depot-grid { display: grid; gap: 8px; }
.route-depot-row { display: grid; grid-template-columns: 36px minmax(230px, 1fr) 130px 120px 120px auto; gap: 9px; align-items: end; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.route-depot-row > label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 11px; }
.route-depot-row input, .route-depot-row select { width: 100%; min-width: 0; }
.route-depot-error { grid-column: 2 / -1; color: #b91c1c; font-size: 12px; }
.route-document-dialog { width: min(620px, calc(100vw - 32px)); }
.route-document-dialog h3 { margin-top: 0; }
.route-document-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.route-document-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.route-document-fields label:last-child { grid-column: 1 / -1; }
.route-document-fields input, .route-document-fields select { width: 100%; }
.route-period-grid { display: grid; gap: 8px; margin-bottom: 12px; }
.route-period-row { display: grid; grid-template-columns: minmax(130px,1.3fr) 105px 105px 115px 125px 105px 125px 48px auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.route-period-row label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.route-period-row input, .route-period-row select { min-width: 0; width: 100%; }
.route-period-row input[type="color"] { width: 48px; height: 36px; padding: 2px; }
.route-period-actions, .route-template-actions { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.route-period-timeline { display: flex; min-height: 62px; margin: 10px 0 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.route-period-block { display: flex; flex-direction: column; justify-content: center; min-width: 55px; padding: 8px; color: #fff; text-shadow: 0 1px 2px #0008; overflow: hidden; }
.route-period-block span { font-size: 11px; white-space: nowrap; }
.route-demand-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.route-demand-jump { margin-top: 8px; }
.route-preview-times { margin: 12px 0; line-height: 1.8; }
.schedule-preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.schedule-preview-head h3 { margin: 0 0 4px; }
.schedule-preview-departures { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; max-height: 150px; overflow: auto; }
.schedule-preview-departures span { padding: 4px 7px; border-radius: 6px; background: #e8f1fb; color: #1e4f86; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .route-passport { grid-template-columns: 1fr; }
  .route-kpis { grid-template-columns: repeat(2, 1fr); }
  .route-stop-row { grid-template-columns: 36px 1fr; }
  .route-stop-coords, .route-stop-actions { grid-column: 2; }
  .route-card-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .route-period-row { grid-template-columns: 1fr 1fr; }
  .route-period-actions { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .route-card-head { align-items: flex-start; flex-direction: column; }
  .route-card-head-actions { justify-content: flex-start; }
  .route-depot-row { grid-template-columns: 36px repeat(3, minmax(0, 1fr)); align-items: end; }
  .route-depot-stop { grid-column: 2 / -1; }
  .route-depot-row > label:not(.route-depot-stop) { grid-row: 2; }
  .route-depot-row .route-stop-actions, .route-depot-error { grid-column: 2 / -1; }
  .route-document-fields { grid-template-columns: 1fr; }
  .route-document-fields label:last-child { grid-column: auto; }
}
@media (max-width: 767px) {
  .route-map { min-height: 320px; }
  .route-map-canvas, .route-map-fallback { height: 320px; }
  .route-map .route-empty { min-height: 320px; }
}
@media print {
  .route-tabs, .route-card-toolbar, .route-direction-switch, .route-stop-actions, .route-depot-editor-controls, .route-document-dialog, .route-document-dialog-bg { display: none !important; }
  .route-card-head { padding: 8px; }
  .route-period-actions, .route-template-actions { display: none !important; }
  .route-period-row { break-inside: avoid; }
  .route-map { min-height: 360px; }
  .route-map-canvas { display: none !important; }
  .route-map-fallback { display: block !important; height: 360px; }
  .route-map-fallback svg { display: block !important; }
}

.schedule-generation-diff { border-color: #93c5fd; background: #f8fbff; }
.schedule-shift-settings { border-color: #bfdbfe; }
.schedule-shift-settings-grid { display: grid; grid-template-columns: repeat(4, minmax(145px, 1fr)); gap: 10px; margin: 12px 0 6px; }
.schedule-shift-checkbox { display: flex; gap: 7px; align-items: center; align-self: end; min-height: 36px; color: var(--text); font-size: 12px; }
.schedule-shift-checkbox input { width: auto; }
.schedule-shift-error { min-height: 18px; color: #b91c1c; font-size: 12px; }
.schedule-shift-preview { border-color: #93c5fd; background: #f8fbff; }
.schedule-output-group { margin-top: 14px; }
.schedule-output-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.schedule-output-group h4 { margin: 0 0 8px; }
.schedule-output-shifts { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 10px; }
.schedule-shift-card { position: relative; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 1px 2px #0f172a0a; }
.schedule-shift-card-head, .schedule-shift-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px; align-items: center; margin-bottom: 7px; }
.schedule-shift-type { display: inline-flex; gap: 6px; align-items: center; color: var(--text); font-size: 12px; font-weight: 700; }
.schedule-shift-type::before { width: 10px; height: 10px; border-radius: 50%; background: var(--shift-color); content: ""; }
.schedule-driver-slots { color: #1e4f86; font-size: 12px; letter-spacing: 1px; }
.schedule-shift-locked { border-color: #f59e0b; box-shadow: inset 3px 0 #f59e0b; }
.schedule-shift-lock-reason { margin: 8px 0; padding: 6px 8px; border-radius: 6px; background: #fff7d6; color: #78350f; font-size: 12px; }
.schedule-shift-conflict { margin-top: 8px; padding: 8px 10px; border: 1px solid #fecaca; border-radius: 7px; background: #fff1f2; color: #991b1b; }
.schedule-generation-diff .cards { margin-top: 12px; }
.schedule-matrix-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.schedule-stop-matrix {
  max-width: 100%; overflow: auto; max-height: 68vh;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px;
}
.schedule-stop-matrix table { border-collapse: separate; border-spacing: 0; min-width: 100%; background: #fff; }
.schedule-stop-matrix th, .schedule-stop-matrix td {
  min-width: 118px; padding: 7px 9px; border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap;
}
.schedule-stop-matrix thead th {
  position: sticky; top: 0; z-index: 4; background: #eef3f9;
  box-shadow: 0 1px 0 var(--line);
}
.schedule-stop-matrix .schedule-stop-name {
  position: sticky; left: 0; z-index: 3; min-width: 190px; max-width: 260px;
  text-align: left; white-space: normal; background: #f8fafc;
}
.schedule-stop-matrix thead .schedule-stop-name { z-index: 6; background: #e7edf5; }
.schedule-stop-cell { cursor: pointer; line-height: 1.25; }
.schedule-stop-cell:hover { background: #eff6ff; }
.schedule-stop-cell span, .schedule-stop-cell b { display: block; }
.schedule-stop-cell span { color: var(--muted); font-size: 11px; }
.schedule-stop-cell i { display: inline-block; margin-top: 3px; color: #92400e; font-size: 10px; }
.schedule-stop-time-manual { background: #fff7d6; box-shadow: inset 3px 0 #d97706; }
.schedule-stop-time-manual:hover { background: #ffefb0; }

@media (max-width: 980px) {
  .schedule-shift-settings-grid { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
}

@media (max-width: 760px) {
  .schedule-shift-settings-grid, .schedule-output-shifts { grid-template-columns: 1fr; }
  .schedule-preview-head, .schedule-output-head { flex-direction: column; align-items: stretch; }
  .schedule-stop-matrix { max-height: 60vh; }
  .schedule-stop-matrix th, .schedule-stop-matrix td { min-width: 100px; padding: 6px; }
  .schedule-stop-matrix .schedule-stop-name { min-width: 145px; max-width: 175px; }
  .schedule-matrix-filters > * { flex: 1 1 145px; }
}

@media print {
  .schedule-shift-settings .toolbar, .schedule-shift-preview .toolbar,
  .schedule-output-shift-workspace .btn { display: none !important; }
  .schedule-output-shifts { grid-template-columns: repeat(2, 1fr); }
  .schedule-shift-card, .schedule-output-group { break-inside: avoid; box-shadow: none; }
  .schedule-matrix-filters, .schedule-stop-matrix .btn { display: none !important; }
  .schedule-stop-matrix { overflow: visible; max-height: none; border: 0; }
  .schedule-stop-matrix table { font-size: 9pt; }
  .schedule-stop-matrix thead th, .schedule-stop-matrix .schedule-stop-name {
    position: static; box-shadow: none;
  }
  .schedule-stop-time-manual { background: #fff !important; box-shadow: inset 2px 0 #555; }
}

/* Модуль выручки */
.revenue-tab { padding: 8px 0; }
.revenue-tab table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.revenue-tab th, .revenue-tab td { border: 1px solid #d8dee6; padding: 4px 8px; text-align: left; vertical-align: top; }
.revenue-tab td.num { text-align: right; font-variant-numeric: tabular-nums; }
.revenue-shortage { color: #b3261e; font-weight: 600; }
.revenue-status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef2f7; }
.revenue-status-сдан { background: #fff4d6; }
.revenue-status-сверен { background: #eaf4ea; }
.revenue-status-аннулирован { background: #fdecec; color: #8a1f1f; }
@media (max-width: 760px) { .revenue-tab table { font-size: 13px; } }
@media print { .revenue-tab .revenue-toolbar { display: none; } }

/* Паспорт маршрута: действия и примечание */
.route-passport-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.route-comment { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; padding: 6px 8px; }

/* Диспетчер: табло и статусы */
.dispatch-tab { padding: 8px 0; }
.dispatch-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dispatch-summary { margin: 8px 0; }
.dispatch-board { width: 100%; border-collapse: collapse; margin-top: 8px; }
.dispatch-board th, .dispatch-board td { border: 1px solid #d8dee6; padding: 4px 8px; text-align: left; }
.dispatch-board td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dispatch-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.dispatch-status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef2f7; }
.dispatch-status-выпущен { background: #e3f0ff; }
.dispatch-status-на_линии { background: #eaf4ea; }
.dispatch-status-сошёл { background: #fff4d6; }
.dispatch-status-срыв { background: #fdecec; color: #8a1f1f; }
.dispatch-status-замена { background: #f0e8fb; }
@media (max-width: 760px) { .dispatch-board { font-size: 13px; } }
@media print { .dispatch-toolbar, .dispatch-actions { display: none; } }
