/* ============================================================
   Bevri POS — Application shell
   Left progress rail (ChatGPT-style) + persistent chat dock.
   ============================================================ */

.shell {
  position: relative;
  z-index: 2;
  display: flex;
  height: 100dvh;
  width: 100%;
}

/* ---------------- left progress rail ---------------- */
.rail {
  flex: 0 0 288px;
  width: 288px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rail-head {
  padding: 20px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rail-logo { background: none; border: 0; padding: 2px; display: inline-flex; }
.rail-scroll { flex: 1 1 auto; overflow-y: auto; padding: 6px 16px 16px; }
.rail-eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--sage);
  font-weight: 500;
  padding: 8px 10px 12px;
}

/* stage list */
.stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 11px 12px;
  border-radius: 12px;
  transition: background .15s;
}
.stage + .stage { margin-top: 2px; }
.stage.clickable { cursor: pointer; }
.stage.clickable:hover { background: var(--mint-tint); }
.stage.active { background: var(--mint-tint); }

/* connector line between markers */
.stage-marker-wrap {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stage-line {
  position: absolute;
  top: 26px;
  bottom: -13px;
  width: 2px;
  background: var(--sage-soft);
  left: 50%;
  transform: translateX(-50%);
}
.stage:last-child .stage-line { display: none; }
.stage.done .stage-line { background: var(--sage); }
.stage.editing .stage-line { background: var(--sage); }

.stage-marker {
  position: relative;
  z-index: 1;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  flex: 0 0 auto;
  background: var(--surface);
  border: 2px solid var(--sage-soft);
  color: var(--faint);
  transition: background .22s, border-color .22s, color .22s, box-shadow .22s;
}
.stage.done .stage-marker { background: var(--sage); border-color: var(--sage); color: #fff; box-shadow: 0 0 0 3px rgba(73,118,91,.12); }
.stage.active .stage-marker { border-color: var(--sage); color: var(--sage); background: var(--surface); }
.stage.active { box-shadow: inset 3px 0 0 var(--sage); }
.stage.editing { background: var(--mint-tint); box-shadow: inset 3px 0 0 var(--sage); }
.stage.editing .stage-marker { border-color: var(--sage); color: var(--sage); background: var(--surface); }

.stage-body { flex: 1; min-width: 0; padding-top: 2px; }
.stage-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.stage.active .stage-label { color: var(--forest); font-weight: 600; }
.stage.editing .stage-label { color: var(--forest); font-weight: 600; }
.stage.done .stage-label { color: var(--text); }
.stage-status {
  display: block;
  font-size: 11px;
  color: var(--sage);
  margin-top: 3px;
  letter-spacing: .02em;
}
.stage.editing .stage-status { font-style: italic; }
/* within-stage mini progress (active only) */
.stage-mini {
  margin-top: 9px;
  height: 4px;
  border-radius: 999px;
  background: var(--sage-soft);
  overflow: hidden;
}
.stage-mini > i {
  display: block;
  height: 100%;
  background: var(--sage);
  border-radius: 999px;
  transition: width .4s ease;
}

/* rail footer: help card */
.rail-foot { padding: 14px 16px 18px; border-top: 1px solid var(--line); }
.rail-help {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: var(--mint-tint);
  border: 1px solid var(--mint);
  border-radius: 14px;
  padding: 12px 14px;
  transition: transform .14s, box-shadow .15s;
}
.rail-help:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.rail-help .ava { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; flex: 0 0 auto; }
.rail-help-txt { flex: 1; min-width: 0; }
.rail-help-txt b { display: block; font-size: 13.5px; color: var(--forest); }
.rail-help-txt span { font-size: 12px; color: var(--muted); }

/* rail footer: documents chip (mirrors the help card) */
.rail-docs {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform .14s, box-shadow .15s, border-color .15s;
}
.rail-docs:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--mint); }
.rail-docs-ic {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--mint-tint); color: var(--forest);
  display: grid; place-items: center; flex: 0 0 auto;
}
.rail-docs-txt { flex: 1; min-width: 0; }
.rail-docs-txt b { display: block; font-size: 13.5px; color: var(--forest); }
.rail-docs-txt span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-docs-count {
  flex: 0 0 auto;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  background: var(--sage); color: #fff;
  font-size: 11.5px; font-weight: 700;
  display: grid; place-items: center;
}
.rail-docs-spin {
  width: 15px; height: 15px;
  border: 2px solid var(--mint);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: rail-docs-rot .7s linear infinite;
}
@keyframes rail-docs-rot { to { transform: rotate(360deg); } }

