/* Load Board (stage 3). Loaded after zap-nav.css.
   Desktop (>=1024px): the table built by zap-load-table.js. Phones and tablets: the same card
   markup as before, laid out more compactly (CSS only). Colors come from zap-theme.css tokens,
   so Light and Dark follow body.light. Only #loadsList and the shared #zapLoadMenu are styled. */

/* ---------- Desktop table ---------- */
.zlt-wrap{overflow-x:auto;border:1px solid var(--zap-border);border-radius:6px;background:var(--zap-panel)}
.zlt-wrap:focus-visible{outline-offset:-2px}
.zlt{width:100%;min-width:1100px;border-collapse:separate;border-spacing:0;font-size:13px;color:var(--zap-text);font-variant-numeric:tabular-nums}
.zlt th,.zlt td{padding:9px 8px;text-align:left;vertical-align:top;border-bottom:1px solid var(--zap-border);background:var(--zap-panel);white-space:nowrap}
/* Place, carrier and broker names wrap; figures, status, Load # and actions stay on one line */
.zlt td.zlt-text{white-space:normal;min-width:108px;max-width:220px;overflow-wrap:anywhere}
.zlt td.zlt-party{min-width:150px}
.zlt td.zlt-party+td.zlt-text{min-width:126px}
.zlt thead th{position:sticky;top:0;z-index:2;background:var(--zap-panel-2);color:var(--zap-text-2);font-size:11.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding-top:9px;padding-bottom:9px}
.zlt tbody tr:last-child>*{border-bottom:0}
.zlt tbody tr:hover>*{background:var(--zap-panel-2)}
.zlt tbody th{font-weight:400}
.zlt .zlt-num{text-align:right}
.zlt .zlt-strong{font-weight:600;color:var(--zap-text);line-height:18px}
.zlt .zlt-sub{color:var(--zap-muted);font-size:12px;line-height:17px;margin-top:2px}
.zlt .load-status-pill{display:inline-block;white-space:nowrap}
.zlt .zlt-select{width:36px;padding-right:0}
.zlt .zlt-select input{width:16px;height:16px;margin:1px 0 0;accent-color:var(--zap-action)}
/* Load # and Actions stay in view while the table scrolls sideways */
.zlt .zlt-load{position:sticky;left:0;z-index:1;min-width:96px;box-shadow:inset -1px 0 0 var(--zap-border)}
.zlt .zlt-actions{position:sticky;right:0;z-index:1;box-shadow:inset 1px 0 0 var(--zap-border);text-align:right}
.zlt thead .zlt-load,.zlt thead .zlt-actions{z-index:3}
.zlt-actions-in{display:flex;gap:6px;justify-content:flex-end}
.zlt-actions-in .small-btn{min-height:30px;padding:4px 9px;white-space:nowrap}
.zlt-more{min-width:34px;font-size:16px;line-height:1}
.zlt-menu-btn[aria-expanded="true"]{background:var(--zap-nav-active-bg);border-color:var(--zap-action);color:var(--zap-nav-active-text)}
.zlt-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- Docs / More menu (attached to <body>) ---------- */
.zlt-menu{position:fixed;z-index:9000;min-width:184px;max-height:calc(100vh - 16px);overflow:auto;padding:4px;
  background:var(--zap-panel);border:1px solid var(--zap-border-strong);border-radius:6px;box-shadow:var(--zap-overlay-shadow)}
.zlt-menu[hidden]{display:none}
.zlt-item{display:block;width:100%;min-height:32px;padding:6px 10px;border:0;border-radius:4px;background:transparent;color:var(--zap-text);
  font:inherit;font-size:13px;text-align:left;cursor:pointer}
.zlt-item:hover,.zlt-item:focus{background:var(--zap-panel-2);outline:none}
.zlt-item:focus-visible{outline:2px solid var(--zap-link)!important;outline-offset:-2px}
.zlt-item.zlt-danger{color:var(--zap-neg)}
.zlt-item.zlt-danger:hover,.zlt-item.zlt-danger:focus{background:var(--zap-chip-red-bg)}
.zlt-sep{height:1px;margin:4px 2px;background:var(--zap-border)}
.zlt-label{padding:6px 10px 2px;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--zap-muted)}

/* Touch screens at desktop width (iPad landscape): larger targets */
@media (pointer:coarse){
  .zlt-actions-in .small-btn{min-height:40px}
  .zlt-item{min-height:40px}
  .zlt .zlt-select input{width:22px;height:22px}
}

