/* Pack 10 Ingest: imports. Tokens only. Rules for 1279, 1023 and 767 px. */

/* ---------- Import flow steps (Upload, Columns, Questions, Matches, Preview, Done) ---------- */
.iflow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s4); }
.iflow .st { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 6px 12px 6px 6px; border-radius: var(--r-pill); background: var(--surface-sunk); white-space: nowrap; min-height: 34px; }
.iflow .st b { width: 22px; height: 22px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 11px; border: 1px solid var(--border-strong); flex-shrink: 0; }
.iflow .st.done { color: var(--ok-ink); background: var(--ok-tint); }
.iflow .st.done b { background: var(--ok); color: #fff; border-color: var(--ok); }
.iflow .st.on { color: var(--primary-ink); background: var(--primary-tint); font-weight: 700; }
.iflow .st.on b { background: var(--primary); color: #fff; border-color: var(--primary); }
.iflow .st.wait { color: var(--warn-ink); background: var(--warn-tint); }
.iflow .st.wait b { background: var(--warn); color: #fff; border-color: var(--warn); }
a.st:hover span { text-decoration: underline; }
@media (max-width: 767px) {
  .iflow .st:not(.on) span { display: none; }
  .iflow .st:not(.on) { padding: 6px; min-height: var(--tap); min-width: var(--tap); justify-content: center; }
}

/* ---------- File summary strip ---------- */
.ifile { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ifile .fi { width: 42px; height: 42px; border-radius: 10px; background: var(--ok-tint); color: var(--ok-ink); display: grid; place-items: center; flex-shrink: 0; }
.ifile .fi.warn { background: var(--warn-tint); color: var(--warn-ink); }
.ifile .fi.bad { background: var(--bad-tint); color: var(--bad-ink); }
.ifile .t { flex: 1 1 260px; min-width: 0; display: grid; gap: 2px; }
.ifile .t strong { font-size: 15px; overflow-wrap: anywhere; }
.ifile .t small { color: var(--muted); font-size: 12.5px; }

/* ---------- Column matching list (desktop rows, phone cards: R5 V11) ---------- */
.colmap { display: grid; }
.colhead, .colrow { display: grid; grid-template-columns: minmax(150px, 1.05fr) minmax(170px, 1.35fr) 22px minmax(190px, 1.25fr) 156px; gap: 14px; align-items: center; padding: 11px 16px; }
.colhead { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted-2); font-weight: 600; border-radius: var(--r-card) var(--r-card) 0 0; }
.colrow { border-bottom: 1px solid var(--line); }
.colrow:last-child { border-bottom: 0; }
.colrow.need { background: color-mix(in srgb, var(--warn-tint) 55%, #fff); box-shadow: inset 3px 0 0 var(--warn); }
.colrow.unk { background: color-mix(in srgb, var(--bad-tint) 45%, #fff); box-shadow: inset 3px 0 0 var(--bad); }
.colrow .src { display: grid; gap: 2px; min-width: 0; }
.colrow .src strong { font-size: 13.5px; overflow-wrap: anywhere; }
.colrow .src small { font-size: 12px; color: var(--muted); }
.colrow .arrow { color: var(--muted-2); }
.colrow .why { font-size: 12px; color: var(--muted); grid-column: 4 / 6; margin-top: -6px; }
.samples { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.samp { font-size: 12px; padding: 2px 7px; border-radius: 6px; background: var(--surface-sunk); color: var(--text-2); max-width: 100%; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.samp.bad { background: var(--bad-tint); color: var(--bad-ink); }
.samp.more { background: transparent; color: var(--muted); padding-left: 0; }
.conf { display: grid; gap: 5px; justify-items: start; }
.confbar { width: 100%; max-width: 140px; height: 6px; border-radius: 3px; background: var(--surface-sunk); overflow: hidden; }
.confbar i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--ok)); }
@media (max-width: 1279px) {
  .colhead { display: none; }
  .colrow { grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); grid-template-areas: "src arrow fld" "smp smp conf" "why why why"; row-gap: 8px; }
  .colrow .src { grid-area: src; } .colrow .arrow { grid-area: arrow; } .colrow .fld { grid-area: fld; }
  .colrow .samples { grid-area: smp; } .colrow .conf { grid-area: conf; justify-items: end; } .colrow .why { grid-area: why; margin-top: 0; }
}
@media (max-width: 767px) {
  .colrow { grid-template-columns: minmax(0, 1fr); grid-template-areas: "src" "smp" "fld" "conf" "why"; padding: 14px; gap: 8px; }
  .colrow .arrow { display: none; }
  .colrow .conf { justify-items: start; }
}

/* ---------- Quick questions ---------- */
.qcard { display: grid; gap: 12px; }
.qcard .q10-h { display: flex; gap: 12px; align-items: flex-start; }
.qcard .q10-n { width: 28px; height: 28px; border-radius: 50%; background: var(--warn-tint); color: var(--warn-ink); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.qcard .q10-n.done { background: var(--ok-tint); color: var(--ok-ink); }
.qcard h3 { font-size: 15.5px; line-height: 1.35; }
.qcard .q10-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.opt { border: 1px solid var(--border-strong); border-radius: 10px; padding: 11px 13px; background: #fff; display: grid; gap: 4px; min-height: var(--tap); }
.opt.on { border-color: var(--primary); background: var(--primary-tint); box-shadow: 0 0 0 1px var(--primary); }
.opt .check { font-weight: 600; }
.opt small { color: var(--muted); font-size: 12px; padding-left: 28px; }
.qfoot { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line); }
@media (max-width: 767px) { .opts { grid-template-columns: minmax(0, 1fr); } .qfoot .btn { width: 100%; } }

/* ---------- Preview buckets ---------- */
.buckets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.bucket { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; display: grid; gap: 4px; align-content: start; box-shadow: var(--shadow-card); }
a.bucket:hover { border-color: var(--primary); }
.bucket .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.bucket .val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.bucket .note { font-size: 12px; color: var(--muted); }
.bucket.add { border-top: 3px solid var(--ok); }
.bucket.chg { border-top: 3px solid var(--primary); }
.bucket.same { border-top: 3px solid var(--info); }
.bucket.skip { border-top: 3px solid var(--grey-ink); }
.bucket.rej { border-top: 3px solid var(--bad); }
@media (max-width: 1279px) { .buckets { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .bucket .val { font-size: 21px; } }

/* ---------- Equation line: rows = added + changed + ... ---------- */
.eqline { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.eqline b { color: var(--text); }
.eqline .op { color: var(--muted-2); }

/* ---------- Compare (patient match) ---------- */
.cmp { display: grid; grid-template-columns: 150px repeat(var(--n, 2), minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 13px; }
.cmp > div { padding: 9px 12px; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.cmp .h { background: var(--surface-2); font-weight: 700; color: var(--text); }
.cmp .k { color: var(--muted); background: var(--surface-2); }
.cmp .same { color: var(--ok-ink); }
.cmp .diff { color: var(--bad-ink); font-weight: 600; }
@media (max-width: 767px) { .cmp { grid-template-columns: 96px repeat(var(--n, 2), minmax(0, 1fr)); font-size: 12.5px; } .cmp > div { padding: 8px; } }

/* ---------- Match cards ---------- */
.mcard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 210px; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.mcard:last-child { border-bottom: 0; }
.mcard .side-l, .mcard .side-r { display: grid; gap: 3px; min-width: 0; }
.mcard .side-l small, .mcard .side-r small { color: var(--muted); font-size: 12.5px; }
.mcard .mc-acts { display: grid; gap: 6px; }
.mcard .mc-acts .btn { width: 100%; }
@media (max-width: 1023px) { .mcard { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .mcard .mc-acts { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .mcard { grid-template-columns: minmax(0, 1fr); padding: 14px; } .mcard .mc-acts { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Progress ---------- */
.prog { display: grid; gap: 6px; }
.prog .bar { height: 10px; border-radius: 5px; }
.prog .row { font-size: 12.5px; color: var(--muted); }
.checks { display: grid; gap: 8px; }
.checks .ck { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.checks .ck .icon { margin-top: 2px; }
.checks .ck.ok .icon { color: var(--ok); }
.checks .ck.run .icon { color: var(--primary); }
.checks .ck.wait .icon { color: var(--muted-2); }
.checks .ck.bad .icon { color: var(--bad); }

/* ---------- Kind picker on upload ---------- */
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kind { border: 1px solid var(--border-strong); border-radius: 12px; padding: 13px 14px; background: #fff; display: flex; gap: 12px; align-items: flex-start; min-height: var(--tap); }
.kind:hover { border-color: var(--primary); }
.kind.on { border-color: var(--primary); background: var(--primary-tint); box-shadow: 0 0 0 1px var(--primary); }
.kind .ki { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-sunk); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; }
.kind.on .ki { background: #fff; color: var(--primary-ink); }
.kind .t { display: grid; gap: 2px; min-width: 0; }
.kind .t strong { font-size: 13.5px; }
.kind .t small { font-size: 12px; color: var(--muted); }
@media (max-width: 1279px) { .kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .kinds { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Waiting import cards on the Imports home ---------- */
.wait-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
@media (max-width: 1023px) { .wait-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Sticky action bar at the bottom of flow pages ---------- */
.flowbar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; background: rgba(255, 255, 255, .96); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); margin-top: var(--s4); }
.flowbar .fb-msg { font-size: 13px; color: var(--muted); flex: 1 1 260px; min-width: 0; }
.flowbar .fb-acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 767px) {
  .flowbar { bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); border-radius: 0; margin-left: calc(-1 * var(--s4)); margin-right: calc(-1 * var(--s4)); padding-bottom: 12px; }
  .flowbar .fb-acts { width: 100%; }
  .flowbar .fb-acts .btn { flex: 1 1 auto; }
}

/* ---------- Mono value, translation arrow ---------- */
.fileword { font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-sunk); border: 1px solid var(--border); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.to-arrow { color: var(--muted-2); display: inline-flex; vertical-align: middle; }

/* ---------- Segmented filters that may be wider than a phone ---------- */
.segx { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segx::-webkit-scrollbar { display: none; }
@media (max-width: 1023px) { .segx .seg a { min-height: var(--tap); display: inline-flex; align-items: center; } }
/* Phone: columns that need checking come first (R5 V11) */
@media (max-width: 767px) { .colmap { display: flex; flex-direction: column; } .colrow.need, .colrow.unk { order: -1; } }

/* Side columns that would leave a half-empty row between 768 and 1279 */
@media (max-width: 1279px) and (min-width: 768px) {
  .grid > .side-pair { grid-column: span 12; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
  .grid > .span-md { grid-column: span 12; }
}
.picker-search { margin-bottom: 4px; }
.picker-search .filters { margin-bottom: 0; }

/* Plain sentence lines that start with a bold count (10-05 Visits card). Unlike .eqline they wrap as text. */
.vline { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.vline b { color: var(--text); font-variant-numeric: tabular-nums; margin-right: 4px; }
.nobr { white-space: nowrap; }

/* Phone: keep all six import steps on one line (5 compact steps of 44px plus the active one fit in 358px with 4px gaps). */
@media (max-width: 767px) {
  .iflow { gap: 4px; }
  .iflow .st.on { padding-right: 10px; }
}
