/* ═══ THE CALMER NEW DELIVERY FORM (#m-delivery) ═══════════════════════════════
   Approved 26 Oct 2026 ("good") from _prototype-delivery-form.html, layout "At the top":
   trip type first, then Where / When and who / What.
   ⚠ NOTHING MOVES (his "whenever I change this, the page changes layout which is hard"):
     every part that depends on the trip type, on where it goes or on the place sits in a
     .dn-stack cell with all its versions; the ones not in use are invisible and inert but
     keep their room, so the cell is as tall as its tallest version for every choice.
   ⚠ Every selector is under #m-delivery (or the list, #dlDdList, which hangs on <body>):
     this sheet is linked on every screen and must touch nothing else.
   Our own drop-down replaces the browser's (rule 37): the real <select> stays, hidden
   (.dn-real), so drafts.js and the change handlers still see it.
   ═════════════════════════════════════════════════════════════════════════════ */
#m-delivery [hidden]{display:none!important}
#m-delivery .dn-real{display:none!important}
#m-delivery .dn .jf-flag{font-size:14px}
#m-delivery .dn .m3s input{font-size:15px}
#m-delivery .dn .dlg-bd{padding-top:8px}
#m-delivery .dn-sec + .dn-sec{margin-top:28px}
#m-delivery .dn-h{font-size:19px;font-weight:600;line-height:1.25;color:var(--ink);margin:0 0 16px;letter-spacing:-.005em}
#m-delivery .dn-q{margin-bottom:20px}
#m-delivery .dn-q:last-child{margin-bottom:0}
#m-delivery .dn-l{display:block;font:600 14px/1.3 'Inter',sans-serif;color:var(--ink-soft);margin:0 0 8px;text-transform:none;letter-spacing:0}
#m-delivery .dn-l .opt{font-weight:400;color:var(--ink-faint);margin-left:6px}
#m-delivery .dn-note{font:400 14px/1.45 'Inter',sans-serif;color:var(--ink-soft);margin:8px 0 0}
#m-delivery .dn-note .bad{color:var(--accent);font-weight:600}
#m-delivery .dn .m3s.dn-miss{box-shadow:0 0 0 2px var(--accent);border-radius:999px}
#m-delivery .inp.dn-miss,#m-delivery .dn-miss > .inp{box-shadow:0 0 0 2px var(--accent)}
#m-delivery .dn-two{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px}
#m-delivery .dn-two > .dn-q{margin-bottom:0}

/* the two switches: the app's strip, both filling their row */
#m-delivery .dn .dn-dest{margin:0}
/* parts that swap in place: every child sits in the same cell, the box is as tall as the tallest */
#m-delivery .dn-stack{display:grid}
#m-delivery .dn-stack > *{grid-area:1 / 1;min-width:0}
#m-delivery .dn-stack > [data-off]{visibility:hidden}
#m-delivery .dn-wrow{margin:0 0 20px}
#m-delivery .dn-line{display:flex;align-items:center;font:400 15px/1.35 'Inter',sans-serif;color:var(--ink-soft)}
#m-delivery .dn-ours{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
#m-delivery .dn-selbtn .bad{margin-left:auto;padding-left:10px;flex:none;white-space:nowrap;color:var(--accent);font-size:14px;font-weight:600}
#m-delivery .dn .dn-kind.mseg{display:grid;width:100%;grid-auto-columns:minmax(max-content,1fr)!important}

/* our drop-down: today's typing box, drawn by us, with today's chevron */
#m-delivery .dn-selbtn.inp{display:flex;align-items:center;width:100%;text-align:left;cursor:pointer;padding-right:44px;
  background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2362615c' stroke-width='2'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 14px center;background-size:20px;color:var(--ink);font-family:'Inter',sans-serif;font-weight:400}
#m-delivery .dn-selbtn .v{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
/* a flag never wraps the button onto a second line (the half-width Our place on a phone) */
#m-delivery .dn-selbtn.inp{overflow:hidden}
#m-delivery .dn-selbtn .ph{color:var(--ink-faint)}
/* the list it opens (and the model list): one look, on the page, above the pop-up (.ov 1000),
   under the picture viewers (1200) and the question box (#m-ask 2100) */
