/* ORDERS and REPORTS (Maxoptra parity, docs/parity/ORDERS-REPORTS-spec.md): list-page options, calendar and chips widgets,
   the Maxoptra confirmation, the filter and order dialogs, the report frames. Kept in its own file so the shared stylesheets
   (app.css, pages.css) stay untouched while other screens are changed in parallel. */

/* ------------------------------------------------------------------ list page: primary Filter button, search clear, pager */
.tb-btn.tb-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.tb-btn.tb-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.search-box .search-clear { width: 22px; border-left: 0; background: transparent; color: #9A9EAE; flex: none; padding: 0; }
.search-box .search-clear[hidden] { display: none; }
.search-box .search-clear:hover { color: var(--text); }
.pager .pg-jump { color: #B4B7C2; letter-spacing: -1px; font-size: 11px; }
.pager .pg-jump:hover:not(:disabled) { color: var(--blue); }
.pager .pg-size { margin-left: 6px; height: 28px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: var(--text); padding: 0 6px; font-size: 13px; }
.empty-inbox { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #B4B7C2; }
.empty-inbox .ic { stroke-width: 1.2; }
.grid tbody tr.clickrow { cursor: pointer; }
.listpage.openclick .grid tbody tr { cursor: pointer; }
.hdr-controls { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }

/* ------------------------------------------------------------------ floating panel (Visibility of columns) */
.float-panel { position: fixed; z-index: 1200; top: 94px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 6px 22px rgba(15,58,39,.22); display: flex; flex-direction: column; }
.fp-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 6px 14px; }
.fp-title { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.fp-x { color: #555B6E; padding: 2px; }
.fp-body { padding: 4px 14px 6px; max-height: 60vh; overflow: auto; border-top: 1px solid var(--line-soft); }
.fp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--line-soft); }
.fp-foot .btn { min-width: 62px; min-height: 28px; }
.collist-mx { display: flex; flex-direction: column; }
.cp-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.cp-row:last-child { border-bottom: 0; }
.cp-row.dragging { opacity: .45; }
.cp-row.drop-above { box-shadow: 0 -2px 0 var(--blue); }
.cp-row.drop-below { box-shadow: 0 2px 0 var(--blue); }
.cp-handle { background: none; border: 0; padding: 2px; color: #B4B7C2; cursor: grab; display: flex; align-items: center; }
.cp-handle:hover { color: var(--text); }
.cp-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; }

/* ------------------------------------------------------------------ Maxoptra confirmation */
.dlg-mx-confirm { border-radius: 8px; }
.mx-confirm-head { display: flex; align-items: center; gap: 6px; padding: 18px 22px 4px; }
.mx-confirm-head .dlg-title { font-size: 18px; font-weight: 700; color: var(--text-strong); }
.mx-warn { width: 16px; height: 16px; border-radius: 50%; background: var(--warning); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dlg-mx-confirm .dlg-body { padding: 8px 22px 6px 44px; }
.dlg-mx-confirm .dlg-footer { border-top: 0; padding: 8px 22px 18px; }
.dlg-mx-confirm .dlg-footer .btn { min-width: 52px; }

/* ------------------------------------------------------------------ calendar popover and picker fields */
.cal-pop { position: fixed; z-index: 2100; background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 6px 22px rgba(15,58,39,.22); padding: 8px 10px 6px; font-size: 13px; color: var(--text); }
.cal-main { display: flex; gap: 14px; align-items: flex-start; }
.cal-month { width: 224px; }
.cal-head { display: flex; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.cal-nav { width: 24px; height: 24px; background: none; border: 0; color: #8A8FA0; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
button.cal-nav:hover { color: var(--blue); }
.cal-title { flex: 1; text-align: center; font-weight: 700; color: var(--text-strong); }
.cal-dow, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-dow span { height: 26px; line-height: 26px; color: var(--text-strong); }
.cal-day { height: 28px; background: none; border: 1px solid transparent; border-radius: 2px; padding: 0; color: var(--text-strong); font-size: 13px; }
.cal-day:hover { background: var(--blue-tint); }
.cal-day.other { color: #B4B7C2; }
.cal-day.today { border-color: var(--blue); }
.cal-day.inrange { background: var(--blue-tint); }
.cal-day.sel, .cal-day.sel:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.cal-time { display: flex; gap: 2px; border-left: 1px solid var(--line-soft); padding-left: 8px; }
.cal-tlist { height: 224px; overflow: auto; width: 44px; display: flex; flex-direction: column; }
.cal-tcell { background: none; border: 0; height: 26px; flex: none; text-align: center; padding: 0; color: var(--text-strong); border-radius: 2px; }
.cal-tcell:hover { background: var(--blue-tint); }
.cal-tcell.sel { background: var(--blue-tint-2); font-weight: 700; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-soft); margin-top: 6px; padding-top: 6px; }
.cal-foot .btn { min-height: 24px; padding: 0 12px; font-size: 12px; }
.cal-link { color: var(--blue-link); font-size: 13px; }

.pickerfield { position: relative; display: block; width: 100%; min-width: 0; }
.pickerfield .pf-text { width: 100%; height: 30px; border: 1px solid #CED2DA; border-radius: 3px; background: #fff; padding: 0 28px 0 9px; font-size: 14px; color: var(--text); min-width: 0; }
.pickerfield .pf-text::placeholder { color: #B0B3BF; }
.pickerfield .pf-text:hover:not(:disabled) { border-color: #AEB3BF; }
.pickerfield .pf-text:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(15,58,39,.18); }
.pickerfield .pf-text:disabled { background: #EEF0F4; color: #8A8FA0; cursor: not-allowed; }
.pf-icon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; background: none; border: 0; padding: 0; color: #B0B3BF; display: flex; align-items: center; justify-content: center; }
.pf-clear { display: none; }
.pickerfield.has-value:hover .pf-cal { display: none; }
.pickerfield.has-value:hover .pf-clear { display: flex; color: #8A8FA0; }
.pickerfield .pf-clear:hover { color: var(--text); }

/* ------------------------------------------------------------------ multi-select with chips */
.multiselect { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 3px; width: 100%; min-height: 30px; padding: 2px 26px 2px 4px; border: 1px solid #CED2DA; border-radius: 3px; background: #fff; cursor: text; }
.multiselect:hover { border-color: #AEB3BF; }
.multiselect:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(15,58,39,.18); }
.mxs-chips { display: contents; }
.mxs-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 4px 0 8px; background: #F5F5F5; border: 1px solid #EDEDED; border-radius: 2px; font-size: 13px; color: var(--text-strong); max-width: 100%; }
.mxs-chip-x { background: none; border: 0; padding: 2px; color: #8A8FA0; display: inline-flex; align-items: center; }
.mxs-chip-x:hover { color: var(--text); }
.mxs-input { flex: 1 1 24px; min-width: 24px; border: 0; outline: 0; background: transparent; height: 24px; padding: 0 5px; font-size: 14px; }
.mxs-input:focus-visible { box-shadow: none; }
.mxs-chev, .mxs-clear { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); color: #8A8FA0; display: flex; align-items: center; }
.mxs-clear { background: none; border: 0; padding: 0; display: none; }
.mxs-clear:hover { color: var(--text); }
.multiselect.has-value .mxs-chev { display: none; }
.multiselect.has-value .mxs-clear { display: flex; }
.multiselect.is-disabled { background: #EEF0F4; cursor: not-allowed; }
.mxs-pop { position: fixed; z-index: 2100; max-height: 240px; overflow: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: 3px; box-shadow: 0 6px 22px rgba(15,58,39,.22); padding: 3px 0; }
.mxs-opt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px; color: var(--text-strong); }
.mxs-opt:hover, .mxs-opt.active { background: #F5F5F5; }
.mxs-opt.on { background: var(--blue-tint); font-weight: 700; }
.mxs-opt .mxs-label { flex: 1; }
.mxs-tick { color: var(--blue); }
.mxs-empty { padding: 14px 10px; text-align: center; color: var(--muted); }
.mxs-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ------------------------------------------------------------------ ORDERS: Filter dialog (T/092) */
.dlg-filter { font-size: 12px; }
.dlg-filter .dlg-header { padding: 10px 14px 8px; }
.dlg-filter .dlg-body { padding: 14px 16px 6px; overflow: visible; }
.of-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 22px; }
.of-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.of-label { flex: 0 0 136px; white-space: nowrap; padding-top: 7px; color: var(--text); font-size: 12px; line-height: 1.2; }
.of-control { flex: 1; min-width: 0; }
.dlg-filter .multiselect, .dlg-filter .pickerfield .pf-text, .dlg-filter .mx-input { font-size: 12px; }
.dlg-filter .mxs-chip { font-size: 12px; }

/* ------------------------------------------------------------------ new-order dialog (T/143, T/144) */
.dlg-neworder .od-footer { justify-content: flex-end; }
.mx-input.od-box.od-edit, textarea.mx-input.od-box.od-edit { background-color: #fff; border-color: #CED2DA; color: var(--text-strong); }
.mx-input.od-box.od-edit:focus { border-color: var(--blue); }
.mx-input.invalid, .mx-input.od-box.od-edit.invalid, .loc2.invalid, .pickerfield.invalid .pf-text { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.prio-wrap { position: relative; width: 100%; }
.prio-sq { position: absolute; left: 9px; top: 8px; width: 12px; height: 12px; border-radius: 2px; pointer-events: none; }
.prio-sel { padding-left: 28px; }
.loc2 { position: relative; display: flex; align-items: flex-start; gap: 8px; width: 100%; min-height: 48px; padding: 7px 150px 7px 9px; border: 1px solid #CED2DA; border-radius: 3px; background: #fff; cursor: pointer; line-height: 1.35; }
.loc2:hover { border-color: #AEB3BF; }
.loc2:not(.filled) { padding-right: 112px; }
.loc2-ic { flex: none; margin-top: 2px; color: #B0B3BF; }
.loc2-text { flex: 1; min-width: 0; color: var(--text-strong); }
.loc2-ph { color: #B0B3BF; }
.loc2-btn { position: absolute; top: 6px; background: none; border: 0; padding: 3px; color: #8A8FA0; display: none; }
.loc2-edit { right: 124px; } .loc2-clear { right: 102px; }
.loc2.filled .loc2-btn { display: flex; }
.loc2-btn:hover { color: var(--text); }
.loc2-note { color: #B0B3BF; font-size: 12px; }
.loc2-form { border: 1px solid var(--line-strong); border-radius: 3px; padding: 8px 10px 6px; background: #FAFAFA; }
.loc2-form[hidden] { display: none; }
.loc2-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.loc2-line label { flex: 0 0 96px; font-size: 12px; }
.loc2-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.od-rule { border-top: 1px solid var(--line); margin: 6px 0 4px; }
.od-new .od-opw .pickerfield { width: 140px; }
.od-none .empty-inbox { padding: 20px 0; }

.dlg-order .pickerfield .pf-text { font-size: 12px; height: 28px; }
.dlg-order .pickerfield .pf-icon { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ REPORTS: navigation and grid frame (T/105, T/107, T/111, T/112) */
.sidebar.reports-nav { width: 180px; padding: 8px 0 16px; }
.reports-nav .side-h { font-size: 16px; color: var(--text-strong); padding: 0 8px; margin: 0 0 8px; line-height: 24px; }
.reports-nav .side-item { min-height: 26px; padding: 0 8px; font-size: 12px; color: var(--muted-2); }
.reports-nav .side-item:hover { color: var(--text); background: transparent; }
.reports-nav .side-item.active { color: var(--blue); }
.reports-nav .side-item.active::before { width: 3px; }
.report-area { background: #fff; }
.report-area > .report-panel { margin: 6px; }
.list-title.report-head { min-height: 44px; height: auto; padding: 5px 12px 5px 14px; flex-wrap: wrap; row-gap: 6px; }
.report-head h1 { white-space: nowrap; }
.report-head .hdr-controls { flex-wrap: wrap; row-gap: 6px; justify-content: flex-end; }
.report-head.compact .hdr-controls { gap: 8px; }
.report-head.compact .rh-ctl { gap: 4px; }
.report-head.compact .rh-text, .report-head.compact .rh-select { width: 96px; }
.report-head.compact .rh-ctl .pickerfield { width: 118px; }
.report-head.compact .rh-btn { padding: 0 10px; }
.report-head h1 { font-size: 14px; color: var(--text-strong); }
.report-head .hdr-controls { gap: 14px; }
.rh-ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); white-space: nowrap; }
.rh-label .req { color: var(--danger); margin-left: 1px; }
.rh-ctl .pickerfield { width: 150px; }
.rh-ctl .pickerfield.pf-range { width: 210px; }
.rh-ctl .pickerfield .pf-text, .rh-select, .rh-text { height: 28px; font-size: 12px; }
.rh-select { width: 150px; }
.rh-text { width: 150px; }
.rh-btn { min-height: 28px; padding: 0 14px; font-size: 12px; }
.report-head .gear-btn { margin-left: 2px; }
.report-area .grid-wrap .grid { width: max-content; min-width: 100%; table-layout: auto; font-size: 12px; }
.report-area .grid thead th { height: 28px; font-size: 12px; padding-right: 22px; }
.report-area .grid td { height: 24px; font-size: 12px; padding: 0 12px 0 10px; }
.report-area .list-footer { height: 40px; }
.report-area .fit-cols .grid-wrap .grid { table-layout: fixed; width: 100%; min-width: 1100px; }
.report-area .fit-cols .grid thead th { padding: 0 20px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; }
.report-area .fit-cols .grid thead th .sort-ic { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.report-area .fit-cols .grid td { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ REPORTS: On time export card (T/106) */
.ot-page { flex: 1; position: relative; background: var(--grid-head); }
.ot-card { position: absolute; left: 64px; right: 64px; top: 22%; background: #fff; border-radius: 2px; padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.ot-text h2 { font-size: 18px; font-weight: 700; color: var(--text-strong); margin-bottom: 8px; }
.ot-text p { font-size: 12px; line-height: 1.5; color: var(--text); max-width: 520px; }
.ot-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ot-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ot-field label { display: block; font-size: 12px; margin-bottom: 4px; color: var(--text); }
.ot-field .mx-select, .ot-field .pickerfield .pf-text { height: 32px; }
.ot-export { width: 100%; min-height: 32px; font-size: 13px; }

/* ------------------------------------------------------------------ REPORTS: Driver performance (T/108) */
.perf-page { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.perf-body { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 6px 10px; overflow: auto; }
.perf-list { flex: none; width: 300px; align-self: flex-start; max-height: 100%; overflow: auto; border-bottom: 1px solid var(--line-soft); }
.perf-table { width: 100%; table-layout: fixed; }
.perf-table th { height: 28px; font-size: 12px; }
.perf-table td { height: 26px; font-size: 12px; }
.perf-table .chk, .perf-table th.chk { width: 36px; padding: 0 0 0 10px; }
.perf-table .empty td { padding: 14px; }
.perf-tiles { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 12px; align-content: start; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 6px 8px 4px; min-width: 0; }
.tile-head { display: flex; align-items: center; justify-content: space-between; }
.tile-head h3 { font-size: 13px; font-weight: 400; color: var(--text-strong); }
.tile-x { color: #555B6E; padding: 2px; }
.tile-chart { overflow: auto; }
.tile-big { overflow: auto; max-height: 70vh; }
.chart { display: block; max-width: 100%; }
.chart-ax { font-size: 11px; fill: var(--muted); }
.chart-val { font-size: 11px; fill: var(--text-strong); }
.chart-bar { fill: var(--blue); }
.chart-axis { stroke: #8A8FA0; stroke-width: 1; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; }

/* ------------------------------------------------------------------ Import from file (T/103), one dialog for ORDERS and PLANNING */
.dlg-import .dlg-header { padding: 10px 14px 8px; }
.dlg-import .dlg-body { padding: 10px 14px 6px; }
.dlg-import .dlg-footer { align-items: center; }
.imp-owlink { font-size: 12px; }
.imp-zone { border: 1px dashed #BFC1CC; border-radius: 3px; padding: 12px 10px 10px; text-align: center; cursor: pointer; background: #fff; min-height: 96px; display: flex; flex-direction: column; justify-content: center; }
.imp-zone:hover, .imp-zone.drag { border-color: var(--blue); background: var(--blue-tint); }
.imp-zone:focus-visible { border-color: var(--blue); }
.imp-zone-in { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.imp-zone-in[hidden], .imp-result[hidden] { display: none; }
.imp-title { font-size: 16px; color: var(--text-strong); }
.imp-name { font-size: 12px; color: var(--text); }
.imp-zone.has-file .imp-name { font-weight: 700; }
.imp-result { text-align: left; font-size: 12px; max-height: 220px; overflow: auto; cursor: default; padding: 0 4px; }
.imp-sum { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.imp-opts { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.imp-daterow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.imp-date { width: 150px; flex: none; }
.imp-date.is-off { opacity: .5; pointer-events: none; }

/* ------------------------------------------------------------------ new-order dialog: items, location search, map (T/143, T/144) */
.od-items .od-table td.chk, .od-items .od-table th.od-chk { width: 28px; }
.od-items .od-table tr.sel td { background: var(--blue-tint); }
.od-new .od-items .od-table tbody tr { cursor: pointer; }
.od-itembar .btn[disabled] { pointer-events: none; }
.loc2-pop { border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; margin-top: 4px; box-shadow: 0 4px 14px rgba(15,58,39,.14); }
.loc2-pop[hidden] { display: none; }
.loc2-search { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); padding: 8px 10px; font-size: 12px; outline: 0; }
.loc2-res { max-height: 200px; overflow: auto; }
.loc2-opt { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 10px; font-size: 12px; color: var(--text-strong); cursor: pointer; }
.loc2-opt:hover, .loc2-opt:focus-visible { background: var(--blue-tint); }
.loc2-opt small { display: block; color: var(--muted); font-size: 11px; }
.loc2-empty { padding: 10px; color: var(--muted); font-size: 12px; }
.loc2-hand { border-top: 1px solid var(--line-soft); color: var(--blue-link); }
.loc2-map { position: absolute; right: 8px; top: 7px; background: none; border: 0; padding: 2px 4px; color: var(--blue-link); font-size: 12px; display: flex; align-items: center; gap: 3px; }
.loc2-map:hover { text-decoration: underline; }
.loc2-link { color: var(--blue-link); font-size: 12px; text-decoration: none; }
.loc2-link:hover { text-decoration: underline; }
.map-pick { width: 100%; height: 420px; border: 1px solid var(--line); }
.map-pick-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ------------------------------------------------------------------ REPORTS: Aggregated routes template panel (T/105) and grid cells */
.agg-panel { flex: 1; margin: 6px; border: 1px solid var(--line); border-radius: 2px; padding: 24px 28px; background: #fff; overflow: auto; }
.agg-panel h1 { font-size: 22px; font-weight: 700; color: var(--text-strong); margin: 30px 0 22px; }
.agg-text { font-size: 13px; line-height: 1.6; max-width: 330px; margin: 0 0 22px; }
.agg-req { font-size: 13px; margin-bottom: 4px; }
.agg-tick { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.5; }
.agg-btns { display: flex; gap: 10px; margin-top: 16px; }
.agg-btn { width: 180px; min-height: 32px; font-size: 13px; }
.cell-ellipsis { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
