/* Booking UI R1 — local review candidate, 2026-10-04.
 * Loaded only by Admin index.html. No driver page, permissions, API or JS changes.
 * Every selector is scoped to #bookingView. Existing layout/hidden states remain intact.
 * !important overrides the historical card styles, which already use !important.
 */
#bookingView {
  --booking-border: #b5ccf2;
  --booking-soft: #f6f8fc;
  border-color: var(--line);
  border-radius: 16px;
  box-shadow: none;
}
[data-theme="dark"] #bookingView {
  --booking-border: #385581;
  --booking-soft: #142036;
}
#bookingView > .panel-heading { padding: 18px 20px; gap: 14px; min-height: 80px; }
#bookingView .booking-heading-line { flex-wrap: wrap; gap: 12px; }
#bookingView .booking-heading-line h2 { font-size: 22px; font-weight: 720; letter-spacing: -.5px; }
#bookingView .booking-heading-copy p { font-size: 11px; color: var(--muted); }
#bookingView .booking-status-chip { min-height: 34px; border-radius: 8px; box-shadow: none; font-size: 11px; }
#bookingView .booking-status-chip > i { width: 6px; height: 6px; box-shadow: none; }
#bookingView .booking-status-chip > b { width: auto; min-width: 21px; height: 21px; border-radius: 5px; }
#bookingView .booking-layout-toggle { border-radius: 9px; box-shadow: none; }
#bookingView .booking-layout-toggle button { min-height: 36px; font-weight: 650; font-size: 11px; }
#bookingView .booking-layout-toggle button.active { box-shadow: none; }
#bookingView > .toolbar { padding: 12px 20px; gap: 10px; background: var(--surface); }
#bookingView .search-box input { min-height: 42px; border-radius: 10px; font-size: 12px; }
#bookingView .progress-status {
  animation: none !important;
  box-shadow: none !important;
  font-weight: 650 !important;
  border-radius: 8px !important;
}
#bookingView .progress-status:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#bookingView button:focus-visible, #bookingView summary:focus-visible, #bookingView a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
#bookingView .type-tag { min-width: 32px; padding: 5px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; }

/* Desktop uses the existing table and all eleven original columns. */
/* V9.55: no extra side padding and no wider min-width, so all columns fit one screen as before. */
#bookingView.layout-table > .table-wrap { padding: 0 0 8px; background: var(--booking-soft); }
#bookingView.layout-table table { border-collapse: separate; border-spacing: 0 8px; }
#bookingView.layout-table thead th { height: 43px; font-size: 10px; font-weight: 650; background: var(--booking-soft); border: 0; }
#bookingView.layout-table tbody td {
  padding-top: 15px; padding-bottom: 15px;
  background: var(--surface);
  border-top: 1px solid var(--booking-border);
  border-bottom: 1px solid var(--booking-border);
  font-size: 11px; line-height: 1.5;
}
#bookingView.layout-table tbody td:first-child { border-left: 1px solid var(--booking-border); border-radius: 10px 0 0 10px; }
#bookingView.layout-table tbody td:last-child { border-right: 1px solid var(--booking-border); border-radius: 0 10px 10px 0; }
#bookingView.layout-table tbody tr:hover td { background: color-mix(in srgb,var(--primary) 3%,var(--surface)); }
#bookingView.layout-table .booking-code { font-size: 12px; font-weight: 720; overflow-wrap: anywhere; }
#bookingView.layout-table .subline { font-size: 10px; line-height: 1.5; }
#bookingView.layout-table .location-primary { color: var(--text); font-size: 11px; line-height: 1.5; }
#bookingView.layout-table .actual-empty { color: var(--muted); }
#bookingView.layout-table .status-cell .progress-status { min-height: 38px; font-size: 11px; }
#bookingView.layout-table .row-actions { gap: 6px; }
#bookingView.layout-table .row-action { min-height: 32px; border-radius: 6px; font-size: 11px; font-weight: 600; }
#bookingView.layout-table .document-button { min-height: 40px; border-radius: 8px; font-size: 10px; box-shadow: none; }
#bookingView.layout-table .money { color: var(--text); font-size: 13px; font-weight: 720; }
#bookingView.layout-table .cost-breakdown { min-width: 0; padding: 8px; }
#bookingView.layout-table .cost-breakdown > span { grid-template-columns: 1fr; gap: 1px; }
#bookingView.layout-table .cutoff-box, #bookingView.layout-table .mooc-timer { border-radius: 7px; box-shadow: none; }