#dlDdList{position:fixed;z-index:1100;background:var(--surface);border:1px solid var(--rule);border-radius:10px;
  box-shadow:0 12px 32px rgba(20,18,16,.16);padding:4px;overflow-y:auto;max-height:280px;font-family:'Inter',sans-serif;
  transform-origin:var(--o,top center);animation:dlDdIn .14s cubic-bezier(.23,1,.32,1)}
@keyframes dlDdIn{from{opacity:0;transform:scale(.97)}}
#dlDdList .dn-opt{display:flex;flex-direction:column;gap:2px;padding:9px 12px;border-radius:7px;cursor:pointer;font-size:15px;color:var(--ink)}
#dlDdList .dn-opt small{font-size:14px;color:var(--ink-soft)}
#dlDdList .dn-opt small.bad{color:var(--accent)}
#dlDdList .dn-opt[aria-selected="true"]{font-weight:600}
#dlDdList .dn-opt.act{background:var(--field)}
#dlDdList .dn-none{padding:9px 12px;font-size:14px;color:var(--ink-soft)}
/* the shared customer search writes 13px inline (maintenance-jobs.js): 14 is the floor here */
#m-delivery #dlCustomerResults .ui,#m-delivery #dlForCustomerResults .ui,
#m-delivery #dlCustomerResults *,#m-delivery #dlForCustomerResults *{font-size:14px!important}

/* machines: rows, not boxes */
#m-delivery .dn-mhead,#m-delivery .dn-rg{display:grid;grid-template-columns:minmax(0,1fr) 190px 184px;gap:12px;align-items:end}
/* Qty and its unit are one pair under the one heading ("3 [Box]"); the unit is our drop-down, a narrow one */
#m-delivery .dn-qu{display:grid;grid-template-columns:64px minmax(0,1fr);gap:8px}
#m-delivery .dn-unit.dn-selbtn.inp{padding-left:10px;padding-right:30px;background-position:right 8px center;background-size:18px}
/* a line counted in anything but Unit has no serial numbers: the foot keeps its height, Remove stays put */
#m-delivery .dn-rf.dn-nosn .dn-sn,#m-delivery .dn-rf.dn-nosn [data-sn]{visibility:hidden}
/* "+ New unit…" turns the list into one typing row */
#dlDdList .dn-opt.dn-newo{color:var(--accent);font-weight:600}
#dlDdList .dn-newu{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:6px}
#dlDdList .dn-newu .inp{width:100%;font-size:15px}
#dlDdList .dn-newu .btn-line{width:auto}
#dlDdList .dn-newe{padding:2px 8px 6px;font-size:14px;color:var(--accent);min-height:0}
#dlDdList .dn-newe:empty{display:none}
#m-delivery .dn-mhead{padding:0 0 8px}
#m-delivery .dn-mhead span{font:600 14px 'Inter',sans-serif;color:var(--ink-soft)}
#m-delivery .dn-row{padding:12px 0 14px;border-top:1px solid var(--rule-soft)}
#m-delivery .dn-row .dn-l{display:none}
#m-delivery .dn-qty.inp{text-align:center;font-variant-numeric:tabular-nums;padding:0 8px}
#m-delivery .dn-rf{display:flex;align-items:center;gap:4px 16px;flex-wrap:wrap;margin-top:8px}
#m-delivery .dn-sn{font-size:14px;color:var(--ink-soft);margin-right:auto}
#m-delivery .dn-sn b{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
#m-delivery .dn-sn.dn-warn{color:var(--accent);font-weight:500}
#m-delivery .dn-tx{border:0;background:none;padding:6px 8px;margin:-6px -8px;border-radius:8px;cursor:pointer;
  font:600 14px 'Inter',sans-serif;color:var(--ink);transition:background-color .12s;width:auto;min-height:0}
