/* NESL Pricelist Manager — Nordic Energy Systems design system.
   Tokens per "NESL Brand Guidelines v01, Sept 2024, Tiia Alexandria Design",
   as codified in the 2026-08 Claude Design handoff (main-workspace redesign). */

:root {
  --merlot: #59170f;
  --copper: #873c1e;
  --lion: #a58f78;
  --midnight: #072831;
  --stone-blue: #7f9b9f;

  --moss-green: #3f6b40;
  --cafe-noir: #241b18;
  --peacock: #2c5560;
  --gold: #c79a4b;

  --cream: #f7f3ee;
  --paper: #fffdfa;
  --ink: #211510;
  --stone-100: #ece6dd;
  --stone-300: #cabfae;
  --stone-500: #a58f78;
  --stone-700: #6b5b47;

  --surface-page: var(--cream);
  --surface-card: var(--paper);
  --text-body: var(--ink);
  --text-muted: var(--stone-700);
  --text-inverse: var(--cream);
  --text-brand: var(--merlot);
  --border-default: var(--stone-300);
  --link: var(--copper);
  --link-hover: var(--merlot);

  --ok: #2e6b32;
  --err: #9c0006;
  --new: #b8860b;
  --changed: #2e7d32;
  --ignored: #8a8a8a;

  --font-display: -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-card: 0 1px 2px rgba(33, 21, 16, .06);
  --shadow-modal: 0 24px 64px rgba(33, 21, 16, .34);
  --scrim: rgba(7, 40, 49, .55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 14px;
  height: 100%;
  overflow: hidden;
}

button { font-family: inherit; }
a { color: var(--link); }
::selection { background: var(--copper); color: var(--cream); }
.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 12px; }
.spacer { flex: 1 1 auto; }

/* ============================================================ shell */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---------- header ---------- */

header.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--midnight);
  color: var(--text-inverse);
  padding: 0 24px;
  height: 72px;
  flex: none;
}

header.topbar .monogram { height: 32px; width: auto; display: block; flex: none; }

header.topbar .hairline {
  width: 1.5px;
  height: 27px;
  background: rgba(247, 243, 238, .2);
  flex: none;
}

header.topbar .titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: none;
}

header.topbar .titles .brand {
  font: 800 18px var(--font-display);
  letter-spacing: .05em;
  color: var(--cream);
}

header.topbar .titles .sub {
  font: 500 14.5px var(--font-body);
  color: var(--stone-blue);
}

.topnav { display: flex; align-items: center; gap: 21px; flex: none; }
.topnav a {
  font: 500 15px var(--font-body);
  color: rgba(247, 243, 238, .62);
  text-decoration: none;
  white-space: nowrap;
}
.topnav a:hover { color: var(--cream); }
.topnav a.active { color: var(--cream); font-weight: 600; border-bottom: 2px solid var(--copper); padding-bottom: 2px; }

.pill {
  padding: 7px 13px;
  border-radius: 999px;
  font: 700 13px var(--font-display);
  letter-spacing: .11em;
  white-space: nowrap;
  flex: none;
}
.pill.offline { background: var(--lion); color: var(--midnight); }
.pill.production { background: var(--merlot); color: var(--cream); }
.pill.test { background: var(--stone-blue); color: var(--midnight); }

.db-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.db-switcher .dd-combo { width: auto; min-width: 120px; }
.db-switcher .dd-combo .dd-combo-trigger {
  height: 35px; padding: 0 11px;
  background: rgba(247, 243, 238, .08);
  border: 1px solid rgba(247, 243, 238, .25);
}
.db-switcher .dd-combo.open .dd-combo-trigger { border-color: var(--stone-blue); }
.db-switcher .dd-combo .dd-value { color: var(--cream); font-size: 14.5px; font-weight: 600; }
.db-switcher .dd-combo .caret { color: rgba(247, 243, 238, .6); }
.db-switcher .icon-btn {
  background: rgba(247, 243, 238, .1);
  color: var(--cream);
  font-size: 14.5px;
  padding: 7px 11px;
}
.db-switcher .icon-btn:hover { background: rgba(247, 243, 238, .18); }

/* ---------- step 0 strip ---------- */

.step0-strip {
  display: grid;
  grid-template-columns: auto auto auto auto 1fr;
  align-items: center;
  gap: 14px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  padding: 13px 18px;
  flex: none;
}