/* Card layout retains the original DOM and all data-* event hooks. */
#bookingView #bookingCards { gap: 16px; padding: 16px; background: var(--booking-soft); }
#bookingView .appscript-card {
  position: relative;
  padding: 16px !important;
  border: 1px solid var(--booking-border) !important;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none !important;
  overflow: visible !important;
}
#bookingView .appscript-card-head {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) minmax(130px,auto) !important;
  grid-template-areas: "kind status" "code code" "so so" "meta meta";
  gap: 6px 10px !important;
  margin: 0; padding: 0 !important;
  background: transparent; border: 0 !important; border-radius: 0;
}
#bookingView .appscript-card-identity { display: contents !important; }
#bookingView .appscript-card-identity .type-tag { grid-area: kind; align-self: center; margin: 0 !important; }
#bookingView .appscript-card-identity .booking-code { grid-area: code; font-size: 20px !important; line-height: 1.25 !important; font-weight: 750; margin-top: 5px !important; }
#bookingView .appscript-card-identity .card-so { grid-area: so; font-size: 11px !important; line-height: 1.4 !important; font-weight: 400 !important; }
#bookingView .card-admin-meta-row { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 !important; }
#bookingView .card-admin-meta-row:empty { margin: 0; }
#bookingView .card-eport, #bookingView .card-customs { padding: 0; font-size: 11px !important; line-height: 1.5; color: var(--muted); }
#bookingView .appscript-card-status { grid-area: status; justify-self: end; width: auto; max-width: 210px; }
#bookingView .appscript-card-status .progress-status {
  width: 100% !important; min-height: 36px !important;
  padding: 7px 27px 7px 10px !important;
  font-size: 11px !important; letter-spacing: 0 !important; line-height: 1.25 !important;
}
#bookingView .appscript-card .booking-gps-pin { top: 19px !important; left: 64px !important; }
#bookingView .card-time-row { grid-template-columns: minmax(0,1.6fr) minmax(84px,.8fr); gap: 8px; margin: 12px 0 0; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
#bookingView .card-time-row .card-cutoff-line {
  display: flex; flex-wrap: wrap !important; align-items: center; justify-content: flex-start;
  margin: 0; padding: 3px 0 !important; gap: 5px !important;
  background: transparent; border: 0; border-radius: 0;
  font-size: 10px !important; line-height: 1.4; white-space: normal; overflow: visible;
}
#bookingView .card-cutoff-line .cy-date-time { gap: 1px; }
#bookingView .card-cutoff-line .cy-date-time b { font-size: 12px; }
#bookingView .card-cutoff-line .cy-date-time small { font-size: 10px; }
#bookingView .card-cutoff-line > strong { font-size: 10px; font-weight: 600; }
#bookingView .card-anchor-time .mooc-timer { padding: 5px !important; min-height: 40px; height: 100%; border-radius: 8px; font-size: 12px !important; box-shadow: none; }
#bookingView .card-anchor-time .mooc-timer small { font-size: 10px; }
#bookingView .appscript-card-facts { padding: 14px 0; gap: 14px 14px; border: 0; border-radius: 0; background: transparent; }
#bookingView .appscript-card-facts > div { align-content: start; gap: 5px !important; }
#bookingView .appscript-card-facts small { color: var(--muted); font-size: 10px; font-weight: 550; letter-spacing: .03em; }
#bookingView .appscript-card-facts strong { color: var(--text) !important; font-size: 12px !important; line-height: 1.5; font-weight: 600 !important; }
#bookingView .appscript-card-facts > div:nth-child(1) { order: 1; }
#bookingView .appscript-card-facts > div:nth-child(2) { order: 3; }
#bookingView .appscript-card-facts > div:nth-child(3) { order: 2; }
#bookingView .appscript-card-facts > div:nth-child(4) { order: 4; }
#bookingView .container-seal-copy { white-space: normal !important; gap: 3px !important; }
#bookingView .container-seal-copy .copy-line { white-space: normal; overflow-wrap: anywhere; }
#bookingView .container-seal-copy .container-copy strong { font-size: 13px !important; font-weight: 700 !important; }
#bookingView .container-seal-copy .seal-copy strong { color: var(--muted) !important; font-size: 11px !important; font-weight: 500 !important; }
#bookingView .appscript-driver {
  grid-template-columns: 34px minmax(0,1fr) 36px !important;
  margin: 0 !important; padding: 10px 0 !important;
  border-left: 0; border-right: 0; border-radius: 0; background: transparent;
}
#bookingView .appscript-driver .driver-car { background: var(--booking-soft); color: var(--muted); border-radius: 8px; }
#bookingView .appscript-driver strong { font-size: 14px !important; font-weight: 650; }
#bookingView .appscript-driver small { font-size: 10px !important; line-height: 1.4; font-weight: 500; }
#bookingView .appscript-driver a { border-radius: 8px; background: var(--primary-soft); }
#bookingView .appscript-card-quick { margin: 0 !important; }
#bookingView .card-cost { padding: 0 !important; background: transparent; border: 0; border-radius: 0; }
#bookingView .card-cost summary { display: flex !important; flex-direction: row; align-items: center !important; justify-content: space-between; gap: 10px !important; min-height: 54px !important; padding: 10px 0; text-align: left !important; }
#bookingView .card-cost summary small { font-size: 10px !important; line-height: 1.4 !important; font-weight: 500; }
#bookingView .card-cost summary strong { color: var(--text); font-size: 18px !important; font-weight: 700; white-space: nowrap; }
#bookingView .card-cost .cost-breakdown { margin: 0 0 12px; padding: 12px; background: var(--booking-soft); }
#bookingView .card-cost .cost-breakdown > span { padding: 4px 0; font-size: 12px !important; }
#bookingView .card-cost .cost-breakdown b { font-size: 12px !important; }
#bookingView .admin-booking-card-actions { gap: 10px; padding: 10px 0 0; border-top: 1px solid var(--line); }
#bookingView .appscript-card .document-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 7px 9px; border-radius: 8px; font-size: 11px; box-shadow: none; }
#bookingView .appscript-card .document-button-meta { display: flex; align-items: center; gap: 4px; }
#bookingView .appscript-card .document-button-meta b, #bookingView .appscript-card .document-button-meta i { width: 20px; height: 20px; font-size: 10px; }
#bookingView .card-action-menu > summary { min-height: 42px; border-radius: 8px; font-size: 12px; font-weight: 650; background: var(--surface); }
#bookingView .card-action-menu > div { bottom: 48px; max-width: min(240px,76vw); }
#bookingView .card-action-menu button { font-size: 12px; font-weight: 600; }
#bookingView > .pagination { border-top: 1px solid var(--line); }
@media (min-width: 1100px) {
  #bookingView.layout-cards #bookingCards { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: start; }
}
@media (min-width: 821px) and (max-width: 1099px) {
  #bookingView.layout-cards #bookingCards { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
}
@media (max-width: 820px) {
  #bookingView > .panel-heading { padding: 15px 14px; align-items: center !important; }
  #bookingView .booking-heading-line { flex-direction: column; align-items: flex-start; gap: 8px; }
  #bookingView .booking-heading-line h2 { font-size: 18px; }
  #bookingView .booking-heading-actions { gap: 7px; }
  #bookingView .booking-layout-toggle button { font-size: 11px; padding: 0 8px; }
  #bookingView .booking-layout-toggle button::first-letter { font-size: inherit; }
  #bookingView > .toolbar { padding: 0 14px 14px; }
  #bookingView #bookingCards { padding: 12px; gap: 14px; }
  #bookingView .appscript-card { padding: 14px !important; }
  #bookingView .appscript-card-head { grid-template-columns: minmax(0,1fr) minmax(125px,auto) !important; }
  #bookingView .appscript-card .booking-gps-pin { top: 17px !important; left: 60px !important; }
  #bookingView.layout-table > .table-wrap { padding: 0 0 8px; }
}
@media (max-width: 360px) {
  #bookingView > .panel-heading { flex-wrap: wrap; }
  #bookingView .booking-heading-actions { margin-left: auto; }
  #bookingView .appscript-card-identity .booking-code { font-size: 18px !important; }
  #bookingView .card-cost summary { flex-wrap: wrap; }
}