/* page-wide drag-and-drop veil */
.page-drop-veil {
  position: fixed; inset: 0; z-index: 300;
  background: color-mix(in srgb, var(--forest) 22%, transparent);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  pointer-events: none; /* window handles the drop; veil is purely visual */
}
.pdv-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--surface);
  border: 2px dashed var(--sage);
  border-radius: 20px;
  padding: 34px 46px;
  color: var(--forest);
  box-shadow: var(--shadow-lg, 0 18px 50px rgba(0,0,0,.25));
}
.pdv-card b { font-size: 17px; }
.pdv-card span { font-size: 12.5px; color: var(--muted); }

/* ---------------- main column ---------------- */
.rail-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.shell-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 26px;
}
.shell-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rail-toggle {
  display: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  place-items: center;
}
.shell-stage-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--forest);
  display: none;
}
.save-exit-group { gap: 10px; }
.save-exit-copy {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ---------------- chat dock (persistent assistant) ---------------- */
/* ---------------- chat dock (persistent bottom composer) ---------------- */
.rail-main { position: relative; }
.chat-dock {
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
}
.rail-main .flow { padding-bottom: 32px; }

/* conversation thread — overlays the form, anchored above the composer bar */
.chat-sheet {
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: min(56vh, 540px);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -18px 40px rgba(16,24,19,.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetUp .28s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes sheetUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.chat-sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--mint-tint);
}
.chat-sheet-head .ava { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; border: 1px solid var(--line); }
.csh-meta { display: flex; flex-direction: column; }
.chat-sheet-head .h-name { font-size: 15px; font-weight: 700; color: var(--forest); letter-spacing: -0.01em; }
.chat-sheet-head .h-sub { font-size: 11.5px; color: var(--sage); letter-spacing: .02em; display: flex; align-items: center; gap: 5px; }
.chat-sheet-head .dot-live { width: 7px; height: 7px; border-radius: 50%; background: #1f8a5b; display: inline-block; }
.chat-x {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 0; background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
}
.chat-x:hover { background: rgba(16,24,19,.06); color: var(--text); }

.chat-thread {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-thread .cd-row, .chat-thread .cd-quick { max-width: 720px; width: 100%; margin-left: auto; margin-right: auto; }
.cd-row { display: flex; gap: 9px; animation: rise .3s ease both; }
.cd-row.user { justify-content: flex-end; }
.cd-ava { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--mint-tint); display: grid; place-items: center; border: 1px solid var(--line); }
.cd-bubble {
  font-size: 14.5px;
  line-height: 1.55;
  border-radius: 16px;
  padding: 11px 15px;
  max-width: 80%;
}
.cd-bubble.ai { background: var(--bg); border: 1px solid var(--line); border-top-left-radius: 5px; color: var(--text); }
.cd-bubble.user { background: var(--forest); color: #eef6f0; border-top-right-radius: 5px; }
.cd-bubble.typing { display: inline-flex; gap: 5px; align-items: center; }
.cd-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cd-chip {
  background: rgba(255,255,255,.7);
  border: 1px solid var(--sage);
  color: var(--sage);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  text-align: left;
  transition: background .15s, color .15s;
}
.cd-chip:hover { background: var(--sage); color: #fff; }

/* persistent composer bar */
.chat-bar {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 10px 24px 12px;
}
.chat-bar-inner { max-width: 720px; margin: 0 auto; }
.cbar-composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  padding: 5px 6px 5px 9px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.cbar-composer:focus-within { border-color: var(--sage); box-shadow: var(--shadow-lg); }
.cbar-ava {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--mint-tint);
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.cbar-input {
  flex: 1;
  min-width: 0;
  border: 0; outline: 0; resize: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  padding: 5px 2px;
  max-height: 76px;
}
.cbar-input::placeholder { color: var(--faint); }
.cbar-collapse {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0; background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  transition: background .15s;
}
.cbar-collapse:hover { background: var(--mint-tint); color: var(--sage); }
.cbar-send {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--sage-soft);
  color: var(--faint);
  display: grid; place-items: center;
  transition: background .15s, color .15s, transform .12s;
}
.cbar-send.on { background: var(--forest); color: var(--mint); }
.cbar-send.on:hover { transform: translateY(-1px); }
.cbar-hint {
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  margin: 9px 0 0;
}


/* ---------------- theme toggle ---------------- */
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  display: grid; place-items: center;
  transition: background .15s, border-color .15s, color .15s;
  flex: 0 0 auto;
}
.theme-toggle:hover { background: var(--mint-tint); border-color: var(--sage); color: var(--sage); }

/* ---------------- toast notifications ---------------- */
.toast-root {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--forest);
  color: #eef6f0;
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(90vw, 400px);
  white-space: normal;
  text-align: center;
  animation: toastLife 3.8s cubic-bezier(.2,.7,.3,1) forwards;
}
.toast.toast-ok   { background: #1a7a52; }
.toast.toast-warn { background: #9a6a14; }
.toast.toast-err  { background: #bf4631; }
@keyframes toastLife {
  0%   { opacity: 0; transform: translateY(14px) scale(.94); }
  9%   { opacity: 1; transform: none; }
  78%  { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px) scale(.96); }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; opacity: 1; } }

/* ---- document upload panel (right-side drawer) ---- */
.upload-panel-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(16,24,19,.35);
  animation: popIn .2s ease both;
}
.upload-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawerIn .28s cubic-bezier(.2,.7,.3,1) both;
  z-index: 41;
  overflow: hidden;
}
.up-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.up-head-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--mint-tint);
  color: var(--sage);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.up-head-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--forest); letter-spacing: -0.01em; }
