/* documents/editor.css — Invoice / Quotation / Receipt generators. Builds on /site.css (colours, buttons, cards). */

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

.bd-main { padding-top: 28px; }
.bd-head { margin-bottom: 18px; }
.bd-head h1 { margin-bottom: 8px; }

/* Invoice | Quotation | Receipt switch */
.bd-types { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.bd-types a { padding: 9px 18px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 15px; white-space: nowrap; }
.bd-types a:hover { background: var(--mint-soft); color: var(--ink); }
.bd-types a.on { background: var(--ink); color: #fff; }

/* Two columns: form | preview */
.bd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 22px; align-items: start; }

.bd-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px 20px; }
.bd-form .bd-card + .bd-card { margin-top: 14px; }
.bd-card h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.01em; }

.bd-f { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; min-width: 0; }
.bd-f > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bd-f > span em { font-style: normal; font-weight: 400; color: var(--faint); }
.bd-form input[type="text"], .bd-form input[type="date"], .bd-form select, .bd-form textarea {
    font: inherit; font-size: 15px; color: var(--ink); background: #fff; width: 100%;
    border: 1px solid #BFCAC5; border-radius: 8px; padding: 9px 11px; min-height: 42px;
}
.bd-form textarea { resize: vertical; line-height: 1.4; min-height: 42px; }
.bd-form select { appearance: auto; }
.bd-form input::placeholder, .bd-form textarea::placeholder { color: #8A9893; }
.bd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.bd-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.bd-half { max-width: calc(50% - 6px); }

.bd-hint { font-size: 13px; color: var(--faint); margin: 6px 0 0; }
.bd-link { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--mint-dark); text-decoration: underline; cursor: pointer; }
.bd-link:hover { color: var(--mint-ink); }

