: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;
}

/* 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,
.line-head: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);
}

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

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

.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;
}

.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; }
.stage-title h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.stage-meta {
  display: flex;
  flex-wrap: wrap;
  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;
}

.workspace.is-open {
  grid-template-columns: minmax(16rem, 38%) minmax(0, 1fr);
}

.original-pane {
  display: none;
  min-width: 0;
  background: #fff;
  border-right: 1px solid var(--desk-line);
}

.workspace.is-open .original-pane { display: flex; flex-direction: column; }

.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 1rem;
  padding: 0.75rem 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;
}

/* 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); }

.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; }

.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: #f3d19a; }
.line-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  list-style: none;
}
.line-head::-webkit-details-marker { display: none; }
.line-no {
  flex: 0 0 1.4rem;
  color: var(--desk-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}
.line-copy { flex: 1; min-width: 0; }
.line-title {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.line-title .why { flex-shrink: 0; }
.line-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.15rem 1.1rem;
  align-items: start;
}
.line-compare-kicker {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--desk-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.line-compare-kicker .why { flex-shrink: 0; }
.line-compare-desc {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.line-compare-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.line-compare-code.is-blank { color: var(--desk-muted); }
.line-compare-code.is-diff { color: #b45309; }
.line-meta { color: var(--desk-muted); font-size: 12px; overflow-wrap: anywhere; margin-top: 0.2rem; }
.line-head-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.line-body {
  padding: 0 0.8rem 0.85rem;
  border-top: 1px solid var(--desk-line);
  container-type: inline-size;
}

.line-grid {
  display: grid;
  grid-template-columns: minmax(9.5rem, 1fr) auto auto auto auto;
  gap: 0.65rem 0.7rem;
  padding-top: 0.75rem;
  align-items: stretch;
}
.line-grid > * {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.line-grid > * > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.line-grid .lookup {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.line-grid .lookup-current {
  overflow-wrap: break-word;
}
.line-grid .lookup > .field-input,
.line-grid .qty-row,
.line-grid .rate-row,
.line-grid .line-fig-value {
  margin-top: auto;
}
.line-item-name {
  margin-top: auto;
  min-height: 2rem;
  display: flex;
  align-items: center;
  font-weight: 650;
  overflow-wrap: break-word;
}
.line-qty .field-label,
.line-fig .field-label {
  white-space: nowrap;
}
.line-fig-span { grid-column: span 2; }
.line-fig-span .line-fig-value { white-space: normal; }
.line-fig-source {
  display: block;
  margin: -0.15rem 0 0.2rem;
  color: var(--desk-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.line-fig-value {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.qty-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
}
.qty-row .field-input {
  width: 4rem;
  flex: 0 0 4rem;
}
.rate-row {
  display: flex;
  align-items: center;
  min-height: 2rem;
}
.rate-row .field-input {
  width: 5.5rem;
  flex: 0 0 5.5rem;
}
.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: 36rem) {
  .line-grid {
    grid-template-columns: auto auto auto auto;
    gap: 0.65rem 1rem;
  }
  .line-item { grid-column: 1 / -1; }
}

.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; }
.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; }

.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; }
/* The "Ours" column sits mid-row: keep its (longer, evidence-bearing) popover narrow so it is not clipped by the stage edge. */
.line-compare-col + .line-compare-col .why-pop { max-width: 15rem; }
.compare-grid,
.fulfil-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.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: 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 .original-pane { 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;
}
.line-total { font-weight: 600; font-variant-numeric: tabular-nums; }
.doc-ids { display: inline-flex; flex-wrap: wrap; 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; }
.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-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 { cursor: pointer; }
.cc-inv-row:hover td { background: #f9fafb; }
.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 9rem !important; }
.cc-call .field-select { flex: 0 0 8rem; }
.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-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; }
.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; }
