/* ============================================================
   Custom select (see assets/select.js)
   Native popups are browser-painted and cannot be positioned with CSS,
   so the list is rendered inline instead.
   ============================================================ */

.csel{position:relative;width:100%;min-width:0}

/* the real control stays for form semantics, out of sight and out of tab order */
.csel-native{
  position:absolute !important;
  left:0;top:0;width:100%;height:100%;
  opacity:0;pointer-events:none;
  margin:0;border:0;padding:0;
}

.csel-btn{
  width:100%;min-width:0;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  background:#fff;border:1px solid var(--line);color:var(--ink);
  font-family:inherit;font-size:13px;font-weight:400;line-height:1.3;
  padding:11px 12px;border-radius:0;text-align:left;
  cursor:pointer;
  -webkit-appearance:none;appearance:none;
  transition:border-color .2s;
}
.csel-btn:focus{outline:none;border-color:var(--teal)}
.csel-btn:focus-visible{outline:2px solid var(--teal);outline-offset:1px}
.csel-btn[disabled]{opacity:.5;cursor:not-allowed}

/* flex:1 1 0 keeps the (long) current value from setting the field's
   min-content width — without it the whole order grid overflows on phones */
.csel-label{width:0;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.csel-caret{width:9px;height:6px;flex:none;color:var(--muted);transition:transform .2s}
.csel.is-open .csel-caret{transform:rotate(180deg)}

.csel-list{
  position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:80;
  background:#fff;border:1px solid var(--line);
  box-shadow:0 20px 44px rgba(17,32,29,.16);
  max-height:320px;overflow-y:auto;overscroll-behavior:contain;
  padding:4px;
}
.csel-list.up{top:auto;bottom:calc(100% + 6px)}

.csel-opt{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:9px 10px;font-size:13px;line-height:1.3;color:var(--ink);
  cursor:pointer;
}
.csel-opt-text{min-width:0}
.csel-opt:hover,.csel-opt.is-active{background:var(--cream)}
.csel-opt.is-selected{font-weight:600}
.csel-opt.is-disabled{opacity:.4;cursor:not-allowed}
.csel-opt.is-disabled:hover{background:none}

.csel-tick{width:11px;height:9px;flex:none;color:var(--teal);opacity:0}
.csel-opt.is-selected .csel-tick{opacity:1}

@media(max-width:640px){
  .csel-btn{font-size:12px;padding:10px 11px}
  .csel-opt{font-size:12px;padding:10px}
}
