/* Onboardo Operator Studio (TASK-P8) — self-serve operator app at /studio.
   Green-led token system per docs/design.md, sharing the marketing site's ported
   values (welcome green #1F9D74, deep #157C5B). Desktop-first operator tool:
   left sidebar nav, clean tables with status pills, top action bar per page.
   Progressive-enhancement: the shell renders server-side, data hydrates via
   fetch to /studio/api (see studio.js). No SPA framework. */

:root {
  /* Surfaces */
  --paper: #FFFCF7; --stone: #F1F0E9; --white: #FFFFFF; --ink: #1E1E1E;
  /* Text */
  --text: #1E1E1E; --text-soft: #56544C; --label: #6E6557;
  /* Brand green (matches marketing.css) */
  --green: #1F9D74; --green-deep: #157C5B; --green-darker: #0F5E45; --green-tint: #DBF2E8;
  /* Functional amber — "action needed" only */
  --amber: #EBA23C; --amber-deep: #9A5A0E; --amber-tint: #FBEAD2;
  /* Functional red — destructive/rejected only */
  --red: #B4462F; --red-deep: #9A3412; --red-tint: #FCECEA; --red-line: #F1C9C1;
  /* Structure */
  --line: #E6E4DA; --line-soft: #EFEDE5;
  --simp-orange: #C85A28;
  /* Elevation (warm, low-opacity) */
  --shadow-sm: 0 8px 22px -12px rgba(30, 60, 45, .26);
  --shadow: 0 26px 60px -30px rgba(30, 60, 45, .32);
  --shadow-pop: 0 18px 50px -18px rgba(30, 60, 45, .34);
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Layout */
  --sidebar-w: 252px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); background: var(--paper); color: var(--ink);
  font-size: 15.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 4px; }

/* ============================ App shell ============================ */
.studio {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.side {
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side__brand { display: flex; align-items: center; gap: 11px; padding: 20px 22px 18px; }
.side__mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--green);
  display: grid; place-items: center; flex: none;
  box-shadow: 0 8px 16px -6px rgba(31, 157, 116, .55);
}
.side__mark span { display: flex; gap: 3px; }
.side__mark i { width: 5px; height: 5px; border-radius: 50%; background: #fff; display: block; }
.side__wm { font-weight: 800; font-size: 19px; line-height: 1; letter-spacing: -.02em; }
.side__sub { font-size: 9.5px; font-weight: 700; letter-spacing: .16em; color: var(--green); text-transform: uppercase; margin-top: 3px; }

.side__nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.side__label { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--label); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  font-size: 15px; font-weight: 600; color: var(--text-soft); cursor: pointer;
  transition: background .13s, color .13s;
}
.nav-item svg { width: 19px; height: 19px; flex: none; color: currentColor; opacity: .85; }
.nav-item:hover { background: var(--stone); color: var(--ink); }
.nav-item.is-active { background: var(--green-tint); color: var(--green-deep); font-weight: 700; }
.nav-item.is-active svg { opacity: 1; }

.side__foot { padding: 14px 16px 18px; border-top: 1px solid var(--line-soft); }
.side__foot .stamp { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--text-soft); }
.side__foot .stamp .m { width: 20px; height: 20px; border-radius: 6px; background: var(--simp-orange); display: grid; place-items: center; }
.side__foot .stamp .m span { display: flex; gap: 2px; }
.side__foot .stamp .m i { width: 3px; height: 3px; border-radius: 50%; background: #fff; display: block; }

/* ---- Main column ---- */
.main { display: flex; flex-direction: column; min-width: 0; }

/* ---- Top bar ---- */
.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 20px;
  padding: 0 32px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.1) blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-size: 23px; font-weight: 800; letter-spacing: -.025em; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar__who { display: flex; align-items: center; gap: 11px; padding-right: 4px; }
.topbar__tenant { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.topbar__tenant b { font-size: 14px; font-weight: 700; }
.topbar__tenant span { font-size: 12px; color: var(--text-soft); }
.topbar__avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none;
}

.content { padding: 28px 32px 64px; max-width: 1240px; width: 100%; }
.page-lead { color: var(--text-soft); font-size: 15.5px; margin: -2px 0 22px; max-width: 640px; }

