/* Movers panel (workflow). Fills the shell's #panel; everything scoped under .cx. Grey ink only. */
.cx { display: flex; flex-direction: column; flex: 1 1 auto; height: 100%; min-height: 0; color: var(--ink); font-size: 12px; }
.cx [hidden] { display: none !important; }
.cx button { -webkit-tap-highlight-color: transparent; }
/* motion: short, one easing; states cross-fade, new content rises in. Off entirely for reduced motion. */
.cx { --ease: cubic-bezier(.2, .7, .2, 1); }
.cx button, .cx select, .cx-q, .cx-list li, .cx-cut { transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease); }
.cx button:not(:disabled):active { transform: scale(.97); }
@keyframes cx-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cx-row { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
@keyframes cx-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cx-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cx, .cx *, .cx *::before, .cx *::after { animation: none !important; transition: none !important; } }

/* header: title, export, filters, search, sort (grid areas change on phones) */
.cx-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; flex: none;
  grid-template-areas: "title export" "filt filt" "search sort";
  padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--edge);
}
.cx-title { grid-area: title; margin: 0; font-size: 13px; font-weight: 500; white-space: nowrap; }
.cx-count { color: var(--ink-3); font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.cx-head > .cx-menuwrap { grid-area: export; justify-self: end; }
.cx-export { padding: 5px 8px; font-size: 11px; }
.cx-filters { grid-area: filt; display: flex; margin-left: -4px; }
.cx-filters > button { padding: 5px 8px; font-size: 11px; flex: 1 1 auto; white-space: nowrap; }
.cx-fsel { grid-area: fsel; display: none; }
.cx-q { grid-area: search; min-width: 0; margin-left: -4px; }
.cx-sort { grid-area: sort; }
.cx select {
  font: inherit; font-size: 12px; color: var(--ink); background: transparent; border: 1px solid var(--edge); border-radius: 6px;
  padding: 5px 22px 5px 8px; appearance: none; -webkit-appearance: none; cursor: pointer; min-width: 0;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 11px) 52%, calc(100% - 7px) 52%; background-size: 4px 4px; background-repeat: no-repeat;
}
.cx select:hover { border-color: var(--ink-3); }
.cx select:focus-visible, .cx-list li:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cx option { background: var(--panel-solid); color: var(--ink); }

/* menus */
.cx-menuwrap { position: relative; }
.cx-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 150px; padding: 4px; border-radius: 8px;
  display: flex; flex-direction: column; gap: 1px; background: var(--panel-solid); box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.cx-menu button { border: 0; text-align: left; padding: 8px 10px; border-radius: 5px; font-size: 12px; width: 100%; }
.cx-menu button:hover, .cx-menu button:focus-visible { background: var(--edge); outline: none; }
.cx-menu button[aria-checked="true"] { background: var(--fill); color: var(--fill-ink); }
.cx-menu:not([hidden]) { animation: cx-pop .14s var(--ease); transform-origin: top right; }

