:root {
  --desk-bg: #f3f4f6;
  --desk-surface: #ffffff;
  --desk-text: #111827;
  --desk-muted: #6b7280;
  --desk-line: #e5e7eb;
  --desk-line-strong: #d1d5db;
  --desk-brand: #2563eb;
  --desk-brand-soft: #eff6ff;
  --desk-danger: #dc2626;
  --desk-danger-soft: #fef2f2;
  --desk-warn: #d97706;
  --desk-warn-soft: #fffbeb;
  --desk-ok: #16a34a;
  --desk-ok-soft: #f0fdf4;
  --desk-radius: 8px;
  --desk-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --desk-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --rail: 13.5rem;
  --queue: 21rem;
}

html, body {
  height: 100%;
  margin: 0;
}

html {
  color-scheme: light;
}

body {
  font-family: var(--desk-font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--desk-text);
  background: var(--desk-bg);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

body.desk,
body.area {
  overflow: hidden;
}

/* The window must never be taller than the screen: a visually-hidden (position:absolute) note deep inside a scrolling pane would
   otherwise take the viewport as its containing block and stretch the document by however far down the pane it sits. */
body.desk #main-content,
body.area #main-content {
  position: relative;
  overflow: hidden;
}

/* Skip-link target from the layout. It carries the column that the desk grid
   fills, so topbar/banners/.desk-body keep behaving as direct body children. */
#main-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: var(--desk-brand);
  color: #fff;
  font-weight: 650;
}
.skip-link:focus { top: 0.5rem; }

.skip-link:focus-visible,
.app-nav-link:focus-visible,
.rail-link:focus-visible,
.queue-item:focus-visible,
.menu summary:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
.lookup-list button:focus-visible {
  outline: 2px solid var(--desk-brand);
  outline-offset: 2px;
}

* { box-sizing: border-box; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.muted { color: var(--desk-muted); }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  height: 2.75rem;
  flex-shrink: 0;
  background: var(--desk-surface);
  border-bottom: 1px solid var(--desk-line);
}

.topbar-brand {
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.app-nav {
  display: flex;
  align-items: stretch;
  gap: 0.1rem;
  align-self: stretch;
  min-width: 0;
}

.app-nav-link {
  display: flex;
  align-items: center;
  padding: 0 0.7rem;
  color: var(--desk-muted);
  font-weight: 550;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.app-nav-link:hover { color: var(--desk-text); }

.app-nav-link[aria-current="page"] {
  color: var(--desk-text);
  font-weight: 650;
  border-bottom-color: var(--desk-brand);
}

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--desk-muted);
}

.topbar-user form { margin: 0; }

.menu { position: relative; }
.menu summary {
  list-style: none;
  cursor: pointer;
}
.menu summary::-webkit-details-marker,
.menu summary::marker { display: none; content: none; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  width: 18rem;
  padding: 0.75rem;
  background: var(--desk-surface);
  border: 1px solid var(--desk-line);
  border-radius: var(--desk-radius);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.menu-panel p { margin: 0 0 0.6rem; }
.menu-actions { display: flex; gap: 0.4rem; }

.banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--desk-line);
  background: var(--desk-warn-soft);
  color: #92400e;
  font-size: 12.5px;
}
.banner-ok { background: var(--desk-ok-soft); color: #166534; }
.banner-danger { background: var(--desk-danger-soft); color: #991b1b; }
.banner p { margin: 0; flex: 1; }

.desk-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail) var(--queue) minmax(0, 1fr);
}

.rail,
.queue,
.stage {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rail {
  background: #f9fafb;
  border-right: 1px solid var(--desk-line);
  padding: 0.85rem 0.6rem;
}

.rail-label {
  padding: 0.35rem 0.65rem 0.45rem;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--desk-muted);
}

