/* ═══ TRIPS — the trip form, the trip line on Deliveries, the simpler driver phone ═══
   Built 1 Oct 2026 from _prototype-trip.html. The form sits in the Maintenance pop-up
   look (popups.css, mp-) and only adds what a trip has that a job does not: the stops,
   what is dropped at each, and what is left on the truck. Everything here is tr- or sx-.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── the form ── */
.tr-crew{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-height:44px}
.tr-crew .tr-with{font-size:13px;color:var(--ink-faint)}
.tr-crew .tr-app{display:inline-flex;align-items:center;gap:4px;font-size:13px;color:var(--ink-soft)}
.tr-crew .tr-app svg{width:16px;height:16px}
.tr-crew .tr-bad{font-size:13px;color:var(--accent);font-weight:500}
.tr-crew .tr-once{font-size:13px;color:var(--ink-faint)}

.tr-lrow{display:grid;grid-template-columns:minmax(0,1fr) 150px auto 32px;gap:10px;align-items:center;padding:4px 0}
.tr-lrow .mp-inp{min-height:40px;padding:8px 12px}
/* Category and Unit: our own list (deliveries.js dlDdShow), a field-like button with the arrow on the right.
   Both are a fixed width, so a longer word never moves the row ("Roll" or "Karung") */
.tr-lrow .tr-dd{display:flex;align-items:center;justify-content:space-between;gap:6px;text-align:left;cursor:pointer;width:100%;padding:8px 10px 8px 12px}
.tr-lrow .tr-dd .gl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.tr-lrow .tr-dd .gl.ph{color:var(--ink-faint)}
.tr-lrow .tr-dd svg{width:14px;height:14px;color:var(--ink-faint);flex-shrink:0}
.tr-lrow .tr-dd:focus-visible{outline:2px solid var(--ink-faint);outline-offset:2px}
/* Qty and its unit are one pair ("3 [Box]"), as on the New delivery form */
.tr-qu{display:flex;align-items:center;gap:6px}
.tr-qu .tr-unit{width:96px;flex:none}
@media (max-width:600px){
  .tr-lrow{grid-template-columns:minmax(0,1fr) auto 32px;grid-template-areas:"m m x" "c q q"}
  .tr-lrow > input{grid-area:m}.tr-lrow > .tr-cat{grid-area:c}.tr-lrow > .tr-qu{grid-area:q}.tr-lrow > .mp-x{grid-area:x}
  .tr-qu .tr-unit{width:84px}
  .tr-lrow + .tr-lrow{border-top:1px solid var(--rule-soft);padding-top:10px}
}
/* the count above the rows grows with the words ("2 units · 3 Box · 2 types"): one line, nothing moves */
#tripBody .mp-sec-hd .mp-count{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}

/* the Day strip and each stop's kind are sliding switches (chips.css "THE NEW TRIP FORM");
   Pick a day / Due back sit beside them as a quiet field that opens our calendar */