.up-head-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.up-close {
  width: 34px; height: 34px;
  border-radius: 9px; border: 0;
  background: transparent; color: var(--muted);
  display: grid; place-items: center;
  transition: background .15s, color .15s;
  flex: 0 0 auto;
}
.up-close:hover { background: rgba(16,24,19,.06); color: var(--text); }
.up-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* section headings inside the panel */
.up-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 8px;
}
/* doc type hint chips */
.up-hints { display: flex; flex-wrap: wrap; gap: 8px; }
.up-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500;
  color: var(--forest);
  background: var(--mint-tint);
  border: 1px solid var(--sage-soft);
  border-radius: 999px;
  padding: 5px 12px;
}
/* borrower needs checklist (N of M) */
.up-needs-count {
  float: right;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--forest);
  background: var(--mint-tint);
  border-radius: 999px;
  padding: 2px 9px;
}
.up-needs { display: flex; flex-direction: column; gap: 6px; }
.up-need {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.up-need.satisfied { border-color: var(--sage-soft); background: var(--mint-tint); }
.up-need-ic { flex: 0 0 auto; display: grid; place-items: center; width: 20px; height: 20px; color: var(--muted); }
.up-need.satisfied .up-need-ic { color: var(--sage); }
.up-need-txt { flex: 1; min-width: 0; }
.up-need-txt b { display: block; font-size: 12.5px; color: var(--forest); }
.up-need-txt span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
/* drop zone */
.up-drop {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.up-drop:hover, .up-drop.drag-over {
  border-color: var(--sage);
  background: var(--mint-tint);
}
.up-drop-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--mint-tint);
  color: var(--sage);
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.up-drop:hover .up-drop-icon, .up-drop.drag-over .up-drop-icon { background: var(--mint); color: var(--forest); }
.up-drop-label { font-size: 15.5px; font-weight: 600; color: var(--forest); }
.up-drop-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.up-drop-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--forest); color: #eef6f0;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 10px 22px; border: 0; border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.09);
  transition: transform .14s, box-shadow .14s;
}
.up-drop-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.09); }
.up-drop-btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.up-drop-btn.secondary {
  background: transparent;
  border: 1.5px solid var(--sage);
  color: var(--sage);
  box-shadow: none;
}
.up-drop-btn.secondary:hover:not(:disabled) { background: var(--mint-tint); box-shadow: none; }
/* doc count pill */
.up-count-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  font-size: 12.5px;
}
.up-count-label { color: var(--muted); }
.up-count-nums { font-weight: 700; color: var(--forest); }
.up-count-nums.warn { color: #9a6a14; }
.up-count-nums.limit { color: #b42318; }
.up-count-action {
  background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px;
  color: var(--sage); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.up-count-action:hover { color: var(--forest); }
/* per-file status cards */
.up-file-list { display: flex; flex-direction: column; gap: 10px; }
.up-file {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .2s;
}
.up-file.analyzing { border-color: var(--sage-soft); }
.up-file.done { border-color: var(--sage-soft); }
.up-file.error { border-color: #f5c3ad; background: #fff8f6; }
.up-file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.up-file-icon {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--mint-tint); color: var(--sage);
  display: grid; place-items: center;
}
.up-file.done .up-file-icon { background: #e4f4ec; color: #1f8a5b; }
.up-file.error .up-file-icon { background: #fff3ee; color: #b42318; }
.up-file-info { flex: 1; min-width: 0; }
.up-file-name { font-size: 13.5px; font-weight: 600; color: var(--forest); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-file-status {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  display: flex; align-items: center; gap: 5px;
}
.up-file-status.ok { color: #1f8a5b; }
.up-file-status.err { color: #b42318; }
.up-file-status.warn { color: #9a6a14; }
/* per-document review feedback (quality reasons + application mismatches) */
.up-file-review { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.up-file-review-line {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  background: #fcf3e2;
  border-left: 2px solid #e5b35c;
  border-radius: 0 6px 6px 0;
  padding: 4px 8px;
}
.up-file-review-line b { color: #9a6a14; }
/* progress bar inside file card */
.up-file-prog {
  height: 3px;
  background: var(--sage-soft);
  margin: 0 14px 12px;
  border-radius: 999px;
  overflow: hidden;
}
.up-file-prog-bar {
  height: 100%;
  background: var(--sage);
  border-radius: 999px;
  transition: width .4s ease;
  animation: progPulse 1.4s ease-in-out infinite;
}
@keyframes progPulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }
.up-file.done .up-file-prog-bar { animation: none; opacity: 1; }
/* small inline spinner */
.up-spinner {
  width: 11px; height: 11px; flex: 0 0 auto;
  border: 1.5px solid var(--sage-soft); border-top-color: var(--sage);
  border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block;
}
/* extracted fields */
.up-fields { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.up-fields-hd {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--sage); margin: 10px 0 8px;
}
.up-field-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.up-field-row:last-child { border-bottom: 0; }
.up-field-key { flex: 1; color: var(--muted); }
.up-field-val { color: var(--forest); font-weight: 600; text-align: right; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.up-field-chk {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  background: #e4f4ec; color: #1f8a5b; display: grid; place-items: center;
}
.up-no-fields { font-size: 12.5px; color: var(--muted); text-align: center; padding: 8px 0; }
/* limit-reached state */
.up-limit-box {
  background: #fff3ee; border: 1px solid #f5c3ad; border-radius: var(--r-md);
  padding: 20px; text-align: center;
}
.up-limit-title { font-size: 15px; font-weight: 700; color: #9a3412; margin-bottom: 8px; }
.up-limit-sub { font-size: 13px; color: #bf4631; line-height: 1.55; margin-bottom: 16px; }
/* conversion strip at bottom of panel */
.up-save-strip {
  background: linear-gradient(135deg, var(--mint-tint), rgba(255,255,255,.4));
  border: 1px solid var(--sage-soft);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
}
.up-save-title { font-size: 15px; font-weight: 700; color: var(--forest); margin-bottom: 6px; }
.up-save-sub { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 14px; }
@media (max-width: 480px) {
  .upload-panel { width: 100%; border-left: none; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; top: auto; height: 88vh; animation: sheetUp .28s cubic-bezier(.2,.7,.3,1) both; }
}

/* ---- improved toast ---- */
.toast-root {
  bottom: 100px !important;
}
.toast {
  font-size: 14.5px !important;
  padding: 13px 24px !important;
  min-width: 220px;
}

/* uploading progress pill in chat hint area */
.cbar-upload-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sage);
  background: var(--mint-tint);
  border: 1px solid var(--mint);
  border-radius: 999px;
  padding: 3px 10px;
  animation: pillPulse 1.4s ease-in-out infinite;
}
@keyframes pillPulse { 0%,100% { opacity: .75; } 50% { opacity: 1; } }
.cbar-upload-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sage);
  animation: blink 1.2s infinite ease-in-out;
}

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .save-exit-copy { display: none; }
  .rail {
    position: fixed;
    z-index: 50;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.2,.7,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .rail.open { transform: none; }
  .rail-toggle { display: grid; }
  .shell-stage-chip { display: block; }
  .rail-scrim {
    position: fixed; inset: 0; z-index: 49;
    background: rgba(16,24,19,.4);
    animation: popIn .2s ease both;
  }
}
/* ---- Document processing banner ---- */
.doc-proc-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: var(--mint-tint);
  border-bottom: 1px solid var(--sage-soft);
  font-size: 13px;
  font-weight: 500;
  color: var(--forest);
  position: sticky;
  top: 0;
  z-index: 10;
  animation: dpbSlideIn .2s ease both;
}
@keyframes dpbSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.doc-proc-banner.dpb-success {
  background: #e4f4ec;
  border-color: #a8d5b8;
  color: #1f6b42;
}
.doc-proc-banner.dpb-error {
  background: #fff3ee;
  border-color: #f5c3ad;
  color: #9a3412;
}
.dpb-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  color: var(--sage);
}
.dpb-success .dpb-icon { color: #1f8a5b; }
.dpb-error .dpb-icon { color: #b42318; }
.dpb-text { flex: 1; }
.dpb-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.dpb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage);
  animation: dpbPulse 1.2s ease-in-out infinite;
}
.dpb-dot:nth-child(2) { animation-delay: .2s; }
.dpb-dot:nth-child(3) { animation-delay: .4s; }
@keyframes dpbPulse {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40%           { opacity: 1;   transform: scale(1); }
}

@media (max-width: 480px) {
  .chat-sheet { height: min(64vh, 520px); }
  .chat-bar { padding: 10px 14px 12px; }
  .chat-thread { padding: 16px 14px 10px; }

  /* Tighter header so stage chip + actions fit on 375px screens */
  .shell-top { padding: 10px 14px; }
  .save-exit-group { gap: 8px; }
  /* Avatar is decorative on mobile — hide to free up header space */
  .shell-top .avatar { display: none; }
  /* Compact Save & exit button */
  .shell-top .ghost-btn { padding: 6px 10px; font-size: 12.5px; }
  .doc-proc-banner { padding: 10px 14px; font-size: 12px; }
}

/* ---- More prominent Save & exit ---- */
.save-exit-group .ghost-btn {
  border-color: var(--sage);
  color: var(--sage);
  font-weight: 600;
}
.save-exit-group .ghost-btn:hover { background: var(--mint-tint); }

/* ---- Inline tooltip (? popover) ---- */
.tt-wrap { position: relative; display: inline-flex; align-items: center; margin-left: 5px; vertical-align: middle; }
.tt-btn {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--sage-soft);
  background: none;
  color: var(--sage);
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: background .12s, border-color .12s;
}
.tt-btn:hover { background: var(--mint-tint); border-color: var(--sage); }
.tt-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--forest);
  color: #eef6f0;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 9px 13px;
  border-radius: 10px;
  white-space: normal;
  width: 230px;
  z-index: 200;
  box-shadow: 0 4px 18px rgba(16,24,19,.2);
  pointer-events: none;
}
.tt-pop::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--forest);
}

/* field-lbl wraps label text + optional tag + tooltip btn in one row */
.field-lbl { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }

/* ---- Auto-fill flash animation ---- */
@keyframes fieldFlash {
  0%   { background: var(--mint-tint); box-shadow: 0 0 0 2px var(--mint); }
  100% { background: transparent; box-shadow: none; }
}
.field-flash .input { animation: fieldFlash 1.8s ease both; border-radius: 10px; }

/* ---- Secure-note (lock icon + text near sensitive fields) ---- */
.secure-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sage);
  margin-top: -6px;
  margin-bottom: 10px;
}