/* ============================ Buttons ============================ */
.btn {
  font-family: var(--sans); font-weight: 700; font-size: 14.5px; border-radius: 100px;
  padding: 10px 20px; border: 2px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .09s ease;
  white-space: nowrap; line-height: 1;
}
.btn svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-p { background: var(--green-deep); color: #fff; box-shadow: var(--shadow-sm); }
.btn-p:not(:disabled):hover { background: var(--green-darker); transform: translateY(-1px); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:not(:disabled):hover { border-color: #bfe0d2; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:not(:disabled):hover { color: var(--green-deep); background: var(--stone); }
.btn-danger { background: #fff; color: var(--red-deep); border-color: var(--red-line); }
.btn-danger:not(:disabled):hover { background: var(--red-tint); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn-icon svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }

/* Instant press feedback — a subtle push-down the moment a button is pressed, so
   clicks feel acknowledged before the (often async) action resolves. Placed after
   the variant :hover rules so it wins over their translateY during an active press. */
.btn:not(:disabled):active { transform: scale(.97); }
.add-row:not(:disabled):active,
.pb-addbtn:not(:disabled):active,
.addstage__btn:not(:disabled):active,
.filter-chip:not(:disabled):active,
.seg button:not(:disabled):active { transform: scale(.97); }

/* Busy/loading state — a button running an async action: disabled look kept legible,
   an inline spinner in currentColor swapped in for its label (see Studio.btnBusy). */
.btn.is-busy, .btn.is-busy:disabled { opacity: 1; cursor: progress; }
.btn-spin {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  opacity: .9; animation: spin .65s linear infinite;
}

/* ============================ Cards / panels ============================ */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.card--flat { box-shadow: none; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.panel__head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.panel__head h2 { font-size: 17px; font-weight: 800; }
.panel__head .btn { margin-left: auto; }
.panel__body { padding: 20px 22px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.section-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.section-head .spacer { flex: 1; }

/* ============================ Tables ============================ */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 640px; }
.tbl thead th {
  text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--label); padding: 13px 18px; background: var(--stone); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl thead th.num, .tbl td.num { text-align: right; }
.tbl tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.row-link { cursor: pointer; transition: background .12s; }
.tbl tbody tr.row-link:hover { background: var(--paper); }
.tbl .primary { font-weight: 700; color: var(--ink); }
.tbl .muted { color: var(--text-soft); }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ============================ Status pills / chips ============================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  padding: 5px 12px; border-radius: 100px; white-space: nowrap; line-height: 1;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill--plain::before { display: none; }
/* neutral / draft */
.pill--neutral { background: var(--stone); color: var(--text-soft); }
/* green family: sent, live, done */
.pill--green { background: var(--green-tint); color: var(--green-deep); }
/* amber: needs attention / viewed / onboarding */
.pill--amber { background: var(--amber-tint); color: var(--amber-deep); }
/* red: rejected / archived */
.pill--red { background: var(--red-tint); color: var(--red-deep); }
/* type pills for sections (plain, no dot) */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 100px; background: var(--stone); color: var(--text-soft); }
.chip--green { background: var(--green-tint); color: var(--green-deep); }

/* ============================ Filter chips ============================ */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  font-size: 13px; font-weight: 700; padding: 7px 15px; border-radius: 100px;
  border: 1.5px solid var(--line); background: #fff; color: var(--text-soft); cursor: pointer; transition: .13s;
}
.filter-chip:hover { border-color: #bfe0d2; }
.filter-chip.is-active { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.filter-chip .count { opacity: .7; margin-left: 4px; font-weight: 600; }

/* ============================ Flows toolbar (Current/Archived · filters · search) ============================ */
.flows-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.flows-toolbar .spacer { flex: 1; }

/* segmented Current | Archived toggle */
.seg { display: inline-flex; padding: 3px; background: var(--stone); border-radius: 100px; border: 1px solid var(--line); }
.seg button {
  font-family: var(--sans); font-size: 13px; font-weight: 700; padding: 7px 16px; border: 0;
  border-radius: 100px; background: transparent; color: var(--text-soft); cursor: pointer; transition: .13s;
}
.seg button.is-active { background: #fff; color: var(--green-deep); box-shadow: var(--shadow-sm); }

/* filter popovers (status + dates) */
.filter-pop { position: relative; }
.filter-pop__btn .caret { width: 13px; height: 13px; opacity: .6; }
.filter-pop__btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-deep); }
.filter-pop__panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; min-width: 250px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop);
  padding: 14px; display: none;
}
.filter-pop.is-open .filter-pop__panel { display: block; }
.filter-pop__panel .pop-title {
  font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--label); margin-bottom: 10px;
}
.pop-check { display: flex; align-items: center; gap: 9px; padding: 6px 4px; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pop-check input { width: 16px; height: 16px; flex: none; accent-color: var(--green-deep); }
.pop-check .count { margin-left: auto; color: var(--text-soft); font-weight: 600; font-size: 12.5px; }
.pop-divider { height: 1px; background: var(--line-soft); margin: 10px 0; }
.pop-field { margin-bottom: 10px; }
.pop-field label { display: block; font-size: 12px; font-weight: 700; color: var(--label); margin-bottom: 4px; }
.pop-field input { width: 100%; font-family: var(--sans); font-size: 14px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.pop-field input:focus { outline: 0; border-color: var(--green-deep); }
.pop-foot { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }

/* search box */
.search-box { position: relative; }
.search-box input {
  font-family: var(--sans); font-size: 14px; padding: 8px 14px 8px 34px; border: 1.5px solid var(--line);
  border-radius: 100px; background: #fff; width: 220px; transition: .13s;
}
.search-box input:focus { outline: 0; border-color: var(--green-deep); width: 250px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-soft); pointer-events: none; }

/* trailing per-row archive / restore ghost button */
.tbl td.row-actions { text-align: right; white-space: nowrap; width: 1%; }
.row-arch-btn {
  background: transparent; border: 0; padding: 6px; border-radius: 8px; color: var(--text-soft);
  cursor: pointer; transition: .13s; display: inline-flex;
}
.row-arch-btn:hover { background: var(--stone); color: var(--green-deep); }
.row-arch-btn svg { width: 17px; height: 17px; }
.row-del-btn:hover { background: var(--red-tint); color: var(--red-deep); }

/* archived rows greyed with an archive glyph (client detail history) */
.tbl tbody tr.is-archived td { color: var(--text-soft); }
.tbl tbody tr.is-archived .primary { color: var(--text-soft); font-weight: 600; }
.archive-glyph { display: inline-flex; vertical-align: -2px; margin-right: 6px; color: var(--text-soft); }
.archive-glyph svg { width: 14px; height: 14px; }

/* archived banner on the flow overview */
.archived-banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px;
  background: var(--stone); border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; color: var(--text-soft); font-weight: 600;
}
.archived-banner svg { width: 18px; height: 18px; flex: none; color: var(--text-soft); }

/* ============================ Funnel bars ============================ */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel__row { display: grid; grid-template-columns: 148px 1fr 52px; align-items: center; gap: 14px; }
.funnel__label { font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.funnel__track { height: 26px; border-radius: 8px; background: var(--stone); overflow: hidden; }
.funnel__fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, #7FD3B4, var(--green)); min-width: 3px; transition: width .5s cubic-bezier(.2,.7,.3,1); }
.funnel__val { font-size: 15px; font-weight: 800; text-align: right; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat__k { font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--label); }
.stat__v { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.stat__m { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ============================ Forms ============================ */
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--label); margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--text-soft); font-weight: 500; margin-top: 6px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel],
.field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 15px; padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--paper); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-error { color: var(--red); font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.form-error { background: var(--red-tint); border: 1px solid var(--red-line); color: var(--red-deep); border-radius: 11px; padding: 11px 14px; font-size: 14px; font-weight: 600; margin-bottom: 16px; }

/* toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; font-size: 14.5px; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track { width: 40px; height: 23px; border-radius: 100px; background: #D7D2C8; position: relative; transition: .16s; flex: none; }
.toggle__track::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .16s; }
.toggle input:checked + .toggle__track { background: var(--green-deep); }
.toggle input:checked + .toggle__track::after { transform: translateX(17px); }
.toggle input:focus-visible + .toggle__track { box-shadow: 0 0 0 3px var(--green-tint); }

/* ============================ Modal ============================ */
.overlay {
  position: fixed; inset: 0; background: rgba(30, 30, 30, .38); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 20px 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow-pop);
  width: 100%; max-width: 520px; max-height: 86vh; display: flex; flex-direction: column;
  transform: translateY(10px) scale(.99); transition: transform .18s; overflow: hidden;
}
.overlay.is-open .modal { transform: none; }
.modal--wide { max-width: 680px; }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 14px; }
.modal__head h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.modal__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-soft); padding: 6px; border-radius: 8px; line-height: 0; }
.modal__close:hover { background: var(--stone); color: var(--ink); }
.modal__close svg { width: 20px; height: 20px; }
.modal__body { padding: 6px 24px 8px; overflow-y: auto; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px 22px; }