/* ---------- Phones and tablets: compact cards (same markup) ---------- */
@media (max-width:1023.98px){
  #loadsList .list-card{position:relative;padding:12px!important;margin-bottom:10px}
  #loadsList .list-card h3{margin:0 0 4px;padding-right:96px;font-size:15px;line-height:20px}
  #loadsList .list-card p{margin:0 0 3px;font-size:12.5px;line-height:17px}
  /* Status sits on the route line, top right */
  #loadsList .list-card .load-status-pill{position:absolute;top:12px;right:12px;margin:0}
  #loadsList .list-card:has(>.invoice-select-box) .load-status-pill{top:44px}
  #loadsList .invoice-select-box{min-height:28px;margin-bottom:6px!important;font-size:12.5px}
  #loadsList .invoice-select-box input{width:20px;height:20px}
  /* Rate, commission / cost, CPM and equipment in one row */
  #loadsList .list-card .pill-row{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 10px}
  #loadsList .list-card .pill-row .pill:empty{display:none}
  /* Actions: wrapping grid, 44px targets, Delete last, red and set apart */
  #loadsList .list-card .card-actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:0}
  #loadsList .list-card .card-actions .small-btn,#loadsList .list-card .status-row .small-btn{min-width:0!important;min-height:44px;padding:6px 4px;font-size:12.5px;line-height:16px}
  #loadsList .list-card .card-actions [data-action="delete"]{order:99;grid-column:1/-1;margin-top:6px;border-color:var(--zap-chip-red-bg)!important}
  #loadsList .list-card .status-row{margin-top:6px!important;gap:6px!important}
}

/* ---------- Load details (opens from a row or its Load #) ---------- */
.zlt tbody tr[data-zlt-row]{cursor:pointer}
.zlt .zlt-open{display:block;padding:0;border:0;background:none;color:var(--zap-text);font:inherit;font-weight:600;line-height:18px;text-align:left;cursor:pointer}
.zlt .zlt-open:hover{text-decoration:underline}
.zld-back{position:fixed;inset:0;z-index:9500;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.55)}
.zld-back[hidden]{display:none}
.zld{width:min(760px,100%);max-height:calc(100vh - 32px);display:flex;flex-direction:column;background:var(--zap-panel);color:var(--zap-text);border:1px solid var(--zap-border-strong);border-radius:8px;box-shadow:var(--zap-overlay-shadow)}
.zld-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 18px;border-bottom:1px solid var(--zap-border)}
.zld-head h2{margin:0;font-size:18px}
.zld-body{padding:6px 18px 14px;overflow:auto}
.zld-foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 18px;border-top:1px solid var(--zap-border)}
.zld-sec{padding:10px 0;border-bottom:1px solid var(--zap-border)}
.zld-sec:last-child{border-bottom:0}
.zld-sec h3{margin:0 0 8px;font-size:11.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--zap-text-2)}
.zld-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px 18px;margin:0}
.zld-item dt{font-size:12px;color:var(--zap-muted)}
.zld-item dd{margin:2px 0 0;font-size:14px;overflow-wrap:anywhere}
.zld-item a{color:var(--zap-link)}
.zld-stops{margin:0;padding-left:18px;font-size:14px}
.zld-notes{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px}
body.zld-open{overflow:hidden}
@media print{.zld-back{display:none!important}}

/* ---------- Archive tab: one folder per carrier ---------- */
.zaf-bar{min-width:0;display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;justify-content:space-between;margin:2px 0 10px;font-size:13px}
.zaf-folder{min-width:0;border:1px solid var(--zap-border);border-radius:8px;background:var(--zap-panel);margin:0 0 12px}
.zaf-folder>summary{display:flex;flex-wrap:wrap;gap:8px 10px;align-items:center;padding:12px 16px;cursor:pointer;list-style:none;font-weight:600;color:var(--zap-text)}
.zaf-folder>summary::-webkit-details-marker{display:none}
.zaf-folder>summary::before{content:"\25B8";color:var(--zap-muted);font-size:13px;transition:transform .15s}
.zaf-folder[open]>summary::before{transform:rotate(90deg)}
.zaf-folder>summary:focus-visible{outline:2px solid var(--zap-action);outline-offset:-2px;border-radius:8px}
.zaf-name{flex:1 1 200px;min-width:0;overflow-wrap:anywhere}
.zaf-pills{display:flex;flex-wrap:wrap;gap:6px}
.zaf-body{min-width:0;padding:0 12px 12px;border-top:1px solid var(--zap-border)}
.zaf-body .zlt-wrap{margin-top:12px}
.zaf-body .list-card{margin:12px 0 0}
@media (prefers-reduced-motion:reduce){.zaf-folder>summary::before{transition:none}}

/* Read-only accounts can't change loads: no cancel or restore prompt that would only be refused */
body[data-read-only] [data-action="cancel-load"],body[data-read-only] [data-action="restore-load"]{display:none!important}
