/* ==========================================================================
   CENTRAL DISPATCH — order listing panel (Post / Update / Remove)
   Removable feature: public/js/cd-listing.js builds the markup. Every rule is
   scoped under .cdl-*; only the overlay reuses the copy panel's .cdp-overlay.
   Look: square edges, compact type, dark header like the order form's cards.
   ========================================================================== */
.cdl-modal {
  --cdl-ink: #111827; --cdl-soft: #5b6675; --cdl-faint: #8b93a1;
  --cdl-line: #e3e8ef; --cdl-bg: #f6f8fb; --cdl-navy: #1a202c; --cdl-accent: #1f3a5f; --cdl-head: #17365d;
  width: 100%; max-width: 820px; max-height: min(90vh, 900px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 4px; box-shadow: 0 24px 60px -20px rgba(17, 18, 22, .5);
  font-family: inherit; color: var(--cdl-ink);
}

/* backdrop: dim + soft blur of the order behind (this panel only — the
   copy panel shares .cdp-overlay) */
#cdlOverlay, #cddOverlay { background: rgba(15, 23, 42, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* header */
/* Deep blue, not the order form's charcoal (#1a202c) — the two headers
   merged when the panel sat on top of Edit Order. */
.cdl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px 11px 18px; background: var(--cdl-head); color: #fff; }
.cdl-head-text { min-width: 0; }
.cdl-eyebrow { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.cdl-head h3 { margin: 3px 0 0; font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdl-env { padding: 1px 6px; border-radius: 2px; background: #f5b942; color: #3d2a00; font-size: 9.5px; letter-spacing: .6px; }
.cdl-x { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0; border: 1px solid rgba(255, 255, 255, .25); border-radius: 3px; background: transparent; color: #fff; cursor: pointer; }
.cdl-x:hover { background: rgba(255, 255, 255, .12); }
.cdl-x svg { width: 14px; height: 14px; }

/* status strip */
.cdl-status { display: flex; align-items: center; gap: 12px; padding: 8px 18px; background: var(--cdl-bg); border-bottom: 1px solid var(--cdl-line); font-size: 11.5px; }
.cdl-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 8px; border-radius: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; background: #e9edf3; color: #4a5565; }
.cdl-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cdl-pill.is-active { background: #e3f3e9; color: #17663b; }
.cdl-pill.is-warn   { background: #fdf0d9; color: #8a5300; }
.cdl-pill.is-bad    { background: #fbe4e4; color: #a61b1b; }
.cdl-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--cdl-soft); font-variant-numeric: tabular-nums; }
.cdl-id { font-weight: 700; color: var(--cdl-ink); }
.cdl-link { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 0; padding: 4px 9px; border: 1px solid #cfd6e1; border-radius: 3px; background: #fff; color: var(--cdl-accent); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.cdl-link:hover:not(:disabled) { background: #eef2f7; }
.cdl-link:disabled { opacity: .5; cursor: default; }
.cdl-link svg { width: 12px; height: 12px; }

/* body */
.cdl-body { overflow-y: auto; padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.cdl-body:empty { display: none; }
.cdl-sec h4 { margin: 0 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--cdl-line); font-size: 10px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--cdl-faint); }
#cdlReport:empty, .cdd-report:empty { display: none; }
#cdlReport, .cdd-report { display: flex; flex-direction: column; gap: 6px; }

/* problems / notes — flat, left stripe */
.cdl-box { padding: 7px 10px; border-left: 3px solid; border-radius: 0 2px 2px 0; font-size: 12px; line-height: 1.45; }
.cdl-box b { font-weight: 700; margin-right: 4px; }
.cdl-box ul { margin: 2px 0 0; padding-left: 16px; }
.cdl-box b + ul { margin-top: 3px; }
.cdl-box.is-bad  { background: #fdf1f1; border-color: #d64545; color: #7d1414; }
.cdl-box.is-warn { background: #fff8ea; border-color: #e0a100; color: #6b4300; }
.cdl-box.is-info { background: #f1f5fb; border-color: #6d8ab3; color: #1f3a5f; }

/* fields */
.cdl-grid { display: grid; gap: 10px 12px; }
.cdl-grid-4 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.45fr); }
.cdl-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cdd-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cdd-when { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cdl-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cdl-field.is-wide { grid-column: 1 / -1; }
.cdl-lab { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
.cdl-lab label { font-size: 11.5px; font-weight: 600; color: var(--cdl-accent); white-space: nowrap; }
.cdl-lab span { font-size: 10.5px; color: var(--cdl-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.cdl-lab span.is-public { color: #a35f00; font-weight: 600; }
.cdl-field input, .cdl-field select, .cdl-field textarea {
  width: 100%; box-sizing: border-box; min-height: 0; height: 32px; padding: 5px 8px;
  border: 1px solid #cfd6e1; border-radius: 3px; background: #fff; color: var(--cdl-ink);
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.cdl-field textarea { height: auto; min-height: 58px; resize: vertical; line-height: 1.4; }
.cdl-field textarea::placeholder { color: #a3abb8; }
.cdl-field select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6675' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 12px 12px;
}
.cdl-field input:focus, .cdl-field select:focus, .cdl-field textarea:focus { outline: none; border-color: #3170e8; box-shadow: 0 0 0 2px rgba(49, 112, 232, .18); }
.cdl-field input:disabled, .cdl-field select:disabled, .cdl-field textarea:disabled { background: var(--cdl-bg); color: var(--cdl-soft); }
.cdl-fixed { display: flex; align-items: center; min-height: 32px; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--cdl-line); border-radius: 3px; background: var(--cdl-bg); font-size: 12px; line-height: 1.3; }

/* what Central Dispatch gets — key/value rows */
.cdl-sum { display: flex; flex-direction: column; font-size: 12px; }
.cdl-kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid #eef1f5; }
.cdl-kv:last-child { border-bottom: 0; }
.cdl-k { padding-top: 1px; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--cdl-faint); }
.cdl-v { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; color: var(--cdl-ink); line-height: 1.45; word-break: break-word; }
.cdl-v b { font-weight: 600; }
.cdl-soft { color: var(--cdl-soft); }
.cdl-veh { display: flex; flex-wrap: wrap; gap: 0 10px; width: 100%; }

/* footer */
.cdl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--cdl-line); background: var(--cdl-bg); }
.cdl-foot-note { font-size: 11px; color: var(--cdl-faint); cursor: default; }
.cdl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cdl-btn {
  min-height: 0; height: 32px; padding: 0 14px; border: 1px solid #cfd6e1; border-radius: 3px;
  background: #fff; color: var(--cdl-accent); font: inherit; font-size: 12px; font-weight: 600;
  letter-spacing: .2px; cursor: pointer; white-space: nowrap;
}
.cdl-btn:hover:not(:disabled) { background: #eef2f7; }
.cdl-btn:disabled { opacity: .5; cursor: default; }
.cdl-btn:focus-visible, .cdl-link:focus-visible, .cdl-x:focus-visible { outline: 2px solid #3170e8; outline-offset: 2px; }
.cdl-btn.is-primary { background: var(--cdl-head); border-color: var(--cdl-head); color: #fff; }
.cdl-btn.is-primary:hover:not(:disabled) { background: #1d4373; border-color: #1d4373; }
.cdl-btn.is-danger { color: #a61b1b; border-color: #e7b9b9; }
.cdl-btn.is-danger:hover:not(:disabled) { background: #fdf1f1; }
.cdl-loading { padding: 40px 20px; text-align: center; color: var(--cdl-soft); font-size: 12.5px; }

/* the order form's "Post to CD" button once the load is on CD */
.aq-btn.cdl-btn-state { display: inline-flex; align-items: center; gap: 7px; }
.aq-btn.cdl-btn-state .cdl-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.aq-btn.cdl-btn-state.is-live  { color: #17663b; border-color: #17663b; background: #f0f9f3; }
.aq-btn.cdl-btn-state.is-warn  { color: #8a5300; border-color: #c98a1a; background: #fff8ea; }
.aq-btn.cdl-btn-state.is-muted { color: #5b6675; border-color: #aab3c0; }

/* ── Chunk 4: dispatch (public/js/cd-dispatch.js) ───────────────────────── */
.cdl-link.cdd-inline { display: inline-flex; margin-left: 6px; padding: 2px 8px; vertical-align: baseline; }

/* Interested Carriers row: status chip under the company + Dispatch button */
.cdd-chip { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 2px; font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; vertical-align: 1px; background: #e9edf3; color: #4a5565; }
.cdd-chip.is-active { background: #e3f3e9; color: #17663b; }
.cdd-chip.is-warn   { background: #fdf0d9; color: #8a5300; }
.cdd-chip.is-bad    { background: #fbe4e4; color: #a61b1b; }
.cdd-chip.is-linked { background: #eaf0f8; color: #17365d; }
.eo-mini-delete.cdd-row-btn { color: #17365d; font-weight: 700; }

/* "Find on CD" inside the Add / Edit carrier popup */
.cdd-find { margin: 14px 0 4px; padding: 10px 12px; border: 1px solid #dfe5ee; border-radius: 4px; background: #f6f8fb; }
.cdd-find-head { margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #17365d; }
.cdd-find-head span { margin-left: 6px; font-weight: 500; letter-spacing: 0; text-transform: none; color: #8b93a1; }
.cdd-find-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 6px; }
.cdd-find-row select, .cdd-find-row input {
  box-sizing: border-box; height: 34px; min-height: 0; margin: 0; padding: 0 9px; border: 1px solid #cfd6e1; border-radius: 3px;
  background: #fff; color: #111827; font: inherit; font-size: 13px;
}
.cdd-find-row input:focus, .cdd-find-row select:focus { outline: none; border-color: #3170e8; box-shadow: 0 0 0 2px rgba(49, 112, 232, .18); }
.cdd-link-btn { height: 34px; min-height: 0; padding: 0 12px; border: 1px solid #cfd6e1; border-radius: 3px; background: #fff; color: #17365d; font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.cdd-link-btn:hover:not(:disabled) { background: #eef2f7; }
.cdd-link-btn:disabled { opacity: .55; cursor: default; }
.cdd-link-btn.is-primary { background: #17365d; border-color: #17365d; color: #fff; }
.cdd-link-btn.is-primary:hover:not(:disabled) { background: #1d4373; }
.cdd-results { display: flex; flex-direction: column; margin-top: 8px; border: 1px solid #e3e8ef; border-radius: 3px; background: #fff; max-height: 220px; overflow-y: auto; }
.cdd-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-bottom: 1px solid #eef1f5; }
.cdd-result:last-child { border-bottom: 0; }
.cdd-result-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; }
.cdd-result-text span { color: #5b6675; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdd-result .cdd-link-btn { height: 28px; }
.cdd-find-msg { margin-top: 8px; font-size: 12px; color: #5b6675; }
.cdd-find-msg.is-bad { color: #a61b1b; }
.cdd-linked { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cdd-linked .cdd-chip { margin-left: 0; }
.cdd-linked .cdd-link-btn { height: 28px; margin-left: auto; }

@media (max-width: 720px) {
  .cdl-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cdl-grid-3, .cdd-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .cdl-status { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .cdd-find-row { grid-template-columns: 84px minmax(0, 1fr); }
  .cdd-find-row .cdd-link-btn { grid-column: 1 / -1; }
  .cdl-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .cdl-head h3 { white-space: normal; }
  .cdl-kv { grid-template-columns: 72px minmax(0, 1fr); }
  .cdl-actions { width: 100%; }
  .cdl-actions .cdl-btn { flex: 1 1 auto; }
}

/* Dispatch panel → Documents (Chunk 6) */
.cdd-docs { display: flex; flex-wrap: wrap; gap: 6px; }
.cdd-docs a.cdl-link { text-decoration: none; }
.cdd-docs-note { margin-top: 6px; font-size: 11.5px; }

/* ── Settings → Central Dispatch (Connect, cd-connect.js). Uses the Settings
   tokens (--sx-*) from .sx-wrap. ── */
#sx-pane-loadboards .cdc-tile { border: 1px solid var(--sx-border, #e4e9f1); border-radius: 10px; background: var(--sx-surface, #fff); overflow: hidden; }
#sx-pane-loadboards .cdc-tile.is-ended { border-color: #f1c4c4; }
#sx-pane-loadboards .cdc-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
#sx-pane-loadboards .cdc-mark { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--sx-border, #e3e8f0); }
#sx-pane-loadboards .cdc-mark img { display: block; width: 26px; height: 26px; }
#sx-pane-loadboards .cdc-tile.is-empty .cdc-mark img { filter: grayscale(1); opacity: .55; }
#sx-pane-loadboards .cdc-who { flex: 1 1 auto; min-width: 0; }
#sx-pane-loadboards .cdc-who b { display: block; font-size: 15px; font-weight: 700; color: var(--sx-ink, #101a2b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sx-pane-loadboards .cdc-who span { display: block; margin-top: 1px; font-size: 12.5px; color: var(--sx-ink2, #54607a); }
#sx-pane-loadboards .cdc-pill { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
#sx-pane-loadboards .cdc-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
#sx-pane-loadboards .cdc-pill.is-ok { background: #e9f7ef; color: #15803d; }
#sx-pane-loadboards .cdc-pill.is-bad { background: #fdecec; color: #b91c1c; }
#sx-pane-loadboards .cdc-pill.is-off { background: var(--sx-surface3, #eef2f8); color: var(--sx-ink2, #54607a); }
#sx-pane-loadboards .cdc-pill.is-wait { background: #eef3ff; color: #2f5bd3; }
#sx-pane-loadboards .cdc-rows { margin: 0; padding: 4px 16px 6px; border-top: 1px solid var(--sx-border, #e4e9f1); background: var(--sx-surface2, #f6f8fc); }
#sx-pane-loadboards .cdc-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 9px 0; font-size: 13px; }
#sx-pane-loadboards .cdc-row + .cdc-row { border-top: 1px solid var(--sx-border, #e4e9f1); }
#sx-pane-loadboards .cdc-row dt { margin: 0; color: var(--sx-ink2, #54607a); }
#sx-pane-loadboards .cdc-row dd { margin: 0; color: var(--sx-ink, #101a2b); font-weight: 600; font-variant-numeric: tabular-nums; }
#sx-pane-loadboards .cdc-sub { color: var(--sx-faint, #8a94a6); font-weight: 400; }
#sx-pane-loadboards .cdc-bad { color: #b91c1c; }
#sx-pane-loadboards .cdc-warn-t { color: #b45309; }
#sx-pane-loadboards .cdc-result { margin: 0; padding: 10px 16px; font-size: 12.5px; border-top: 1px solid var(--sx-border, #e4e9f1); }
#sx-pane-loadboards .cdc-result.is-ok { color: #15803d; background: #f3fbf6; }
#sx-pane-loadboards .cdc-result.is-bad { color: #b91c1c; background: #fef6f6; }
#sx-pane-loadboards .cdc-steps { list-style: none; counter-reset: cdc; margin: 0; padding: 4px 16px 6px; border: 1px solid var(--sx-border, #e4e9f1); border-radius: 10px; background: var(--sx-surface2, #f6f8fc); }
#sx-pane-loadboards .cdc-steps li { counter-increment: cdc; position: relative; padding: 9px 0 9px 34px; font-size: 13px; }
#sx-pane-loadboards .cdc-steps li::before { content: counter(cdc); position: absolute; left: 0; top: 9px; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: var(--sx-brand, #0a2540); background: #fff; border: 1px solid var(--sx-border2, #d7deea); }
#sx-pane-loadboards .cdc-steps b { display: block; color: var(--sx-ink, #101a2b); }
#sx-pane-loadboards .cdc-steps span { display: block; color: var(--sx-ink2, #54607a); font-size: 12.5px; }
#sx-pane-loadboards .cdc-hint { margin: 12px 0 0; font-size: 12.5px; color: var(--sx-ink2, #54607a); line-height: 1.5; }
#sx-pane-loadboards .cdc-hint b { color: var(--sx-ink, #101a2b); }
#sx-pane-loadboards .cdc-empty b { display: block; font-size: 14px; color: var(--sx-ink, #101a2b); }
#sx-pane-loadboards .cdc-empty p { margin: 4px 0 0; font-size: 13px; color: var(--sx-ink2, #54607a); }
#sx-pane-loadboards .cdc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
#tab-settings #sx-pane-loadboards .cdc-danger { margin-left: auto; color: #b91c1c; }
#sx-pane-loadboards .cdc-msg { margin: 0; font-size: 13px; color: var(--sx-ink2, #54607a); }
#sx-pane-loadboards .cdc-note { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--sx-border, #e4e9f1); font-size: 12px; color: var(--sx-faint, #8a94a6); line-height: 1.5; }
@media (max-width: 600px) {
  #sx-pane-loadboards .cdc-head { flex-wrap: wrap; }
  #sx-pane-loadboards .cdc-row { grid-template-columns: 1fr; gap: 2px; }
  #tab-settings #sx-pane-loadboards .cdc-danger { margin-left: 0; }
}

/* 7b: whose account the post goes under */
.cdl-acct { font-weight: 600; text-transform: none; letter-spacing: 0; color: inherit; opacity: .85; }