/* slide-over (right drawer) — reuses .overlay but aligns right */
.overlay--drawer { align-items: stretch; justify-content: flex-end; padding: 0; }
.drawer {
  background: var(--paper); box-shadow: var(--shadow-pop); width: 100%; max-width: 480px;
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(16px); transition: transform .2s;
}
.overlay.is-open .drawer { transform: none; }
.drawer__head { display: flex; align-items: center; gap: 12px; padding: 22px 26px 16px; border-bottom: 1px solid var(--line-soft); }
.drawer__head h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.drawer__body { padding: 20px 26px; overflow-y: auto; flex: 1; }
.drawer__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 26px; border-top: 1px solid var(--line-soft); }

/* ============================ Toast ============================ */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  background: var(--ink); color: #fff; border-radius: 13px; padding: 13px 16px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-pop); display: flex; align-items: flex-start; gap: 10px;
  transform: translateY(8px); opacity: 0; transition: .22s; line-height: 1.4;
}
.toast.is-in { transform: none; opacity: 1; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast--ok { background: var(--green-deep); }
.toast--err { background: var(--red-deep); }
.toast__close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0 0 0 6px; font-size: 16px; line-height: 1; }
.toast__close:hover { opacity: 1; }

/* ============================ Empty / loading ============================ */
.empty { text-align: center; padding: 54px 24px; color: var(--text-soft); }
.empty__icon { width: 52px; height: 52px; border-radius: 15px; background: var(--green-tint); color: var(--green-deep); display: inline-grid; place-items: center; margin-bottom: 16px; }
.empty__icon svg { width: 26px; height: 26px; }
.empty h3 { font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14.5px; max-width: 360px; margin: 0 auto 18px; }
.skeleton { background: linear-gradient(90deg, var(--stone) 25%, #E9E7DF 50%, var(--stone) 75%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-row { height: 48px; margin-bottom: 8px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--green-tint); border-top-color: var(--green-deep); border-radius: 50%; animation: spin .7s linear infinite; }
.spin-center { display: grid; place-items: center; padding: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ Proposal overview ============================ */
.overview { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.ov-title { font-size: 27px; font-weight: 800; letter-spacing: -.03em; }
.ov-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: 14px; color: var(--text-soft); }
.ov-meta b { color: var(--ink); font-weight: 700; }
.linkbox { display: flex; align-items: center; gap: 8px; background: var(--stone); border: 1px solid var(--line); border-radius: 11px; padding: 8px 8px 8px 14px; }
.linkbox code { flex: 1; font-family: var(--sans); font-size: 13.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-col { display: flex; flex-direction: column; gap: 10px; }
.actions-col .btn { justify-content: flex-start; }

/* activity timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 13px; padding: 0 0 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--green-tint); color: var(--green-deep); display: grid; place-items: center; flex: none; z-index: 1; }
.timeline .tl-dot svg { width: 12px; height: 12px; }
.timeline .tl-body { padding-top: 1px; }
.timeline .tl-what { font-size: 14.5px; font-weight: 700; }
.timeline .tl-when { font-size: 12.5px; color: var(--text-soft); margin-top: 1px; }
.signers { list-style: none; margin: 0; padding: 0; }
.signers li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.signers li:first-child { border-top: 0; }
.signers .who { flex: 1; }
.signers .role { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--label); font-weight: 800; }
.signers .name { font-weight: 700; font-size: 14px; }

/* builder stub */
.builder-stub { border: 2px dashed var(--line); border-radius: 18px; padding: 48px; text-align: center; color: var(--text-soft); background: #fff; }

/* ============================ Section / template editors ============================ */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.rte-pane { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 16px 18px; min-height: 260px; font-size: 15px; line-height: 1.6; overflow-y: auto; }
.rte-pane :is(h1, h2, h3) { letter-spacing: -.01em; margin: 0 0 8px; }
.rte-pane p { margin: 0 0 10px; }

/* editable rows (line items, form fields, stages) */
.rows { display: flex; flex-direction: column; gap: 10px; }
.erow { display: flex; align-items: flex-start; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px; }
.erow__grip { color: #b9c7c0; cursor: grab; padding-top: 6px; flex: none; }
.erow__grip svg { width: 16px; height: 16px; }
.erow__main { flex: 1; display: grid; gap: 10px; min-width: 0; }
.erow__cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.erow__del { color: var(--text-soft); background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; flex: none; }
.erow__del:hover { background: var(--red-tint); color: var(--red-deep); }
.erow__del svg { width: 16px; height: 16px; }
.add-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--line); border-radius: 13px; padding: 13px; width: 100%;
  font-weight: 700; font-size: 14px; color: var(--text-soft); background: transparent; cursor: pointer; transition: .13s;
}
.add-row:hover { border-color: var(--green); background: var(--green-tint); color: var(--green-deep); }
.add-row svg { width: 17px; height: 17px; }

/* ---- form-field builder (TASK-068) ----
   A tidier take on the shared .erow: each field is a card with captioned groups —
   label + type on top, options when relevant, then a settings strip (Required +
   a "Due in N days" composed control with help text). Grip drags to reorder. */
.ffield { align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.ffield.is-drag { opacity: .45; box-shadow: var(--shadow-pop); }
.ffield.is-drop-before { box-shadow: inset 0 3px 0 var(--green); }
.ffield.is-drop-after { box-shadow: inset 0 -3px 0 var(--green); }
.ffield__grip { color: #b9c7c0; cursor: grab; display: grid; place-items: center; padding: 0 4px; background: var(--stone); border-right: 1px solid var(--line-soft); flex: none; }
.ffield__grip:active { cursor: grabbing; }
.ffield__grip svg { width: 16px; height: 16px; }
.ffield__main { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 14px 16px; }
.ffield__del { color: var(--text-soft); background: none; border: 0; cursor: pointer; padding: 12px 12px 0 0; border-radius: 8px; flex: none; align-self: flex-start; }
.ffield__del:hover { color: var(--red-deep); }
.ffield__del svg { width: 16px; height: 16px; }
.ffield__cap { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--label); margin-bottom: 5px; }
.ffield__top { display: grid; grid-template-columns: 1fr 190px; gap: 12px; align-items: end; }
.ffield__num { font-size: 12px; font-weight: 800; color: var(--green-deep); }
.ffield__settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.ffield__due { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-soft); }
.ffield__due input { width: 66px; text-align: center; }
.ffield__due-hint { flex-basis: 100%; margin: -4px 0 0; }
@media (max-width: 860px) {
  .ffield__top { grid-template-columns: 1fr; }
}

/* stage card (templates) */
.stage { border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.stage + .stage { margin-top: 14px; }
.stage__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--stone); }
.stage__num { width: 32px; height: 32px; border-radius: 10px; background: #fff; color: var(--green-deep); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.stage__title { font-weight: 800; font-size: 15.5px; }
.stage__title .sub { font-weight: 600; font-size: 12.5px; color: var(--text-soft); }
.stage__tools { margin-left: auto; display: flex; gap: 4px; }
.stage__body { padding: 14px 16px; }
.stage__secs { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stage__secs li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; font-size: 14px; }
.stage__secs .grip { color: #b9c7c0; }
.stage__secs .nm { flex: 1; font-weight: 600; }

/* ============================ Login ============================ */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-bubble { position: absolute; border-radius: 50%; pointer-events: none; }
.lb1 { width: 340px; height: 340px; background: var(--green); opacity: .08; top: -90px; right: -70px; }
.lb2 { width: 150px; height: 150px; background: var(--green); opacity: .14; bottom: 14%; left: 9%; }
.lb3 { width: 66px; height: 66px; background: var(--green); opacity: .26; top: 20%; left: 20%; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 40px 38px; width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-card .side__mark { margin-bottom: 20px; }
.login-card h1 { font-size: 27px; font-weight: 800; letter-spacing: -.03em; }
.login-card h1 .ghost { opacity: .32; display: block; }
.login-card .sub { color: var(--text-soft); font-size: 15px; margin: 8px 0 26px; }
.login-card .foot { text-align: center; margin-top: 22px; font-size: 12.5px; color: #8A8578; font-weight: 500; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===================== Client detail (cd-) ========================= */
/* Full client dashboard: details card (left, inline-editable) + all-proposals
   history (right, wider). Additive — scoped to the .cd- prefix. */
.cd-grid { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
.cd-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.cd-card__head h2 { font-size: 16px; font-weight: 800; flex: 1; }
.cd-grp { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--label); margin: 18px 0 8px; }
.cd-grp:first-of-type { margin-top: 10px; }
.cd-dl { display: flex; flex-direction: column; }
.cd-item { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.cd-item:last-child { border-bottom: 0; }
.cd-k { color: var(--text-soft); font-weight: 600; flex: none; }
.cd-v { color: var(--ink); font-weight: 600; text-align: right; word-break: break-word; }
.cd-notes { font-size: 14px; color: var(--ink); white-space: pre-wrap; line-height: 1.5; }
.cd-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cd-toolbar .chips { flex: 1; }

/* ============================ Responsive ============================ */
@media (max-width: 1080px) {
  .overview { grid-template-columns: 1fr; }
  .cd-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .editor-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .studio { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; z-index: 60; width: 252px;
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-pop);
  }
  .side.is-open { transform: none; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 18px 56px; }
  .nav-toggle { display: inline-grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row, .erow__cols { grid-template-columns: 1fr; }
}
.nav-toggle { display: none; place-items: center; }

/* scrim for mobile sidebar */
.side-scrim { position: fixed; inset: 0; background: rgba(30,30,30,.3); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .18s; }
.side-scrim.is-open { opacity: 1; pointer-events: auto; }
@media (min-width: 861px) { .side-scrim { display: none; } }

/* ===== builder ===== */
/* Proposal builder canvas (follow-up builder agent). Mounted at #studio-builder
   by studio-builder.js. Reuses shell tokens/components; adds the stacked-card
   canvas, drag reorder, Quill chrome, merge chips, add-affordances and preview. */
.pb { max-width: 920px; }

/* ---- top action bar ---- */
.pb-bar {
  display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.pb-bar__main { flex: 1; min-width: 240px; }
.pb-name {
  width: 100%; font-family: var(--sans); font-size: 22px; font-weight: 800; letter-spacing: -.02em;
  color: var(--ink); border: 1.5px solid transparent; border-radius: 11px; background: transparent;
  padding: 6px 10px; margin: -6px -10px 2px;
}
.pb-name:hover { border-color: var(--line); }
.pb-name:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); background: var(--paper); }
.pb-name[readonly] { border-color: transparent; }
.pb-bar__sub { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.pb-clientpick { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--label); }
.pb-clientpick select {
  font-family: var(--sans); font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0;
  padding: 7px 11px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
}
.pb-clientpick select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.pb-bar__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---- read-only banner ---- */
.pb-banner {
  display: flex; align-items: center; gap: 10px; background: var(--amber-tint); color: var(--amber-deep);
  border: 1px solid #F0D8AE; border-radius: 13px; padding: 12px 16px; font-size: 14px; font-weight: 600; margin-bottom: 20px;
}
.pb-banner svg { width: 18px; height: 18px; flex: none; }
.pb-banner a { color: var(--amber-deep); text-decoration: underline; font-weight: 800; }

/* ---- canvas + cards ---- */
.pb-canvas { display: flex; flex-direction: column; }
.pb-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
  overflow: hidden; transition: box-shadow .15s, opacity .15s;
}
.pb-card.is-dragging { opacity: .5; box-shadow: var(--shadow-pop); }
.pb-card__head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 12px;
  border-bottom: 1px solid var(--line-soft); background: var(--stone);
}
.pb-card.is-collapsed .pb-card__head { border-bottom: 0; }
.pb-grip { color: #a9bcb4; cursor: grab; display: grid; place-items: center; padding: 2px; flex: none; }
.pb-grip:active { cursor: grabbing; }
.pb-grip svg { width: 17px; height: 17px; }
.pb-title {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: 15.5px; font-weight: 700; color: var(--ink);
  border: 1.5px solid transparent; border-radius: 9px; background: transparent; padding: 7px 10px; margin: -1px 0;
}
.pb-title:hover { border-color: var(--line); background: #fff; }
.pb-title:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); background: #fff; }
.pb-typechip { flex: none; }
.pb-card__tools { display: flex; align-items: center; gap: 2px; flex: none; }
.pb-tool { background: none; border: 0; cursor: pointer; color: var(--text-soft); padding: 7px; border-radius: 9px; line-height: 0; transition: .12s; }
.pb-tool svg { width: 17px; height: 17px; }
.pb-tool:hover { background: #fff; color: var(--green-deep); }
.pb-tool--danger:hover { background: var(--red-tint); color: var(--red-deep); }
.pb-collapse svg { transition: transform .18s; }
.pb-card.is-collapsed .pb-collapse svg { transform: rotate(-90deg); }
.pb-card__body { padding: 16px 18px; }
.pb-card.is-collapsed .pb-card__body { display: none; }
.pb-cardfoot { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---- per-section save tick ---- */
.pb-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; flex: none; min-width: 0; white-space: nowrap; }
.pb-status svg { width: 14px; height: 14px; }
.pb-status.is-saving { color: var(--text-soft); }
.pb-status.is-saved { color: var(--green-deep); }
.pb-status.is-error { color: var(--red-deep); }
.pb-status__dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--green-tint); border-top-color: var(--green-deep); animation: spin .7s linear infinite; }

/* ---- rich text (Quill snow) ---- */
.pb-rte-host { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.pb-rte-host .ql-toolbar.ql-snow {
  border: 0; border-bottom: 1px solid var(--line-soft); background: var(--paper);
  font-family: var(--sans); padding: 7px 8px;
}
.pb-rte-host .ql-container.ql-snow { border: 0; font-family: var(--sans); font-size: 15px; }
.pb-rte-host .ql-editor { min-height: 150px; line-height: 1.6; color: var(--ink); padding: 14px 16px; }
.pb-rte-host .ql-editor.ql-blank::before { color: var(--label); font-style: normal; left: 16px; }
.pb-rte-host .ql-editor h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.pb-rte-host .ql-editor h3 { font-size: 16.5px; font-weight: 800; }
.pb-rte-host .ql-snow .ql-stroke { stroke: var(--text-soft); }
.pb-rte-host .ql-snow .ql-fill { fill: var(--text-soft); }
.pb-rte-host .ql-snow .ql-picker { color: var(--text-soft); }
.pb-rte-host .ql-snow.ql-toolbar button:hover .ql-stroke,
.pb-rte-host .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--green-deep); }
.pb-rte-host .ql-snow.ql-toolbar button:hover .ql-fill,
.pb-rte-host .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--green-deep); }
.pb-rte-host .ql-snow .ql-picker.ql-expanded .ql-picker-label { border-color: var(--line); }
.pb-rte-host .ql-snow a { color: var(--green-deep); }

/* ---- merge-field chips ---- */
.pb-chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; align-items: center; }
.pb-chipgroup { display: inline-flex; align-items: center; gap: 6px; }
.pb-chipgroup__l { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--label); }
.pb-mchip {
  font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--green-deep);
  background: var(--green-tint); border: 1px solid transparent; border-radius: 100px; padding: 4px 10px; cursor: pointer; transition: .12s;
}
.pb-mchip:hover { border-color: var(--green); background: #cdeadd; }

/* ---- price: subtotal footer ---- */
.pb-addline { margin-top: 12px; }
.pb-subtotal {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: var(--stone);
  font-size: 13.5px; font-weight: 700; color: var(--text-soft);
}
.pb-subtotal__vals { font-weight: 600; }
.pb-subtotal__vals b { font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }

/* ---- form/checklist read-only list ---- */
.pb-fieldlist .pill--plain { padding: 3px 9px; }
.pb-muted { color: var(--label); font-style: italic; }

/* ---- add-affordances ---- */
.pb-add { display: flex; align-items: center; gap: 10px; height: 30px; opacity: 0; transition: opacity .13s; }
.pb-canvas:hover .pb-add, .pb-add:focus-within { opacity: 1; }
.pb-add__line { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.pb-add__btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; color: var(--green-deep);
  display: grid; place-items: center; cursor: pointer; flex: none; transition: .12s;
}
.pb-add__btn svg { width: 15px; height: 15px; }
.pb-add__btn:hover { border-color: var(--green); background: var(--green-tint); transform: scale(1.08); }
.pb-drop { height: 3px; background: var(--green); border-radius: 3px; margin: 5px 2px; box-shadow: 0 0 0 3px var(--green-tint); }

/* ---- bottom add bar ---- */
.pb-bottom { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }

/* ---- empty state ---- */
.pb-empty { text-align: center; padding: 44px 24px; border: 2px dashed var(--line); border-radius: 18px; background: #fff; color: var(--text-soft); }
.pb-empty h3 { font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.pb-empty p { font-size: 14.5px; max-width: 360px; margin: 0 auto 18px; }
.pb-empty__cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- type picker ---- */
.pb-typegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 0 10px; }
.pb-typebtn {
  text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: .13s;
  display: flex; flex-direction: column; gap: 3px;
}
.pb-typebtn:hover { border-color: var(--green); background: var(--green-tint); transform: translateY(-1px); }
.pb-typebtn b { font-size: 15px; font-weight: 800; color: var(--ink); }
.pb-typebtn span { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }

/* ---- library drawer ---- */
.pb-liblist { display: flex; flex-direction: column; gap: 8px; }
.pb-libitem {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: .13s;
}
.pb-libitem:hover { border-color: var(--green); background: var(--green-tint); }
.pb-libitem__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pb-libitem__main b { font-size: 14.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-libitem__main span { font-size: 12.5px; color: var(--text-soft); }

/* ---- preview ---- */
.pb-preview { background: var(--stone); border-radius: 14px; padding: 22px; }
.pb-prev-doc { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 34px 40px; box-shadow: var(--shadow-sm); }
.pb-prev-sec { margin-bottom: 26px; }
.pb-prev-sec:last-child { margin-bottom: 0; }
.pb-prev-sec h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 10px; }
.pb-prev-sec p { margin: 0 0 10px; line-height: 1.6; }
.pb-prev-total { font-size: 15px; margin-top: 10px; }
.pb-prev-fields { list-style: none; margin: 0; padding: 0; }
.pb-prev-fields li { padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-weight: 600; }
.pb-req { color: var(--red); }

@media (max-width: 720px) {
  .pb-typegrid { grid-template-columns: 1fr; }
  .pb-prev-doc { padding: 22px 20px; }
}

/* ============================ Branding settings (TASK-044) ============================
   Two-column: controls on the left, a live mini-proposal preview on the right that
   restyles from --brand-primary / --brand-accent custom properties as inputs change. */
.bset-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.bset-preview-col { position: sticky; top: calc(var(--topbar-h) + 20px); }

/* ---- team / operators ---- */
.btm-list { display: flex; flex-direction: column; gap: 8px; }
.btm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--paper); }
.btm-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--green-tint); color: var(--green-deep); font-weight: 800; font-size: 14px; }
.btm-row__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.btm-row__main b { font-weight: 700; }