/* ---- Mobile overall progress bar (hidden on desktop, visible ≤900px) ---- */
.mob-prog {
  display: none;
  height: 3px;
  background: var(--line);
  flex: 0 0 auto;
  overflow: hidden;
}
.mob-prog-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 999px;
  transition: width .45s ease;
}
@media (max-width: 900px) { .mob-prog { display: block; } }


/* "Your loan officer" card, upper right of the form header */
.lo-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mint-tint);
  border: 1px solid var(--sage-soft);
  border-radius: 12px;
  padding: 4px 12px 4px 6px;
  white-space: nowrap;
}
.lo-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--forest);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lo-card-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  font-size: 11.5px;
  color: var(--muted);
}
.lo-card-info b { color: var(--forest); font-weight: 600; font-size: 12.5px; }
.lo-card-phone { color: var(--forest); text-decoration: none; }
.lo-card-phone:hover { text-decoration: underline; }
@media (max-width: 700px) {
  /* Compact on phones: identity stays, detail lines go. */
  .lo-card { padding: 3px 10px 3px 4px; }
  .lo-card-role, .lo-card-phone { display: none; }
}

/* ============================================================
   Motion & polish layer (2026-08-05 feedback round)
   One easing, three speeds (tokens in brand.css). Everything here
   is presentation only and fully disabled under reduced motion.
   ============================================================ */