#m-delivery .dn-tx:focus-visible,#m-delivery .dn-fold:focus-visible,#m-delivery .dn-selbtn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (max-width:760px){#m-delivery .dn-tx{padding:12px 10px;margin:-12px -10px;white-space:nowrap}#m-delivery .dn-rf{gap:8px 20px;flex-wrap:nowrap}#m-delivery .dn-sn{min-width:0}}
@media (hover:hover){#m-delivery .dn-tx:hover{background:var(--field)}}
#m-delivery .dn-tx:active{transform:scale(.97)}
#m-delivery .dn-sng{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px 12px;margin-top:12px}
#m-delivery .dn-sng label{display:block;font:600 14px 'Inter',sans-serif;color:var(--ink-soft);margin:0 0 6px;text-transform:none;letter-spacing:0}
#m-delivery .dn-sng .inp{font-variant-numeric:tabular-nums}
#m-delivery .dn-gone{display:flex;align-items:center;gap:16px;padding:14px 0;border-top:1px solid var(--rule-soft);font-size:14px;color:var(--ink-soft)}
#m-delivery .dn-gone b{color:var(--ink);font-weight:600}
#m-delivery .dn-add{margin-top:16px}
#m-delivery .dn-cnt{font-size:14px;color:var(--ink-soft);font-variant-numeric:tabular-nums}
#m-delivery .dn-mlab{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:24px 0 8px}
#m-delivery .dn-mlab .dn-l{margin:0;flex:none}
/* the count grows with the units ("2 units · 3 Box · 1 Roll"): one line always, so the rows never move */
#m-delivery .dn-mlab .dn-cnt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}

/* ticks (the app's fine tick, manage.css .msbox) */
#m-delivery .dn-ticks{display:flex;flex-direction:column;gap:14px;margin-top:4px}
#m-delivery .dn-tick{display:flex;align-items:center;gap:10px;cursor:pointer;font:400 15px 'Inter',sans-serif;color:var(--ink);text-transform:none;letter-spacing:0;margin:0}
#m-delivery .dn-tick .msbox{margin:0}

/* more details: our own fold, no browser arrow */
#m-delivery .dn-more{margin-top:20px}
#m-delivery .dn-fold{display:flex;align-items:center;gap:8px;border:0;background:none;padding:6px 8px;margin:0 -8px;border-radius:8px;
  font:600 15px 'Inter',sans-serif;color:var(--ink);cursor:pointer;width:auto;min-height:0}
@media (hover:hover){#m-delivery .dn-fold:hover{background:var(--field)}}
#m-delivery .dn-fold svg{width:18px;height:18px;transition:transform .2s cubic-bezier(.23,1,.32,1)}
#m-delivery .dn-fold[aria-expanded="true"] svg{transform:rotate(180deg)}
#m-delivery .dn-fbody{display:grid;grid-template-rows:0fr;transition:grid-template-rows .22s cubic-bezier(.23,1,.32,1)}
#m-delivery .dn-fbody.open{grid-template-rows:1fr}
#m-delivery .dn-fbody > div{overflow:hidden;min-height:0}
#m-delivery .dn-fin{padding-top:16px;display:grid;grid-template-columns:1fr 1fr;gap:20px}
#m-delivery .dn-fin .wide{grid-column:1 / -1}
#m-delivery .dn-fin textarea.inp{width:100%}
#m-delivery .dn-fin .inp{width:100%}

/* the foot: the answer to Save on the left */
#m-delivery .dn-ftn{margin-right:auto;font-size:14px;color:var(--accent);min-width:0}

@media (max-width:760px){
  #m-delivery .dn-two,#m-delivery .dn-fin{grid-template-columns:1fr}
  #m-delivery .dn-two{gap:20px}
  #m-delivery .dn-mhead{display:none}
  #m-delivery .dn-row .dn-l{display:block}
  #m-delivery .dn-rg{grid-template-columns:minmax(0,1fr) 176px;gap:12px 12px}
  #m-delivery .dn-qu{grid-template-columns:60px minmax(0,1fr)}
  #m-delivery .dn-rg > :first-child{grid-column:1 / -1}
  #m-delivery .dn-row{padding:16px 0}
  #m-delivery .dn-sng{grid-template-columns:1fr}
  #m-delivery .dn-ftn:empty{display:none}
  #m-delivery .dn-ftn{flex:1 1 100%;order:-1}
  #m-delivery .dn .dlg-ft{flex-wrap:wrap}
  /* five trips on a phone: the same strip, two to a row, the last one across */
  #m-delivery .dn .dn-kind.mseg{height:auto!important;grid-auto-flow:row!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-auto-rows:38px}
  #m-delivery .dn .dn-kind.mseg > button:nth-child(5){grid-column:1 / -1}
  #m-delivery .dn .dn-kind.mseg > button:is(:nth-child(3),:nth-child(5))::before{display:none!important}
  #m-delivery .dn .dn-kind.mseg > button::after{height:38px!important}
}
@media (prefers-reduced-motion:reduce){#dlDdList{animation:none}#m-delivery .dn-fbody,#m-delivery .dn-fold svg{transition:none}}