/* ---- logo dropzone ---- */
.bset-drop {
  border: 2px dashed var(--line); border-radius: 14px; background: var(--paper);
  padding: 20px; display: flex; align-items: center; gap: 16px; cursor: pointer;
  transition: border-color .13s, background .13s;
}
.bset-drop:hover, .bset-drop.is-drag { border-color: var(--green); background: var(--green-tint); }
/* Uploading: dim the controls and centre the spinner that replaced the thumbnail. */
.bset-drop.is-uploading { pointer-events: none; opacity: .75; cursor: progress; }
.bset-drop.is-uploading .bset-drop__thumb { display: grid; place-items: center; }
.bset-drop__thumb {
  width: 72px; height: 72px; border-radius: 12px; flex: none; background: var(--white);
  border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden;
}
.bset-drop__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bset-drop__thumb svg { width: 26px; height: 26px; color: var(--label); }
.bset-drop__main { min-width: 0; }
.bset-drop__main b { display: block; font-size: 14.5px; font-weight: 700; }
.bset-drop__main span { font-size: 12.5px; color: var(--text-soft); }
.bset-drop__actions { margin-top: 8px; display: flex; gap: 14px; }
.bset-linkbtn { background: none; border: 0; padding: 0; font-size: 12.5px; font-weight: 700; color: var(--green-deep); cursor: pointer; }
.bset-linkbtn--danger { color: var(--red); }