/* Step content enters with a soft rise. Wrapper is keyed per step so the
   animation re-triggers on every step change. */
.step-anim { animation: pos-step-enter var(--dur-slow) var(--ease-out) both; }
@keyframes pos-step-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Interactive cards: lift on hover, settle on press. */
.choice, .opt, .start-cta, .resume-primary, .resume-secondary, .example-chip {
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.choice:hover, .opt:hover, .start-cta:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.choice:active, .opt:active, .start-cta:active,
.btn:active, .resume-primary:active, .resume-secondary:active { transform: translateY(0) scale(0.985); box-shadow: var(--shadow-sm); }

/* Buttons share the press feel; primary buttons get a soft glow on hover. */
.btn { transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out); }
.btn:not(:disabled):hover { box-shadow: 0 4px 14px rgba(73, 118, 91, 0.22); }

/* Selected option cards spring in their check state. */
.opt.sel { animation: pos-opt-pop var(--dur-med) var(--ease-spring); }
@keyframes pos-opt-pop {
  0% { transform: scale(0.985); }
  60% { transform: scale(1.008); }
  100% { transform: scale(1); }
}

/* Inputs: calm focus ring in brand sage; error text slides in. */
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(73, 118, 91, 0.14);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.field-err { animation: pos-err-in var(--dur-med) var(--ease-out) both; }
@keyframes pos-err-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Progress rail: fills glide instead of jumping. */
.stage-mini i, .mob-prog-fill, .resume-prog-fill { transition: width var(--dur-slow) var(--ease-out); }

