/* Build S103: the Builder pages (/builders, server/routes/builders.js). Everything else comes from base.css and
   dashboard.css; this only adds what the Builder pages have and the client dashboard doesn't. Mobile first. */

.page-builders .dash-main .wrap { display: flex; flex-direction: column; gap: 20px; }
.bld-wide { max-width: 760px; }
.bld-hero { max-width: 760px; }

.bld-steps, .bld-list { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 10px; }
.bld-plans { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 12px; }
.bld-plan { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--ground-2); }
.bld-plan p { margin: 6px 0 0; }

.bld-meet { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.bld-meet > div { flex: 1 1 260px; min-width: 0; }
.bld-face { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }

.bld-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.bld-fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.bld-fieldset legend { font-weight: 700; padding: 0 6px; }
.bld-radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.bld-radio input { margin-top: 4px; flex: 0 0 auto; }

.bld-two { display: grid; grid-template-columns: 1fr; gap: 14px; }
.bld-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.bld-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bld-inline form { margin: 0; }

.bld-code { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; word-break: break-all; background: var(--ground-2);
  border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 10px; margin: 4px 0; }
span.bld-code { display: inline-block; padding: 2px 8px; }

.bld-problems { margin: 0; padding-left: 1.2em; color: var(--danger); display: flex; flex-direction: column; gap: 6px; }

.bld-clients, .bld-conns, .bld-money { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bld-client { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 16px; border-radius: var(--radius-sm); }
.bld-client-link { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.bld-client-link:hover .bld-client-business, .bld-client-link:focus-visible .bld-client-business { text-decoration: underline; }
.bld-client-business { font-weight: 800; font-size: 18px; }
.bld-client .dash-muted { color: var(--on-ink-muted); }
.bld-client-money { font-weight: 700; }
.bld-conn { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.bld-conn p { margin: 0; }
.bld-money li { display: grid; grid-template-columns: 1fr; gap: 2px; border-top: 1px solid var(--line-soft); padding-top: 8px; }

@media (min-width: 720px) {
  .bld-face { width: 168px; height: 168px; }
  .bld-plans, .bld-two { grid-template-columns: 1fr 1fr; }
  .bld-client { grid-template-columns: minmax(0, 2fr) auto minmax(0, 1fr); align-items: center; }
  .bld-client-money { text-align: right; }
  .bld-money li { grid-template-columns: 7rem minmax(0, 1fr) 6rem 5rem; gap: 10px; }
}

/* 9 Nov 2026: /builders is the workflow canvas (server/views/builder-canvas.html), styled by admin.css and workflow.css
   like the admin's editor, then trimmed here for the Builder (Matt: "top banner is chaos, takes up too much space"):
   one slim bar, the canvas filling the screen, a short popup, and messages as a toast that goes away. Everything is
   scoped to .bld-canvas-page, so the admin's page is unchanged. */

/* The bar, on one row: the mark, the three names, then the state, How it works, Sign in, Save and Share. */
.bld-canvas-page .bld-top { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px 18px; padding: 10px 20px; }
.bld-canvas-page .bld-logo { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--ink); text-decoration: none;
  font-weight: 800; font-size: 16px; font-stretch: 112%; }
.bld-canvas-page .bld-logo img { display: block; width: auto; height: 28px; }
.bld-canvas-page .bld-logo-word { padding-right: 16px; border-right: 1px solid var(--line); line-height: 28px; }
.bld-title { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.bld-title-in { font: inherit; font-weight: 600; font-size: 16px; line-height: 1.25; color: var(--ink); background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 5px 8px; width: 12ch; min-width: 3ch; max-width: 26ch; flex: 0 1 auto; text-overflow: ellipsis; }
.bld-title-in.bld-title-flow { font-weight: 800; }
.bld-title-in:hover { border-color: var(--line); }
.bld-title-in:focus { border-color: var(--ink); background: var(--paper); outline: none; }
.bld-title-in::placeholder { color: var(--muted); font-weight: 500; }
.bld-title-sep { color: var(--line); font-size: 18px; flex: none; }
/* Build S116: the AI employee in the bar is a button (face and name) that opens their popup. */
.bld-emp { display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 22ch; font: inherit; font-weight: 600; font-size: 16px; line-height: 1.25;
  color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; }
.bld-emp:hover { border-color: var(--line); }
.bld-emp:focus-visible { border-color: var(--ink); outline: none; }
.bld-emp-face { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.bld-emp-face[hidden] { display: none; }
.bld-emp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-emp-top { display: flex; align-items: center; gap: 18px; margin: 0 28px 14px 0; }
.bld-emp-big { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.bld-emp-big[hidden] { display: none; }
.bld-emp-id { flex: 1 1 auto; min-width: 0; display: grid; gap: 8px; }
.bld-emp-id .bld-dialog-h { margin: 0; }
.bld-faces-set { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.bld-emp-label { font-weight: 600; font-size: 14px; padding: 0; margin: 0 0 8px; }
.bld-faces { display: flex; flex-wrap: wrap; gap: 10px; }
.bld-face { padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; overflow: hidden; width: 56px; height: 56px; flex: none; }
.bld-face img { width: 100%; height: 100%; max-width: 100%; object-fit: cover; display: block; border-radius: 50%; }
.bld-face:hover { border-color: var(--line); }
.bld-face.is-on { border-color: var(--accent, #1D4ED8); }
.bld-face:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bld-upload-row { margin: 10px 0 0; }
.bld-price-row { display: flex; align-items: center; gap: 6px; max-width: 12rem; }
.bld-price-cur { font-weight: 700; }
.bld-price { flex: 1 1 auto; min-width: 0; }
@media (max-width: 560px) {
  .bld-emp { max-width: 12ch; padding-right: 6px; }
  .bld-emp-face { width: 22px; height: 22px; }
  .bld-emp-big { width: 72px; height: 72px; }
}
.bld-actions { display: flex; align-items: center; gap: 8px 16px; margin-left: auto; flex: none; }
.bld-canvas-page .bld-actions .btn { min-height: 40px; padding: 0 18px; font-size: 15px; }
.bld-canvas-page .bld-state { flex: none; margin: 0; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.bld-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.bld-state[data-state="saved"]::before { background: #1B7A3A; }
.bld-state:empty { display: none; }
.bld-link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.bld-link:hover, .bld-link:focus-visible { text-decoration: underline; text-underline-offset: 3px; color: var(--accent-dark); }
.bld-nav { display: contents; }
.bld-canvas-page #wf-save::after { content: none; }
.bld-short { display: none; }
.bld-canvas-page [hidden] { display: none !important; } /* hidden always wins on this page (the steps search, the Share popup) */

/* The canvas fills the screen under the bar; the steps list and the settings scroll on their own. */
@media (min-width: 961px) {
  .bld-canvas-page { overflow: hidden; }
  .bld-canvas-page #wf-app:not([hidden]) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  .bld-canvas-page .wf-main { flex: 1 1 auto; min-height: 0; grid-template-columns: 236px minmax(0, 1fr) 320px; }
  .bld-canvas-page .wf-palette, .bld-canvas-page .wf-panel { max-height: none; min-height: 0; }
  .bld-canvas-page .wf-canvas-wrap { min-height: 0; }
  .bld-canvas-page .wf-canvas { position: absolute; inset: 0; min-height: 0; height: 100%; }
  .bld-canvas-page .wf-outline { position: absolute; inset: 0; max-height: none; }
}
@media (min-width: 961px) and (max-width: 1239px) {
  .bld-canvas-page .wf-main { grid-template-columns: 200px minmax(0, 1fr) 280px; }
}

/* The steps to add: a search box, then tighter rows that show + on hover. */
.bld-canvas-page .wf-palette { padding: 12px; }
.bld-canvas-page .bld-find { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.bld-find-none { margin: 12px 2px 0; }
.bld-canvas-page .wf-palette-h { margin: 16px 2px 6px; font-size: 11px; }
.bld-canvas-page .wf-palette-group { gap: 4px; }
.bld-canvas-page .wf-palette-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; font-size: 14px; border-width: 1px; }
.bld-canvas-page .wf-palette-item::after { content: '+'; font-weight: 700; font-size: 16px; line-height: 1; color: var(--accent-dark); opacity: 0; }
.bld-canvas-page .wf-palette-item:hover, .bld-canvas-page .wf-palette-item:focus-visible { background: #FFF1EA; }
.bld-canvas-page .wf-palette-item:hover::after, .bld-canvas-page .wf-palette-item:focus-visible::after { opacity: 1; }

/* The canvas: a dot grid that moves with the steps, smaller tools. */
.bld-canvas-page .wf-canvas-tools { top: 12px; left: 12px; }
.bld-canvas-page .wf-canvas-tools .btn { min-height: 32px; padding: 0 12px; font-size: 13px; }
.bld-grid { fill: url(#bld-dots); pointer-events: none; }
#bld-dots circle { fill: #BDBFBA; }

/* The settings panel with nothing picked: how to build, in a few lines. */
.bld-canvas-page .wf-panel { padding: 16px 18px; }
.bld-tips-h { font-size: 17px; font-weight: 800; font-stretch: 112%; margin: 2px 0 2px; }
.bld-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 14px; color: var(--text-3); }
.bld-tips strong { color: var(--ink); }
.bld-tips kbd { font-family: var(--font-mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--ground-2); }

/* What's left to finish: only there when something is. */
.bld-canvas-page .wf-problems { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 8px 20px; }
.bld-canvas-page .wf-problems:has(#wf-problems-list:empty) { display: none; }
.bld-canvas-page .wf-problems .label { margin: 0; color: var(--danger); font-weight: 800; }
.bld-canvas-page .wf-problems ul { flex-direction: row; flex-wrap: wrap; gap: 2px 18px; margin: 0; max-height: 4.4em; overflow-y: auto; }
.bld-canvas-page .wf-problem { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(194, 65, 12, .35); }
/* Build S106b: what an n8n import says is worth a look comes after the musts, quieter, under its own heading. */
.bld-canvas-page .wf-problems .label:empty { display: none; }
.bld-canvas-page .wf-problems-soft { color: var(--text-3); font-weight: 800; }
.bld-canvas-page .wf-problems-break { flex-basis: 100%; height: 0; }
.bld-canvas-page .wf-problem.is-soft { color: var(--text-3); text-decoration-color: rgba(15, 30, 54, .2); }

/* Messages: a toast at the foot of the canvas, above the list (builder-canvas.js sets --toast-bottom), that goes
   away by itself (or on a click). */
.bld-canvas-page .wf-status { position: fixed; left: 50%; bottom: var(--toast-bottom, 24px); transform: translateX(-50%); z-index: 20; margin: 0; min-height: 0;
  width: max-content; max-width: min(560px, calc(100vw - 32px)); padding: 11px 18px; border-radius: 12px; background: var(--ink); color: var(--on-ink);
  font-size: 14px; font-weight: 600; line-height: 1.4; box-shadow: 0 10px 28px rgba(15, 30, 54, .28); cursor: pointer; }
.bld-canvas-page .wf-status:empty { display: none; }
.bld-canvas-page .wf-status.is-error { background: #FCE0DA; color: #8A1C12; }
.bld-canvas-page .bld-undo { margin-left: 4px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 800;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Build S106: an n8n file dragged over the page. */
.bld-canvas-page .wf-canvas-wrap { position: relative; }
.bld-canvas-page .wf-canvas-wrap.is-dropping { outline: 3px dashed var(--accent); outline-offset: -10px; }
.bld-canvas-page .wf-canvas-wrap.is-dropping::after { content: 'Drop an n8n workflow, or a job ad (PDF or Word)'; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-weight: 700;
  pointer-events: none; z-index: 5; }

/* Build S111: the AI employee's workflows in the bar, beside this one's name: the others a click away, then Add. Add never
   shrinks; the names shrink first. */
.bld-set { display: contents; }
.bld-set-item, .bld-set-add { display: inline-block; min-height: 30px; padding: 0 11px; margin: 0 2px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; font: inherit; font-size: 14px; line-height: 28px; white-space: nowrap; cursor: pointer; }
.bld-set-item { flex: 0 1 auto; min-width: 5ch; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); font-weight: 600; }
.bld-set-item:hover, .bld-set-item:focus-visible { border-color: var(--ink); color: var(--ink); }
.bld-set-add { flex: none; margin-left: 6px; border-style: dashed; border-color: var(--accent-dark); color: var(--accent-dark); font-weight: 700; }
.bld-set-add:hover, .bld-set-add:focus-visible { background: #FFF1EA; }
/* Build S110: "Paste a job ad". */
.bld-job-text { min-height: 180px; resize: vertical; }
.bld-job-file { font-size: 14px; }

/* The popups. */
.bld-dialog { padding: 24px 26px; }
.bld-dialog p { margin: 0 0 10px; }
.bld-dialog form { display: flex; flex-direction: column; gap: 14px; }
.bld-dialog-h { font-size: 22px; font-weight: 800; font-stretch: 112%; line-height: 1.2; margin: 0 0 4px; }
.bld-dialog-sub { color: var(--text-3); font-size: 15px; }
.bld-opt { font-weight: 400; color: var(--muted); }
.bld-dialog .wf-panel-actions { margin-top: 4px; }
.bld-intro .wf-panel-actions { align-items: center; }
.bld-intro .bld-learn { margin-left: 10px; font-weight: 600; } /* build S112: the Builder as a business, /builders/learn */
.bld-error { border-color: var(--danger, #B42318); color: var(--danger, #B42318); }
.bld-intro { max-width: min(680px, calc(100vw - 32px)); padding: 30px 32px 28px; }
.bld-dialog .bld-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-dark); margin: 0 0 10px; }
.bld-intro h2 { font-size: clamp(26px, 3.2vw, 32px); font-weight: 800; font-stretch: 112%; line-height: 1.1; margin: 0 0 10px; }
.bld-dialog .bld-lede { font-size: 17px; color: var(--text-3); margin: 0 0 22px; max-width: 54ch; }
.bld-beats { list-style: none; counter-reset: beat; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
.bld-beats li { counter-increment: beat; display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; align-items: start; background: var(--ground-2); border-radius: 14px; padding: 14px; }
.bld-beats li::before { content: counter(beat); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.bld-beats strong { font-size: 16px; }
.bld-beats span { font-size: 15px; color: var(--text-3); line-height: 1.4; }
.bld-plans-pick { display: grid; grid-template-columns: 1fr; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.bld-plans-pick legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.bld-plan-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.bld-plan-card:has(input:checked) { border-color: var(--ink); background: #FFF1EA; }
.bld-plan-card input { margin-top: 4px; flex: none; accent-color: var(--accent-dark); }
.bld-plan-card span { font-size: 14px; color: var(--text-3); line-height: 1.4; }
.bld-plan-card strong { display: block; font-size: 15px; color: var(--ink); }
.bld-prices { grid-column: 1 / -1; }
/* Build S109: Share's one path, the partner commission, in a soft card. */
.bld-earn { border: 1.5px solid var(--ink); border-radius: 12px; padding: 12px 14px; background: #FFF1EA; }
.bld-earn-h { margin: 0 0 4px; font-size: 15px; font-weight: 800; color: var(--ink); }
.bld-earn-p { margin: 0; font-size: 14px; color: var(--text-3); line-height: 1.45; }
.bld-run-form { display: grid; gap: 10px; max-width: 560px; }
.bld-canvas-page .bld-live { flex: none; margin: 0; display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: #DDF3E3; color: #145C2C; white-space: nowrap; }
.bld-canvas-page .bld-live.is-off { background: var(--ground-2); color: var(--muted); }
/* Build S111: a cross at the top right closes a popup; Share is the link, Copy under it, then the commission. */
.bld-dialog .bld-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0;
  border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.bld-dialog .bld-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bld-dialog .bld-x:hover, .bld-dialog .bld-x:focus-visible { background: var(--ground-2); color: var(--ink); }
.bld-dialog:has(.bld-x) .bld-dialog-h { padding-right: 40px; }
#bld-share[open] { display: flex; flex-direction: column; gap: 16px; }
#bld-share .bld-dialog-h { margin: 0; }
.bld-share-box { display: grid; gap: 10px; }
.bld-share-url { width: 100%; min-height: 48px; font-size: 15px; font-family: var(--font-mono); }
.bld-share-url::placeholder { font-family: var(--font-sans); color: var(--muted); }
.bld-share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.bld-share-row .btn { min-width: 110px; }
.bld-share-row .cell-sub { font-size: 14px; }
#bld-share .notice { margin: 0; }
.bld-share-seat { margin-top: 10px; }
@media (min-width: 640px) {
  .bld-beats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .bld-beats li { grid-template-columns: 1fr; row-gap: 4px; }
  .bld-beats li::before { grid-row: auto; margin-bottom: 6px; }
  .bld-plans-pick { grid-template-columns: 1fr 1fr; }
}

/* Narrower screens: shorter words first, then the buttons on their own row. */
@media (max-width: 1239px) {
  .bld-canvas-page .bld-logo-word { display: none; }
  .bld-long { display: none; }
  .bld-short { display: inline; }
}
@media (max-width: 960px) {
  .bld-canvas-page .wf-palette { max-height: 280px; } /* the steps scroll in a short box, so the canvas is near the top */
}
@media (max-width: 860px) {
  .bld-canvas-page .bld-top { flex-wrap: wrap; padding: 10px 16px; }
  .bld-title { flex-basis: calc(100% - 50px); }
  .bld-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .bld-canvas-page .bld-state { margin-right: auto; }
}
@media (max-width: 560px) {
  .bld-title-in { font-size: 15px; }
  .bld-set-add-w { display: none; } /* build S111: on a phone, Add workflow is its + */
  .bld-set-add { padding: 0 10px; margin-left: 4px; }
  .bld-set-item { max-width: 9ch; }
  .bld-canvas-page .bld-actions { gap: 8px 12px; }
  .bld-canvas-page .bld-actions .btn { padding: 0 14px; }
  .bld-canvas-page .wf-status { bottom: var(--toast-bottom, 16px); }
}