/* ---- colour rows ---- */
.bset-colour { display: flex; align-items: center; gap: 10px; }
.bset-colour input[type="text"] { flex: 1; font-family: var(--sans); }
.bset-swatch {
  width: 42px; height: 42px; border-radius: 10px; flex: none; border: 1px solid var(--line);
  padding: 0; cursor: pointer; overflow: hidden; position: relative;
}
.bset-swatch input[type="color"] {
  position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px);
  border: 0; padding: 0; cursor: pointer; background: transparent;
}

/* ---- live preview card ---- */
.bset-prev {
  --brand-primary: #1F9D74; --brand-accent: #11694C;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.bset-prev__band {
  background: var(--brand-primary); color: #fff; padding: 16px 22px;
  display: flex; align-items: center; gap: 12px;
}
.bset-prev__logo {
  width: 40px; height: 40px; border-radius: 9px; flex: none; background: rgba(255,255,255,.9);
  display: grid; place-items: center; overflow: hidden;
}
.bset-prev__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bset-prev__band b { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.bset-prev__body { padding: 24px 22px; }
.bset-prev__body h3 { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.bset-prev__body p { margin: 0 0 8px; color: var(--text-soft); font-size: 14px; line-height: 1.55; }
.bset-prev__price {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 16px 0 18px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-weight: 700;
}
.bset-prev__price span:last-child { font-size: 20px; color: var(--brand-accent); }
.bset-prev__cta {
  display: inline-flex; width: 100%; justify-content: center; padding: 12px 20px;
  border-radius: 100px; background: var(--brand-accent); color: #fff; font-weight: 700; font-size: 14.5px;
}
.bset-note { font-size: 12.5px; color: var(--text-soft); margin-top: 14px; line-height: 1.5; }

@media (max-width: 900px) {
  .bset-grid { grid-template-columns: 1fr; }
  .bset-preview-col { position: static; }
}

/* ===== sections-rte ===== */
/* Rich-text-first Section editor (TASK-046). The editing surface is the shared
   OnboardoRte (studio-rte.js) with a merge-field picker in the toolbar; the preview
   pane substitutes each token's sample value. Quill chrome mirrors the builder's
   green re-theme, scoped to .sre-host so it never touches the builder block above. */
.sre-host { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.sre-host .ql-toolbar.ql-snow {
  border: 0; border-bottom: 1px solid var(--line-soft); background: var(--paper);
  font-family: var(--sans); padding: 7px 8px;
}
.sre-host .ql-container.ql-snow { border: 0; font-family: var(--sans); font-size: 15px; }
.sre-host .ql-editor { min-height: 240px; line-height: 1.6; color: var(--ink); padding: 14px 16px; }
.sre-host .ql-editor.ql-blank::before { color: var(--label); font-style: normal; left: 16px; }
.sre-host .ql-editor h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.sre-host .ql-editor h3 { font-size: 16.5px; font-weight: 800; }
.sre-host .ql-snow .ql-stroke { stroke: var(--text-soft); }
.sre-host .ql-snow .ql-fill { fill: var(--text-soft); }
.sre-host .ql-snow .ql-picker { color: var(--text-soft); }
.sre-host .ql-snow.ql-toolbar button:hover .ql-stroke,
.sre-host .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--green-deep); }
.sre-host .ql-snow.ql-toolbar button:hover .ql-fill,
.sre-host .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--green-deep); }
.sre-host .ql-snow .ql-picker.ql-expanded .ql-picker-label { border-color: var(--line); }
.sre-host .ql-snow a { color: var(--green-deep); }