/* list */
.cx-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 0 1 auto; min-height: 0; overscroll-behavior: contain; }
.cx.has-detail .cx-list { flex: 1 1000 auto; min-height: 92px; }
.cx-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--ink-2); outline-offset: -2px; }
.cx-list li:hover { background: var(--edge); color: var(--ink); }
/* rows rise in one after another when the listed set changes (filter, search, new movers), not on every click */
.cx-list.cx-anim li { animation: cx-row .22s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 22ms); }
.cx-list li[aria-selected="true"] { color: var(--ink); background: var(--edge); }
.cx-list li:focus-visible { outline-offset: -2px; }
.cx-list .n { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.cx-mid { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cx-lab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.cx-sub { font-size: 11px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.cx-list .s { font-size: 11px; color: var(--ink-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
/* status by form as well as word: unmatched candidates stand out, pipeline matches recede */
.cx-list .s::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1px solid transparent; flex: none; transition: background-color .15s var(--ease), border-color .15s var(--ease); }
.cx-list .s-candidate { color: var(--ink); }
.cx-list .s-candidate::before { background: var(--ink); border-color: var(--ink); }
.cx-list .s-likely { color: var(--ink-2); }
.cx-list .s-likely::before { border-color: var(--ink-2); }
.cx-list li[aria-selected="true"] .n, .cx-list li[aria-selected="true"] .s-matched, .cx-list li[aria-selected="true"] .cx-sub { color: var(--ink-2); }
.cx-count { transition: opacity .15s var(--ease); }
.cx-sim { font-size: 10px; line-height: 1; padding: 2px 5px; border: 1px solid var(--edge); border-radius: 4px; color: var(--ink-2); letter-spacing: .01em; white-space: nowrap; }
/* in the list the label is quiet inline text; the top-bar badge and the detail header carry the bordered chip */
.cx-list .cx-sim { border: 0; padding: 0; font-size: 11px; line-height: inherit; color: var(--ink-3); }
.cx-list .cx-sim::before { content: "·"; margin-right: 6px; }
/* the list fades out at the bottom while there is more to scroll to */
.cx-list.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
/* desktop: the panel is only as tall as its contents; with a mover selected the list gives way to its card */
@media (min-width: 861px) { #panel { bottom: auto; max-height: calc(100dvh - var(--top-h) - 8px - env(safe-area-inset-bottom, 0px) - 86px); } }
.cx-empty { padding: 18px 14px; color: var(--ink-3); line-height: 1.5; }
.cx-empty:not([hidden]) { animation: cx-fade .2s var(--ease); }
.cx-empty button { margin-top: 8px; padding: 6px 8px; font-size: 11px; }

/* detail */
/* the card is shown whole; the list above it shrinks first (flex-shrink 1000 vs 1), so the card only scrolls on windows too short for it */
.cx-detail { border-top: 1px solid var(--edge); padding: 12px 14px 0; flex: 0 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.cx-detail:not([hidden]) { animation: cx-rise .24s var(--ease); }
.cx-detail.cx-swap .cx-card { animation: cx-rise .2s var(--ease); }
/* inspector: the selected mover's imagery and description (see INSPECTOR in index.js) */
.cx-insp { color: var(--ink); font-size: 12px; }
#inspect .cx-insp { padding: 12px 14px 14px; overflow: auto; min-height: 0; overscroll-behavior: contain; }
.cx-insp.cx-swap { animation: cx-rise .2s var(--ease); }
.cx-dhead { display: flex; align-items: center; gap: 8px; }
.cx-dhead h3 { margin: 0; font-size: 13px; font-weight: 500; }
.cx-close { margin-left: auto; width: 24px; height: 24px; font-size: 11px; color: var(--ink-2); }
.cx-close:hover { color: var(--ink); }
.cx-tag { color: var(--ink-2); margin-top: 2px; }
.cx-cutgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 10px; }
.cx-fig { display: contents; }
.cx-cut { width: 100%; height: auto; aspect-ratio: 1; border-radius: 6px; background: #000; border: 1px solid var(--edge); display: block; cursor: zoom-in; }
.cx-cut:hover { border-color: var(--ink-2); }
.cx-cut.cx-tick { animation: cx-fade .25s var(--ease); } /* the cutout steps to another scan */
.cx-cutlabel { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 6px; color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.cx-note { margin: 6px 0 0; color: var(--ink-2); line-height: 1.45; }
/* in the sheet (phones) the cutout sits beside the description, and the sheet has its own close */
.cx-insp-slot .cx-cutgrid { grid-template-columns: 88px minmax(0, 1fr); grid-template-areas: "cut note" "cap cap"; gap: 6px 10px; align-items: start; }
.cx-insp-slot .cx-cut { grid-area: cut; }
.cx-insp-slot .cx-cutlabel { grid-area: cap; }
.cx-insp-slot .cx-note { grid-area: note; margin: 0; }
.cx-insp-slot .cx-close { display: none; }
/* facts stay in the sidebar; with the inspector out they carry the mover's name */
.cx-facts { margin-top: 10px; }
.cx-insp-slot:empty + .cx-facts { margin-top: 0; }
.cx-fname { display: none; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.cx.insp-out .cx-fname { display: block; }
.cx-detail dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 10px; align-content: start; }
.cx-detail dt { color: var(--ink-3); }
.cx-detail dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* the buttons stay put at the bottom of the card; when the card has to scroll (short windows) they sit on a solid strip */
.cx-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 2px; padding: 10px 0 14px; position: sticky; bottom: 0; }
.cx-detail.scrolls .cx-actions { background: var(--panel); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--edge); margin-inline: -14px; padding-inline: 14px; }
.cx-actions button { padding: 6px 4px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* export fallback dialog */
.cx-dialog { border: 1px solid var(--edge); border-radius: 12px; padding: 0; background: var(--panel-solid); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
.cx-dialog::backdrop { background: rgba(0,0,0,.4); }
.cx-dlg-box { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.cx-dlg-box h3 { margin: 0; font-size: 14px; font-weight: 500; }
.cx-dlg-msg { margin: 0; color: var(--ink-2); line-height: 1.45; font-size: 12px; }
.cx-dlg-text { font: 11px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink); background: transparent; border: 1px solid var(--edge); border-radius: 6px; padding: 8px; width: 100%; height: 40vh; resize: vertical; white-space: pre; overflow: auto; }
.cx-dlg-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.cx-dlg-status { flex: 1; color: var(--ink-3); font-size: 11px; }

/* phones: bottom sheet contents. Compact selects, side-by-side cutout, ≥ 40px tap targets. */
@media (max-width: 860px) {
  .cx-head { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "title search search export" "fsel fsel sort sort"; padding: 8px 8px 8px 14px; }
  .cx-title { margin-right: 4px; }
  .cx-filters { display: none; }
  .cx-fsel { display: block; }
  .cx-q { margin-left: 0; }
  .cx-head > .cx-menuwrap .cx-export { padding: 6px 10px; }
  .cx button, .cx select, .cx-q { min-height: 40px; }
  .cx-export { font-size: 12px; }
  .cx-q { font-size: 16px; } /* avoids iOS zoom-on-focus */
  .cx select { font-size: 13px; }
  .cx-list li { min-height: 44px; }
  .cx.has-detail .cx-list { min-height: 88px; }
  @media (max-height: 700px) { .cx.has-detail .cx-list { min-height: 44px; } } /* short phones: one row of list, the card first */
  #panel { height: auto; max-height: calc(100dvh - var(--top-h) - var(--bottom-h) - 40px); } /* the sheet grows to fit the card */
  .cx-actions button { font-size: 12px; }
  .cx-menu button { min-height: 44px; }
}
@media (pointer: coarse) {
  .cx button, .cx select { min-height: 40px; }
  .cx-list li { min-height: 44px; }
}