.tr-dayrow,.tr-kindrow{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.tr-kindrow{margin-top:8px}
.tr-pick{display:inline-flex;align-items:center;gap:6px;height:44px;min-width:150px;padding:0 14px;border-radius:22px;background:var(--field);
  font:500 15px 'Inter',sans-serif;color:var(--ink);cursor:pointer;white-space:nowrap;position:relative;box-sizing:border-box}
.tr-pick svg{width:16px;height:16px;color:var(--ink-soft);flex-shrink:0}
.tr-pick.on{background:var(--surface);font-weight:600;box-shadow:0 0 0 1.5px var(--ink) inset}
.tr-pick input[type=date]{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;margin:0}
.tr-pick:focus-within{outline:2px solid var(--ink-faint);outline-offset:2px}
.tr-pick.tr-pickoff{background:none;color:var(--ink-faint);font-size:14px;cursor:default;padding:0 4px}

.tr-stops{margin-top:2px}
.tr-stop{display:grid;grid-template-columns:28px minmax(0,1fr);gap:0 14px;padding:14px 0 20px;position:relative}
.tr-stop + .tr-stop{border-top:1px solid var(--rule-soft)}
.tr-stop .n{width:28px;height:28px;border-radius:50%;background:var(--ink);color:var(--on-ink);font-size:13px;font-weight:600;display:flex;align-items:center;justify-content:center;margin-top:6px}
.tr-stop .n svg{width:16px;height:16px}
.tr-stop.end .n{background:var(--field);color:var(--ink-soft)}
.tr-stop.done .n{background:var(--good);color:#fff}
.tr-stop.needs .n{background:var(--accent);color:#fff}
.tr-stop-hd{display:flex;align-items:center;gap:6px;min-height:40px}
.tr-stop-hd .nm{flex:1;min-width:0;font-size:15px;font-weight:600;overflow-wrap:anywhere}
.tr-stop-hd .nm .mp-13{font-weight:400}
.tr-stop-hd .mv{display:flex;flex-shrink:0}
.tr-stop-hd .tr-srch{flex:1;min-width:0}
.tr-stop .mp-chips{margin-top:8px;gap:6px}
.tr-stop .mp-chip{min-height:34px;padding:0 13px}
.tr-fac{margin-top:6px}
.tr-drops{margin-top:12px}
.tr-drow{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;align-items:center;padding:3px 0}
.tr-drow .m{font-size:15px;overflow-wrap:anywhere}
.tr-drow.zero .m{color:var(--ink-faint)}
.tr-drow .l{font-size:13px;color:var(--ink-faint);text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tr-drow .l.bad{color:var(--accent);font-weight:500}
@media (max-width:600px){.tr-drow{grid-template-columns:minmax(0,1fr) auto}.tr-drow .l{grid-column:1/-1;text-align:left;margin-top:-4px}}
.tr-drow .mp-step{height:34px}
.tr-drow .mp-step button{height:34px;width:34px}
.mp-step .mp-qty{width:48px;height:100%;border:0;background:none;text-align:center;font:inherit;font-weight:500;font-variant-numeric:tabular-nums;color:var(--ink);padding:0;-moz-appearance:textfield;appearance:textfield}
.mp-step .mp-qty::-webkit-outer-spin-button,.mp-step .mp-qty::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.mp-step .mp-qty:focus{outline:2px solid var(--ink-faint);outline-offset:-2px;border-radius:8px}
.mp-step button:disabled{opacity:.35;cursor:default}
.tr-makes{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--ink-soft);margin-top:12px}
.tr-makes svg{width:16px;height:16px;color:var(--ink-faint);flex-shrink:0}
/* one line always (a long customer name ends in "…", the whole line is its title): the stop keeps its height */
.tr-makes span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.tr-makes.quiet{color:var(--ink-faint)}
.tr-needl{font-size:13px;color:var(--accent);margin-top:8px}
.tr-left{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;margin-top:6px}
.tr-tag{display:inline-flex;align-items:center;min-height:30px;padding:0 12px;border-radius:15px;background:var(--field);font-size:13px;font-weight:500}
.tr-acct{display:flex;gap:8px;align-items:flex-start;font-size:13px;margin-top:14px;color:var(--good);font-weight:500}
.tr-acct svg{width:16px;height:16px;margin-top:1px;flex-shrink:0}
.tr-acct.bad{color:var(--accent)}
.tr-stamp{font-size:13px;color:var(--good);margin-top:6px}
.tr-stamp.tr-locked{display:flex;align-items:center;gap:6px;color:var(--ink-soft)}
.tr-stamp.tr-locked svg{width:16px;height:16px;flex-shrink:0}
.mp-foot .mp-sum.red{color:var(--accent)}

/* ── a trip on the Deliveries screen: one line above its stops ── */
.tr-line{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px 10px;padding:12px 0 4px;border-top:1px solid var(--rule-soft)}
.tr-line:first-child{border-top:0}
.tr-line .no{font-size:15px;font-weight:600;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tr-line .meta,.tr-line .who{grid-column:1/-1;font-size:13px;color:var(--ink-soft)}
.tr-line .who{display:flex;align-items:center;gap:4px}
.tr-line .who:empty{display:none}
.tr-line .who svg{width:14px;height:14px}
.tr-line .who.bad{color:var(--accent)}
.tr-line .mp-text{min-height:30px;margin-right:-10px}

/* ── the driver's phone, the simpler layout he picked (1 Oct: "simpler") ── */
.sx-hd{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.sx-hd .t{font-size:19px;font-weight:600}
.sx-hd .s{font-size:15px;color:var(--ink-soft)}
.sx-prog{font-size:13px;color:var(--ink-faint);margin:-4px 0 10px}
.sx{border:1px solid var(--rule);border-radius:13px;background:var(--surface);overflow:hidden}
.sx-row{padding:14px;border-top:1px solid var(--rule-soft)}
.sx-row:first-child{border-top:0}
.sx-top{display:flex;align-items:flex-start;gap:12px;cursor:pointer;-webkit-tap-highlight-color:transparent}
.sx-n{flex-shrink:0;width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:600;background:var(--ink);color:var(--on-ink)}
.sx-n svg{width:17px;height:17px}
.sx-row.todo .sx-n{background:none;border:1.5px solid var(--rule);color:var(--ink-faint)}
.sx-row.wh .sx-n{background:var(--field);color:var(--ink-soft)}
.sx-row.done .sx-n{background:var(--good);color:#fff}
.sx-main{flex:1;min-width:0}
.sx-nm{font-size:15px;font-weight:600;line-height:1.3;overflow-wrap:anywhere}
.sx-row.todo .sx-nm{color:var(--ink-soft)}
.sx-what{font-size:15px;color:var(--ink-soft);margin-top:2px}
.sx-what b{font-weight:500;color:var(--ink)}
.sx-maps{flex-shrink:0;font-size:13px;font-weight:600;color:var(--ink);text-decoration:none;padding:6px 0 6px 8px}
.sx-steps{display:flex;flex-wrap:wrap;gap:4px 10px;font-size:13px;color:var(--ink-faint);margin-top:8px}
.sx-steps .ok{color:var(--good)}
.sx-steps .now{color:var(--ink);font-weight:600}
.sx-body{margin-left:42px}
.sx-body .tv-act{margin-top:12px}
.sx-done{font-size:13px;color:var(--good);margin-top:4px}
.sx-mv{display:flex;gap:4px;margin-top:8px}
.sx-mv button{width:44px;height:36px;border-radius:8px;border:1px solid var(--rule);background:none;color:var(--ink-soft);font-size:15px}
.sx-mv button:disabled{opacity:.35}
.sx-wait{font-size:13px;color:var(--ink-faint);margin-top:6px}
.sx-block + .sx-block{margin-top:30px}
.sx-back{display:inline-flex;align-items:center;gap:4px;border:0;background:none;color:var(--ink-soft);font:600 13px 'Inter',sans-serif;padding:6px 0;margin-bottom:10px;cursor:pointer}
@media (max-width:420px){.sx-body{margin-left:0}}