/* ---- merge-field picker (toolbar button + popover; created by studio-rte.js) ---- */
.rte-mergewrap { position: relative; }
.rte-mergebtn {
  display: inline-flex; align-items: center; gap: 6px; width: auto !important; height: auto;
  padding: 4px 10px; border: 1px solid var(--green-tint); border-radius: 100px;
  background: var(--green-tint); color: var(--green-deep); cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 700; line-height: 1.2; transition: .12s;
}
.rte-mergebtn:hover { border-color: var(--green); background: #cdeadd; }
.rte-mergebtn svg { width: 15px; height: 15px; }
.rte-mergebtn__t { white-space: nowrap; }
.rte-mergepop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: 288px; max-height: 320px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px;
}
.rte-mergepop[hidden] { display: none; }
.rte-mergepop__grp {
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--label);
  padding: 8px 10px 4px;
}
.rte-mergepop__item {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px; padding: 7px 10px; cursor: pointer; transition: background .1s;
}
.rte-mergepop__item:hover { background: var(--green-tint); }
.rte-mergepop__l { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.rte-mergepop__s { font-size: 12px; color: var(--text-soft); }

/* ---- preview sample-data chips ---- */
.sre-preview .sre-sample {
  background: var(--green-tint); color: var(--green-deep); border-radius: 5px; padding: 0 4px; font-weight: 600;
}
.sre-preview .sre-sample--unknown { font-style: italic; }

/* ===== builder add-section ===== */
/* Nusii-style add-section affordances for the proposal builder (studio-builder.js):
   a centred row of flat bordered buttons, an overflow "More" menu, the between-cards
   "+" popover, and a card-row restyle of the reusable-section drawer. Studio tokens
   throughout — white buttons, 1px border, hover border-green + text-green. */
.pb-addrow { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pb-addbtn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--text-soft);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; cursor: pointer; transition: border-color .13s, color .13s, box-shadow .13s;
}
.pb-addbtn svg { width: 16px; height: 16px; }
.pb-addbtn:hover { border-color: var(--green); color: var(--green-deep); box-shadow: var(--shadow-sm); }
.pb-addbtn--more { padding: 12px 14px; color: var(--label); }
.pb-addbtn--more svg { width: 14px; height: 14px; }