/* Toasts rise from the edge and ease away. */
.toast { animation: pos-toast-in var(--dur-med) var(--ease-spring) both; }
@keyframes pos-toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat dock + upload panel entrances. */
.chat-sheet { animation: pos-sheet-in var(--dur-med) var(--ease-out) both; }
@keyframes pos-sheet-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Live autosave indicator (header). */
.save-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  white-space: nowrap;
  animation: pos-err-in var(--dur-fast) var(--ease-out) both;
}
.save-status.is-saving { color: var(--muted); }
.save-status.is-saved { color: var(--sage); font-weight: 600; }
.save-check { stroke-dasharray: 24; stroke-dashoffset: 24; animation: pos-check-draw var(--dur-slow) var(--ease-out) forwards; }
@keyframes pos-check-draw { to { stroke-dashoffset: 0; } }
.save-dots { display: inline-flex; gap: 2px; margin-left: 1px; }
.save-dots i {
  width: 3px; height: 3px; border-radius: 50%; background: currentColor;
  animation: pos-dot 1s ease-in-out infinite;
}
.save-dots i:nth-child(2) { animation-delay: 0.15s; }
.save-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pos-dot { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

/* LO card, resume card, tracker: gentle settle on first paint. */
.lo-card, .resume-card { animation: pos-step-enter var(--dur-slow) var(--ease-out) both; }

/* Reduced motion: everything above becomes instant. */
@media (prefers-reduced-motion: reduce) {
  .step-anim, .opt.sel, .field-err, .toast, .chat-sheet,
  .save-status, .save-check, .lo-card, .resume-card { animation: none; }
  .save-dots i { animation: none; opacity: 0.6; }
  .choice, .opt, .start-cta, .resume-primary, .resume-secondary, .example-chip, .btn,
  .stage-mini i, .mob-prog-fill, .resume-prog-fill { transition: none; }
  .choice:hover, .opt:hover, .start-cta:hover { transform: none; }
}

/* Required-before-submit checklist (review screen) */
.rs-required {
  border: 1px solid rgba(191, 70, 49, 0.28);
  background: rgba(191, 70, 49, 0.05);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin: 18px 0 4px;
}
.rs-required-head { font-size: 14px; color: var(--text); margin-bottom: 12px; }
.rs-required-list { display: flex; flex-direction: column; }
.rs-required-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.rs-required-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rs-required-label { font-size: 13.5px; font-weight: 600; color: var(--forest); }
.rs-required-why { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.rs-required-row .co-act { flex-shrink: 0; }

/* Non-blocking conversion strip (replaces the halfway-there modal) */
.save-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  background: var(--mint-tint);
  border-bottom: 1px solid var(--sage-soft);
  color: var(--forest);
  font-size: 13px;
  animation: pos-step-enter var(--dur-med) var(--ease-out) both;
}
.save-strip-txt { flex: 1; min-width: 0; color: var(--text); }
.save-strip-btn {
  flex-shrink: 0;
  border: 1px solid var(--sage);
  background: var(--surface);
  color: var(--forest);
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.save-strip-btn:hover { background: var(--mint); }
.save-strip-btn:active { transform: scale(0.97); }
.save-strip-x {
  flex-shrink: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}
.save-strip-x:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .save-strip { animation: none; } }

/* Payroll connect hero (Employment section, verify-first) */
.ei-payroll {
  border: 1px solid var(--sage-soft);
  background: var(--mint-tint);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.ei-payroll.connected { border-color: var(--sage); }
.ei-payroll-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--forest);
  font-size: 15px;
}
.ei-payroll-head svg { color: var(--sage); flex: 0 0 auto; }
.ei-payroll-sub { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.ei-payroll-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.ei-payroll-alt { font-size: 12.5px; color: var(--faint); }
.ei-payroll-err { margin: 10px 0 0; font-size: 12.5px; color: #bf4631; }

/* identity-first gate privacy line */
.ig-privacy {
  margin: 4px 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--faint);
}

/* ---- LO white-labeling ---- */
.rail-lo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  text-decoration: none;
  min-width: 0;
}
.rail-lo-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.rail-lo-txt b { font-size: 14px; color: var(--forest); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-lo-txt span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lo-ava-img { border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 1.5px solid var(--sage-soft); }
.lo-ava-logo { object-fit: contain; flex: 0 0 auto; border-radius: 6px; }
.lo-ava-init {
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.powered-by {
  margin-top: 10px;
  background: none;
  border: 0;
  padding: 4px 0 0;
  font: inherit;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--faint);
  opacity: .8;
  cursor: pointer;
  text-align: left;
}
.powered-by b { font-weight: 600; color: var(--muted); }
.powered-by:hover { opacity: 1; }
.hero-lo { margin: 2px 0 6px; font-size: 14px; color: var(--muted); }
.hero-lo b { color: var(--forest); font-weight: 600; }
.powered-by-strip {
  /* Pinned to the center bottom of the welcome page (.welcome is the
     position: relative container), out of the hero's flex row. */
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  opacity: .55;
}
.powered-by-strip span { font-weight: 600; }