.rail-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.42rem 0.65rem;
  border-radius: 6px;
  color: var(--desk-text);
}
.rail-link:hover { background: #eef2f7; }
.rail-link[aria-current="page"] {
  background: var(--desk-brand-soft);
  color: #1d4ed8;
  font-weight: 600;
}
.rail-count {
  color: var(--desk-muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.rail-link[aria-current="page"] .rail-count { color: #1d4ed8; }

.queue {
  background: var(--desk-surface);
  border-right: 1px solid var(--desk-line);
}

.queue-toolbar {
  padding: 0.7rem 0.75rem 0.55rem;
  border-bottom: 1px solid var(--desk-line);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search { margin: 0; flex: 1; min-width: 0; }
.search .field-input { width: 100%; }

.queue-scroll {
  flex: 1;
  overflow: auto;
}

.queue-more {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.6rem 0.75rem;
  text-align: center;
}
.queue-item {
  display: block;
  padding: 0.7rem 0.85rem 0.75rem;
  border-bottom: 1px solid var(--desk-line);
  border-left: 2px solid transparent;
  cursor: pointer;
}
.queue-item:hover { background: #fafafa; }
.queue-item[aria-current="true"] {
  background: #dbeafe;
  border-left-color: var(--desk-brand);
}

.queue-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.queue-item-end {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* reply-marker: on the row's top line (no extra row); pushes the time to the right as before */
.queue-reply { margin-right: auto; font-size: 12px; font-weight: 600; color: #1d4ed8; white-space: nowrap; }
.queue-item .order-spinner { display: none; }
.queue-item.is-busy .order-spinner { display: block; }

.queue-item-title {
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.queue-item-sub,
.queue-item-issue {
  color: var(--desk-muted);
  font-size: 12px;
}

.queue-item-issue { margin-top: 0.15rem; }
.queue-item.is-blocked .queue-item-issue { color: #b45309; }

.empty-pane {
  padding: 1.5rem 1rem;
  color: var(--desk-muted);
}

.area-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.area-empty {
  max-width: 26rem;
  text-align: center;
}

.area-empty p { margin: 0 0 0.45rem; }

.stage {
  background: var(--desk-bg);
  min-width: 0;
}

.stage-fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--desk-surface);
  border-bottom: 1px solid var(--desk-line);
}

.stage-title { flex: 1; min-width: 0; }
/* Original / Assistant: one joined pair, so the second toggle costs little header width. */
.toggle-pair { display: inline-flex; margin-left: auto; align-self: center; }
.stage-header { row-gap: 0.25rem; } /* the pair wraps to a row of its own when the stage is narrow (1280): the actions keep the title's row */
.toggle-pair .btn { padding-left: 0.6rem; padding-right: 0.6rem; height: 1.6rem; font-size: 12.5px; }
.toggle-pair .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.toggle-pair .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.stage-title h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.stage-meta {
  display: flex;
  flex-wrap: nowrap; /* one line at any width: the customer/vendor name truncates first (ui-audit 2) */
  min-width: 0;
  gap: 0.35rem 0.75rem;
  margin-top: 0.2rem;
  color: var(--desk-muted);
  font-size: 12px;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.readiness-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.status-hint {
  color: var(--desk-muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.status-hint.is-on {
  animation: desk-hint-in 0.28s ease;
}

@keyframes desk-hint-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.order-busy {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 550;
}

.stage-fill.is-busy .order-busy,
.order-busy.is-on { display: inline-flex; }

.order-spinner {
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid #bfdbfe;
  border-top-color: var(--desk-brand);
  border-radius: 50%;
  animation: order-spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes order-spin {
  to { transform: rotate(360deg); }
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  /* One row exactly the workspace's height. With the default (auto) row, a tall Original (a long email, a tall scan) stretched the row past
     the window, and the review pane's end (History, Reprocess) sat below the screen where nothing could scroll to it. */
  grid-template-rows: minmax(0, 1fr);
}
.workspace > .left-pane,
.workspace > .proposal { min-height: 0; }

.workspace.is-open {
  /* A dragged Original pane leaves the review pane at least 30rem when the screen has room for both; on a narrow one it
     simply shares what there is (never a sideways page scroll). */
  grid-template-columns: minmax(12rem, min(var(--original-w, 38%), max(12rem, calc(100% - 30rem - 6px)))) 6px minmax(0, 1fr);
}

/* The Assistant tab is a chat: never narrower than 17rem (the review pane keeps what is left). */
.workspace.is-open.on-assistant, .workspace.is-open.on-conversation { grid-template-columns: minmax(17rem, min(var(--original-w, 38%), max(17rem, calc(100% - 30rem - 6px)))) 6px minmax(0, 1fr); }

/* The draggable divider between the Original preview and the review pane. */
.pane-divider {
  cursor: col-resize;
  background: var(--desk-line);
  border-left: 1px solid transparent;
  touch-action: none;
  transition: background 0.1s;
}
.pane-divider:hover, .pane-divider:focus-visible, body.is-resizing .pane-divider { background: #93c5fd; outline: none; }
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing .original-pane iframe, body.is-resizing .original-pane embed, body.is-resizing .original-pane object { pointer-events: none; }

/* The left pane holds two tabs' content (Original, Assistant); the header's toggles pick which one shows. */
.left-pane {
  display: none;
  min-width: 0;
  background: #fff;
  border-right: 1px solid var(--desk-line);
}
.workspace.is-open .left-pane { display: flex; flex-direction: column; }
.original-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.original-pane[hidden] { display: none; }

.original-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.original-pane iframe,
.original-pane embed,
.original-pane object,
.original-pane img,
.raw-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.original-pane img { object-fit: contain; }

.original-pane .raw-text {
  flex: 1;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.original-loading { padding: 1rem; }

.proposal {
  min-width: 0;
  overflow: auto;
  padding: 1rem 1.1rem 2rem;
}

.blockers {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.85rem;
  background: var(--desk-warn-soft);
  border: 1px solid #fde68a;
  border-radius: var(--desk-radius);
}
.blockers h2 {
  margin: 0 0 0.35rem;
  font-size: 13px;
}
.blockers ol {
  margin: 0;
  padding-left: 1.15rem;
}
.blockers a { color: #92400e; text-decoration: underline; }

.card {
  background: var(--desk-surface);
  border: 1px solid var(--desk-line);
  border-radius: var(--desk-radius);
  box-shadow: var(--desk-shadow);
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  font-size: 13px;
  font-weight: 650;
}

.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 9rem 9rem;
  gap: 0.75rem 0.85rem;
  align-items: stretch;
}

/* F-O1: when the card itself is narrow (Original open on a 1280 or 1100 px screen) the customer/vendor takes a full row and
   PO number + ship date share the next one, instead of the name wrapping a letter per line. Sized by the card, not the window. */
#desk-order { container-type: inline-size; }
@container (max-width: 40rem) {
  .header-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .header-grid > div:first-child { grid-column: 1 / -1; }
  /* The date hint takes its own line here instead of floating over the label of the row below. */
  .header-grid .has-hint .field-hint { position: static; white-space: normal; }
  #desk-order .header-grid-rest > div:not(.span-all) > .field-input { margin-top: 0; } /* PO number and date inputs share a row edge */
}

/* PO/ship cells are children of .header-grid-rest (display:contents). */
.header-grid > div:not(.span-all),
.header-grid-rest > div:not(.span-all) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.header-grid > div:not(.span-all) > form,
.header-grid > div:not(.span-all) .lookup {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.header-grid-rest > div:not(.span-all) > .field-input,
.header-grid > div:not(.span-all) .lookup > .field-input {
  margin-top: auto;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.25rem;
}
.field-label-row .field-label { margin-bottom: 0; }

.field-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--desk-muted);
}
.field-label .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.field-input,
.field-select {
  width: 100%;
  height: 2rem;
  padding: 0 0.6rem;
  border: 1px solid var(--desk-line-strong);
  border-radius: 6px;
  background: #fff;
}
.field-input:focus,
.field-select:focus {
  outline: 2px solid color-mix(in srgb, var(--desk-brand) 35%, transparent);
  outline-offset: 1px;
  border-color: var(--desk-brand);
}
.field-input:disabled { background: #f9fafb; color: var(--desk-muted); }
/* Notes: one line when empty or short, grows with the text up to ~10 lines, then scrolls; keeps line breaks. */
textarea.field-textarea {
  height: 2rem;
  min-height: 2rem;
  max-height: 15rem;
  padding: 0.3rem 0.6rem;
  line-height: 1.4;
  resize: none;
  overflow-y: hidden; /* the component switches to auto only at max-height */
  font: inherit;
  box-sizing: border-box;
}

.span-all { grid-column: 1 / -1; }
.header-grid-rest { display: contents; }

.lookup,
[data-controller~="lookup"] { position: relative; }
.lookup-current {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.lookup-hint { margin: 0 0 0.35rem; font-size: 12px; }
.lookup-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.lookup-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  max-height: 16rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--desk-line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
.lookup-list button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 0;
  background: transparent;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}
.lookup-list button:hover,
.lookup-list button.is-active { background: var(--desk-brand-soft); }
.lookup-title { font-weight: 600; }
.lookup-meta { color: var(--desk-muted); font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip,
button.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--desk-line-strong);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.chip:hover { border-color: var(--desk-brand); color: #1d4ed8; }

/* ONE definition of the line table's horizontal geometry (column tracks are set once per layout below, for the header AND every row):
   the row's inset from the table edge is border + padding, and the header takes the SAME two numbers, so a cell can never start somewhere
   other than its column header. Nothing about a line's state (blocked, open) may change these: the blocked mark is an inset shadow. */
#desk-lines { --line-border: 1px; --line-pad-x: 0.7rem; --line-gap: 0.6rem; --line-bin: 1.5rem; } /* --line-bin: the last track of every row and the header, taken FROM the status track (which is that much narrower), so no other column loses width for the small bin */
.line {
  border: var(--line-border, 1px) solid var(--desk-line);
  border-radius: var(--desk-radius);
  background: #fff;
  margin: 0 0 0.55rem;
  overflow: visible;
}
.line.is-blocked { border-color: #f0b463; box-shadow: inset 4px 0 0 #e0912f; background: #fffaf2; }

/* Compact rows (slice iv): ONE dense row per line on both desks; the editor is the expander. Column headers once, above the list. */
#desk-lines { container-type: inline-size; }
.line { margin-bottom: 0.3rem; }
.line-fix-copy.is-bad { color: #9a3412; }

.line-cell {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 0.25rem;
  min-width: 0;
}
.line-cell .lookup-split { display: contents; }
.line-cell .lc-label { align-self: start; display: flex; flex-direction: column; min-width: 0; }
.line-cell .lc-label .field-label { margin-bottom: 0; }
.line-cell .lc-control { align-self: start; display: flex; align-items: center; min-height: 2rem; min-width: 0; position: relative; }
.line-cell .lc-control > .field-input,
.line-cell .lc-control > form,
.line-cell .lc-control > select { flex: 1 1 auto; min-width: 0; }
.line-cell .lc-hint { align-self: start; min-width: 0; font-size: 12px; margin-bottom: 0.4rem; }
.line-cell .lc-hint:empty { margin-bottom: 0.4rem; }

/* B2: Item | GL account switch. */
.kind-switch-wrap { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; margin: 0.3rem 0; }
.kind-switch { display: inline-flex; align-self: flex-start; border: 1px solid var(--desk-line, #d9dde3); border-radius: 6px; overflow: hidden; }
.kind-switch button { border: 0; background: transparent; padding: 0.2rem 0.65rem; font: inherit; font-size: 12px; cursor: pointer; }
.kind-switch button + button { border-left: 1px solid var(--desk-line, #d9dde3); }
.kind-switch button.is-on { background: #e8f0fe; font-weight: 650; }
.kind-switch-note { margin: 0; font-size: 12px; }

/* B1: printed vs proposed totals. */
.totals-table { border-collapse: collapse; width: 100%; max-width: 32rem; font-variant-numeric: tabular-nums; }
.totals-table th, .totals-table td { padding: 0.25rem 0.6rem 0.25rem 0; text-align: right; font-weight: 500; font-size: 13px; }
.totals-table thead th { color: var(--desk-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.totals-table tbody th { text-align: left; font-weight: 650; }
.totals-table tr.is-bad td { color: #9a3412; font-weight: 650; }
.totals-message { color: #9a3412; font-weight: 600; margin: 0.5rem 0; }
.totals-card.is-mismatch, .totals-card.is-no_printed { border-color: #f0b27a; }
.recode-banner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; border: 1px solid var(--desk-line); border-radius: var(--desk-radius, 8px); margin: 0 0 0.6rem; padding: 0.6rem 0.85rem; }
.banner-info { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }
.banner-warn { background: var(--desk-warn-soft); color: #92400e; border-color: #f3d19a; }
.recode-banner .recode-text { min-width: 0; }
.totals-figs { display: flex; gap: 0.75rem; flex-wrap: wrap; flex: 1 1 100%; }
.totals-fig { display: flex; flex-direction: column; gap: 0.2rem; }
.totals-form .totals-fig .field-input { width: 8.5rem; flex: none; }
.totals-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.totals-form .field-input { flex: 1 1 12rem; min-width: 0; }
.qty-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
}
.qty-row .field-input {
  width: 4rem;
  flex: 0 0 4rem;
}
.post-payload {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--desk-line);
}
.payload-dl {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  margin: 0;
}
.payload-dl dt {
  color: var(--desk-muted);
  font-size: 12px;
  font-weight: 650;
}
.payload-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.addr-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
  margin-top: 0.75rem;
}

@container (max-width: 42rem) { /* 42rem, not 36: the Ships-from select now keeps its longest option, so the five-column row needs more room (ui-audit 8) */
  /* The figures wrap onto as many rows as the width allows (they used to be four fixed-content columns, which pushed the review pane
     sideways with Original open at 1087). */

  .line-item { grid-column: 1 / -1; }

  /* two tracks for Ships from, so its select keeps its longest option whole */

  /* the NetSuite price line under Our price gets two tracks too, so "Keyed · NetSuite $55.11" and Reset fit on one line */

}

.line-fix {
  margin-top: 0.75rem;
  padding: 0.7rem 0.75rem;
  background: var(--desk-warn-soft);
  border-radius: 6px;
}
.line-fix-copy { margin: 0 0 0.5rem; }
/* The PO suggestion sits directly under the blocker box, as its own block (same edges as the blocker box). */
#desk-proposal > .po-suggestion { margin: 0 0 1rem; border: 1px solid #fde68a; border-radius: var(--desk-radius); }
.line-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}
.pill-ok { background: var(--desk-ok-soft); color: #166534; }
.pill-warn { background: var(--desk-warn-soft); color: #b45309; }
.pill-brand { background: var(--desk-brand-soft); color: #1d4ed8; }
.pill-danger { background: var(--desk-danger-soft); color: #b91c1c; }
.pill-muted { background: #f3f4f6; color: #6b7280; }

.btn,
button.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: 2rem;
  padding: 0 0.7rem;
  border: 1px solid var(--desk-line-strong);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f9fafb; }
button.btn.btn-primary,
a.btn.btn-primary,
.btn.btn-primary {
  background: var(--desk-brand);
  border-color: var(--desk-brand);
  color: #fff;
}
button.btn.btn-primary:hover,
.btn.btn-primary:hover { background: #1d4ed8; filter: none; }
button.btn.btn-warning,
.btn.btn-warning {
  background: #b45309;
  border-color: #b45309;
  color: #fff;
}
button.btn.btn-warning:hover,
.btn.btn-warning:hover { background: #92400e; }
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--desk-muted);
}
.btn-quiet:hover { background: #f3f4f6; color: var(--desk-text); }
.btn-toggle[aria-pressed="true"],
.btn-toggle.is-pressed {
  background: var(--desk-brand-soft);
  border-color: var(--desk-brand);
  color: #1d4ed8;
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--desk-brand);
}
.btn-toggle[aria-pressed="false"] {
  background: #fff;
  color: var(--desk-text);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
/* Post while the request is out: full strength (it is working, not unavailable), a white spinner, and the order under it dimmed. */
.btn.is-posting[disabled] { opacity: 1; cursor: progress; }
/* Post and "⟳ Posting…" are the same width, so the header's actions don't reflow when a post starts. */
#desk-post-actions > .btn { min-width: 6.25rem; }
/* The busy label lies over the meta line while it shows (a fixed slot): the header never grows or reflows for it. */
.stage-meta { position: relative; }
.stage-meta .order-busy { margin-top: 0; }
.stage-meta .order-busy.is-on { position: absolute; inset: 0; z-index: 2; background: var(--desk-surface); }
/* After about a minute of reading: one muted clause on the same line (it never wraps the header). */
.order-busy > span:not(.order-busy-slow) { flex: none; white-space: nowrap; }
.order-busy-slow { flex: 1 1 auto; min-width: 0; margin-left: 0.5rem; color: var(--desk-muted, #6b7280); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-meta .status-hint.is-on { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; background: var(--desk-surface); }
/* ...and what it covers is hidden, not just covered (a copy button's edge used to show a pixel below the slot). */
.stage-meta:has(> .is-on) > :not(.is-on) { visibility: hidden; }
.btn.is-posting .order-spinner { border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff; }
.proposal[inert] { opacity: 0.55; }

.history-timeline { margin: 0; padding-left: 1.1rem; }
.history-event { margin: 0 0 0.7rem; }
.history-note { margin: 0.2rem 0 0; color: var(--desk-muted); }

.more-block { margin-top: 0.5rem; }
.more-block summary {
  cursor: pointer;
  color: var(--desk-muted);
  font-size: 12.5px;
}
.more-block .card { margin-top: 0.6rem; }

dialog.confirm {
  width: min(28rem, calc(100vw - 2rem));
  border: 1px solid var(--desk-line);
  border-radius: 12px;
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}
dialog.confirm::backdrop { background: rgba(17, 24, 39, 0.35); }
dialog.confirm h2 { margin: 0 0 0.4rem; font-size: 1rem; }
dialog.confirm p { margin: 0 0 0.5rem; }
.cancel-reasons {
  border: 0;
  margin: 0.65rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.cancel-reasons legend {
  padding: 0;
  margin-bottom: 0.25rem;
  font-size: 12.5px;
  color: var(--desk-muted);
}
.cancel-reasons label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 13px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.auth-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(1200px 500px at 50% -10%, #dbeafe 0%, transparent 55%),
    var(--desk-bg);
}
.auth-card {
  width: min(26rem, 100%);
  background: #fff;
  border: 1px solid var(--desk-line);
  border-radius: 12px;
  padding: 1.6rem 1.5rem 1.4rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}
.auth-card h1 { margin: 0.15rem 0 0.4rem; font-size: 1.35rem; letter-spacing: -0.03em; }
.auth-card p { margin: 0 0 0.85rem; }
.auth-card .btn { width: 100%; height: 2.3rem; }
.auth-gap { height: 0.75rem; }

.card.is-mismatch {
  border-color: #fbbf24;
  background: color-mix(in srgb, var(--desk-warn-soft) 55%, #fff);
}

.why {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.why-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 1px solid var(--desk-line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--desk-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.why-btn:hover,
.why-btn[aria-expanded="true"] {
  border-color: var(--desk-brand);
  color: #1d4ed8;
  background: var(--desk-brand-soft);
}
.why-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--desk-brand) 35%, transparent);
  outline-offset: 1px;
}
.why-pop {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  max-width: min(22rem, 70vw);
  padding: 0.45rem 0.55rem;
  background: #fff;
  border: 1px solid var(--desk-line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  color: var(--desk-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  cursor: text;
}
.why-pop[hidden] { display: none; }

.compare-grid,
.fulfil-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* minmax(0): a wide cell (the freight row) shrinks instead of widening the review pane */
  gap: 0.85rem;
}
.compare-grid > *, .fulfil-grid > * { min-width: 0; }
.addr-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.addr-block p { margin: 0 0 0.2rem; }
.compare-grid-compact { gap: 0.55rem; }
.addr-block-compact {
  font-size: 13px;
  line-height: 1.35;
}
.delivery-fix { margin-top: 0.65rem; }
.addr-edit { margin-top: 0.55rem; }
.addr-edit-toggle {
  cursor: pointer;
  color: var(--desk-brand);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}
.addr-edit-toggle::-webkit-details-marker { display: none; }
.addr-edit[open] .addr-form { margin-top: 0.55rem; }
.check-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 650;
  white-space: nowrap;
}
.fulfil-grid .muted { display: inline; margin-left: 0.35rem; }

@media (max-width: 1100px) {
  .compare-grid,
  .fulfil-grid,
  .addr-form { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .desk-body { grid-template-columns: 16rem minmax(0, 1fr); }
  .rail { display: none; }
  .workspace.is-open { grid-template-columns: 1fr; }
  .workspace.is-open .left-pane, .workspace.is-open .pane-divider { display: none; }
}

@media (max-width: 640px) {
  .topbar {
    gap: 0.35rem;
    padding: 0 0.6rem;
  }
  .topbar-brand { display: none; }
  .app-nav-link { padding: 0 0.5rem; }
  .topbar-user > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* No spinner steppers on number inputs; typing still works. */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stage-meta > * { flex: none; white-space: nowrap; }
.stage-meta > .stage-subtitle { flex: 0 1 auto; min-width: 3rem; overflow: hidden; text-overflow: ellipsis; }
.doc-ids { display: inline-flex; flex-wrap: nowrap; gap: 0.35rem; align-items: center; font-size: 0.75rem; color: #6b7280; }
.doc-id { font-family: ui-monospace, monospace; }
.copy-icon { border: 0; background: none; padding: 0 0.15rem; color: inherit; cursor: pointer; font-size: 0.85rem; line-height: 1; }
.copy-icon:hover { color: #111827; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.has-hint { position: relative; }
/* Under the input, out of flow: the hint must not move the input off its row. */
.field-hint { position: absolute; right: 0; top: 100%; margin: 0.15rem 0 0; font-size: 0.75rem; white-space: nowrap; }
.freight-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.freight-row .field-input { width: 6.5rem; }
.freight-row { flex-wrap: nowrap; }
.freight-row .freight-method { flex: 1 1 8rem; min-width: 0; width: auto; max-width: 18rem; }
.freight-row .field-input:not(.freight-method) { flex: 0 0 5.5rem; width: 5.5rem; }
.freight-row .link-quiet, .freight-row #freight-overridden { white-space: nowrap; }
.link-quiet { background: none; border: 0; padding: 0; color: #6b7280; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.link-quiet:hover { color: #111827; }

/* Credit control desk: dense debtor table, no new design system. */
.cc-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cc-bar {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem;
  background: var(--desk-surface); border-bottom: 1px solid var(--desk-line);
}
.cc-bar h1 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; }
.cc-bar form { margin: 0; }
.cc-scroll { flex: 1; min-height: 0; overflow: auto; }
.cc-detail { padding: 0 0 1rem; }
.cc-table { width: 100%; border-collapse: collapse; background: var(--desk-surface); }
.cc-table th, .cc-table td {
  padding: 0.3rem 0.75rem; text-align: left; border-bottom: 1px solid var(--desk-line);
  white-space: nowrap;
}
.cc-table th { position: sticky; top: 0; background: #f9fafb; color: var(--desk-muted); font-weight: 600; font-size: 12px; }
.cc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cc-table tr.is-due td:first-child { box-shadow: inset 3px 0 0 var(--desk-warn); }
.cc-table td .pill { margin-right: 0.25rem; }
.cc-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.85rem; padding: 0.85rem 1rem 0; }
.cc-cols > .card { min-width: 0; }
/* A row of the debtor page's Actions card: a fixed label column, then the controls, which WRAP inside the card (a narrow card puts the
   button on the next line under the controls; nothing ever runs past the card into History). Hidden inputs take no grid cell. */
.cc-form.cc-action { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: center; column-gap: 0.4rem; }
.cc-form.cc-action > input[type="hidden"] { display: none; }
.cc-form.cc-action .field-label { min-width: 0; }
.cc-action-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; min-width: 0; }
.cc-form.cc-action .cc-action-controls .field-input, .cc-form.cc-action .cc-action-controls .field-select { flex: 1 1 7rem; min-width: 0; height: 2rem; }
.cc-form.cc-action .cc-action-controls .field-input[type="date"] { flex: 0 1 9.5rem; }
.cc-form.cc-action.cc-call .cc-action-controls .field-select { flex: 0 0 6rem; }
.cc-form.cc-action .cc-action-controls .btn { flex: 0 0 auto; }
.cc-form { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.cc-form .field-label { margin: 0; min-width: 7rem; }
.cc-form .field-input, .cc-form .field-select { flex: 1; min-width: 0; height: 2rem; }
.cc-history { list-style: none; margin: 0; padding: 0; }
.cc-history li { margin: 0 0 0.5rem; }
.banner-test { background: #fef3c7; color: #92400e; }
.cc-send { font-size: 12px; }
.cc-inline { display: inline; margin: 0 0 0 0.4rem; }
.cc-inline .btn { height: 1.6rem; padding: 0 0.5rem; }
.cc-warn { color: #b91c1c; margin-top: 0.15rem; }
.cc-preview { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 0.85rem; padding: 0.85rem 1rem; }
.cc-mail { background: #fff; border: 1px solid var(--desk-line); border-radius: var(--desk-radius); }
.cc-mail-head { padding: 0.6rem 1rem; border-bottom: 1px solid var(--desk-line); }
.cc-mail-head div { display: flex; gap: 0.6rem; }
.cc-mail-head .k { width: 3.5rem; color: var(--desk-muted); flex-shrink: 0; }
.cc-mail-body { padding: 0.9rem 1rem; font-size: 14px; }
.cc-mail-body p { margin: 0 0 0.7rem; }
.cc-side .card h2 { margin-bottom: 0.5rem; }
.cc-side ul { margin: 0; padding-left: 1.1rem; }
.cc-blockers { background: var(--desk-danger-soft); color: #991b1b; border: 1px solid #fecaca; border-radius: var(--desk-radius); padding: 0.6rem 1rem; margin: 0.85rem 1rem 0; }
.cc-blockers ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.cc-ack { display: flex; gap: 0.4rem; align-items: flex-start; margin-bottom: 0.5rem; }
.cc-inv-row, .cc-click { cursor: pointer; }
.cc-inv-row:hover td, .cc-click:hover td { background: #f9fafb; }
.cc-chevron { display: inline-block; width: 1.3em; font-size: 1.5em; line-height: 0; vertical-align: middle; position: relative; top: -2px; }
.cc-promise { white-space: nowrap; font-size: 12px; }
.cc-call .field-input[name="note"] { min-width: 5rem; }
.cc-tabs { display: inline-flex; border: 1px solid var(--desk-line-strong); border-radius: 6px; overflow: hidden; background: #fff; }
.cc-bar .cc-tab { display: inline-flex; align-items: center; height: calc(2rem - 2px); margin: 0; padding: 0 0.8rem; border: 0; border-radius: 0; font-size: 0.95rem; font-weight: 500; letter-spacing: 0; color: var(--desk-muted); background: #fff; }
.cc-tab + .cc-tab { border-left: 1px solid var(--desk-line-strong); }
a.cc-tab:hover { background: #f3f4f6; color: var(--desk-text); text-decoration: none; }
.cc-tab.is-current { background: #e5e7eb; color: var(--desk-text); font-weight: 600; }
.cc-latest { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; color: var(--desk-muted); }
.cc-inv-detail td { background: #f9fafb; }
.cc-inv-detail[hidden] { display: none; }
.cc-detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0.85rem; padding: 0.2rem 0; }
.cc-note { margin-bottom: 0.3rem; }
.cc-date { flex: 0 0 8.5rem !important; }
.cc-call .field-select { flex: 0 0 6rem; }
.cc-stage-select { display: inline-flex; align-items: center; gap: 0.4rem; }
.cc-sources { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.cc-bar .cc-stage-pick { flex: 0 0 auto; width: auto; min-width: 14rem; }
.cc-bar > .muted { white-space: nowrap; }

/* Playbook page: one dense line per rule; edit + history behind a click. */
.pb-search { max-width: 18rem; height: 1.8rem; }
.pb-help { margin: 0; padding: 0.4rem 1rem; font-size: 12px; }
.pb-group { margin: 0 0 0.6rem; }
.pb-group > .rail-label { padding: 0.4rem 1rem 0.2rem; }
.pb-group-head { margin: 0; padding: 0.5rem 1rem 0.2rem; font-size: 13px; font-weight: 650; color: var(--desk-text, inherit); }
.pb-group-counts { font-weight: 400; font-size: 12px; color: var(--desk-muted); }
.pb-explain-top { padding: 0.4rem 1rem 0.2rem; margin: 0; }
.pb-measured-note { padding: 0 1rem; margin: 0.4rem 0; font-size: 12px; }
.pb-empty { padding: 0 1rem; margin: 0.2rem 0; }
.pb-rule { border-bottom: 1px solid var(--desk-line); background: var(--desk-surface); }
.pb-rule.is-off .pb-text { color: var(--desk-muted, #6b7280); }
.pb-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 1rem; min-width: 0; font-size: 13px; list-style: none; cursor: pointer; }
.pb-row::-webkit-details-marker { display: none; }
.pb-chip { flex: 0 0 auto; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 0.45rem; border-radius: 999px; background: var(--desk-warn-soft); color: #92400e; font-size: 11.5px; font-weight: 600; }
.pb-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-meta { flex: 0 0 auto; font-size: 11.5px; white-space: nowrap; }
.pb-edit { padding: 0.2rem 1rem 0.7rem 1rem; }
.pb-textarea { width: 100%; box-sizing: border-box; resize: vertical; overflow: hidden; min-height: 4.5rem; }
.pb-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem; }
.pb-reason { flex: 1; max-width: 22rem; height: 1.8rem; }
.pb-collapse { cursor: pointer; padding: 0.4rem 1rem; }
.pb-history { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 12.5px; }
.pb-history li { border-top: 1px solid var(--desk-line); padding: 0.3rem 0; }
.pb-history p { margin: 0.1rem 0 0.2rem; }
.pb-form, .pb-draft { margin: 0.5rem 1rem; padding: 0.6rem 0.8rem; border: 1px solid var(--desk-line); border-radius: var(--desk-radius); background: var(--desk-surface); }
.pb-draft { background: var(--desk-warn-soft); }
.pb-draft .pb-form { margin: 0; padding: 0; border: 0; background: transparent; }
.pb-draft-head { margin: 0 0 0.3rem; font-size: 13px; }
.pb-form-row { display: flex; align-items: flex-end; gap: 0.6rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.pb-picker { position: relative; min-width: 22rem; }
.pb-chosen { font-size: 13px; }
.pb-hits { position: absolute; z-index: 5; left: 0; right: 0; margin: 0; padding: 0; list-style: none; background: var(--desk-surface); border: 1px solid var(--desk-line); border-radius: var(--desk-radius); max-height: 16rem; overflow: auto; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12); }
.pb-hit { display: block; width: 100%; text-align: left; padding: 0.3rem 0.6rem; border: 0; background: transparent; font-size: 12.5px; cursor: pointer; }
.pb-hit:hover { background: var(--desk-warn-soft); }
.pb-check { display: block; margin: 0 0 0.4rem; font-size: 12.5px; }
.pb-corr { padding: 0.3rem 1rem; border-bottom: 1px solid var(--desk-line); background: var(--desk-surface); }
.pb-corr form { margin: 0; }
.teach-line { margin: 0 0 0.4rem; padding: 0 0.2rem; font-size: 12px; }
/* An action that is a link: underlined and link-coloured, no new chrome. */
.linklike { color: #1d4ed8; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.linklike:hover { color: #1e3a8a; }
.linklike-muted { color: inherit; opacity: 0.8; margin-left: 0.3rem; }
.notes-count { display: block; font-size: 11.5px; margin-top: 0.15rem; }
.notes-count.is-full { color: #b91c1c; }

/* Playbook: the new-rule flow (scope in plain words, examples, preview) and the inline edit. */
.pb-panel { margin: 0.6rem 1rem; border: 1px solid var(--desk-line); border-radius: var(--desk-radius); background: var(--desk-surface); }
.pb-panel-title { margin: 0; padding: 0.5rem 0.9rem 0; font-size: 1rem; }
.pb-new.pb-form { border: 0; margin: 0; }
.pb-step { border: 0; margin: 0 0 0.6rem; padding: 0; min-width: 0; }
.pb-step legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 0.3rem; }
.pb-num { display: inline-block; width: 1.25rem; height: 1.25rem; line-height: 1.25rem; text-align: center; border-radius: 999px; background: var(--desk-warn-soft); color: #92400e; font-size: 11.5px; margin-right: 0.3rem; }
.pb-kinds { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pb-kind { padding: 0.35rem 0.8rem; border: 1px solid var(--desk-line-strong); border-radius: 999px; background: #fff; font-size: 13px; cursor: pointer; }
.pb-kind:hover { background: var(--desk-warn-soft); }
.pb-kind.is-on { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.pb-kind-help { margin: 0.3rem 0 0; font-size: 12.5px; }
.pb-examples { margin-top: 0.3rem; font-size: 12.5px; }
.pb-example { display: block; margin: 0.1rem 0; text-align: left; }
.pb-count { float: right; font-size: 11.5px; }
.pb-preview { margin: 0 0 0.6rem; padding: 0.5rem 0.7rem; border-left: 3px solid #1d4ed8; background: #eff6ff; border-radius: 0 6px 6px 0; }
.pb-preview-head { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #1e3a8a; margin-bottom: 0.2rem; }
.pb-preview p { margin: 0.1rem 0; font-size: 13px; }
.pb-preview-scope { font-weight: 600; }
.pb-preview-note { font-size: 12px; }
.pb-edit-scope { margin: 0 0 0.3rem; font-size: 12.5px; }
/* A rule for a customer whose orders come through a fixed adapter: the AI never reads it (outline chip in the row, the full line when open). */
.pb-chip.pb-chip-warn { background: transparent; border: 1px solid #d97706; color: #92400e; font-weight: 500; }
.pb-adapter-note { margin: 0 0 0.4rem; padding: 0.25rem 0.5rem; border-left: 3px solid #d97706; background: var(--desk-warn-soft); font-size: 12.5px; }
/* Delivery card: the per-customer "Always use the NetSuite address" switch, one quiet line under the NetSuite default. */
.pb-switch { border-bottom: 1px solid var(--desk-line); background: var(--desk-surface); cursor: default; }
.addr-always { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.35rem; font-size: 12.5px; cursor: pointer; }
.pb-rule.is-new { background: #ecfdf5; box-shadow: inset 3px 0 0 #16a34a; }
.suggested-row { display: inline-flex; align-items: center; gap: 0.4rem; margin-left: 0.5rem; }
.btn-compact { height: 1.5rem; padding: 0 0.6rem; font-size: 12px; }
.bank-check { margin: 0 0 0.6rem; padding: 0.6rem 0.8rem; border: 1px solid #fca5a5; background: #fef2f2; border-radius: var(--desk-radius); color: #991b1b; }
.bank-check h2 { margin: 0 0 0.2rem; font-size: 0.95rem; }
.bank-check p { margin: 0 0 0.4rem; font-size: 12.5px; }
.bank-check form { display: flex; gap: 0.5rem; }
.bank-check input { flex: 1; }
.lookup-current:has(.suggested-row) { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; }
.lookup-name { min-width: 0; overflow-wrap: break-word; }
.suggested-row { flex: 0 0 auto; margin-left: 0; white-space: nowrap; }

/* Sales slice 3: the address picker (a draft until "Use this address"). */
.addr-change { margin-top: 0.5rem; font-size: 13px; }
.addr-panel { margin-top: 0.6rem; border: 1px solid var(--desk-line); border-radius: var(--desk-radius, 8px); padding: 0.7rem 0.8rem; background: #fff; display: flex; flex-direction: column; gap: 0.6rem; }
.addr-panel-head { font-size: 13px; }
.addr-choices { display: flex; flex-direction: column; border: 1px solid var(--desk-line); border-radius: 6px; overflow: hidden; }
.addr-choice { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) 7.5rem auto; gap: 0.6rem; align-items: center; padding: 0.3rem 0.6rem; border-top: 1px solid var(--desk-line); font-size: 13px; }
.addr-choice:first-child { border-top: 0; }
.addr-choice.is-current { background: #f0fdf4; }
.addr-choice-label { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-choice-text { color: var(--desk-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-choice .btn { padding: 0.15rem 0.6rem; font-size: 12.5px; }
.addr-tag { margin-left: 0; font-size: 11px; font-weight: 600; color: #166534; background: #dcfce7; border-radius: 999px; padding: 0 0.4rem; }
.addr-inuse { font-size: 12px; font-weight: 650; color: #166534; }
.addr-warn { color: #9a3412; margin: 0.25rem 0.6rem; font-size: 12.5px; }
.addr-new { display: flex; flex-direction: column; gap: 0.4rem; }
.addr-search { position: relative; }
.addr-suggest { position: absolute; z-index: 6; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--desk-line); border-radius: 6px; box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14); }
.addr-suggest button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 0.4rem 0.6rem; font: inherit; font-size: 13px; cursor: pointer; }
.addr-suggest button:hover { background: #f1f5f9; }
.addr-form-grid { display: grid; grid-template-columns: 1.2fr 1.6fr 1.2fr 1fr 6rem; gap: 0.4rem 0.6rem; }
.addr-field { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.addr-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.addr-check { border: 1px solid #f3d19a; background: #fffaf2; border-radius: 6px; padding: 0.55rem 0.7rem; display: flex; flex-direction: column; gap: 0.45rem; }
.addr-check-head { display: flex; align-items: center; gap: 0.6rem; }
.addr-compare { border-collapse: collapse; width: 100%; font-size: 13px; }
.addr-compare th, .addr-compare td { text-align: left; padding: 0.15rem 0.6rem 0.15rem 0; font-weight: 500; }
.addr-compare thead th { color: var(--desk-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.addr-compare tbody th { color: var(--desk-muted); width: 6rem; }
.addr-compare tr.is-changed td:last-child { font-weight: 650; }
.addr-flag { margin-left: 0.4rem; font-size: 11px; font-weight: 600; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 0 0.4rem; }
.addr-flag.is-bad { color: #991b1b; background: #fee2e2; }
@container (max-width: 40rem) { .addr-form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1350px) { .addr-form-grid { grid-template-columns: 1fr 1fr 1fr; } .addr-choice { grid-template-columns: minmax(6rem, 9rem) minmax(0, 1fr) 6.5rem auto; } }

/* M: the agent's remark (never sent to NetSuite) and the "check Notes" decision sit directly under the Notes box. */
.ai-note, .notes-review { margin-top: 0.4rem; padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 12.5px; }
.ai-note { background: #f1f5f9; border: 1px dashed var(--desk-line, #cbd5e1); }
.ai-note p { margin: 0.15rem 0 0.35rem; white-space: pre-wrap; }
.notes-review { background: #fff7e6; border: 1px solid #e0912f; color: #92400e; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.notes-review-actions { display: inline-flex; gap: 0.4rem; margin-left: auto; }

/* F-B6: the LINES heading and, when it qualifies, one quiet "Confirm N lines from <vendor>'s history" button on the same row. */
.lines-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.lines-head .rail-label { margin: 0; }
.lines-head .btn { min-height: 1.7rem; padding: 0.1rem 0.6rem; font-size: 12px; }
.confirm-all { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0.25rem 0 0.5rem; }
.confirm-all-group { display: flex; flex-direction: column; gap: 0.15rem; }
.confirm-all-reason { margin: 0; font-size: 12px; }

/* Part B: a promotion's discount sits directly under the product line it applies to (compact, muted, no controls), and the per-promotion summary. */
/* The child sits INSIDE its line's card as a sub-row of the same grid: the label under the description/item columns, the negative amount in the AMOUNT column.
   Column positions come from the same layout definitions as the header and the row (each template below adds its own two numbers). */
/* inline-size containment: a promotion sub-row must never influence the column widths the header and the other rows share. */
.promo-summary { margin-top: 0.4rem; padding: 0.45rem 0.8rem; font-size: 12.5px; background: #f8fafc; border: 1px solid var(--desk-line); border-radius: var(--desk-radius, 8px); }
.promo-summary-head { color: var(--desk-muted); font-size: 11px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; margin-bottom: 0.2rem; }
.promo-line { display: flex; justify-content: space-between; gap: 1rem; padding: 0.1rem 0; font-variant-numeric: tabular-nums; }
.promo-line.is-unknown, .promo-line.is-dollar { color: #92400e; justify-content: flex-start; }
.promo-total { font-weight: 650; border-top: 1px solid var(--desk-line); margin-top: 0.15rem; padding-top: 0.2rem; }

/* Plan v3.1 part 1: the manual-entry hold, above the fix list. */
.manual-entry-check { margin: 0 0 0.6rem; padding: 0.6rem 0.85rem; background: #fff7e6; border: 1px solid #e0912f; border-radius: var(--desk-radius, 8px); }
.manual-entry-check h2 { margin: 0 0 0.2rem; font-size: 14px; }
.manual-entry-check p { margin: 0.15rem 0 0.4rem; }
.manual-entry-hint { margin-top: 0.3rem; font-size: 12.5px; }
.post-outcome-number { width: 10rem; }

.mini-table td { padding: 0.1rem 0.8rem 0.1rem 0; font-variant-numeric: tabular-nums; }

/* Hub-sent discounts (printed / operator): listed inside the line they discount, plus the form. */
.line-discounts { margin-top: 0.6rem; padding: 0.5rem 0.65rem; background: #f8fafc; border: 1px solid var(--desk-line); border-radius: 6px; font-size: 12.5px; }
.line-discount { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.15rem 0; }
.line-discount.is-blocked { color: #92400e; }
.discount-form { margin: 0.4rem 0; padding: 0.55rem 0.7rem; background: #fff; border: 1px solid var(--desk-line); border-radius: 6px; font-size: 12.5px; }
.discount-form-row { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.35rem; }
.discount-pct { width: 4.5rem; }
.discount-form-lines { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.45rem; }

/* GHB (builder) and its job address: one compact row in the order header. */
.ghb-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0.75rem; row-gap: 0; align-items: start; margin-top: 0.75rem; }
.ghb-row .lc-hint p { margin: 0.2rem 0 0; }
@container (max-width: 40rem) { .ghb-row { grid-template-columns: minmax(0, 1fr); } }

/* v3.2 B: a quiet suggestion line above the lines; never adds anything by itself. */
.platinum-suggestion { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem; margin: 0.3rem 0 0.4rem; padding: 0.4rem 0.65rem; font-size: 12.5px; background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 6px; color: #3b2a6b; }
.platinum-suggestion.is-unavailable { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.platinum-suggestion ul { margin: 0.15rem 0 0; padding-left: 1.1rem; }
.platinum-suggestion .platinum-note { margin: 0.2rem 0 0; }
.platinum-suggestion .platinum-note.is-po { color: #92400e; }
.platinum-reason { margin: 0.3rem 0; }
.builder-suggestion { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.3rem 0 0.4rem; padding: 0.35rem 0.65rem; font-size: 12.5px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; color: #1e3a8a; }

.card p a { color: var(--desk-brand, #2563eb); text-decoration: underline; }

/* Posted documents: one line for whether the source file is attached to the NetSuite record. */
.source-attach { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .25rem 0 .5rem; font-size: .9rem; }
.source-attach.is-attached { color: var(--ok, #1a7f37); }
.source-attach.is-failed, .source-attach.is-too_large { color: var(--bad, #b42318); }
.source-attach .btn { padding: .1rem .6rem; }
.source-attach-pick { display: inline-flex; gap: .4rem; align-items: center; }

/* Remove line (two-step confirm inside the line card). */
.line-remove { margin-top: .5rem; }
.line-remove .line-actions { flex-wrap: wrap; align-items: center; gap: .5rem; }

/* The price-cache stamp / More-menu sentence when it is refreshing, the last refresh failed, or prices are older than 26h (information only: approval is never paused). */
.pricing-alert { color: #9a3412; font-weight: 600; }

/* tab-access: the Users screen (one dense row per person) and the no-access page. */
.users-table td, .users-table th { white-space: nowrap; }
.users-table .users-check { text-align: center; width: 4.5rem; }
.users-table .users-email { color: var(--desk-muted); }
.users-table .users-roles { white-space: normal; font-size: 12px; }
.users-table tr.is-none td { background: #fafafa; }
.users-none { font-size: 12px; }
.menu-users { margin: 0.75rem 0 0; padding-top: 0.6rem; border-top: 1px solid var(--desk-line); }
.no-access p { margin: 0.4rem 0 0.9rem; }
.pb-readonly { margin: 0.2rem 0 0; font-size: 12px; }

/* Users: the "managed in Entra" sentence sits right after the title, muted, and wraps under it at narrow widths instead of crowding it (ui-audit 11). */
.cc-bar .users-managed { margin-left: 0.75rem; flex: 1 1 20rem; min-width: 0; text-align: left; font-size: 12px; }

/* assistant-panel: the Assistant (components/Assistant.tsx): summary on top, the thread below, the input pinned at the bottom. The summary+thread area scrolls. */
.assistant { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--desk-surface); font-size: 13px; line-height: 1.45; }
.asst-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0.6rem 0.85rem 0.5rem; }
.asst-summary { padding-bottom: 0.6rem; margin-bottom: 0.6rem; border-bottom: 1px solid var(--desk-line); }
.asst-summary p { margin: 0.35rem 0 0; }
.asst-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; font-size: 12px; min-width: 0; }
.asst-meta > *:not(:last-child)::after { content: "·"; display: inline-block; margin-left: 0.5rem; color: #94a3b8; text-decoration: none; } /* trailing, so a wrapped line never starts with a dot */
.asst-links { display: inline-flex; gap: 0 0.6rem; flex-wrap: wrap; min-width: 0; }
.asst-links a { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst-updating { display: inline-flex; align-items: center; gap: 0.3rem; }
.asst-updating .order-spinner, .asst-pending .order-spinner { width: 10px; height: 10px; border-color: #bfdbfe; border-top-color: var(--desk-brand, #1d4ed8); }
.asst-ns { cursor: help; }
.asst-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.asst-failed { color: #b91c1c; }
.asst-empty, .asst-unverified-line { font-size: 12px; }
.asst-facts { margin-top: 0.4rem; }
.asst-label { display: block; font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--desk-muted); }
.asst-facts ul { margin: 0.1rem 0 0; padding-left: 1.1rem; }
.asst-notes { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.asst-notes li { margin-bottom: 0.15rem; }
.asst-thread { display: flex; flex-direction: column; gap: 0.6rem; }
.asst-older { margin: 0; font-size: 12px; text-align: center; }
.asst-thread > .asst-empty { margin: 0; }
.asst-x { display: flex; flex-direction: column; gap: 0.3rem; }
.asst-q { align-self: flex-end; max-width: 88%; display: flex; flex-direction: column; align-items: flex-end; }
.asst-who { font-size: 11px; }
.asst-bubble { background: var(--desk-brand-soft); border: 1px solid #bfdbfe; border-radius: 10px 10px 2px 10px; padding: 0.3rem 0.6rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.asst-a { align-self: flex-start; max-width: 96%; }
.asst-a p { margin: 0; }
.asst-pending { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--desk-muted); }
.asst-based { margin-top: 0.2rem !important; font-size: 12px; }
.asst-based a { color: var(--desk-brand); }
.asst-unverified { margin-top: 0.25rem !important; font-size: 12px; color: #92400e; background: #fff7e6; padding: 0.15rem 0.4rem; border-radius: 4px; }
.asst-input { margin: 0; padding: 0.5rem 0.85rem 0.55rem; border-top: 1px solid var(--desk-line); background: var(--desk-surface); }
.asst-input[inert] { opacity: 0.55; } /* paused while the document is being read, like the body */
.asst-input-row { display: flex; gap: 0.4rem; align-items: stretch; }
.asst-input textarea.field-input { flex: 1; min-width: 0; resize: none; height: auto; line-height: 1.4; }
.asst-input .btn { min-width: 4.5rem; align-self: flex-end; }
.asst-input .btn.is-posting .order-spinner { border-color: #bfdbfe; border-top-color: var(--desk-brand); }
.asst-note { margin: 0.25rem 0 0; font-size: 11px; }

/* Credit control: the Assistant is a column on the right from 1200 px (the invoices, Actions and History stacked on the left); below it sits under the
   invoices at its natural height. One panel in the DOM: .cc-left holds the table and the cards, and disappears into the flow on narrow screens. */
.cc-main { display: flex; flex-direction: column; }
.cc-main > *, .cc-left > * { flex: none; } /* nothing squeezes: the page scrolls */
.cc-left { display: contents; }
.cc-left .cc-table { order: 0; }
.cc-assistant { order: 1; margin: 0.85rem 1rem 0; border: 1px solid var(--desk-line); border-radius: var(--desk-radius); overflow: hidden; display: flex; flex-direction: column; }
.cc-assistant .assistant { flex: none; }
.cc-assistant .asst-scroll { flex: none; overflow: visible; }
.cc-left .cc-cols { order: 2; }
@media (min-width: 1200px) {
  .cc-main { display: grid; grid-template-columns: minmax(0, 1fr) 21.5rem; overflow: hidden; padding: 0; }
  .cc-left { display: block; min-height: 0; overflow: auto; padding-bottom: 1rem; }
  .cc-left .cc-cols { grid-template-columns: minmax(0, 1fr); }
  .cc-assistant { margin: 0; border: 0; border-left: 1px solid var(--desk-line); border-radius: 0; min-height: 0; }
  .cc-assistant .assistant { flex: 1; }
  .cc-assistant .asst-scroll { flex: 1; overflow-y: auto; }
}

/* Work rail collapsed: a narrow strip with the expand button and the To do count. */
.desk-body.rail-collapsed { --rail: 2.75rem; }
.rail-head { display: flex; justify-content: flex-end; padding: 0 0.15rem 0.3rem; }
.rail-toggle { padding: 0 0.4rem; height: 1.5rem; line-height: 1; }
.rail.is-collapsed { padding: 0.5rem 0.3rem; align-items: center; }
.rail.is-collapsed .rail-head { justify-content: center; padding: 0 0 0.4rem; }
.rail-mini-count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--desk-muted); }

/* po-bill-workflow ---------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.pill-amber { background: #fef3c7; color: #92400e; }
.btn-sm, button.btn.btn-sm { height: 1.4rem; padding: 0 0.5rem; font-size: 12px; }

/* The PO summary row in the bill header (replaces the "Our PO" lookup while a PO is linked). */
.po-summary { padding: 0.35rem 0; border-top: 1px solid var(--desk-line); border-bottom: 1px solid var(--desk-line); }
.po-summary-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; font-size: 13px; }
.po-summary-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.7rem; margin-left: auto; }
.po-summary-problem { margin: 0.25rem 0 0; font-size: 12px; }
.po-summary .lookup { margin-top: 0.35rem; max-width: 26rem; }

/* The small bin (Remove line): top-right of a plain line card, the end of a comparison row. The confirmation is a small popover beside it. */
.line { position: relative; }
.line-bin { position: relative; display: inline-flex; }
.bin-btn { appearance: none; border: 0; background: transparent; color: var(--desk-muted); width: 1.5rem; height: 1.5rem; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.bin-btn:hover, .bin-btn[aria-expanded="true"] { background: #fee2e2; color: #b91c1c; }
.bin-pop { position: absolute; top: 1.7rem; right: 0; z-index: 5; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.45rem; background: #fff; border: 1px solid var(--desk-line-strong); border-radius: 6px; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18); font-size: 12px; white-space: nowrap; }
.cmp-ok { display: flex; align-items: center; gap: 0.3rem; font-size: 12px; cursor: pointer; }
.cmp-ok input { margin: 0; }

/* Totals: three-way (invoice / will post / PO), and tighter spacing on the bill desk so header + comparison + totals fit one screen. */
.totals-table td.is-diff { color: #b45309; font-weight: 600; }
.card h2 { margin-bottom: 0.5rem; }
.card-dense { padding: 0.55rem 0.8rem; margin-bottom: 0.5rem; }
.card-dense h2 { margin-bottom: 0.3rem; }
.card-dense .header-grid { gap: 0.25rem 0.7rem; }
.card-dense .field-label { margin-bottom: 0.1rem; }
.totals-card.card-dense .totals-table th, .totals-card.card-dense .totals-table td { padding-top: 0.1rem; padding-bottom: 0.1rem; }
.totals-card.card-dense p { margin: 0.25rem 0 0; }
.totals-card.card-dense h2 { margin-bottom: 0.15rem; }
.totals-card.card-dense .totals-table { font-size: 12.5px; }
.po-summary { padding: 0.15rem 0; }
/* Totals: the card's full width, labels and headers on one line, one status pill per row. */
.totals-card.card-dense .totals-table { max-width: none; }
.totals-table th, .totals-table td { white-space: nowrap; }
.totals-table .totals-status { text-align: left; padding-left: 0.75rem; width: 99%; }
.totals-card { container-type: inline-size; }
@container (max-width: 560px) {
  .totals-table th, .totals-table td { white-space: normal; }
  .totals-table .totals-status { width: auto; }
  .totals-table .totals-status .pill { white-space: normal; }
}

/* PO-linked bill, fix round 2: one compact line for the line-level blockers, a one-line vendor, "+ Note", and the totals message in the card's heading row. */
.blockers-compact { padding: 0.35rem 0.85rem; margin-bottom: 0.5rem; }
.blockers-compact .blockers-line { margin: 0; font-size: 13px; }
.blockers-compact ol { margin: 0.25rem 0 0; }
.vendor-line { display: flex; align-items: baseline; gap: 0.6rem; }
.totals-inline { font-weight: 500; font-size: 12.5px; }
.totals-inline.is-bad { color: #9a3412; font-weight: 600; }
.card-dense.totals-card { padding: 0.4rem 0.8rem; margin-bottom: 0.4rem; }
.notes-inline { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.6rem; align-items: center; }
.notes-inline > .field-label { margin: 0; white-space: nowrap; }
.notes-inline > :not(.field-label):not(textarea):not(.notes-review):not(.ai-note) { min-width: 0; }
.notes-inline .notes-review, .notes-inline .ai-note { grid-column: 1 / -1; }
.card-dense:has(.notes-inline) textarea { min-height: 1.9rem; height: 1.9rem; resize: none; }
.po-summary { padding: 0.05rem 0; }
.card-dense { padding: 0.45rem 0.8rem; }
.totals-card.card-dense .totals-table th, .totals-card.card-dense .totals-table td { padding-top: 0.05rem; padding-bottom: 0.05rem; }
.blockers-compact { padding: 0.25rem 0.85rem; margin-bottom: 0.4rem; }

/* A PO-linked bill's header (card wide enough): vendor, invoice number and invoice date are ONE row with inline labels; the lookup/inputs keep their size. */
@container (min-width: 40.01rem) {
  #desk-order.po-compact .header-grid { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.25rem 1rem; }
  #desk-order.po-compact .header-grid > div:not(.span-all), #desk-order.po-compact .header-grid-rest > div:not(.span-all) { flex-direction: row; align-items: center; gap: 0.45rem; }
  #desk-order.po-compact .header-grid .field-label { margin: 0; white-space: nowrap; }
  #desk-order.po-compact .header-grid-rest > div:not(.span-all) > .field-input { margin-top: 0; width: 8.5rem; }
  #desk-order.po-compact .header-grid .has-hint .field-hint { display: none; }
}
@container (min-width: 40.01rem) {
  #desk-order.po-compact .header-grid { gap: 0.25rem 0.75rem; }
  #desk-order.po-compact .vendor-line { flex-wrap: nowrap; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; }
  #desk-order.po-compact .vendor-line .linklike { flex: none; }
  #desk-order.po-compact .header-grid-rest > div:not(.span-all) > .field-input { width: 7.6rem; }
  #desk-order.po-compact .header-grid .field-label .muted { display: none; } /* "optional" beside the invoice date */
}
.vendor-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#desk-order.po-compact .header-grid > div:first-child { min-width: 0; }

/* The PO sentence under a PO-linked bill's totals (two columns, like any bill): information, one or two lines. */
.totals-po { margin: 0.2rem 0 0; font-size: 12.5px; }
.totals-po.is-differs { color: #92400e; }
.totals-po-ok { color: #166534; font-weight: 600; }
.totals-body.has-po { display: flex; gap: 1.5rem; align-items: flex-start; }
.totals-body.has-po .totals-table { width: auto; flex: none; }
.totals-body.has-po .totals-table .totals-status { width: auto; padding-left: 0.75rem; }
.totals-po-box { flex: 1 1 0; min-width: 0; padding-top: 0.2rem; }
.totals-po-box .totals-po:first-child { margin-top: 0; }
@container (max-width: 700px) { .totals-body.has-po { flex-direction: column; gap: 0.3rem; } }
/* 💎 platinum partner: a small mark right before the customer's name (queue row, stage subtitle, Customer field, Credit control list and debtor page). */
.platinum-mark { margin-right: 0.25em; font-style: normal; cursor: help; }

/* address-cleanup: the delivery card's candidate address on lines, one status, and the order's text as written. */
.addr-lines > div { line-height: 1.35; }
.addr-status { margin: 0.3rem 0 0; font-size: 12.5px; }
.addr-status.is-ok { color: #166534; }
.addr-status.is-unconfirmed { color: #92400e; }
.addr-status.is-not_checked { color: var(--desk-muted); }
.addr-dropped { color: #92400e; }
.addr-source { margin: 0.3rem 0 0; font-size: 12px; overflow-wrap: anywhere; }
.addr-source .field-label { display: inline; margin-right: 0.3rem; }

.addr-inline { margin: 0.4rem 0; }
.addr-inline .addr-field.is-missing .field-input { border-color: #dc2626; background: #fef2f2; }
.addr-inline .addr-gap { color: #b91c1c; font-size: 12px; }
.addr-inline .addr-google-fill { margin: 0.3rem 0; font-size: 13px; }

.pill-amber { background: #fef3c7; color: #92400e; }

/* custom-order-lines: + Add line, collapsed to one small button; open it is the discount form's card with an item search and a quantity. */
.add-line { margin: 0.5rem 0; }
.add-line.discount-form .discount-form-row { align-items: flex-start; flex-wrap: wrap; }
.add-line-item { flex: 1 1 18rem; min-width: 12rem; position: relative; }
.add-line-qty { display: inline-flex; align-items: center; gap: 0.35rem; }
.add-line-qty .field-input { width: 5.5rem; }

/* conversation: the thread on a document (app/frontend/desk/Conversation.tsx). Shares the assistant panel's layout; these are its own bits. */
.conv-context { margin-bottom: 0.6rem; }
.conv-context > summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--desk-muted); }
.conv-thread .conv-line { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.conv-when { white-space: nowrap; }
.conv-ai .asst-who { margin-bottom: 0.1rem; }
.conv-ai.conv-ai_text .asst-text { color: var(--desk-muted); font-size: 13px; }
.conv-ai.conv-ai_summary .asst-text, .conv-ai.conv-ai_answer .asst-text { font-weight: 560; }
.conv-question { border: 1px solid var(--desk-line); border-left: 3px solid #f59e0b; border-radius: 6px; padding: 0.35rem 0.55rem; background: #fffbeb; max-width: 100%; }
.conv-question.is-closed { border-left-color: #94a3b8; background: var(--desk-surface); opacity: 0.8; }
.conv-findings { margin: 0.25rem 0 0; font-size: 12px; }
.conv-email { margin-top: 0.35rem; font-size: 12px; }
.conv-email-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.25rem 0; font: inherit; background: var(--desk-surface); border: 1px solid var(--desk-line); border-radius: 4px; padding: 0.3rem 0.45rem; }
.conv-working { display: flex; align-items: center; gap: 0.4rem; margin: 0; padding: 0.25rem 0.85rem; font-size: 12px; border-top: 1px solid var(--desk-line); }
.conv-working .order-spinner { width: 10px; height: 10px; border-color: #bfdbfe; border-top-color: var(--desk-brand, #1d4ed8); }
.conv-buttons { display: flex; flex-direction: column; gap: 0.3rem; justify-content: flex-end; }

/* Field notes: what the AI did / asks, on the field it concerns. */
.field-notes { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.field-evidence { margin: 0; font-size: 0.85em; }
.mark-new { background: #e8f0fe; color: #1a4fa0; border-radius: 3px; padding: 0 4px; font-size: 0.8em; font-weight: 600; }
.field-question { border-left: 3px solid #1a4fa0; padding: 4px 8px; background: #f5f8ff; }
.field-question p { margin: 2px 0; }
.ai-working { margin-left: 8px; color: #1a4fa0; font-size: 0.85em; }

/* Learning: the "why?" strip on an edited row, the lesson controls, the Lessons inbox, the metrics. */
.learning-strip { border-left: 3px solid #7a5a00; background: #fffaf0; padding: 4px 8px; }
.learning-strip p { margin: 2px 0; }
.learning-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.learning-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.learning-free .field-input { min-width: 14rem; }
.learning-warn { flex-basis: 100%; margin: 0; }
.pb-lesson { display: flex; gap: 8px; align-items: flex-start; }
.pb-lesson-party { font-size: 0.95em; margin: 8px 0 2px; }
.pb-metrics td, .pb-metrics th { padding: 2px 12px 2px 0; text-align: left; }
.nav-count { margin-left: 6px; background: #7a5a00; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 0.75em; }

/* ---- line-ui: the sales order line. One scannable row (# | Item | Quantity | Price ex GST | Line total), the one thing to settle as a sentence under it, and an opened table
   (On their PO | We'll post | How). The coloured left edge is the line's state: ready (green), needs a person (amber), locked (grey). Names wrap; nothing is ellipsised; figures are tabular. ---- */
.sl-line { position: relative; --sl-edge: #2f9e6b; box-shadow: inset 4px 0 0 var(--sl-edge); }
.sl-line.is-needs { --sl-edge: #e0912f; border-color: #f0b463; background: #fffaf2; }
.sl-line.is-locked { --sl-edge: #cbd5e1; }
.sl-head { display: block; padding: 0.6rem 0.8rem 0.6rem 1rem; cursor: pointer; list-style: none; }
.sl-head::-webkit-details-marker { display: none; }
.sl-line:not([open]) > .sl-head:hover { background: #f8fafc; }
.sl-line.is-needs:not([open]) > .sl-head:hover { background: #fff5e6; }
.sl-row { display: grid; grid-template-columns: 1.4rem minmax(0, 2.3fr) minmax(7.5rem, 1.1fr) minmax(11rem, 1.9fr) 6.4rem; gap: 0 var(--line-gap, 0.7rem); align-items: start; position: relative; }
.sl-line.has-bin .sl-row { padding-right: 1.6rem; }
.sl-row > .line-bin { position: absolute; top: -0.2rem; right: -0.4rem; z-index: 2; }
.sl-no { color: var(--desk-muted); font-variant-numeric: tabular-nums; padding-top: 0.05rem; }
.sl-cell { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; overflow-wrap: anywhere; }
.sl-main { font-weight: 600; }
.sl-sub { color: var(--desk-muted); font-size: 12px; line-height: 1.3; }
.sl-sub .is-warn, .sl-sub.is-warn { color: #b45309; font-weight: 600; }
.sl-qty, .sl-price, .sl-total { font-variant-numeric: tabular-nums; }
.sl-total { text-align: right; align-items: flex-end; }
.sl-row-head { color: var(--desk-muted); font-size: 11px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; padding: 0 calc(var(--line-pad-x, 0.7rem) + var(--line-border, 1px) + 0.3rem) 0.15rem 1rem; margin-top: 0.1rem; }
.sl-row-head .sl-total { text-align: right; }

/* the one thing to settle: a sentence and its buttons, inside the line's card, under the row */
.sl-strip { margin: 0.5rem 0 0 calc(1.4rem + var(--line-gap, 0.7rem)); padding: 0.5rem 0.7rem; background: #fff; border: 1px solid #f0b463; border-radius: 6px; cursor: default; }
.sl-strip-text { margin: 0 0 0.4rem; font-weight: 500; }
.sl-strip-hint { margin: 0 0 0.4rem; font-size: 12.5px; }
.sl-strip .chips, .sl-strip .zero-rate, .sl-strip [data-typed-po-price] { margin-bottom: 0.4rem; }

/* the opened line: ONE table, each fact once, the control beside the value it changes */
.sl-body { padding: 0.2rem 0.9rem 0.8rem 1rem; border-top: 1px solid var(--desk-line); }
.sl-table { display: grid; font-size: 13.5px; }
.sl-trow { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.5fr); gap: 0.2rem 0.9rem; padding: 0.55rem 0; border-bottom: 1px solid var(--desk-line); align-items: start; }
.sl-trow:last-child { border-bottom: 0; }
.sl-thead { color: var(--desk-muted); font-size: 11px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; padding-bottom: 0.3rem; }
.sl-label { font-weight: 650; }
.sl-theirs { overflow-wrap: anywhere; }
.sl-how { display: flex; flex-direction: column; gap: 0.2rem; color: #334155; overflow-wrap: anywhere; }
.sl-note { font-size: 12px; }
.sl-ours .lookup { max-width: 22rem; }
/* the column header and the row already say what this is: the lookup's own "Our item" label stays for screen readers only */
.sl-r-item .field-label-row, .sl-r-account .field-label-row { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sl-ours .btn { margin-top: 0.3rem; }
.sl-price-cell { display: flex; flex-direction: column; gap: 0.35rem; }
.sl-posted { font-weight: 600; font-variant-numeric: tabular-nums; }
.sl-ourprice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; padding: 0.4rem 0.5rem; background: #f8fafc; border: 1px dashed var(--desk-line-strong, #cbd5e1); border-radius: 6px; }
.sl-ourprice .field-input { width: 6rem; }
.sl-ourprice .sl-note { flex-basis: 100%; margin: 0; }
.sl-ourprice-hint { font-size: 12px; }
.sl-ours .field-input, .sl-ours select { border: 1px solid #94a3b8; background: #fff; }
.sl-decision { margin: 0.5rem 0 0; padding: 0.55rem 0.7rem; background: #f1f5f9; border-radius: 6px; }
.sl-decision p { margin: 0 0 0.35rem; }
.sl-decision .line-actions { margin-top: 0.2rem; }
.sl-total-line { margin: 0.6rem 0 0; text-align: right; font-variant-numeric: tabular-nums; }

/* bill-line-ui: a PO-linked bill's table has a fourth column (what the PO says); an all-expense bill has no quantity or price to show; the Item | GL account toggle sits above its lookup */
.sl-trow.has-po { grid-template-columns: 5.5rem minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.4fr); }
.sl-po { overflow-wrap: anywhere; }
.sl-po.is-warn { color: #b45309; font-weight: 600; }
.sl-kind .kind-switch-wrap { margin: 0 0 0.3rem; }
.sl-qty-cell { display: flex; flex-direction: column; gap: 0.35rem; }
.sl-receipt { display: flex; align-items: center; gap: 0.35rem; font-size: 12.5px; }
#desk-lines[data-kind="bill"] .sl-row { grid-template-columns: 1.4rem minmax(0, 2.2fr) minmax(10rem, 1.6fr) minmax(11rem, 1.8fr) 6.4rem; }
#desk-lines[data-all-expense="true"] .sl-row { grid-template-columns: 1.4rem minmax(0, 1fr) 9rem; }
#desk-lines[data-all-expense="true"] .sl-qty, #desk-lines[data-all-expense="true"] .sl-price { display: none; }
.sl-line.is-compact .sl-row > .sl-item { flex-direction: row; align-items: baseline; gap: 0 0.6rem; flex-wrap: wrap; }
.sl-line.is-compact .sl-row > .sl-item > :first-child { flex: 0 1 auto; max-width: 100%; }
.sl-line.is-compact .sl-row > .sl-item .sl-sub { min-width: 0; flex: 1 1 12rem; }
.sl-line.is-compact .sl-row > .sl-total { flex-direction: row; align-items: baseline; justify-content: flex-end; gap: 0 0.5rem; }
.sl-line.is-compact > .sl-head { padding-top: 0.35rem; padding-bottom: 0.35rem; }
.sl-line.is-compact.is-needs > .sl-head { padding-bottom: 0.6rem; }
.sl-missing { color: #b45309; font-weight: 600; }
.sl-po-open { margin: 0.7rem 0 0; padding: 0.5rem 0.8rem 0.5rem 1rem; border: 1px dashed var(--desk-line-strong, #cbd5e1); border-radius: 6px; font-size: 13px; }
.sl-po-open-label { margin: 0 0 0.25rem; font-weight: 600; }
.sl-po-open ul { margin: 0; padding-left: 1.1rem; }

/* ~51rem (the Original pane open on a laptop): the tags tighten */
@container (max-width: 51rem) {
  .sl-row { grid-template-columns: 1.4rem minmax(0, 2fr) minmax(4.8rem, 0.9fr) minmax(7.5rem, 1.4fr) 5.4rem; }
  .sl-trow { grid-template-columns: 4.8rem minmax(0, 1fr) minmax(0, 1.5fr); }
  .sl-trow.has-po { grid-template-columns: 4.8rem minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); }
  #desk-lines[data-kind="bill"] .sl-row { grid-template-columns: 1.4rem minmax(0, 2fr) minmax(8rem, 1.5fr) minmax(8.5rem, 1.4fr) 5.4rem; }
  #desk-lines[data-all-expense="true"] .sl-row { grid-template-columns: 1.4rem minmax(0, 1fr) 9rem; }
  .sl-trow .sl-how { grid-column: 2 / -1; }
  .sl-thead > span:last-child { display: none; }
}
/* a narrow pane or a phone: two rows per line (# Item … total / quantity · price), the strip under, the table stacked as label / their PO → ours / how */
@container (max-width: 37rem) {
  .sl-row { grid-template-columns: 1.4rem minmax(0, 1fr) auto; grid-template-areas: "no item total" ". qty qty" ". price price"; gap: 0.15rem 0.6rem; }
  .sl-row > .sl-no { grid-area: no; }
  .sl-row > .sl-item { grid-area: item; }
  .sl-row > .sl-total { grid-area: total; }
  .sl-row > .sl-qty { grid-area: qty; flex-direction: row; flex-wrap: wrap; gap: 0 0.5rem; align-items: baseline; }
  .sl-row > .sl-price { grid-area: price; flex-direction: row; flex-wrap: wrap; gap: 0 0.5rem; align-items: baseline; }
  .sl-row-head { display: none; }
  .sl-strip { margin-left: 0; }
  .sl-trow, .sl-trow.has-po { grid-template-columns: 1fr; padding: 0.6rem 0; }
  #desk-lines[data-kind="bill"] .sl-row, #desk-lines[data-all-expense="true"] .sl-row { grid-template-columns: 1.4rem minmax(0, 1fr) auto; }
  .sl-thead { display: none; }
  .sl-trow > span[data-label]::before { content: attr(data-label); display: block; color: var(--desk-muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
  .sl-trow .sl-how { grid-column: auto; }
  .sl-line.is-compact .sl-row > .sl-item { flex-direction: column; align-items: stretch; }
  .sl-line.is-compact .sl-row > .sl-item .sl-sub { flex: none; }
  #desk-lines .sl-line.is-compact .sl-row { grid-template-columns: 1.4rem minmax(0, 1fr); grid-template-areas: "no item" ". total"; }
  .sl-line.is-compact .sl-row > .sl-total { justify-content: flex-start; }
}

/* playbook-ui: four tabs (To review, Rules, Customer settings, Results), review cards, the rule side panel, the results bars. */
.pb-head .pb-tagline { font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-tabs { display: flex; gap: 0.25rem; padding: 0 1rem; border-bottom: 1px solid var(--desk-line); background: #fff; overflow-x: auto; flex: none; }
.pb-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 0.55rem 0.7rem 0.45rem; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--desk-muted); cursor: pointer; white-space: nowrap; }
.pb-tab.is-on { color: #111827; border-bottom-color: #1d4ed8; font-weight: 650; }
.pb-tab-count { display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem; border-radius: 999px; background: #e8f0fe; color: #1e3a8a; font-size: 11.5px; font-weight: 650; }
.pb-tab.is-on .pb-tab-count { background: #1d4ed8; color: #fff; }
.pb-scroll { position: relative; }
.pb-review { padding: 0.5rem 1rem 1rem; max-width: 60rem; }
.pb-card { border: 1px solid var(--desk-line); border-radius: var(--desk-radius); background: #fff; padding: 0.7rem 0.9rem; margin: 0 0 0.6rem; }
.pb-card-lesson { border-left: 3px solid #1d4ed8; }
.pb-card-corr.is-minor { background: var(--desk-surface); }
.pb-card-head { display: flex; align-items: center; gap: 0.5rem; }
.pb-card-head h3 { margin: 0; font-size: 14px; }
.pb-card-sub { margin: 0.1rem 0 0.4rem; font-size: 12px; }
.pb-card-text { margin: 0.2rem 0 0.4rem; font-size: 13.5px; }
.pb-explain { margin: 0.3rem 0 0; font-size: 12px; }
.pb-patterns { list-style: none; margin: 0.2rem 0 0.4rem; padding: 0; }
.pb-pattern { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0; border-top: 1px solid var(--desk-line); font-size: 13px; }
.pb-pattern:first-child { border-top: 0; }
.pb-pattern-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pb-pattern .pb-val { font-weight: 600; }
.pb-card-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.3rem; }
.pb-confirm { margin: 0.5rem 0 0; padding: 0.5rem 0.7rem; border: 1px solid #f0b463; border-radius: 6px; background: #fffaf2; font-size: 13px; }
.pb-confirm p { margin: 0 0 0.3rem; }
.pb-confirm ul { margin: 0 0 0.4rem; padding-left: 1.1rem; }
.pb-rows { width: 100%; border-collapse: collapse; margin-top: 0.4rem; font-size: 12.5px; }
.pb-rows td { padding: 0.2rem 0.5rem 0.2rem 0; border-top: 1px solid var(--desk-line); vertical-align: top; }
.pb-rows .pb-row-actions { white-space: nowrap; text-align: right; }
.pb-older, .pb-more { margin: 0.2rem 0 0.5rem; padding: 0 1rem; font-size: 13px; }
.pb-review .pb-older { padding: 0; }
.pb-minor { margin-top: 1rem; }
.pb-minor > .rail-label { padding-left: 0; }
.pb-rules { padding-bottom: 1rem; }
.pb-search-row { position: relative; padding: 0.6rem 1rem 0; }
.pb-search-row .pb-search { max-width: 36rem; width: 100%; }
.pb-search-row .pb-hits { left: 1rem; right: auto; min-width: 24rem; }
.pb-rule-group { margin: 0 0 0.6rem; }
.pb-rule-btn { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; display: flex; align-items: flex-start; gap: 0.6rem; }
.pb-rule-btn:hover { background: #f8fafc; }
.pb-rule-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: 0.5rem; }
.pb-rule-main .pb-text { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
.pb-rule-main .pb-chip { margin-top: 0.1rem; }
.pb-rule.is-open { background: #eff6ff; }
.pb-rule .pb-meta { white-space: normal; max-width: 16rem; text-align: right; }
.pb-sub { margin: 0.6rem 1rem 0.2rem; font-size: 12.5px; color: var(--desk-muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
.pb-drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.25); z-index: 30; }
.pb-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(36rem, 100%); background: #fff; border-left: 1px solid var(--desk-line); box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12); z-index: 31; padding: 0.8rem 1rem 1rem; overflow: auto; }
.pb-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pb-drawer-head h2 { margin: 0; font-size: 15px; }
.pb-drawer-text { font-size: 14px; line-height: 1.4; margin: 0.5rem 0; }
.pb-drawer .pb-reason { max-width: none; margin-top: 0.4rem; }
.pb-settings { padding: 0.4rem 0 1rem; }
.pb-settings .pb-search { margin: 0 1rem 0.4rem; max-width: 24rem; }
.pb-results { padding: 0.5rem 1rem 1rem; max-width: 60rem; }
.pb-results-title { margin: 0.3rem 0 0.1rem; font-size: 15px; }
.pb-results .pb-help { padding: 0; }
.pb-bars { display: flex; align-items: flex-end; gap: 0.6rem; margin: 0.8rem 0 0.4rem; height: 11rem; }
.pb-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.pb-bar-pct { font-size: 12px; font-weight: 650; white-space: nowrap; }
.pb-bar.is-unmeasured .pb-bar-pct { color: var(--desk-muted); font-weight: 500; font-size: 10.5px; white-space: normal; text-align: center; }
.pb-bar-track { display: block; width: 100%; max-width: 3.5rem; height: 6rem; background: #f1f5f9; border-radius: 4px; position: relative; overflow: hidden; }
.pb-bar.is-unmeasured .pb-bar-track { background: repeating-linear-gradient(135deg, #f1f5f9, #f1f5f9 4px, #e2e8f0 4px, #e2e8f0 8px); }
.pb-bar-fill { position: absolute; left: 0; right: 0; bottom: 0; background: #1d4ed8; border-radius: 4px 4px 0 0; }
.pb-bar.is-partial .pb-bar-fill { background: #60a5fa; }
.pb-bar-label { margin-top: 0.3rem; font-size: 12px; white-space: nowrap; }
.pb-bar-posted { font-size: 11px; white-space: nowrap; }
.pb-results-notes p { margin: 0.2rem 0; font-size: 13.5px; }
.pb-others { margin-top: 0.4rem; }
.pb-others .pb-check { margin: 0.15rem 0; }
@media (max-width: 640px) {
  .pb-head .pb-tagline { display: none; }
  .pb-tabs { padding: 0 0.6rem; }
  .pb-review, .pb-results { padding-left: 0.6rem; padding-right: 0.6rem; }
  .pb-rule-btn { flex-direction: column; gap: 0.2rem; }
  .pb-rule .pb-meta { max-width: none; text-align: left; }
  .pb-search-row { padding: 0.5rem 0.6rem 0; }
  .pb-search-row .pb-hits { left: 0.6rem; right: 0.6rem; min-width: 0; }
  .pb-bars { gap: 0.25rem; height: 9rem; }
  .pb-bar-label, .pb-bar-posted { font-size: 10px; }
  .pb-rows td:nth-child(3) { display: none; }
}

/* manual-intake: the New dialog (upload a file / enter by hand). */
dialog.confirm.new-entry { width: min(36rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; }
.new-section { padding: 0.75rem 0 0.25rem; border-top: 1px solid var(--desk-line); margin-top: 0.6rem; }
.new-section h3 { margin: 0 0 0.2rem; font-size: 0.95rem; }
.new-drop { display: grid; gap: 0.2rem; justify-items: center; text-align: center; padding: 0.9rem 0.75rem; margin: 0.4rem 0; border: 1.5px dashed var(--desk-line); border-radius: 10px; cursor: pointer; background: var(--desk-surface, #fff); }
.new-drop:hover { border-color: var(--desk-muted); }
.new-drop input[type="file"] { font-size: 13px; max-width: 100%; }
.new-files { list-style: none; margin: 0.3rem 0 0.5rem; padding: 0; display: grid; gap: 0.2rem; font-size: 13px; }
.new-party { margin: 0.5rem 0; position: relative; }
.new-party-list { position: static; max-height: 10rem; overflow-y: auto; margin-top: 0.2rem; }
@media (max-width: 600px) { .new-drop input[type="file"] { width: 100%; } }

/* order-confirmation: the card under Totals. The switch on the right of the heading; address chips with the reason under each; the wording as a quiet letter. */
.confirmation-card { container-type: inline-size; }
.confirmation-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.confirmation-head h2 { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 0.45rem; border: 0; background: none; padding: 0.15rem 0; font: inherit; color: var(--desk-muted); cursor: pointer; }
.switch-track { width: 2rem; height: 1.15rem; border-radius: 999px; background: var(--desk-line-strong); position: relative; transition: background 0.12s; flex: none; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: calc(1.15rem - 4px); height: calc(1.15rem - 4px); border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.3); transition: transform 0.12s; }
.switch.is-on { color: var(--desk-text); font-weight: 600; }
.switch.is-on .switch-track { background: var(--desk-ok); }
.switch.is-on .switch-thumb { transform: translateX(0.85rem); }
.switch:focus-visible { outline: 2px solid var(--desk-brand); outline-offset: 2px; border-radius: 6px; }
.confirmation-off { margin: 0.25rem 0 0.35rem; padding: 0.3rem 0.55rem; border-radius: 6px; background: var(--desk-warn-soft); color: #92400e; }
.confirmation-fields { display: grid; gap: 0.35rem; margin-top: 0.3rem; }
.confirmation-fields.is-off > :not(.confirmation-row):not(.confirmation-from) { opacity: 0.55; }
.confirmation-from { margin: 0; }
.confirmation-row { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); align-items: start; column-gap: 0.5rem; }
.confirmation-row > .field-label { margin: 0; padding-top: 0.3rem; }
#confirmation-subject { width: 100%; box-sizing: border-box; }
.recipient-chips { display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: flex-start; }
.recipient { display: inline-flex; flex-direction: column; max-width: 100%; }
.recipient-chip { display: inline-flex; align-items: center; gap: 0.25rem; align-self: flex-start; padding: 0.1rem 0.2rem 0.1rem 0.55rem; border: 1px solid var(--desk-line-strong); border-radius: 999px; background: var(--desk-brand-soft); font-weight: 500; }
.recipient-chip button { border: 0; background: none; color: var(--desk-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.3rem; border-radius: 50%; }
.recipient-chip button:hover { color: var(--desk-danger); }
.recipient.is-warn .recipient-chip { background: var(--desk-warn-soft); border-color: var(--desk-warn); }
.recipient-reason { font-size: 11.5px; color: var(--desk-muted); padding-left: 0.55rem; max-width: 34rem; }
.recipient.is-warn .recipient-reason { color: #92400e; }
.recipient-add { width: 9rem; border: 1px dashed var(--desk-line-strong); border-radius: 999px; padding: 0.1rem 0.6rem; background: transparent; font: inherit; }
.recipient-add:focus { border-style: solid; border-color: var(--desk-brand); outline: none; background: var(--desk-surface); }
#confirmation-body { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; padding: 0.55rem 0.7rem; border: 1px solid var(--desk-line-strong); border-radius: 6px; background: #fcfcfd; resize: vertical; field-sizing: content; min-height: 9rem; }
.confirmation-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.9rem; margin: 0; }
.attachment-chip { display: inline-flex; align-items: center; padding: 0.1rem 0.55rem; border: 1px solid var(--desk-line); border-radius: 6px; background: var(--desk-bg); }
.confirmation-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.75rem; margin: 0.25rem 0; }
.confirmation-status.is-sent { color: #166534; }
.confirmation-status.is-busy { color: var(--desk-muted); }
.confirmation-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 0.75rem; margin: 0.3rem 0; }
.confirmation-banner p { margin: 0; }
.confirmation-banner.is-warn { background: var(--desk-warn-soft); color: #92400e; }
.confirmation-sent { margin-top: 0.3rem; padding: 0.45rem 0.7rem; border: 1px solid var(--desk-line); border-radius: 6px; background: #fcfcfd; }
.confirmation-sent p { margin: 0 0 0.2rem; }
.confirmation-sent .field-label { display: inline; margin-right: 0.3rem; }
.confirmation-sent pre { margin: 0.4rem 0; white-space: pre-wrap; font: inherit; line-height: 1.5; }
.confirmation-card .field-error { margin: 0.1rem 0; color: var(--desk-danger); }