.step0-marker { display: flex; align-items: center; gap: 9px; flex: none; }
.step0-circle {
  width: 20px; height: 20px;
  border-radius: 999px;
  border: 1.5px solid var(--merlot);
  color: var(--merlot);
  font: 700 10.5px var(--font-display);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.step0-label {
  font: 800 11px var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.vendor-combo { position: relative; width: 183px; flex: none; }
.vendor-combo-trigger {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  background: #fff;
  height: 36px;
  cursor: pointer;
  text-align: left;
}
.vendor-combo.open .vendor-combo-trigger { border-color: var(--copper); }
.vendor-combo .ico { color: var(--stone-500); font-size: 18px; flex: none; display: flex; align-items: center; line-height: 1; }
.vendor-combo .vc-value {
  font: 600 13px var(--font-body);
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: none; outline: none; background: none; padding: 0;
  cursor: pointer;
}
.vendor-combo .vc-value::placeholder { color: var(--stone-500); font-weight: 400; }
.vendor-combo .caret { font: 400 10px var(--font-body); color: var(--copper); flex: none; display: flex; align-items: center; line-height: 1; }

.vendor-combo-panel {
  position: absolute; left: 0; top: 38px; z-index: 30;
  width: 392px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(33, 21, 16, .16);
  overflow: hidden;
}
.vendor-combo-cols { display: grid; grid-template-columns: 1fr 1fr; height: 320px; }
.vendor-combo-col { display: flex; flex-direction: column; overflow-y: auto; min-height: 0; }
.vendor-combo-col:first-child { border-right: 1px solid var(--border-default); }
.vendor-combo-colhead {
  font: 700 9.5px var(--font-display);
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 9px 12px 7px;
  border-bottom: 1px solid var(--stone-100);
  position: sticky; top: 0; background: var(--surface-card);
}
.vc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.vc-item:hover { background: var(--stone-100); }
.vc-item.queued { background: var(--cream); }
.vc-item .vc-name {
  font: 500 12.5px var(--font-body);
  color: var(--ink);
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vc-item.queued .vc-name { font-weight: 700; color: var(--merlot); }
.vc-item .vc-meta { font: 400 10px var(--font-mono); color: var(--text-muted); flex: none; }

.vendor-combo-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-default);
  background: var(--cream);
}
.vendor-combo-footer .muted { flex: 1; font-size: 11px; }

/* ---------- generic dropdown combo — same icon+input+caret+panel
   language as the vendor picker above, for every other <select> in the
   app. Single flat list (no A-Z/Recent split); reuses .vc-item/.vc-name/
   .vc-meta for the list rows so both stay visually identical. ---------- */
.dd-combo { position: relative; }
.dd-combo-trigger {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  background: #fff;
  height: 36px;
  cursor: pointer;
  text-align: left;
}
.dd-combo.open .dd-combo-trigger, .dd-combo:focus-within .dd-combo-trigger { border-color: var(--copper); }
.dd-combo .dd-value {
  font: 600 13px var(--font-body);
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: none; outline: none; background: none; padding: 0;
  cursor: pointer;
}
.dd-combo .dd-value::placeholder { color: var(--stone-500); font-weight: 400; }
.dd-combo .caret { font: 400 10px var(--font-body); color: var(--copper); flex: none; display: flex; align-items: center; line-height: 1; }
.dd-combo-panel {
  position: absolute; left: 0; top: 38px; z-index: 30;
  width: 100%; min-width: 220px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(33, 21, 16, .16);
  overflow: hidden;
}
.dd-combo-list { max-height: 260px; overflow-y: auto; }
.dd-combo .vc-item.sel { background: var(--cream); }
.dd-combo .vc-item.sel .vc-name { font-weight: 700; color: var(--merlot); }

.btn-primary {
  flex: none;
  white-space: nowrap;
  background: var(--merlot);
  color: var(--cream);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: 700 13px var(--font-display);
  cursor: pointer;
}
.btn-primary:hover { background: #6f1d13; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary.full { width: 100%; }

/* Design handoff sizes "Open portal" at 132x40, but the user wants its
   height to match its neighbors (Copy login/Copy password) instead —
   the merlot fill already sets it apart, a taller box was overkill. */
#open-portal-btn { width: 132px; height: 36px; padding: 0 14px; display: flex; align-items: center; justify-content: center; }

.btn-secondary {
  flex: none;
  white-space: nowrap;
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--copper);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: 700 13px var(--font-display);
  cursor: pointer;
}
.btn-secondary:hover { background: var(--cream); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary.full { width: 100%; }

.cred-cluster {
  display: flex; flex: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.cred-cluster button {
  background: none; border: none; border-left: 1px solid var(--border-default);
  font: 600 12.5px var(--font-body);
  color: var(--ink);
  height: 36px; padding: 0 13px;
  display: flex; align-items: center;
  white-space: nowrap;
  cursor: pointer;
}
.cred-cluster button:first-child { border-left: none; }
.cred-cluster button:hover { background: var(--cream); }
.cred-cluster button.muted-seg { color: var(--text-muted); }

.step0-spacer { min-width: 0; }

.dropzone {
  border: 1.5px dashed var(--stone-300);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 12px;
  background: var(--cream);
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--copper); background: var(--stone-100); }
.dropzone-text { display: flex; flex-direction: column; gap: 1px; }
.dz-title { font: 700 12.5px var(--font-display); color: var(--merlot); }
.dz-sub { font: 400 10.5px var(--font-body); color: var(--text-muted); }
.dz-divider { width: 1px; height: 26px; background: var(--stone-300); flex: none; }
.dz-count { font: 700 10.5px var(--font-mono); color: var(--text-muted); flex: none; }

/* ============================================================ main grid */

.workspace-grid {
  display: grid;
  grid-template-columns: 15% 1fr 15%;
  align-items: stretch;
  background: var(--surface-page);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ---------- queue rail ---------- */

.queue-rail {
  grid-column: 1; grid-row: 1;
  border-right: 1px solid var(--border-default);
  background: var(--surface-card);
  display: flex; flex-direction: column;
  padding-top: 16px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.queue-rail-head { display: flex; align-items: center; gap: 8px; padding: 0 14px 12px; }
.eyebrow {
  font: 800 11px var(--font-display);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink);
}
.count-pill {
  font: 700 10.5px var(--font-mono);
  background: var(--merlot); color: #fff;
  border-radius: 999px; padding: 2px 7px;
}

.seg-toggle { display: flex; border: 1px solid var(--border-default); border-radius: var(--radius-sm); overflow: hidden; }
.seg-opt {
  border: none; background: none;
  font: 600 10.5px var(--font-display); letter-spacing: .05em;
  padding: 5px 8px;
  color: var(--text-muted);
  cursor: pointer;
}
.seg-opt.active { background: var(--stone-100); color: var(--ink); }
.seg-opt + .seg-opt { border-left: 1px solid var(--border-default); }

/* Queue rail's "⋯" overflow menu — supersedes the +Add/−Remove/Clear
   queue footer row. Opens on hovering the wrapper (not the glyph), per
   the design handoff — a deliberate exception to this app's other
   click-to-open menus. */
.queue-overflow { position: relative; flex: none; --menu-op: 0; --menu-pe: none; --menu-y: -4px; }
.queue-overflow:hover, .queue-overflow:focus-within { --menu-op: 1; --menu-pe: auto; --menu-y: 0px; }
.queue-overflow-btn {
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font: 700 13px var(--font-body); color: var(--text-muted);
  cursor: pointer; transition: background 140ms ease, color 140ms ease;
}
.queue-overflow:hover .queue-overflow-btn, .queue-overflow:focus-within .queue-overflow-btn { background: var(--stone-100); color: var(--ink); }
.queue-overflow-menu {
  position: absolute; top: 24px; right: 0; width: 168px;
  background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(33,21,16,.14);
  padding: 5px 0; z-index: 5;
  opacity: var(--menu-op); pointer-events: var(--menu-pe);
  transform: translateY(var(--menu-y));
  transition: opacity 140ms ease, transform 140ms ease;
}
.queue-overflow-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 7px 12px; font: 400 12.5px var(--font-body); color: var(--ink); cursor: pointer;
}
.queue-overflow-menu button:hover { background: var(--cream); }
.queue-overflow-menu button.merlot { color: var(--merlot); }
.queue-overflow-divider { height: 1px; background: var(--border-default); margin: 4px 0; }

.queue-filter { padding: 0 14px 12px; }
.queue-filter input {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  background: #fff;
  font: 400 12.5px var(--font-body);
}

.queue-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border-default);
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.queue-row {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border-default);
  border-left: 3px solid transparent;
  cursor: pointer;
}
.queue-row:hover { background: var(--cream); }
.queue-row.selected { background: var(--cream); border-left-color: var(--merlot); }
.queue-row-content {
  display: flex; gap: 10px;
  padding: 11px 14px 11px 15px;
  transform: translateX(0);
  transition: transform 180ms cubic-bezier(.2,.7,.3,1);
}
.queue-row.revealed .queue-row-content { transform: translateX(-10px); }
.queue-row-remove {
  position: absolute; top: 0; right: 0; bottom: 0; width: 78px;
  background: var(--merlot);
  display: flex; align-items: center; justify-content: center;
  transform: translateX(100%);
  transition: transform 180ms cubic-bezier(.2,.7,.3,1);
  cursor: pointer;
}
/* box-shadow lives only on the revealed state — otherwise its blur still
   bleeds a few px past the panel's clipped edge even while translated
   fully off-screen, which read as a permanent smudge at the row's right
   edge. */
.queue-row.revealed .queue-row-remove { transform: translateX(0); box-shadow: -6px 0 12px rgba(33,21,16,.22); }
.queue-row-remove span { font: 700 9.5px var(--font-display); letter-spacing: .08em; color: var(--cream); }
.queue-row-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.queue-row-slug { font: 700 13.5px var(--font-body); color: var(--ink); }
.queue-row.selected .queue-row-slug { color: var(--merlot); }
.queue-row-slug.unlinked { color: var(--stone-500); font-weight: 500; }
.queue-row-meta {
  font: 400 11px var(--font-mono); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-row-status {
  font: 700 9px var(--font-display); letter-spacing: .09em;
  align-self: center; flex: none; text-align: right;
}
.queue-row-status.ready { color: var(--moss-green); }
.queue-row-status.warn { color: var(--copper); }
.queue-row-status.muted-status { color: var(--stone-500); opacity: .7; }
.queue-empty { padding: 16px 14px; font-size: 12px; color: var(--text-muted); }


/* ---------- workspace ---------- */

.workspace {
  grid-column: 2; grid-row: 1;
  padding: 22px 24px 26px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
  min-width: 0;
  min-height: 0;
}

.workspace-head { display: flex; align-items: flex-start; gap: 14px; }
.workspace-titles { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.workspace-titles h2 {
  margin: 0;
  font: 800 30px/1 var(--font-display);
  color: var(--merlot);
  text-transform: uppercase;
}
.badge-pill {
  display: inline-flex; align-items: center;
  font: 700 10px var(--font-display); letter-spacing: .06em; text-transform: uppercase;
  background: var(--stone-100); color: var(--stone-700);
  border-radius: 999px; padding: 3px 9px;
}

.tools-menu { position: relative; flex: none; }
.tools-btn {
  display: flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--merlot);
  border-radius: var(--radius-sm);
  background: none;
  padding: 9px 14px;
  font: 600 13px var(--font-display);
  color: var(--merlot);
  cursor: pointer;
}
.tools-btn:hover { background: var(--cream); }
.caret-sm { font-size: 9px; }
.tools-panel {
  position: absolute; right: 0; top: 42px; z-index: 30;
  width: 250px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  box-shadow: 0 12px 32px rgba(33, 21, 16, .16);
  display: flex; flex-direction: column;
  padding: 6px;
}
.tools-panel button {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  background: none; border: none; text-align: left;
  font: 500 13px var(--font-body); color: var(--ink);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tools-panel button:hover { background: var(--cream); }
.tools-divider { height: 1px; background: var(--stone-100); margin: 4px 2px; }
.count-badge {
  font: 700 10px var(--font-mono);
  color: var(--copper);
}

.workspace-subline { font: 400 12px var(--font-mono); color: var(--text-muted); margin-top: -10px; }

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-default);
}
.card-head .eyebrow { font-size: 10px; }
.card-head .spacer { flex: 1; }

.terms-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.terms-cell {
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 5px;
  border-left: 1px solid var(--stone-100);
  min-width: 0;
}
.terms-cell:first-child { border-left: none; }
.terms-label {
  font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}