/* Logo */
.bd-logo { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.bd-logo-box { width: 96px; height: 64px; flex: none; border: 1.5px dashed var(--dash); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--faint); background: #FAFBFA; overflow: hidden; }
.bd-logo-box.has { border-style: solid; border-color: var(--line); background: #fff; }
.bd-logo-box.has span { display: none; }
.bd-logo-box img { max-width: 88px; max-height: 56px; object-fit: contain; }
.bd-file { position: relative; overflow: hidden; min-height: 40px; font-size: 14px; }
.bd-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bd-logo .bd-link { margin-left: 10px; }

/* Items: description on top, then Qty · Unit · Price · Amount (delivery note: Unit · Ordered · Delivered) */
.bd-item { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 30px; gap: 8px 10px; align-items: end; padding: 12px 0; border-top: 1px dashed var(--dash); }
.bd-item:first-child { border-top: 0; padding-top: 2px; }
.bd-item .bd-desc { grid-column: 1 / 5; grid-row: 1; }
.bd-item .bd-x { grid-column: 5; grid-row: 1; align-self: start; }
.bd-dn .bd-item { grid-template-columns: repeat(3, minmax(0, 1fr)) 30px; }
.bd-dn .bd-item .bd-desc { grid-column: 1 / 4; }
.bd-dn .bd-item .bd-x { grid-column: 4; }
.bd-item .bd-f { margin: 0; }
.bd-item .bd-f > span, .bd-amt span { font-size: 12px; font-weight: 600; color: var(--faint); }
.bd-item input { text-align: right; }
.bd-item .bd-unit input { text-align: left; }
.bd-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-family: 'IBM Plex Mono', monospace; font-size: 14px; min-width: 0; }
.bd-amt span { font-family: 'IBM Plex Sans', sans-serif; }
.bd-amt b { min-height: 42px; display: flex; align-items: center; white-space: nowrap; }
.bd-x { width: 30px; height: 42px; border: 0; background: none; color: var(--faint); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px; }
.bd-x:hover { color: var(--danger); background: #FBE9E7; }
.bd-add { margin-top: 10px; min-height: 40px; font-size: 14px; }
/* Tax name + rate on each item (empty = the default tax under Totals) */
.bd-item .bd-tn { grid-column: 1 / 3; }
.bd-item .bd-tr { grid-column: 3; }
.bd-item .bd-tn input { text-align: left; }
.bd-item .bd-tn input::placeholder, .bd-item .bd-tr input::placeholder { color: #A9B4AF; }

/* Totals summary in the form */
.bd-sum { margin: 6px 0 0; border-top: 1px dashed var(--dash); padding-top: 10px; }
.bd-sum div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 15px; }
.bd-sum dt { color: var(--muted); }
.bd-sum dd { margin: 0; font-family: 'IBM Plex Mono', monospace; }
.bd-sum .big { font-weight: 700; font-size: 17px; padding-top: 6px; }
.bd-sum .big dt { color: var(--ink); }

/* Colours */
.bd-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 42px; }
.bd-swatches button, .bd-custom { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.bd-swatches button[aria-checked="true"], .bd-custom.on { box-shadow: 0 0 0 2px var(--ink); }
.bd-custom { position: relative; overflow: hidden; background: conic-gradient(#e11d48, #f59e0b, #16a34a, #0ea5e9, #7c3aed, #e11d48); }
.bd-custom input { position: absolute; inset: -6px; width: 44px; height: 44px; opacity: 0; cursor: pointer; }

.bd-private { font-size: 14px; color: var(--faint); margin: 14px 2px 0; }

/* Preview */
.bd-preview { position: sticky; top: 14px; background: #E8EDEB; border: 1px solid var(--line); border-radius: 14px; padding: 14px; max-height: calc(100vh - 28px); overflow: auto; }
.bd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bd-actions .btn { min-height: 42px; font-size: 14px; padding: 0 14px; }
.bd-actions .btn.mint { flex: 1 1 160px; }
.bd-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bd-pages canvas { display: block; background: #fff; box-shadow: 0 6px 20px rgba(20, 32, 27, 0.14); border-radius: 2px; max-width: 100%; }
.bd-loading { color: var(--faint); padding: 60px 0; text-align: center; }
.bd-warn { background: #FFF6E5; color: #6B4A00; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.bd-mobilebar { display: none; }

/* Info sections under the tool */
.bd-block { margin-top: 48px; }
.bd-how { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bd-how li { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; color: var(--muted); font-size: 15px; }
.bd-how b { display: block; color: var(--ink); font-size: 16px; margin: 10px 0 4px; }
.bd-how .num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff; font-family: 'IBM Plex Mono', monospace; font-size: 14px; }
.bd-two { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.bd-ticks { list-style: none; padding: 0; margin: 0; }
.bd-ticks li { position: relative; padding: 6px 0 6px 28px; color: var(--ink-2); }
.bd-ticks li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 11px; height: 6px; border: solid var(--mint); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.bd-related ul { margin: 0; padding-left: 18px; color: var(--muted); }
.bd-related li + li { margin-top: 8px; }
.bd-related a { font-weight: 600; }
.bd-faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; max-width: 860px; }
.bd-faq details + details { margin-top: 10px; }
.bd-faq summary { cursor: pointer; font-weight: 600; }
.bd-faq p { margin: 10px 0 0; color: var(--muted); }

/* ---------- Tablets and phones: one column, switch between form and preview ---------- */
@media (max-width: 999px) {
    .bd-grid { grid-template-columns: 1fr; }
    .bd-grid[data-view="edit"] .bd-preview { display: none; }
    .bd-grid[data-view="preview"] .bd-form { display: none; }
    .bd-preview { position: static; max-height: none; padding: 10px; }
    .bd-actions #bd-download { display: none; }
    .bd-mobilebar { display: flex; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(20, 32, 27, 0.08); }
    .bd-mobilebar .btn { flex: 1; }
    body.bd-page { padding-bottom: 76px; }
    .bd-how { grid-template-columns: 1fr; }
    .bd-two { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .bd-main { padding-left: 16px; padding-right: 16px; }
    .bd-card { padding: 16px; }
    .bd-row { grid-template-columns: 1fr; }
    .bd-row-3 { grid-template-columns: 1fr 1fr; }
    .bd-row-3 > span:empty { display: none; }
    .bd-half { max-width: none; }
    .bd-types { display: flex; }
    .bd-types a { flex: 1; text-align: center; padding: 9px 8px; }

    .bd-item, .bd-dn .bd-item { grid-template-columns: repeat(3, minmax(0, 1fr)); position: relative; }
    .bd-item .bd-desc, .bd-dn .bd-item .bd-desc { grid-column: 1 / -1; padding-right: 34px; }
    .bd-item .bd-x, .bd-dn .bd-item .bd-x { position: absolute; top: 12px; right: -4px; }
    .bd-amt { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
    .bd-amt b { min-height: 0; }
}

/* ---------- Terms & conditions, signature option, delivery note items ---------- */
.bd-hint-top { margin: -4px 0 10px; }
.bd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bd-chip { font: inherit; font-size: 13px; text-align: left; color: var(--mint-ink); background: var(--mint-soft); border: 1px solid #CBE6DA; border-radius: 999px; padding: 5px 11px; cursor: pointer; line-height: 1.35; }
.bd-chip:hover { background: #D3ECE1; }
.bd-chip[disabled] { display: none; }
.bd-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; margin-top: 4px; }
.bd-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--mint); flex: none; }
.bd-check em { font-style: normal; color: var(--faint); font-size: 13px; }

@media (max-width: 560px) {
    .bd-long { display: none; }
    .bd-types a { font-size: 14px; padding: 9px 4px; }
}

/* ---------- Stage 1: logo tools ---------- */
.bd-logo-tools { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
#bd-logo-note:empty { display: none; }
#bd-logo-note { color: var(--mint-ink); margin-top: 4px; }
.bd-logo-tools .bd-link { margin-left: 0; }

/* Logged in: the "Saving to your account" bar above the form */
.bd-acct { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 10px 16px; margin-bottom: 18px; }
.bd-acct p { margin: 0; font-size: 14px; color: var(--muted); min-width: 0; }
.bd-acct p b { color: var(--ink); margin-right: 6px; }
.bd-acct-btns { display: flex; gap: 8px; }
.bd-acct-btns .btn { min-height: 38px; font-size: 14px; padding: 0 14px; }
#bd-sync.is-ok { color: var(--mint-ink); }
#bd-sync.is-warn { color: #8A5A00; }
#bd-sync .bd-link { font-size: 14px; }
@media (max-width: 560px) {
    .bd-acct-btns { width: 100%; }
    .bd-acct-btns .btn { flex: 1; }
}

/* Logged in: pick a saved customer / product while typing */
.bd-f { position: relative; }
.bd-pick { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(20, 32, 27, 0.16); padding: 6px; max-height: 320px; overflow-y: auto; }
.bd-pick-row { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--ink); }
.bd-pick-row b { font-weight: 600; overflow-wrap: anywhere; }
.bd-pick-row span { font-size: 13px; color: var(--muted); }
.bd-pick-row:hover, .bd-pick-row.on { background: var(--mint-soft); }
.bd-pick-foot { font-size: 12px; color: var(--faint); padding: 6px 10px 2px; border-top: 1px dashed var(--dash); margin-top: 4px; }

/* Logged in: stamp & signature */
.bd-mark { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.bd-mark-box { flex: 0 0 132px; height: 96px; border: 1px dashed var(--dash); border-radius: 10px; display: grid; place-items: center; color: var(--faint); font-size: 13px; overflow: hidden;
  background-color: #fff; background-image: linear-gradient(45deg, #F1F4F3 25%, transparent 25%), linear-gradient(-45deg, #F1F4F3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #F1F4F3 75%), linear-gradient(-45deg, transparent 75%, #F1F4F3 75%);
  background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; }
.bd-mark-box.has { border-style: solid; border-color: var(--line); }
.bd-mark-box.has > span { display: none; }
.bd-mark-box img { max-width: 92%; max-height: 88px; object-fit: contain; }
.bd-mark-side { flex: 1 1 auto; min-width: 0; }
.bd-mark-side .bd-hint { margin: 6px 0 0; }
.bd-mark-side .bd-check { margin-top: 8px; }
.bd-mark-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-mark-size { margin: 8px 0 0; max-width: 180px; }
.bd-pad { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 14px; background: #FAFBFA; }
.bd-pad canvas { display: block; width: 100%; height: 170px; background: #fff; border: 1px solid var(--line); border-radius: 10px; touch-action: none; cursor: crosshair;
  background-image: linear-gradient(transparent 128px, #C9D3CF 128px, #C9D3CF 129px, transparent 129px); }
.bd-pad-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.bd-pad-btns .btn { min-height: 40px; font-size: 14px; padding: 0 14px; }
.bd-pad-btns #bd-pad-done { margin-left: auto; }
.bd-pad-ink { display: inline-flex; gap: 6px; }
.bd-pad-ink button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.bd-pad-ink button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
@media (max-width: 480px) {
    .bd-mark-box { flex-basis: 104px; height: 84px; }
    .bd-pad-btns #bd-pad-done { margin-left: 0; width: 100%; }
}
.bd-maker .bd-row { margin-bottom: 0; }
.bd-maker-prev { display: flex; justify-content: center; margin: 4px 0 6px; }
.bd-maker-prev canvas { width: 200px; max-width: 100%; height: auto; border-radius: 10px;
  background-color: #fff; background-image: linear-gradient(45deg, #F1F4F3 25%, transparent 25%), linear-gradient(-45deg, #F1F4F3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #F1F4F3 75%), linear-gradient(-45deg, transparent 75%, #F1F4F3 75%);
  background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; }

/* Launch: Starter bar and "Free or Starter?" for visitors (lib.php) */
.bd-promo { border-color: var(--mint); background: #F3FBF7; }
.bd-promo p b { display: block; margin: 0 0 2px; }
.bd-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 1040px; align-items: stretch; }
.bd-compare .bd-card { display: flex; flex-direction: column; }
.bd-compare .bd-card.on { border-color: var(--mint); box-shadow: 0 0 0 1px var(--mint); }
.bd-compare h3 { margin: 0; font-size: 18px; }
.bd-price { margin: 4px 0 10px; font-size: 26px; font-weight: 700; color: var(--ink); }
.bd-price small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }
.bd-compare .bd-ticks { margin-bottom: 14px; }
.bd-compare .btn.block { width: 100%; margin-top: auto; }
.bd-small { margin: 8px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
/* Wide enough for three columns: every card shares the same rows, so prices, lists and buttons line up across cards */
@media (min-width: 641px) {
    .bd-compare { grid-template-rows: auto auto 1fr auto auto; }
    .bd-compare .bd-card { display: grid; grid-template-rows: subgrid; grid-row: span 5; }
}
@media (max-width: 640px) { .bd-compare { grid-template-columns: 1fr; max-width: 520px; } }

/* Duplicate number / PO warnings (saved accounts) */
.bd-dup { display: block; background: #FFF6E5; color: #6B4A00; border-radius: 8px; padding: 6px 10px; font-size: 13px; margin-top: 6px; line-height: 1.4; }
.bd-dup[hidden] { display: none; }
.bd-dup a { color: inherit; text-decoration: underline; }

/* watermark card */
#bd-wm .bd-row[hidden], #bd-wm .bd-f[hidden] { display: none; }

/* Logged in: the account menu above the generator, so there is always a way back (Home, Documents, Business details & look…) */
.bd-acctnav { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 0 4px; scrollbar-width: thin; }
.bd-acctnav a { flex: 0 0 auto; text-decoration: none; font-size: 14px; color: var(--ink, #14201B); background: #fff; border: 1px solid var(--line, #DCE3E0); border-radius: 999px; padding: 7px 13px; white-space: nowrap; }
.bd-acctnav a:first-child { background: var(--mint-soft, #E3F3EC); border-color: transparent; font-weight: 600; }
.bd-acctnav a:hover { border-color: var(--mint, #0E7C5A); }

/* Starter nudge under the Download / Print buttons (visitors only) */
.bd-upsell { margin: -2px 0 12px; font-size: 13.5px; line-height: 1.45; color: #3C4A44; background: #F3FBF7; border: 1px solid #CFE8DC; border-radius: 10px; padding: 9px 12px; }
.bd-upsell a { color: var(--mint-dark, #0B6B4E); font-weight: 600; }
.bd-upsell-form { display: none; margin: 14px 0 0; }
@media (max-width: 999px) { .bd-upsell-form { display: block; } .bd-grid[data-view="preview"] .bd-upsell-form { display: none; } }

/* "Remove date" beside an optional date */
.bd-clear { margin-left: 8px; font-size: 12.5px; font-weight: 500; }

/* ---------- Shorter forms on phones: jump bar, folded optional cards, tighter spacing ---------- */
.bd-jump { display: none; }
.bd-fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; min-height: 28px; }
.bd-fold > summary::-webkit-details-marker { display: none; }
.bd-fold > summary::after { content: ''; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; }
.bd-fold[open] > summary { margin-bottom: 12px; }
.bd-fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.bd-fold-t { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.bd-fold-t em { font-style: normal; font-weight: 400; color: var(--faint); font-size: 14px; }
.bd-fold-s { margin-left: auto; font-size: 13px; color: var(--faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.bd-fold[open] .bd-fold-s { display: none; }
.bd-form .bd-card { scroll-margin-top: 62px; }

@media (max-width: 999px) {
    .bd-jump { display: flex; gap: 8px; position: sticky; top: 0; z-index: 25; margin: 0 0 12px; padding: 8px 0; background: rgba(255, 255, 255, 0.97); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
    .bd-jump::-webkit-scrollbar { display: none; }
    .bd-jump button { flex: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--mint-ink); background: var(--mint-soft); border: 1px solid #CBE6DA; border-radius: 999px; padding: 7px 14px; min-height: 36px; cursor: pointer; }
    .bd-jump button.on { background: var(--mint); border-color: var(--mint); color: #fff; }
}
@media (max-width: 560px) {
    .bd-jump { margin: 0 -16px 10px; padding: 8px 16px; }
    .bd-card { padding: 14px; }
    .bd-form .bd-card + .bd-card { margin-top: 10px; }
    .bd-card h2 { margin-bottom: 8px; }
    .bd-f { margin-bottom: 9px; gap: 4px; }
    .bd-row { grid-template-columns: 1fr 1fr; gap: 0 10px; }
    .bd-row.bd-stack { grid-template-columns: 1fr; }
    .bd-row-3 { grid-template-columns: 1fr 1fr; }
    .bd-fold[open] > summary { margin-bottom: 8px; }
}
.bd-grid > .bd-form { min-width: 0; }
.bd-jump { min-width: 0; max-width: 100%; box-sizing: border-box; }