/* V9.56: anchor icon in front of the trailer (mooc) anchoring time, table and cards. */
#bookingView .mooc-timer::before {
  content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='2.5'/%3E%3Cpath d='M12 7.5V21M7.5 11.5h9M4 13.5c0 4.5 3.6 7.5 8 7.5s8-3 8-7.5M4 13.5l-1.6 2.6M4 13.5l2.7 1.5M20 13.5l1.6 2.6M20 13.5l-2.7 1.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='2.5'/%3E%3Cpath d='M12 7.5V21M7.5 11.5h9M4 13.5c0 4.5 3.6 7.5 8 7.5s8-3 8-7.5M4 13.5l-1.6 2.6M4 13.5l2.7 1.5M20 13.5l1.6 2.6M20 13.5l-2.7 1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
#bookingView .card-anchor-time .mooc-timer::before { width: 14px; height: 14px; }

/* Local compact R1, based on V9.56: presentation only, keep customs data/forms. */
#bookingView .card-customs,
#bookingView .customs-number { display: none !important; }
#bookingView .appscript-card-head {
  grid-template-areas: "kind status" "code code" "so so";
  gap: 4px 10px !important;
}
/* No reserved row when Eport is absent. A real Eport keeps its own copy button. */
#bookingView .card-admin-meta-row { display: contents; min-height: 0; }
#bookingView .card-admin-meta-row .card-eport {
  grid-column: 1 / -1;
  grid-row: 4;
  padding: 0;
  line-height: 1.4;
}
#bookingView .card-time-row { margin-top: 6px; padding-bottom: 8px; }

/* V9.57: desktop table must show all 11 columns without horizontal scrolling on 1280px+ screens.
 * The historical rule forced 1260px; the Booking area at 1280px is only about 1224px wide. */
@media (min-width: 1001px) {
  #bookingView.layout-table table { min-width: 1180px; }
}

/* Admin anchor timer: keep icon, elapsed time, labels and click target without a box. */
#bookingView .mooc-timer {
  border: 1px solid transparent !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Admin CY/Cut-off: keep countdown, dates, icons and status colors without a box. */
#bookingView .cutoff-box,
#bookingView .card-time-row .card-cutoff-line {
  border-color: transparent !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Local IMP journey: keep the editor label readable on mobile. */
.booking-journey-modal .cms-header-actions [data-admin-route-segments]{font-size:12px;white-space:nowrap}
body:has(.booking-journey-backdrop) #aiAgentWidgetRoot{display:none!important}