/* ---- add-choice popover (More menu + between-cards "+") ---- */
.pb-addmenu {
  z-index: 60; min-width: 212px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px;
}
.pb-addmenu__item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink);
  background: none; border: 0; border-radius: 8px; padding: 9px 10px; cursor: pointer; transition: background .1s, color .1s;
}
.pb-addmenu__item:hover { background: var(--green-tint); color: var(--green-deep); }
.pb-addmenu__ic { display: inline-grid; place-items: center; color: var(--green-deep); flex: none; }
.pb-addmenu__ic svg { width: 15px; height: 15px; }

/* ---- reusable-section drawer: card rows (overrides the base .pb-libitem) ---- */
.pb-liblist .pb-libitem {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
  cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.pb-liblist .pb-libitem:hover { border-color: var(--green); background: #fff; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.pb-liblist .pb-libitem__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pb-liblist .pb-libitem__main b { font-size: 14.5px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-liblist .pb-libitem__main span { font-size: 12.5px; color: var(--text-soft); }
.pb-liblist .pb-libitem .chip { flex: none; }

/* ===== template-polish ===== */
/* Inline "add stage" row: flat white buttons that create a stage on click, plus a
   "More" popover for the less-common stage types. */
.addstage { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.addstage__btn {
  font: inherit; font-size: 13.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px; border-radius: 100px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .12s, color .12s, background .12s;
}
.addstage__btn:hover { border-color: var(--green); color: var(--green-deep); }
.addstage__more { position: relative; }
.addstage__pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  min-width: 180px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 2px;
}
.addstage__pop[hidden] { display: none; }
.addstage__popitem {
  font: inherit; font-size: 13.5px; font-weight: 600; text-align: left;
  padding: 9px 12px; border-radius: 8px;
  background: transparent; color: var(--ink); border: 0; cursor: pointer;
}
.addstage__popitem:hover { background: var(--stone); color: var(--green-deep); }

/* ===== global select styling + template library popover (2026-07-03) ===== */
select {
  appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2311694C' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 34px 9px 12px; font: inherit; font-weight: 600; color: var(--ink);
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.te-libpop {
  position: absolute; z-index: 60; left: 0; bottom: calc(100% + 8px);
  width: min(620px, 92vw); background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-pop, 0 18px 50px -12px rgba(20,45,35,.25));
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.te-libsearch { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; }
.te-libsearch:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.te-liblist { max-height: min(460px, 55vh); overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.te-libpop .pb-libitem { padding: 12px 14px; font-size: 14.5px; }
.te-libpop .pb-libitem { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.te-libname { font-weight: 700; }
.te-libtitle { color: var(--text-soft); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-libpop .chip { margin-left: auto; }

/* ===== merge-picker vs Quill toolbar specificity fix (2026-07-03) =====
   Quill's snow theme styles EVERY button descendant of .ql-toolbar (28px,
   float:left) — including our popover's items, which collapsed into an
   overlapping heap. Out-specify it and reset the layout properties. */
.sre-host .ql-toolbar.ql-snow .rte-mergepop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  width: min(360px, 80vw); max-height: 340px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px -12px rgba(20, 45, 35, .25); padding: 8px;
}
.sre-host .ql-toolbar.ql-snow .rte-mergepop[hidden] { display: none; }
.sre-host .ql-toolbar.ql-snow .rte-mergepop button.rte-mergepop__item {
  display: block; float: none; width: 100%; height: auto;
  padding: 8px 10px; text-align: left; border-radius: 8px;
  background: none; border: 0; cursor: pointer; font: inherit;
}
.sre-host .ql-toolbar.ql-snow .rte-mergepop button.rte-mergepop__item:hover {
  background: var(--green-tint, #E3F4EC);
}
.sre-host .ql-toolbar.ql-snow .rte-mergepop .rte-mergepop__grp {
  float: none; width: 100%; padding: 8px 10px 2px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--label, #8A8578);
}
.sre-host .ql-toolbar.ql-snow .rte-mergepop .rte-mergepop__l {
  display: block; float: none; font-weight: 700; color: var(--ink); font-size: 14px;
}
.sre-host .ql-toolbar.ql-snow .rte-mergepop .rte-mergepop__s {
  display: block; float: none; color: var(--text-soft); font-size: 12.5px;
}

/* ===================== Dashboard widgets (TASK-066 Phase 2) ===================== */
/* A grid of movable widget cards the operator arranges themselves. Each card reuses the
   panel look; the grip starts an HTML5 drag-reorder, the × hides a card into the tray. */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.widget { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.widget--wide { grid-column: 1 / -1; }
.widget.is-hidden { display: none; }
.widget.is-dragging { opacity: .5; outline: 2px dashed var(--green-deep); outline-offset: -2px; }
.widget__head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.widget__head h2 { font-size: 16px; font-weight: 800; }
.widget__grip {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; padding: 0;
  border: 0; background: transparent; color: var(--label); cursor: grab; border-radius: 8px;
}
.widget__grip:hover { background: var(--stone); color: var(--text-soft); }
.widget__grip:active { cursor: grabbing; }
.widget__grip svg { width: 18px; height: 18px; }
.widget__hide {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; padding: 0; margin-left: 8px;
  border: 0; background: transparent; color: var(--label); cursor: pointer; border-radius: 8px; opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.widget:hover .widget__hide, .widget__hide:focus-visible { opacity: 1; }
.widget__hide:hover { background: var(--red-tint); color: var(--red-deep); }
.widget__hide svg { width: 16px; height: 16px; }
.widget__body { padding: 18px; }

/* Hidden-widgets tray */
.dash-tray { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; flex-wrap: wrap; }
.dash-tray.is-empty { display: none; }
.dash-tray__label { font-size: 12.5px; font-weight: 700; color: var(--label); }
.dash-tray__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-tray__chip { border: 1px dashed var(--line); cursor: pointer; background: #fff; color: var(--text-soft); }
.dash-tray__chip:hover { border-color: #bfe0d2; color: var(--green-deep); background: var(--green-tint); }

/* Shortcuts widget */
.shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shortcut {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .12s, box-shadow .15s;
}
.shortcut:hover { border-color: #bfe0d2; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.shortcut__ic { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--stone); color: var(--text-soft); }
.shortcut__ic--p { background: var(--green-tint); color: var(--green-deep); }
.shortcut__ic svg { width: 20px; height: 20px; }
.shortcut b { display: block; font-size: 14.5px; font-weight: 800; }
.shortcut small { display: block; font-size: 12.5px; color: var(--text-soft); }

/* Latest-activity feed */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed__item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.feed__item:last-child { border-bottom: 0; }
.feed__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--label); }
.feed__dot--green { background: var(--green); }
.feed__dot--amber { background: var(--amber); }
.feed__dot--red { background: var(--red); }
.feed__body { display: block; text-decoration: none; color: inherit; min-width: 0; flex: 1; }
.feed__line { display: block; font-size: 14px; color: var(--ink); }
.feed__line b { font-weight: 800; }
.feed__meta { display: block; font-size: 12.5px; color: var(--text-soft); margin-top: 1px; }
.feed__body:hover .feed__line b { color: var(--green-deep); }

/* Notes widget */
.notes__area {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; resize: vertical;
  font: inherit; font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--paper);
}
.notes__area:focus { outline: none; border-color: #bfe0d2; box-shadow: 0 0 0 3px var(--green-tint); }
.notes__foot { display: flex; justify-content: flex-end; min-height: 18px; margin-top: 8px; }
.notes__status { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }

@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
  .widget--wide { grid-column: auto; }
  .shortcuts { grid-template-columns: 1fr; }
  .widget__hide { opacity: 1; }
}