.terms-value { font: 700 20px var(--font-display); color: var(--ink); }
.terms-value .unit { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.terms-value.text {
  font: 600 13px/1.35 var(--font-body); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.rules-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.rules-row { display: flex; align-items: baseline; gap: 9px; }
.rules-count { font: 700 15px var(--font-display); color: var(--ink); min-width: 20px; }
.rules-text { flex: 1; font: 400 12.5px/1.4 var(--font-body); color: var(--text-body); }
.hr { height: 1px; background: var(--stone-100); }

.workspace-footer {
  display: flex; align-items: center; gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-default);
  margin-top: auto;
}
.workspace-footer .muted { flex: 1; font-size: 12px; line-height: 1.5; }

/* ---------- run rail ---------- */

.run-rail {
  grid-column: 3; grid-row: 1;
  border-left: 1px solid var(--border-default);
  background: var(--surface-card);
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}
.run-rail-head { display: flex; align-items: center; }
.run-rail-meta { font: 700 9.5px var(--font-display); letter-spacing: .09em; color: var(--stone-700); }

.run-steps { display: flex; flex-direction: column; gap: 10px; }
.run-step { border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 12px 13px; display: flex; flex-direction: column; gap: 10px; }
.run-step.row-only { flex-direction: row; align-items: center; cursor: pointer; }
.run-step.row-only:hover { border-color: var(--copper); background: var(--stone-100); }
.run-step.done { background: var(--cream); }
.run-step.current { border: 1.5px solid var(--copper); }
.run-step.future { opacity: .62; }

/* Step 1 doubles as the drop zone while the queue is empty — the
   dedicated drop box in the step-0 strip was removed in favor of this,
   so it takes on the same dashed-border treatment. Once something is
   queued it reverts to a normal (done) step card. */
#run-step-1.as-dropzone.current {
  border: 1.5px dashed var(--stone-300);
  background: var(--cream);
}
#run-step-1.as-dropzone.current:hover,
#run-step-1.as-dropzone.current.drag-over {
  border-style: dashed;
  border-color: var(--copper);
  background: var(--stone-100);
}
.step-row { display: flex; gap: 11px; }
.step-dot {
  width: 20px; height: 20px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font: 700 11px var(--font-display);
  flex: none;
}
.run-step.done .step-dot { background: var(--moss-green); color: #fff; }
.run-step.current .step-dot { background: var(--copper); color: #fff; }
.run-step.future .step-dot { border: 1.5px solid var(--stone-300); color: var(--text-muted); }
.step-copy { display: flex; flex-direction: column; gap: 3px; }
.step-title { font: 700 13px var(--font-display); color: var(--ink); }
.step-desc { font: 400 11.5px/1.45 var(--font-body); color: var(--text-muted); }
.step-desc.running { color: var(--copper); }

.run-warnings { border-top: 1px solid var(--border-default); padding-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.run-warning { display: flex; gap: 8px; align-items: flex-start; }
.run-warning .bang { color: var(--copper); font: 700 12px var(--font-body); line-height: 1.5; }
.run-warning .txt { font: 400 11.5px/1.5 var(--font-body); color: var(--text-body); flex: 1; }
.warn-info { display: inline-block; margin-left: 4px; color: var(--stone-blue); cursor: help; font-size: 11px; }
.warn-info:hover { color: var(--copper); }
.run-warnings-empty { font: 400 11.5px/1.5 var(--font-body); color: var(--text-muted); }

.run-db-note {
  margin-top: auto;
  border: 1px solid var(--stone-blue);
  background: rgba(127, 155, 159, .14);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  font: 600 11.5px/1.5 var(--font-body);
  color: var(--midnight);
}
.run-db-note.production {
  border-color: var(--merlot);
  background: rgba(89, 23, 15, .1);
  color: var(--merlot);
}

/* ---------- progress: lives in exactly two places — the running step's
   card in the run rail, and this card in the workspace. Never a third. ---------- */

/* Easing sweep (handoff 8a): one 30%-wide band, easing along the SAME curve
   as the log drawer so the app has one motion signature, fading in/out at
   each end so the loop restart is never visible — no snap. */
@keyframes progress-sweep {
  0%   { transform: translateX(-100%); opacity: 0; }
  14%  { opacity: 1; }
  86%  { opacity: 1; }
  100% { transform: translateX(333%); opacity: 0; }
}

.step-progress, .progress-card-track {
  border-radius: 999px;
  background: var(--stone-100);
  overflow: hidden;
}
.step-progress { height: 6px; }
.progress-card-track { height: 8px; }

.step-progress-bar, .progress-card-bar {
  height: 100%;
  background: var(--copper);
  border-radius: 999px;
  width: 30%;
  /* Determinate updates arrive in backend-side chunks, not smoothly — this
     glides the fill into each new value instead of stepping visibly. */
  transition: width 400ms cubic-bezier(.4, 0, .2, 1);
}
.step-progress-bar.indeterminate, .progress-card-bar.indeterminate {
  width: 30%;
  transition: none;
  animation: progress-sweep 1.5s cubic-bezier(.65, 0, .35, 1) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .step-progress-bar.indeterminate, .progress-card-bar.indeterminate {
    animation: none;
    opacity: .6;
  }
}

.progress-title-sep { height: 1px; background: var(--stone-300); }
.progress-card { border: 1.5px solid var(--copper); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.progress-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.progress-card-head .eyebrow { font-size: 10px; }
.progress-card-count { font: 700 15px var(--font-mono); color: var(--ink); }
.progress-card-note { font: 400 11.5px/1.5 var(--font-body); color: var(--text-muted); }

/* ---------- workbook link (handoff 9a/9c): lives in step 2's done state
   and at the top of Tools — never in the workspace. ---------- */

.step2-workbook {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px;
  border-top: 1px solid var(--stone-300);
  margin: 0 -13px -12px;
}
.step2-workbook .fname {
  font: 400 11px var(--font-mono); color: var(--text-muted); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step2-workbook button {
  background: none; border: none; padding: 0; cursor: pointer;
  font: 600 11.5px var(--font-body); color: var(--copper); flex: none;
}
.step2-workbook .resync { font-weight: 500; color: var(--text-muted); }
.step2-workbook .sep { color: var(--stone-300); font-size: 10px; }

.tools-panel .tp-date { font: 400 10.5px var(--font-mono); color: var(--text-muted); }

/* ---------- log drawer ---------- */

.log-drawer {
  position: relative;
  height: 38px;
  background: var(--midnight);
  flex: none;
}
.log-lines-wrap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  overflow: hidden;
  background: var(--midnight);
  display: flex; flex-direction: column; justify-content: flex-end;
  transition: height 210ms cubic-bezier(.65, 0, .35, 1);
  height: 38px;
}
.log-drawer.open .log-lines-wrap { height: 262px; }
.log-lines {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 14px 18px 46px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 3px;
  font: 400 11.5px/1.6 var(--font-mono);
  color: rgba(247, 243, 238, .55);
  user-select: text;
}
.log-drawer-head {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px; height: 38px;
  border-top: 1px solid rgba(247, 243, 238, .12);
  cursor: pointer;
}
.log-drawer-head .eyebrow {
  font: 700 9.5px var(--font-display); letter-spacing: .13em;
  color: var(--stone-blue);
}
.log-drawer-head .last-line {
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 11.5px var(--font-mono);
  color: rgba(247, 243, 238, .72);
}
.log-hint { font: 400 10px var(--font-body); color: rgba(247, 243, 238, .4); }
#log-toggle-caret { font: 400 11px var(--font-body); color: rgba(247, 243, 238, .5); }

/* ============================================================ generic form controls */

label.field-label {
  display: block;
  font-size: 11px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 3px;
}

input[type="text"], input[type="number"], input[type="password"],
input[type="search"], select, textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 2px rgba(135, 60, 30, .15);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.form-grid .span2 { grid-column: 1 / -1; }
.field { margin-bottom: 8px; }
.hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tier-info { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---------- generic buttons (used inside modals) ---------- */

button {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s ease, opacity .12s ease;
}

button.primary {
  background: var(--merlot);
  color: var(--cream);
  width: 100%;
  padding: 11px 14px;
}
button.primary:hover { background: #6f1d13; }

button.quiet {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--border-default);
}
button.quiet:hover { background: var(--cream); }

button.danger { background: var(--merlot); color: var(--cream); }
button.danger:hover { background: #430f09; }

button:disabled {
  background: var(--stone-100) !important;
  color: var(--stone-500) !important;
  border-color: var(--stone-100) !important;
  cursor: not-allowed;
}

button.icon-btn { padding: 6px 9px; font-size: 12px; }

button.link-btn, a.link-btn {
  background: none;
  color: var(--copper);
  padding: 2px 4px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--stone-300);
  border-radius: 0;
}
button.link-btn:hover, a.link-btn:hover { color: var(--merlot); border-color: var(--merlot); }
.link-btn.merlot { color: var(--merlot); font-size: 12.5px; }

.btn-row { display: flex; gap: 6px; }
.btn-row button { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }

/* ============================================================ modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.wide { max-width: 960px; }

.modal-head {
  padding: 14px 18px;
  background: var(--midnight);
  color: var(--cream);
  font: 800 15px var(--font-display);
  display: flex;
  align-items: center;
}

.modal-head.destructive { background: var(--merlot); }
.modal-head .modal-head-pill {
  font: 700 10px var(--font-display); letter-spacing: .1em;
  color: var(--midnight); background: var(--stone-blue);
  padding: 4px 9px; border-radius: 999px;
  margin-left: auto;
}
.modal-head .modal-head-pill.production { color: var(--cream); background: var(--midnight); }

.runconfirm-lead { margin: 0 0 14px; font: 600 14px/1.5 var(--font-body); color: var(--ink); }

.preflight-card { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 14px; }
.preflight-row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stone-100);
  background: var(--surface-card);
}
.preflight-row:last-child { border-bottom: none; }
.preflight-row .n { font: 700 15px var(--font-mono); color: var(--ink); width: 52px; text-align: right; flex: none; }
.preflight-row.muted-row .n, .preflight-row.muted-row .txt { color: var(--text-muted); }
.preflight-row .txt { flex: 1; font: 400 12.5px/1.45 var(--font-body); color: var(--text-body); }
.preflight-row .txt code { font: 400 11.5px var(--font-mono); }

.warn-card {
  border: 1px solid var(--copper); background: rgba(135, 60, 30, .1);
  border-radius: var(--radius-md); padding: 13px 14px;
  display: flex; gap: 10px; margin-bottom: 14px;
}
.warn-card .bang { color: var(--copper); font: 700 13px var(--font-body); line-height: 1.4; flex: none; }
.warn-card .body { display: flex; flex-direction: column; gap: 3px; }
.warn-card .head { font: 700 12.5px var(--font-body); color: var(--ink); }
.warn-card .line { font: 400 12px/1.5 var(--font-body); color: var(--text-body); }

.db-target-card {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--stone-blue); background: rgba(127, 155, 159, .14);
  border-radius: var(--radius-md); padding: 12px 14px;
  margin-bottom: 12px;
}
.db-target-card.production { border-color: var(--merlot); background: rgba(89, 23, 15, .1); }
.db-target-card .info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.db-target-card .eyebrow { font-size: 9.5px; color: var(--midnight); }
.db-target-card.production .eyebrow { color: var(--merlot); }
.db-target-card .val { font: 600 12.5px var(--font-mono); color: var(--midnight); }
.db-target-card.production .val { color: var(--merlot); }

.modal-head .x {
  margin-left: auto;
  cursor: pointer;
  color: var(--stone-blue);
  font-size: 18px;
  line-height: 1;
  background: none;
  border: none;
  padding: 4px;
}

.modal-note {
  background: var(--cream);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- New Vendor modal (14b) ---------- */

.nv-body { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.nv-intro { margin: 0; font: 400 12.5px/1.55 var(--font-body); color: var(--text-muted); }
.nv-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nv-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.nv-field .flabel { font: 600 11.5px var(--font-body); color: var(--ink); }
.nv-field .fhint { font: 400 10.5px var(--font-body); color: var(--text-muted); }
.nv-field .fhint.ok { color: var(--moss-green); }
.nv-box {
  border: 1.5px solid var(--border-default); border-radius: 4px;
  padding: 8px 10px; background: #fff;
  display: flex; align-items: center; gap: 8px;
}
.nv-box.copper { border-color: var(--copper); }
.nv-box input {
  border: none; outline: none; background: none; flex: 1; min-width: 0;
  font: 400 12.5px var(--font-mono); color: var(--ink); padding: 0; width: 100%;
}
.nv-box .show-btn { font: 600 10px var(--font-display); letter-spacing: .06em; color: var(--copper); background: none; border: none; cursor: pointer; flex: none; padding: 0; }

.nv-divider { height: 1px; background: var(--border-default); flex: none; }
.nv-eyebrow { font: 700 9.5px var(--font-display); letter-spacing: .09em; color: var(--stone-700); }

.nv-terms-row { display: grid; grid-template-columns: 96px 96px 96px 1fr; gap: 12px; }
.nv-unit-box { display: flex; align-items: center; border: 1.5px solid var(--border-default); border-radius: 4px; background: #fff; }
.nv-unit-box input {
  border: none; outline: none; background: none; font: 700 14px var(--font-display); color: var(--ink);
  padding: 7px 0 7px 10px; flex: 1; width: 0; min-width: 0;
}
.nv-unit-box .unit { font: 400 11.5px var(--font-body); color: var(--text-muted); padding-right: 9px; flex: none; }
.nv-terms-row .dd-combo .dd-combo-trigger { height: 33px; }

.nv-status-row { display: flex; align-items: center; gap: 12px; }
.nv-status-seg { display: flex; border: 1px solid var(--border-default); border-radius: 4px; overflow: hidden; flex: none; }
.nv-status-seg span {
  font: 600 10.5px var(--font-display); letter-spacing: .04em; padding: 7px 11px;
  color: var(--text-muted); cursor: pointer; border-left: 1px solid var(--border-default);
}
.nv-status-seg span:first-child { border-left: none; }
.nv-status-seg span.confirmed.sel { background: var(--moss-green); color: #fff; }
.nv-status-seg span.tentative.sel { background: var(--gold); color: var(--cafe-noir); }
.nv-status-seg span.assumed.sel { background: var(--copper); color: var(--cream); }
.nv-status-seg span.placeholder.sel { background: var(--merlot); color: var(--cream); }

.nv-portal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nv-portal-grid .nv-field.span2 { grid-column: 1 / -1; }

.nv-foot { background: var(--cream); padding: 13px 20px; }
.nv-foot .txt { flex: 1; font: 400 11.5px var(--font-body); color: var(--text-muted); }

/* ---------- info / blocked dialogs (handoff 7a/7b): a dialog that changes
   nothing never gets a merlot fill or a Cancel — merlot stays reserved for
   the one destructive confirm (4c). Two variants only. ---------- */

.rich-dialog-head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 20px;
  border-bottom: 1px solid;
}
.rich-dialog-head.info { background: rgba(127, 155, 159, .16); border-color: var(--stone-blue); }
.rich-dialog-head.blocked { background: rgba(135, 60, 30, .10); border-color: var(--copper); }
.rich-dialog-glyph {
  width: 20px; height: 20px; border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font: 700 11px var(--font-display); color: #fff;
}
.rich-dialog-head.info .rich-dialog-glyph { background: var(--stone-blue); color: var(--midnight); }
.rich-dialog-head.blocked .rich-dialog-glyph { background: var(--copper); }
.rich-dialog-head h3 { margin: 0; font: 800 14px var(--font-display); letter-spacing: .04em; flex: 1; }
.rich-dialog-head.info h3 { color: var(--midnight); }
.rich-dialog-head.blocked h3 { color: var(--ink); }
.rich-dialog-head .x { color: var(--text-muted); }

.rich-dialog-body { margin: 0; font: 400 13.5px/1.6 var(--font-body); color: var(--ink); }

.rich-subcard {
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--cream); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px;
}
.rich-subcard .row { display: flex; align-items: center; gap: 10px; }
.rich-subcard .dot {
  width: 18px; height: 18px; border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font: 700 10px var(--font-display); box-sizing: border-box;
}
.rich-subcard .dot.done { background: var(--moss-green); color: #fff; }
.rich-subcard .dot.pending { border: 1.5px solid var(--copper); color: var(--copper); }
.rich-subcard .rule { height: 1px; background: var(--stone-300); }
.rich-subcard .tag { font: 700 9.5px var(--font-display); letter-spacing: .09em; color: var(--copper); flex: none; }
.rich-subcard .label { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.rich-subcard .line { font: 400 12px/1.5 var(--font-body); color: var(--ink); }
.rich-dialog-foot-note { font: 400 11.5px/1.5 var(--font-body); color: var(--text-muted); margin-top: 10px; display: block; }

/* ---------- pricing status (handoff 10/10b/11): a vendor-level segmented
   control, plus an optional per-rule override that always wins. ---------- */

.status-card {
  border: 1px solid var(--stone-300); border-radius: var(--radius-md);
  background: var(--cream); padding: 13px 15px 15px;
  display: flex; flex-direction: column; gap: 10px;
}
.status-segmented {
  display: flex; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  overflow: hidden; width: fit-content; background: #fff;
}
.status-segment {
  flex: none; white-space: nowrap; cursor: pointer;
  font: 600 12.5px var(--font-body); color: var(--ink);
  padding: 9px 16px;
  border-right: 1px solid var(--border-default);
}
.status-segment:last-child { border-right: none; }
.status-segment.not-set { color: var(--stone-500); }
.status-segment.sel { background: var(--merlot); color: var(--cream); border-right-color: var(--merlot); }
.status-segment.confirmed.sel { background: var(--moss-green); color: #fff; border-right-color: var(--moss-green); }
.status-segment.tentative.sel { background: var(--gold); color: var(--cafe-noir); border-right-color: var(--gold); }
.status-segment.assumed.sel { background: var(--copper); color: var(--cream); border-right-color: var(--copper); }
.status-segment.placeholder.sel { background: var(--merlot); color: var(--cream); border-right-color: var(--merlot); }
.status-segment.not-set.sel { background: var(--stone-700); color: var(--cream); border-right-color: var(--stone-700); }
.status-hint-line { font: 400 11.5px/1.45 var(--font-body); color: var(--ink); }
.status-hint-line em { color: var(--copper); font-style: normal; font-weight: 600; }

.mr-table { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.mr-row {
  display: grid; grid-template-columns: 1fr 84px 1fr 56px 64px 150px; gap: 10px;
  padding: 11px 14px; align-items: center;
  border-bottom: 1px solid var(--stone-100);
}
.mr-row:last-child { border-bottom: none; }
.mr-row.head { background: var(--stone-100); border-bottom: 1px solid var(--border-default); padding: 9px 14px; }
.mr-row.head span { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--stone-700); }
.mr-row.selected { background: var(--cream); }
.mr-row .num { text-align: right; font: 600 12.5px var(--font-mono); color: var(--ink); }
.mr-row .num.base { font: 400 12px var(--font-body); color: var(--text-muted); font-family: var(--font-body); }
.mr-row .lbl { font: 600 13px var(--font-body); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-row .match { font: 400 12px var(--font-body); color: var(--text-muted); }
.mr-row .val { font: 400 12px var(--font-mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-eff { display: flex; align-items: center; gap: 7px; }
.eff-pill { font: 700 9.5px var(--font-display); letter-spacing: .08em; padding: 4px 8px; border-radius: 999px; }
.eff-pill.confirmed { color: #fff; background: var(--moss-green); }
.eff-pill.tentative { color: var(--cafe-noir); background: var(--gold); }
.eff-pill.assumed { color: var(--cream); background: var(--copper); }
.eff-pill.placeholder { color: var(--cream); background: var(--merlot); }
.eff-pill.not-set { color: var(--cream); background: var(--stone-700); }

/* Rules table's per-rule "Effective status" pill — a light tint, not the
   solid gradient fill used by the Vendors table's Status column (eff-pill
   above). Two different things: this is a contextual qualifier next to
   "on rule"/"from vendor"; that's a scannable per-vendor summary. Colors
   match turn 12a of the design handoff exactly. */
.rules-eff-pill { font: 700 9px var(--font-display); letter-spacing: .08em; padding: 4px 7px; border-radius: 999px; }
.rules-eff-pill.confirmed { color: var(--moss-green); background: rgba(93,110,73,.13); }
.rules-eff-pill.tentative { color: #4d6669; background: rgba(127,155,159,.16); }
.rules-eff-pill.assumed, .rules-eff-pill.placeholder { color: var(--copper); background: rgba(135,60,30,.10); }
.rules-eff-pill.not-set { color: var(--stone-700); background: var(--stone-100); }
.v-status-cell { display: flex; }
.eff-plain { font: 600 12px var(--font-body); color: var(--ink); }
.eff-plain.muted { color: var(--stone-500); font-weight: 500; }
.eff-qual { font: 400 10.5px var(--font-body); color: var(--text-muted); }

.mr-foot-divider { width: 1px; height: 22px; background: var(--stone-300); margin: 0 4px; }
.mr-updown {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  background: #fff; font: 400 13px var(--font-body); color: var(--ink); cursor: pointer;
}

/* ---------- run-blocked dialog (11a) ---------- */

.rb-table { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.rb-row {
  display: grid; grid-template-columns: 1fr 150px 92px; gap: 10px;
  padding: 11px 14px; align-items: center;
  border-bottom: 1px solid var(--stone-100);
}
.rb-row:last-child { border-bottom: none; }
.rb-row.head { background: var(--stone-100); border-bottom: 1px solid var(--border-default); padding: 9px 14px; }
.rb-row.head span { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--stone-700); }
.rb-row.blocked { background: rgba(135,60,30,.06); }
.rb-row .slug { font: 700 13px var(--font-mono); }
.rb-row.blocked .slug { color: var(--merlot); }
.rb-row .status-val { font: 600 12.5px var(--font-body); color: var(--ink); }
.rb-row .status-val .qual { font-weight: 400; color: var(--text-muted); }
.rb-not-set-pill {
  font: 700 9.5px var(--font-display); letter-spacing: .08em; color: #fff;
  background: var(--copper); padding: 4px 8px; border-radius: 999px; justify-self: start;
}
.rb-row .action { font: 600 12px var(--font-body); text-align: right; }
.rb-row.blocked .action { color: var(--copper); cursor: pointer; }
.rb-row:not(.blocked) .action { color: var(--text-muted); }

/* ---------- Database Connections modal (5b): radio cards, not a dropdown —
   arming production is a deliberate click, never a side effect. ---------- */

.db-card-list { display: flex; flex-direction: column; gap: 8px; }
.db-card {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 12px 13px; background: #fff; cursor: pointer;
}
.db-card .radio-dot {
  width: 14px; height: 14px; border-radius: 999px; flex: none; box-sizing: border-box;
  border: 1.5px solid var(--stone-300); background: #fff;
}
.db-card.active .radio-dot { border: 4px solid var(--copper); }
.db-card.prod .radio-dot { border: 1.5px solid var(--stone-300); }
.db-card .db-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.db-card .db-name { font: 700 13px var(--font-body); color: var(--ink); }
.db-card .db-desc {
  font: 400 11px var(--font-mono); color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-card .db-pill { font: 700 9.5px var(--font-display); letter-spacing: .09em; padding: 4px 9px; border-radius: 999px; flex: none; }
.db-card .db-pill.test { background: var(--stone-blue); color: var(--midnight); }
.db-card .db-pill.prod-pill { background: var(--merlot); color: var(--cream); }
.db-card .db-pill.plain { background: none; color: var(--stone-700); padding-right: 0; }
.db-card.active { border: 1.5px solid var(--copper); background: var(--cream); }
.db-card.prod { border: 1.5px solid var(--merlot); }
.db-card.prod .db-name { color: var(--merlot); }
.db-card.selected:not(.active) { background: var(--cream); }

.db-field-grid { display: grid; grid-template-columns: 128px 1fr; gap: 9px; align-items: center; }
.db-field-grid label { font: 400 12px var(--font-body); color: var(--text-muted); }
.db-field-grid input {
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 9px 11px; font: 400 12px var(--font-mono); color: var(--ink); background: #fff; width: 100%;
}
.pw-row { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm); padding: 0 11px; background: #fff; }
.pw-row input { border: none; padding: 9px 0; flex: 1; min-width: 0; font: 400 12px var(--font-mono); color: var(--ink); }
.pw-row button { background: none; border: none; padding: 0; font: 600 11px var(--font-body); color: var(--copper); cursor: pointer; flex: none; }

.db-test-row {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--stone-blue); background: rgba(127,155,159,.14);
  border-radius: var(--radius-md); padding: 10px 12px;
}
.db-test-row .glyph { color: var(--midnight); font: 700 12px var(--font-body); flex: none; }
.db-test-row .txt { font: 400 11.5px/1.45 var(--font-body); color: var(--midnight); flex: 1; }
.db-test-row button {
  background: none; border: none; padding: 0; flex: none;
  font: 600 11.5px var(--font-body); color: var(--midnight);
  border-bottom: 1px solid rgba(7,40,49,.35); cursor: pointer;
}
.db-test-row button:disabled { opacity: .6; cursor: default; }

/* ---------- push ledger + failed/complete dialogs (3b/5c/6a) ---------- */

.pl-row {
  display: grid; grid-template-columns: 1fr 70px 70px 110px;
  align-items: center; padding: 9px 14px;
  border-bottom: 1px solid var(--stone-100);
  font: 400 12.5px var(--font-body); color: var(--ink);
}
.pl-row:last-child { border-bottom: none; }
.pl-row-bad { background: rgba(89, 23, 15, .05); }
.pl-brand { font: 700 13px var(--font-mono); color: var(--ink); }
.pl-count { text-align: right; font: 600 13px var(--font-mono); color: var(--ink); }
.pl-of { font: 400 11px var(--font-mono); color: var(--text-muted); padding-left: 2px; }
.pl-status { font: 700 9.5px var(--font-display); letter-spacing: .06em; text-align: right; }
.pl-status.done { color: var(--moss-green); }
.pl-status.failed, .pl-status.stopped, .pl-status.failed-extract { color: var(--merlot); }
.pl-status.skipped { color: var(--text-muted); }

.pf-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.pf-action {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: #fff; padding: 11px 13px; cursor: pointer;
}
.pf-action:hover { background: var(--cream); }
.pf-action-primary { border: 1.5px solid var(--copper); background: var(--cream); }
.pf-action-danger { border-color: var(--merlot); }
.pf-action-title { font: 700 12.5px var(--font-display); color: var(--ink); }
.pf-action-desc { font: 400 11.5px/1.45 var(--font-body); color: var(--text-muted); }

/* ---------- step 0 strip locked during a real push ---------- */
.step0-strip.locked { opacity: .45; pointer-events: none; }

.ghost-stop {
  width: 100%; background: none; border: none;
  font: 600 11.5px var(--font-body); color: var(--text-muted);
  padding: 6px; cursor: pointer; text-align: center;
}
.ghost-stop:hover { color: var(--merlot); }

/* ---------- Vendors screen (5a) — replaces the queue/workspace/run-rail
   grid entirely (not a modal): portal access and terms in one expandable
   row, since they're set in the same sitting. ---------- */

.vendors-view {
  grid-column: 2; grid-row: 1;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface-page);
  overflow: hidden;
}
.vendors-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  padding: 22px 24px; background: var(--surface-page);
  flex: none;
}
.vendors-head-titles { flex: 0 1 auto; display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.vendors-head-titles h2 { margin: 0; font: 800 24px/1.1 var(--font-display); color: var(--merlot); text-transform: uppercase; }
.vendors-head-titles p { margin: 0; font: italic 400 13.5px/1.55 var(--font-body); color: var(--ink); }
.vendors-head-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.vendors-filter {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 9px 12px; background: #fff; width: 220px; flex: none;
}
.vendors-filter input { border: none; outline: none; flex: 1; min-width: 0; font: 400 13px var(--font-body); color: var(--ink); }

.vendors-body { padding: 0 24px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; background: var(--surface-page); }
.vendors-table { background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.v-row {
  display: grid; grid-template-columns: 150px 1fr 172px 70px 74px 66px 108px 88px; gap: 12px;
  padding: 13px 16px; align-items: center;
  border-bottom: 1px solid var(--stone-100);
  cursor: pointer;
}
.v-row.head {
  background: var(--stone-100); border-bottom: 1px solid var(--border-default);
  padding: 10px 16px; cursor: default;
}
.v-row.head span { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--stone-700); }
.v-row.expanded { background: var(--cream); border-bottom: 1px solid var(--border-default); }
.v-row .slug { font: 700 13.5px var(--font-mono); color: var(--ink); }
.v-row.expanded .slug, .v-row .slug.linked { color: var(--merlot); }
.v-row .portal-cell { font: 400 11.5px var(--font-mono); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-row .portal-cell.add { font: 600 11.5px var(--font-body); color: var(--copper); font-family: var(--font-body); }
.v-row .supplier-cell { font: 400 12.5px var(--font-body); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-row .num-cell { font: 600 13px var(--font-body); color: var(--ink); text-align: right; }
.v-row .row-action { font: 600 12px var(--font-body); text-align: right; }
.v-row .row-action.edit { color: var(--copper); }
.v-row .row-action.close { color: var(--merlot); }

.v-expand-body { background: var(--cream); border-bottom: 1px solid var(--border-default); padding: 16px 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.v-col { display: flex; flex-direction: column; gap: 11px; }
.v-field-grid { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; }
.v-field-grid label { font: 400 12px var(--font-body); color: var(--text-muted); }
.v-field-grid .box {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 8px 10px; background: #fff;
}
.v-field-grid .box.notes { align-self: start; min-height: 42px; align-items: flex-start; }
.v-field-grid input, .v-field-grid select, .v-field-grid textarea {
  border: none; outline: none; width: 100%; font: 500 12.5px var(--font-body); color: var(--ink); background: none;
  font-family: inherit; resize: vertical;
}
.v-field-grid input.mono, .v-field-grid textarea.mono { font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
.v-field-grid .dd-combo .dd-combo-trigger { height: 34px; }
.v-field-grid .in-odoo { font: 700 9px var(--font-display); letter-spacing: .08em; color: var(--moss-green); flex: none; }
.v-field-grid .pw-show { font: 600 11px var(--font-body); color: var(--copper); flex: none; background: none; border: none; cursor: pointer; padding: 0; }

.v-numerics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.v-numerics .field { display: flex; flex-direction: column; gap: 5px; }
.v-numerics label { font: 400 12px var(--font-body); color: var(--text-muted); }
.v-numerics .box { display: flex; align-items: center; gap: 4px; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm); padding: 8px 10px; background: #fff; }
.v-numerics input { border: none; outline: none; width: 100%; font: 600 12.5px var(--font-mono); color: var(--ink); }
.v-numerics .unit { font: 400 11.5px var(--font-body); color: var(--text-muted); flex: none; }

.v-rules-line { display: flex; align-items: baseline; gap: 9px; border-top: 1px solid var(--stone-300); padding-top: 10px; }
.v-rules-line .n { font: 700 14px var(--font-display); color: var(--ink); }
.v-rules-line .txt { flex: 1; font: 400 12.5px/1.4 var(--font-body); color: var(--ink); }

.v-portal-note {
  display: flex; align-items: flex-start; gap: 9px;
  border: 1px solid var(--stone-blue); background: rgba(127,155,159,.14);
  border-radius: 5px; padding: 9px 11px;
}
.v-portal-note .glyph { color: var(--midnight); font: 700 12px var(--font-body); flex: none; line-height: 1.4; }
.v-portal-note .txt { font: 400 11.5px/1.45 var(--font-body); color: var(--midnight); }

.v-expand-foot { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; margin-top: -4px; }
.v-expand-foot .txt { flex: 1; font: 400 11.5px/1.45 var(--font-body); color: var(--text-muted); }

.vendors-table-foot {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 10px 24px; background: var(--surface-page);
  border-top: 1px solid var(--border-default);
}
.vendors-table-foot .txt { flex: 1; font: 400 12px var(--font-body); color: var(--text-muted); }
.vendors-table-foot button { background: none; border: none; padding: 0; font: 600 12px var(--font-body); color: var(--copper); cursor: pointer; }

.modal-body { padding: 14px 18px; overflow-y: auto; flex: 1 1 auto; font: 400 13.5px/1.6 var(--font-body); color: var(--ink); }

/* ---------- Rules page (12) — margin + category rules, replaces both
   modals. Same center-column-swap shell as Vendors. ---------- */

.rules-view {
  grid-column: 2; grid-row: 1;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface-page);
  overflow: hidden;
}
#rules-tab-toggle.seg-toggle .seg-opt.active { background: var(--merlot); color: var(--cream); }

.rules-scope-bar {
  display: flex; align-items: center; gap: 12px; flex: none;
  margin: 0 24px 0; padding: 11px 14px;
  background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-md);
}
.rules-scope-bar .field-label { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); flex: none; white-space: nowrap; }
.rules-scope-bar .dd-combo { width: 168px; flex: none; }
.rules-scope-bar .dd-combo .dd-combo-trigger { height: 32px; }
.rules-scope-bar .base-rate { font: 400 11.5px var(--font-body); color: var(--text-muted); flex: none; white-space: nowrap; }
.rules-scope-bar .spacer { flex: 1 1 auto; min-width: 8px; }
.rules-scope-bar .status-readout { font: 600 12.5px var(--font-body); color: var(--ink); flex: none; white-space: nowrap; }
.rules-scope-bar .change-link { font: 600 11.5px var(--font-body); color: var(--copper); text-decoration: none; cursor: pointer; flex: none; white-space: nowrap; }
.rules-scope-bar .change-link:hover { color: var(--merlot); }
.rules-scope-bar .shared-pill {
  font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase;
  background: var(--stone-blue); color: var(--midnight); padding: 4px 9px; border-radius: 999px; flex: none;
}
.rules-scope-bar .shared-line { font: 400 12.5px/1.5 var(--font-body); color: var(--ink); flex: 1; }
.rules-scope-bar input#rules-cat-filter { border: 1.5px solid var(--border-default); border-radius: var(--radius-sm); padding: 7px 10px; font: 400 13px var(--font-body); width: 180px; flex: none; }

.rules-lead { margin: 14px 24px; font: 400 12.5px/1.55 var(--font-body); color: var(--ink); }

#rules-view .vendors-head-titles h2 { font: 800 26px/1 var(--font-display); text-transform: uppercase; }
#rules-view .vendors-head-titles p { font: 400 12px var(--font-body); font-style: normal; color: var(--text-muted); }

.cr-table { background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.cr-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 12px 16px; align-items: center;
  border-bottom: 1px solid var(--stone-100);
  cursor: pointer;
}
.cr-row:last-child { border-bottom: none; }
.cr-row.head { background: var(--stone-100); border-bottom: 1px solid var(--border-default); padding: 9px 16px; cursor: default; }
.cr-row.head span { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--stone-700); }
.cr-row.selected { background: var(--cream); }
.cr-row .kw { font: 400 12.5px var(--font-mono); color: var(--ink); }
.cr-row .cat { font: 600 13px var(--font-body); color: var(--ink); }

.rules-unmatched-card {
  margin-top: 14px; padding: 12px 15px;
  background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.rules-unmatched-card .field-label { font: 700 9.5px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--stone-700); flex: none; }
.rules-unmatched-card .dd-combo { width: 200px; flex: none; }
.rules-unmatched-card .dd-combo .dd-combo-trigger { height: 32px; }
.rules-unmatched-card .hint { font: 400 12px/1.5 var(--font-body); color: var(--text-muted); flex: 1; min-width: 200px; }

.rules-foot {
  display: flex; align-items: center; gap: 6px; flex: none;
  padding: 10px 24px; background: var(--surface-page);
  border-top: 1px solid var(--border-default);
  transition: background 120ms ease, border-color 120ms ease;
}
.rules-foot.dirty { background: rgba(135,60,30,.08); border-top: 1.5px solid var(--copper); }
.rules-dirty-text { font: 400 12px var(--font-body); color: var(--text-muted); }
.rules-foot.dirty .rules-dirty-text { color: var(--copper); font-weight: 600; }

/* ---------- History page (13) — replaces the Restore Previous Prices
   modal. One row per push, grouped by run. ---------- */

.history-view {
  grid-column: 2; grid-row: 1;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface-page);
  overflow: hidden;
}
.history-filter-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; }
.history-filter-bar #hist-vendor-filter.dd-combo { width: 150px; }
.history-filter-bar #hist-vendor-filter .dd-combo-trigger { height: 34px; }
#hist-db-toggle .seg-opt { padding: 8px 12px; font: 600 11.5px var(--font-body); letter-spacing: 0; text-transform: none; }
#hist-db-toggle .seg-opt.active { background: var(--merlot); color: var(--cream); }

#history-view .vendors-head-titles h2 { font: 800 26px/1 var(--font-display); text-transform: uppercase; }
#history-view .vendors-head-titles p { font: 400 12px var(--font-body); font-style: normal; color: var(--text-muted); }

.hist-row {
  display: grid; grid-template-columns: 172px 92px 1fr 92px 118px 22px; gap: 10px;
  padding: 11px 14px; align-items: center;
  border-bottom: 1px solid var(--stone-100);
  cursor: pointer;
}
.hist-row.head { cursor: default; }
.hist-row .run { font: 600 12.5px var(--font-mono); color: var(--ink); }
.hist-row .db-pill { font: 700 9px var(--font-display); letter-spacing: .08em; padding: 4px 7px; border-radius: 999px; flex: none; width: fit-content; }
.hist-row .db-pill.test { background: var(--stone-blue); color: var(--midnight); }
.hist-row .db-pill.production { background: var(--merlot); color: var(--cream); }
.hist-row .brands { font: 400 12.5px var(--font-body); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row .products { text-align: right; font: 600 12.5px var(--font-mono); color: var(--ink); }
.hist-row .result { font: 700 9.5px var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.hist-row .result.complete { color: var(--moss-green); }
.hist-row .result.part-written { color: var(--copper); }
.hist-row .chevron { font: 400 11px var(--font-body); color: var(--stone-500); text-align: right; }
.hist-row.hist-row-warn { background: rgba(135,60,30,.05); }
.hist-row.expanded { background: var(--cream); border-left: 3px solid var(--merlot); padding-left: 11px; }
.hist-row.expanded .run { color: var(--merlot); }
.hist-row.expanded .chevron { color: var(--merlot); }

.hist-detail {
  padding: 0 14px 16px 14px; background: var(--cream);
  border-bottom: 1px solid var(--border-default);
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.hist-detail.hist-detail-single { grid-template-columns: 1fr; }
.hist-detail-right { display: flex; flex-direction: column; gap: 10px; }
.hist-detail .archive-card {
  background: var(--paper); border: 1px solid var(--border-default); border-radius: 5px;
  padding: 11px 13px; display: flex; flex-direction: column; gap: 7px;
}
.hist-detail .archive-card .field-label { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.hist-detail .archive-card .path { font: 400 11.5px var(--font-mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-detail .archive-card .links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hist-detail .archive-card .links a, .hist-detail .archive-card .links button { font: 600 12px var(--font-body); color: var(--copper); background: none; border: none; padding: 0; cursor: pointer; text-decoration: none; }
.hist-detail .archive-card .links a:hover, .hist-detail .archive-card .links button:hover { color: var(--merlot); }
.hist-detail .restore-note {
  font: 400 11.5px/1.5 var(--font-body); color: var(--midnight);
  background: rgba(127,155,159,.14); border: 1px solid var(--stone-blue); border-radius: 5px; padding: 11px 13px;
  display: flex; flex-direction: column; gap: 9px;
}
.hist-detail .restore-actions { display: flex; align-items: center; gap: 8px; }

.hist-brand-table { background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.hist-brand-row { display: grid; grid-template-columns: 1fr 74px 96px; gap: 10px; padding: 9px 12px; align-items: center; border-bottom: 1px solid var(--stone-100); font: 400 12.5px var(--font-body); color: var(--ink); }
.hist-brand-row:last-child { border-bottom: none; }
.hist-brand-row.head { background: var(--stone-100); border-bottom: 1px solid var(--border-default); }
.hist-brand-row.head span { font: 700 9.5px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--stone-700); }
.hist-brand-row .b-name { font: 700 12.5px var(--font-mono); color: var(--ink); }
.hist-brand-row .b-written { text-align: right; font: 600 12.5px var(--font-mono); }
.hist-brand-row .b-pricing { font: 600 11.5px var(--font-body); text-align: right; text-transform: uppercase; letter-spacing: .02em; }
.hist-brand-row .b-pricing.confirmed { color: var(--moss-green); }
.hist-brand-row .b-pricing.tentative, .hist-brand-row .b-pricing.assumed { color: var(--copper); }
.hist-brand-row .b-pricing.placeholder { color: var(--merlot); }
.hist-brand-row .b-pricing.not-set { color: var(--stone-500); }

/* ---------- Add Pricelist modal (4b) ---------- */

.ap-head {
  display: flex; align-items: center; gap: 12px;
}
.ap-head h3 { margin: 0; font: 800 15px var(--font-display); letter-spacing: .04em; color: var(--cream); }
.ap-head .ap-filename {
  font: 400 12px var(--font-mono); color: rgba(247,243,238,.55);
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ap-body { display: grid; grid-template-columns: 1fr 300px; overflow-y: auto; flex: 1 1 auto; }
.ap-left { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 15px; border-right: 1px solid var(--border-default); }
.ap-right { padding: 18px; display: flex; flex-direction: column; gap: 9px; background: var(--stone-100); }

.ap-field { display: flex; flex-direction: column; gap: 6px; }
.ap-label { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.ap-label .ap-optional { font-weight: 400; text-transform: none; letter-spacing: 0; }
.ap-hint { font: 400 11px/1.45 var(--font-body); color: var(--text-muted); }
.ap-hint code { font-family: var(--font-mono); }
.ap-hint.copper { color: var(--copper); }
.ap-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ap-row { display: flex; gap: 8px; }

.ap-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 9px 11px; background: #fff;
}
.ap-input-wrap.has-value { border-color: var(--copper); }
.ap-input-wrap input, .ap-mono-input {
  border: none; outline: none; padding: 0; flex: 1; min-width: 0;
  font: 600 13px var(--font-mono); color: var(--ink); background: none;
}
input.ap-mono-input {
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 9px 11px; background: #fff; width: 100%;
}
.ap-matched { font: 700 9px var(--font-display); letter-spacing: .08em; color: var(--moss-green); flex: none; }
.ap-newbtn {
  flex: none; background: none; border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font: 600 12px var(--font-body); padding: 9px 12px; cursor: pointer;
}
.ap-newbtn:hover { background: var(--cream); }

.ap-currency-row { display: flex; gap: 8px; }
.ap-currency-card {
  flex: 1; display: flex; align-items: center; gap: 9px;
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 10px 12px; background: #fff; cursor: pointer;
}
.ap-currency-card input { position: absolute; opacity: 0; pointer-events: none; }
.ap-currency-card .dot { width: 14px; height: 14px; border-radius: 999px; border: 1.5px solid var(--stone-300); background: #fff; flex: none; box-sizing: border-box; }
.ap-currency-card .cur-label { font: 600 13px var(--font-body); color: var(--text-muted); }
.ap-currency-card:has(input:checked) { border-color: var(--copper); background: var(--cream); }
.ap-currency-card:has(input:checked) .dot { border: 4px solid var(--copper); }
.ap-currency-card:has(input:checked) .cur-label { font-weight: 700; color: var(--ink); }

.ap-saved-as {
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--cream); padding: 11px 13px;
  display: flex; flex-direction: column; gap: 5px;
}
.ap-saved-name { font: 600 13.5px var(--font-mono); color: var(--merlot); word-break: break-all; }
.ap-saved-sub { font: 400 10.5px/1.5 var(--font-mono); color: var(--text-muted); }

.ap-preview-head { display: flex; align-items: baseline; gap: 8px; }
.ap-preview-head .ap-label { flex: 1; }
.ap-right .pdf-preview { flex: 1; min-height: 280px; }

.ap-foot { justify-content: flex-start; }
.ap-foot .muted { flex: 1; text-align: right; }

.modal-foot {
  padding: 12px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border-default);
}
.modal-foot button { width: auto; }

table.mini { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
table.mini thead th { text-align: left; padding: 6px 8px; background: var(--stone-100); font-size: 11px; }
table.mini tbody tr { border-bottom: 1px solid var(--stone-100); cursor: pointer; }
table.mini tbody tr.selected { background: var(--copper); color: var(--cream); }
table.mini td { padding: 6px 8px; }

.tooltip-bubble {
  position: fixed;
  z-index: 500;
  background: var(--midnight);
  color: var(--cream);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  max-width: 260px;
  box-shadow: var(--shadow-modal);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}
.tooltip-bubble.show { opacity: 1; transform: translateY(0); }

#toast-stack {
  position: fixed;
  right: 16px;
  bottom: 54px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 400;
}
.toast {
  background: var(--midnight);
  color: var(--cream);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-modal);
  font-size: 13px;
  max-width: 320px;
  border-left: 4px solid var(--copper);
}
.toast.error { border-left-color: var(--merlot); }
.toast.success { border-left-color: var(--changed); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.ok { background: #e9f5ee; color: var(--ok); }
.badge.err { background: #fbeaea; color: var(--err); }
.badge.new { background: #fff6e0; color: var(--new); }
.badge.changed { background: #e9f5ee; color: var(--changed); }
.badge.ignored { background: #eee; color: var(--ignored); }

.list-scroll { max-height: 46vh; overflow-y: auto; border: 1px solid var(--stone-100); border-radius: var(--radius-sm); }

.pdf-preview {
  background: #fff;
  border: 1px solid var(--stone-100);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
}
.filename-preview { text-align: center; color: var(--copper); font-weight: 800; padding: 8px 0; }
.two-col { display: flex; gap: 16px; flex-wrap: wrap; }
.two-col > div { flex: 1 1 260px; }

/* ---------- Resolve Unresolved SKUs modal (4a) ---------- */

.ru-head { display: flex; align-items: center; gap: 12px; }
.ru-head h3 { margin: 0; font: 800 15px var(--font-display); letter-spacing: .04em; color: var(--cream); }
.ru-head .count-pill { font: 700 10.5px var(--font-mono); background: var(--copper); color: #fff; }
.ru-head .ru-source { font: 400 12px var(--font-body); color: rgba(247,243,238,.55); flex: 1; }

.ru-body { padding: 16px 22px 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1 1 auto; }
.ru-intro { margin: 0; font: 400 12.5px/1.55 var(--font-body); color: var(--text-body); max-width: 760px; }

.ru-table-card { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.ru-row {
  display: grid; grid-template-columns: 34px 118px 152px 1fr 152px 92px; align-items: center;
  border-bottom: 1px solid var(--stone-100); background: var(--surface-card);
}
.ru-row > span { padding: 9px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ru-row.ru-head-row { background: var(--stone-100); border-bottom: 1px solid var(--border-default); }
.ru-row.ru-head-row > span { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--stone-700); white-space: normal; }
.ru-row.ru-warn { background: rgba(168, 143, 120, .09); }
.ru-cell-brand { font: 500 12px var(--font-body); color: var(--text-muted); }
.ru-cell-code { font: 600 12px var(--font-mono); color: var(--ink); }
.ru-cell-desc { font: 400 12px var(--font-body); color: var(--text-body); }
.ru-cell-proposed { font: 600 12px var(--font-mono); color: var(--ink); }
.ru-row.ru-warn .ru-cell-proposed { color: var(--copper); }
.ru-cell-status { font: 700 9.5px var(--font-display); letter-spacing: .08em; }
.ru-cell-status.yes { color: var(--moss-green); }
.ru-cell-status.no { color: var(--merlot); }
.ru-cell-status.ignore { color: var(--stone-700); }
.ru-more-row { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--cream); }
.ru-more-row .muted { flex: 1; font-size: 11.5px; }
.ru-more-row button { background: none; border: none; padding: 0; font: 600 11.5px var(--font-body); color: var(--copper); cursor: pointer; }

.tf-card { border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--cream); padding: 13px 14px; display: flex; flex-direction: column; gap: 10px; }
.tf-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.tf-field { display: flex; flex-direction: column; gap: 3px; flex: none; }
.tf-label { font: 700 9.5px var(--font-display); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); height: 16px; display: flex; align-items: center; }
.tf-hint { font: 400 10px var(--font-body); color: var(--text-muted); height: 13px; padding-left: 2px; }
select.tf-select, input.tf-input {
  display: block;
  border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 7px 10px; background: #fff; box-sizing: border-box;
  font: 600 12.5px var(--font-body); color: var(--ink);
}
select.tf-select { width: 150px; cursor: pointer; }
input.tf-input { width: 118px; font-family: var(--font-mono); }
input.tf-input.filled { border-color: var(--copper); }
.tf-field .dd-combo { width: 150px; }
.tf-field .dd-combo .dd-combo-trigger { height: 32px; }
.tf-also { flex: 1; font: 400 11px/1.45 var(--font-body); color: var(--text-muted); max-width: 230px; text-align: right; align-self: flex-start; padding-top: 8px; }
.tf-result { display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--stone-300); padding-top: 10px; }
.tf-result .dot { width: 16px; height: 16px; border-radius: 999px; background: var(--moss-green); color: #fff; font: 700 9.5px var(--font-display); display: flex; align-items: center; justify-content: center; flex: none; }
.tf-result .txt { font: 400 12.5px var(--font-body); color: var(--text-body); flex: 1; }

.ru-foot { flex-wrap: wrap; }
.ru-foot .sel-count { font: 400 12px var(--font-body); color: var(--text-muted); flex: none; white-space: nowrap; }
.ru-foot .tf-input { width: 148px; }
.ru-foot .ru-permanence { flex: 1; font: 400 11.5px/1.45 var(--font-body); color: var(--text-muted); max-width: 250px; text-align: right; }

/* ============================================================ responsive */

@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: 220px 1fr 280px; }
  .terms-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .queue-rail, .run-rail { border: none; border-bottom: 1px solid var(--border-default); }
  .step0-strip { grid-template-columns: 1fr; }
  .dropzone { width: 100%; grid-column: auto; }
  .terms-grid { grid-template-columns: repeat(2, 1fr); }
}
