:root {
  --ink: #121316; --ink-2: #3A3D44; --muted: #62666F; --faint: #9A9EA6; --field: #949390;
  --line: #E6E5E1; --line-2: #EFEEEA; --canvas: #F7F6F3; --surface: #FFFFFF; --hover: #F1F0EC;
  --brand: #4B44D6; --brand-soft: #EEEDFD; --ok: #12703F; --ok-soft: #E6F4EC; --warn: #B45309; --warn-soft: #FEF3E2; --err: #C2362B; --err-soft: #FDECEA;
  --r: 10px; --r-lg: 14px; --shadow: 0 1px 2px rgba(16,17,20,.05), 0 4px 16px rgba(16,17,20,.06);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden, [hidden] { display: none !important; }
.scaler { transform-origin: top left; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons & controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s; }
.btn:hover { background: var(--hover); }
.btn:focus-visible, .seg button:focus-visible, .input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #2A2C31; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.danger { color: var(--err); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.input, select.input { height: 36px; border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; background: var(--surface); width: 100%; }
.input:hover { border-color: var(--ink-2); }
textarea.input { height: auto; padding: 8px 10px; }
label.fl { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 6px; }
.seg { display: inline-flex; background: var(--hover); border-radius: 9px; padding: 3px; gap: 2px; width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; height: 28px; border-radius: 7px; font-size: 13px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #D5D4CF; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.color-in { display: flex; align-items: center; gap: 8px; border: 1px solid var(--field); border-radius: 8px; height: 36px; padding: 0 8px 0 4px; background: var(--surface); }
.color-in input[type=color] { width: 28px; height: 28px; border: 0; padding: 0; background: none; border-radius: 6px; cursor: pointer; }
.color-in input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-in input[type=color]::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.1); border-radius: 6px; }
.color-in input[type=text] { border: 0; outline: 0; width: 76px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; text-transform: uppercase; background: transparent; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 99px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.err { background: var(--err-soft); color: var(--err); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; }
.banner.warn { background: var(--warn-soft); color: #7A3E06; }
.banner.err { background: var(--err-soft); color: #8A231B; }
.banner.info { background: var(--brand-soft); color: #2F2A8F; }
.banner .i { margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
.eyebrow-app { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; background: var(--canvas); }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; padding: 6px 8px 14px; letter-spacing: -.02em; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); display: grid; place-items: center; }
.logo-mark::after { content: ''; width: 10px; height: 13px; background: #fff; border-radius: 2px 5px 2px 2px; box-shadow: 3px -3px 0 -1px var(--brand); }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--ink); }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.side .create { margin: 0 0 12px; width: 100%; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; }
.main { padding: 32px 40px 64px; max-width: 1180px; width: 100%; }
.page-title { font-size: 24px; font-weight: 650; }
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 36px 0 14px; }
.section-h h2 { font-size: 15px; font-weight: 600; }

.hero { padding: 28px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; overflow: hidden; position: relative; }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.hero p { color: var(--muted); margin: 10px 0 20px; font-size: 15px; max-width: 460px; }
.hero-steps { display: flex; gap: 10px; align-items: center; justify-content: center; }
.hs-card { background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 120px; font-size: 12px; font-weight: 500; }
.hs-card .mini { height: 92px; border-radius: 6px; background: #fff; border: 1px solid var(--line); margin-bottom: 8px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.hs-card .mini i { display: block; height: 5px; border-radius: 3px; background: #E4E3DF; }
.hs-arrow { color: var(--faint); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.doc-card { cursor: pointer; overflow: hidden; transition: box-shadow .15s, transform .15s; text-align: left; padding: 0; }
.doc-card:hover { box-shadow: var(--shadow); }
.doc-thumb { height: 190px; background: var(--hover); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); position: relative; }
.doc-thumb .thumb-scale { transform-origin: top center; position: absolute; top: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.doc-meta { padding: 12px 14px; }
.doc-meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.swatches { display: flex; }
.swatches span { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); margin-right: -6px; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.brand-type { font-size: 12.5px; color: var(--muted); }
.empty { padding: 36px; text-align: center; color: var(--muted); border: 1px dashed #D8D7D2; border-radius: var(--r-lg); background: transparent; }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; }
.tpl-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.tpl-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }

/* ---------- wizard ---------- */
.wiz { min-height: 100vh; display: flex; flex-direction: column; background: var(--canvas); }
.wiz-top { height: 60px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.wiz-top .ttl { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 8px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 1.5px solid #D5D4CF; }
.step.on { color: var(--ink); }
.step.on .n { border-color: var(--ink); background: var(--ink); color: #fff; }
.step.done { color: var(--ink-2); }
.step.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-line { width: 36px; height: 1.5px; background: #DEDDD8; }
.wiz-body { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 36px 32px 120px; }
.wiz-body.narrow { max-width: 720px; }
.wiz-foot { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; z-index: 5; }
.wiz-h { text-align: center; margin-bottom: 28px; }
.wiz-h h1 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }
.wiz-h p { color: var(--muted); margin: 8px 0 0; font-size: 15px; }

.drop { border: 1.5px dashed #CFCEC8; border-radius: var(--r-lg); background: var(--surface); padding: 48px 24px; text-align: center; transition: .15s; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--brand); background: #FBFBFF; }
.drop .ico { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.drop .ico svg.i { width: 22px; height: 22px; }
.drop b { font-size: 15px; display: block; }
.drop .or { color: var(--muted); margin: 6px 0 14px; font-size: 13.5px; }
.drop .hint { color: var(--muted); font-size: 12.5px; margin-top: 12px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.file-ico { width: 36px; height: 40px; border-radius: 6px; background: #FDECEA; color: #C2362B; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.file-ico.docx { background: #E8F0FE; color: #1A56DB; }
.stages { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.stages li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.stages li.done { color: var(--ink-2); }
.stages li.active { color: var(--ink); font-weight: 500; }
.st-ico { width: 18px; height: 18px; display: grid; place-items: center; flex: none; }
.st-ico .ring { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #D5D4CF; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #D9D8F7; border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.check { width: 18px; height: 18px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; color: #fff; }
.check svg.i { width: 11px; height: 11px; stroke-width: 3; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 22px 0 14px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.saved-brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick { padding: 12px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; }
.pick:hover { border-color: #CFCEC8; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 28px; align-items: start; }
.panel-card { padding: 18px 20px; }
.panel-card + .panel-card { margin-top: 14px; }
.panel-card h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.attr { display: grid; grid-template-columns: 110px 1fr 112px; gap: 12px; align-items: center; padding: 6px 0; }
.attr .k { font-size: 13px; color: var(--ink-2); }
.attr > .chip { justify-self: end; }
.attr.low .k::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-left: 6px; vertical-align: middle; }
.comp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.comp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; cursor: pointer; }
.comp input { accent-color: var(--ink); }
.comp .chip { margin-left: auto; }
.sticky-prev { position: sticky; top: 84px; }
.prev-frame { background: #ECEBE7; border-radius: var(--r-lg); padding: 20px; display: grid; place-items: center; overflow: hidden; }
.prev-frame .scaler { transform-origin: top left; box-shadow: 0 4px 24px rgba(0,0,0,.12); }
.ref-img { max-width: 100%; border-radius: 4px; box-shadow: 0 4px 24px rgba(0,0,0,.12); display: block; }

.tree { font-size: 13.5px; }
.tree-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; min-height: 38px; }
.tree-row:hover { background: var(--hover); }
.tree-row .txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.tree-row.lv1 .txt { font-weight: 600; color: var(--ink); }
.tree-row.lv2 .txt { font-weight: 500; color: var(--ink); }
.tree-row.amb { background: var(--warn-soft); }
.tree-row select { width: 130px; height: 28px; font-size: 12.5px; padding: 0 6px; border-radius: 7px; border: 1px solid var(--field); background: var(--surface); }
.type-tag { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); width: 58px; flex: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { padding: 12px 14px; }
.stat b { font-size: 20px; font-weight: 650; display: block; }
.stat span { font-size: 12px; color: var(--muted); }

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card { padding: 18px; cursor: pointer; text-align: left; position: relative; transition: .12s; display: flex; flex-direction: column; justify-content: flex-start; }
.mode-card:hover { border-color: #CFCEC8; }
.mode-card.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.mode-card .radio { position: absolute; top: 16px; right: 16px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #CFCEC8; }
.mode-card.on .radio { border: 5px solid var(--ink); }
.mode-card b { display: block; font-size: 15px; margin: 12px 0 4px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 13px; }
.mode-card .best { margin-top: 10px; font-size: 12px; color: var(--muted); }
.mode-illo { height: 110px; border-radius: 9px; background: var(--canvas); display: flex; gap: 8px; align-items: center; justify-content: center; }
.mode-illo .pgm { width: 62px; height: 86px; background: #fff; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.1); padding: 7px; display: flex; flex-direction: column; gap: 4px; }
.mode-illo .pgm i { height: 3px; border-radius: 2px; background: #E1E0DC; display: block; }
.mode-illo .pgm i.h { background: var(--mi-p, #102A43); height: 5px; width: 60%; }
.mode-illo .pgm.cv { background: var(--mi-p, #102A43); }
.mode-illo .pgm.cv i { background: rgba(255,255,255,.35); }
.mode-illo .pgm.cv i.a { background: var(--mi-a, #D4A72C); width: 30%; height: 3px; margin-top: 30px; }
.summary { padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.opt-row:first-child { border-top: 0; }

/* generation */
.gen { min-height: 100vh; display: grid; place-items: center; background: var(--canvas); padding: 24px; }
.gen-card { width: 440px; max-width: 100%; padding: 30px; }
.gen-card h2 { font-size: 20px; font-weight: 650; }
.gen-card .stages { margin-top: 22px; gap: 12px; }
.gen-card .stages li { font-size: 14px; }
.gen-card .stages li .sub { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.gen-pages { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; min-height: 42px; }
.gen-pages span { width: 28px; height: 38px; border-radius: 3px; background: #fff; border: 1px solid var(--line); animation: pop .25s ease-out; position: relative; overflow: hidden; }
.gen-pages span::before { content: ''; position: absolute; left: 4px; right: 8px; top: 6px; height: 3px; background: var(--gp, #102A43); border-radius: 2px; }
.gen-pages span::after { content: ''; position: absolute; left: 4px; right: 4px; top: 13px; height: 16px; background: repeating-linear-gradient(#E4E3DF 0 2px, transparent 2px 5px); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- review ---------- */
.rv { height: 100vh; display: grid; grid-template-rows: 56px 1fr; }
.rv-top { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.rv-top .title-in { border: 1px solid transparent; background: transparent; font-weight: 600; font-size: 15px; height: 32px; padding: 0 8px; border-radius: 7px; width: 320px; max-width: 34vw; }
.rv-top .title-in:hover { border-color: var(--line); }
.rv-top .title-in:focus { border-color: var(--brand); outline: 0; }
.rv-main { display: grid; grid-template-columns: 168px minmax(0, 1fr) 316px; min-height: 0; }
.thumbs { border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 12px; background: var(--canvas); }
.thumbs .lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 4px 10px; display: flex; justify-content: space-between; }
.thumb { display: block; width: 100%; border: 0; background: none; padding: 6px; border-radius: 10px; margin-bottom: 4px; }
.thumb:hover { background: var(--hover); }
.thumb.on { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); }
.thumb .tbox { position: relative; margin: 0 auto; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.12); background: #fff; }
.thumb .tbox .scaler { transform-origin: top left; pointer-events: none; }
.thumb .tmeta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 6px; padding: 0 2px; color: var(--muted); }
.thumb .regen { position: absolute; inset: 0; background: rgba(255,255,255,.75); display: grid; place-items: center; }
.st-ok { color: var(--ok); } .st-warn { color: var(--warn); }
.canvas { overflow: auto; background: #E9E8E4; position: relative; }
.canvas-inner { padding: 28px 28px 80px; display: flex; flex-direction: column; align-items: center; }
.canvas .scaler { transform-origin: top left; box-shadow: 0 6px 30px rgba(0,0,0,.14); }
.canvas-bar { position: sticky; bottom: 16px; margin: 0 auto; width: max-content; display: flex; align-items: center; gap: 4px; background: var(--ink); color: #fff; border-radius: 12px; padding: 5px; box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 3; }
.canvas-bar .icon-btn { color: #C8CAD0; }
.canvas-bar .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.canvas-bar .pn { font-size: 13px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.canvas-bar select { background: transparent; color: #fff; border: 0; font-size: 13px; padding: 0 6px; height: 30px; }
.canvas-bar select option { color: var(--ink); }
.canvas-bar .sep { width: 1px; height: 18px; background: rgba(255,255,255,.2); margin: 0 4px; }
.rpanel { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 8px 10px 10px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .badge { font-size: 11px; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 0 6px; font-weight: 600; }
.rp-body { overflow-y: auto; padding: 4px 16px 24px; flex: 1; }
.grp { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.grp:last-child { border-bottom: 0; }
.grp-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.grp-h button { text-transform: none; letter-spacing: 0; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fld + .fld { margin-top: 12px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13.5px; }
.warn-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 10px; }
.warn-item.info { border-color: var(--line); }
.warn-item .wt { font-size: 13px; margin: 6px 0 10px; color: var(--ink-2); }
.warn-item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 5px 0; }
.check-row .x { width: 18px; height: 18px; border-radius: 50%; background: var(--err); color: #fff; display: grid; place-items: center; flex: none; }
.sel-card { padding: 12px; border-radius: 10px; background: var(--canvas); font-size: 13px; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(18,19,22,.4); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal { width: 440px; max-width: 100%; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { font-size: 17px; font-weight: 650; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; gap: 8px; align-items: center; animation: fade .2s; max-width: 90vw; }

/* ======================================================================
   Document pages (rendered + measured by the layout engine)
   ====================================================================== */
.pg { width: var(--pw); height: var(--ph); background: var(--bg); color: var(--tx); position: relative; overflow: hidden; font-family: var(--bf); font-size: var(--fs); line-height: var(--lh); -webkit-print-color-adjust: exact; print-color-adjust: exact; text-align: left; }
.pg-body { position: absolute; top: var(--m); bottom: var(--m); left: var(--m); right: var(--m); overflow: hidden; }
.pg-head { position: absolute; top: calc(var(--m) * .42); left: var(--m); right: var(--m); display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; color: var(--sec); gap: 16px; transform: translateY(-50%); }
.pg-head.logo-right { flex-direction: row-reverse; }
.pg-head.logo-center { justify-content: center; }
.pg-head.logo-center .ph-title { display: none; }
.pg-head .ph-title { letter-spacing: .02em; }
.pg-foot { position: absolute; bottom: calc(var(--m) * .42); left: var(--m); right: var(--m); display: flex; justify-content: space-between; font-size: 10px; color: var(--sec); transform: translateY(50%); border-top: 1px solid var(--bd); padding-top: 8px; }
.wordmark { display: inline-flex; align-items: center; gap: .45em; font-family: var(--hf); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.wordmark i { background: var(--a); border-radius: 22% 50% 22% 22%; display: inline-block; }
.logo-img { display: block; object-fit: contain; }

.b { padding-top: calc(.8em * var(--gap)); }
.b.first { padding-top: 0 !important; }
.b p { margin: 0; }
.b-title { padding-top: 0; }
.t-title { font-family: var(--hf); font-size: 2.6em; line-height: 1.1; color: var(--p); font-weight: 700; margin: 0; letter-spacing: -.02em; padding-bottom: .15em; }
.b-subtitle { padding-top: calc(.4em * var(--gap)); }
.t-sub { font-size: 1.15em; color: var(--sec); padding-bottom: 1.2em; border-bottom: 3px solid var(--a); }
.b-h1 { padding-top: calc(2em * var(--gap)); }
.b-h2 { padding-top: calc(1.5em * var(--gap)); }
.b-h3 { padding-top: calc(1.2em * var(--gap)); }
.h { font-family: var(--hf); color: var(--p); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.h1 { font-size: 1.75em; font-weight: 700; }
.h2 { font-size: 1.28em; font-weight: 650; }
.h3 { font-size: 1.08em; font-weight: 650; color: var(--tx); }
.h-num { color: var(--a); margin-right: .45em; font-variant-numeric: tabular-nums; }
.hs-underline .h1 { padding-bottom: .3em; border-bottom: 2px solid var(--a); }
.hs-underline .h2 { padding-bottom: .2em; border-bottom: 1px solid var(--bd); }
.hs-band .h1 { background: var(--p); color: var(--on-p); padding: .35em .55em; border-radius: 3px; }
.hs-band .h2 { border-left: 4px solid var(--a); padding-left: .55em; }
.eyebrow { font-size: .78em; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--a); margin-bottom: .6em; font-family: var(--bf); }
.synth .b-h1 { padding-top: calc(1.2em * var(--gap)); }
.synth .b-h1.first::before { content: ''; display: block; width: 48px; height: 4px; background: var(--a); margin-bottom: 1.2em; }
.synth .h1 { font-size: 2.1em; padding-bottom: .5em; }
.b ul, .b ol { margin: 0; padding-left: 1.4em; }
.b li + li { margin-top: .3em; }
.b li::marker { color: var(--a); font-weight: 600; }
.cap { font-size: .86em; color: var(--sec); font-weight: 600; }
.b-caption + .b-table { padding-top: .5em; }
.callout { background: var(--p-soft); border-left: 4px solid var(--a); padding: .9em 1.1em; border-radius: 2px 6px 6px 2px; color: var(--p); font-weight: 500; }
blockquote { margin: 0; padding: .3em 0 .3em 1.2em; border-left: 3px solid var(--a); font-family: var(--hf); font-size: 1.18em; line-height: 1.45; color: var(--p); font-style: italic; }
blockquote cite { display: block; font-style: normal; font-family: var(--bf); font-size: .72em; color: var(--sec); margin-top: .6em; }
figure { margin: 0; }
figure img { max-width: 100%; display: block; }
figcaption { font-size: .85em; color: var(--sec); margin-top: .4em; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92em; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-weight: 650; padding: .55em .7em; font-size: .92em; }
.tbl td { padding: .5em .7em; }
.tbl td.num, .tbl th:not(:first-child) { text-align: right; }
.tbl.compact { font-size: .74em; }
.tbl.compact th, .tbl.compact td { padding: .45em .45em; }
.ts-striped .tbl th { background: var(--p); color: var(--on-p); }
.ts-striped .tbl tbody tr:nth-child(even) td { background: var(--p-soft); }
.ts-striped .tbl tr.total td { font-weight: 700; border-top: 2px solid var(--p); background: transparent; }
.ts-lined .tbl th { color: var(--p); border-bottom: 2px solid var(--p); }
.ts-lined .tbl td { border-bottom: 1px solid var(--bd); }
.ts-lined .tbl tr.total td { font-weight: 700; border-bottom: 2px solid var(--p); }
.ts-minimal .tbl th { color: var(--sec); font-size: .8em; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--tx); }
.ts-minimal .tbl tr.total td { font-weight: 700; border-top: 1px solid var(--tx); }
.tbl-cont { font-size: .78em; color: var(--sec); text-align: right; margin-top: .3em; font-style: italic; }
.b.cont .tbl-cont { display: none; }

/* template pages: the reference page (copy removed) is the background; new copy sits in its slots */
.pg.tpl { background: #fff; }
.pg-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.slot { position: absolute; margin: 0; white-space: normal; overflow-wrap: break-word; letter-spacing: 0; }
.tscale .b { padding-top: var(--pgap); }
.tscale .b-h1 { padding-top: var(--hgap); }
.tscale .b-h2, .tscale .b-h3 { padding-top: calc(var(--hgap) * .8); }
.tscale .b-caption, .tscale .b-subtitle { padding-top: calc(var(--pgap) * .6); }
.tscale .h { letter-spacing: 0; line-height: 1.2; }
.tscale .h1 { font-size: var(--h1s); color: var(--h1c); font-weight: var(--h1w); text-transform: var(--h1t); font-style: var(--h1i); }
.tscale .h2 { font-size: var(--h2s); color: var(--h2c); font-weight: var(--h2w); text-transform: var(--h2t); font-style: var(--h2i); font-family: var(--h2f); }
.tscale .h3 { font-size: calc(var(--fs) * 1.08); color: var(--h2c); font-family: var(--h2f); }
.tscale .t-title { font-size: calc(var(--h1s) * 1.3); color: var(--h1c); }

/* cover */
.pg.cover { background: var(--p); color: var(--on-p); }
.cv-top { position: absolute; top: var(--m); left: var(--m); right: var(--m); display: flex; }
.cv-top.logo-center { justify-content: center; }
.cv-top.logo-right { justify-content: flex-end; }
.cv-mid { position: absolute; left: var(--m); right: calc(var(--m) * 1.6); top: 38%; }
.cv-bar { width: 64px; height: 6px; background: var(--a); margin-bottom: 28px; }
.cv-title { font-family: var(--hf); font-size: 48px; line-height: 1.06; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.cv-sub { font-size: 17px; opacity: .8; margin: 18px 0 0; line-height: 1.45; }
.cv-foot { position: absolute; bottom: var(--m); left: var(--m); right: var(--m); display: flex; justify-content: space-between; font-size: 12px; opacity: .75; border-top: 1px solid currentColor; padding-top: 12px; }
.cv-shape { position: absolute; right: -120px; top: -120px; width: 360px; height: 360px; border-radius: 50%; border: 56px solid var(--a); opacity: .9; }

/* interactive affordances inside review canvas only */
.canvas .pg .b { cursor: pointer; }
.canvas .pg .b:hover { outline: 1px dashed rgba(75,68,214,.5); outline-offset: 3px; }
.canvas .pg .b.sel { outline: 2px solid var(--brand); outline-offset: 3px; }
.canvas .pg .b.warn { outline: 2px solid rgba(217,119,6,.65); outline-offset: 3px; }

/* print: only the pages */
#print-root { display: none; }
@media print {
  body { background: #fff; }
  #app, .toast, .modal-bg { display: none !important; }
  #print-root { display: block; }
  #print-root .pg { break-after: page; page-break-after: always; box-shadow: none; }
  #print-root .pg:last-child { break-after: auto; page-break-after: auto; }
}

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .sticky-prev { position: static; }
  .rv-main { grid-template-columns: 120px minmax(0, 1fr) 280px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .nav { display: flex; gap: 4px; }
  .side-foot, .side .create { display: none; }
  .main { padding: 20px 16px 48px; }
  .hero { grid-template-columns: 1fr; }
  .hero-steps { display: none; }
  .mode-cards, .summary, .stats { grid-template-columns: 1fr 1fr; }
  .rv-main { grid-template-columns: 1fr; }
  .thumbs, .rpanel { display: none; }
  .wiz-top .stepper .step span.lbl { display: none; }
}

/* page templates (brand review) */
.tpl-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.tpl-pg { border: 1px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; background: var(--surface); transition: .12s; }
.tpl-pg:hover { border-color: #CFCEC8; }
.tpl-pg.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.tpl-img { position: relative; border-radius: 4px; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tpl-img img { display: block; width: 100%; }
.tpl-img .regen { position: absolute; inset: 0; background: rgba(255,255,255,.7); display: grid; place-items: center; }
.tpl-pg select { width: 100%; margin-top: 6px; height: 26px; font-size: 11.5px; border: 1px solid var(--field); border-radius: 6px; background: var(--surface); padding: 0 4px; }
.slot-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.slot-row + .slot-row { border-top: 1px solid var(--line-2); }
.slot-row.swap { background: var(--brand-soft); }
.slot-row .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.slot-row select { width: 150px; flex: none; height: 28px; font-size: 12.5px; border: 1px solid var(--field); border-radius: 7px; background: var(--surface); padding: 0 6px; }
.link-btn { color: var(--brand); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.compare { display: flex; gap: 12px; align-items: flex-start; }
.cmp-l { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.shadow { box-shadow: 0 4px 24px rgba(0,0,0,.12); }
.brand-pages { display: flex; gap: 6px; }
.brand-pages img { width: calc(25% - 5px); border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.tscale .cap, .tscale figcaption { color: var(--h2c); }
.tscale blockquote cite, .tpl .tbl-cont { color: var(--tx); opacity: .75; }

/* in-place editor */
.canvas-inner { position: relative; }
.etb { position: absolute; z-index: 4; display: flex; align-items: center; gap: 2px; background: var(--ink); color: #fff; border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.25); white-space: nowrap; animation: fade .12s; }
.etb button { width: 30px; height: 30px; border: 0; background: transparent; color: #D6D8DD; border-radius: 7px; display: grid; place-items: center; font-size: 14px; }
.etb button:hover { background: rgba(255,255,255,.12); color: #fff; }
.etb button.on { background: rgba(255,255,255,.2); color: #fff; }
.etb button.danger:hover { background: var(--err); }
.etb button[disabled] { opacity: .35; pointer-events: none; }
.etb select { height: 30px; background: transparent; color: #fff; border: 0; font-size: 13px; padding: 0 4px; border-radius: 7px; cursor: pointer; }
.etb select:hover { background: rgba(255,255,255,.12); }
.etb select option { color: var(--ink); }
.etb .sep { width: 1px; height: 18px; background: rgba(255,255,255,.2); margin: 0 4px; }
.etb-lbl { font-size: 12.5px; padding: 0 8px; color: #D6D8DD; }
.etb-menu-wrap { position: relative; display: inline-flex; }
.etb-menu { position: absolute; top: 38px; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px; min-width: 170px; z-index: 5; }
.etb .etb-menu button { width: 100%; display: flex; justify-content: flex-start; color: var(--ink); padding: 0 10px; height: 32px; font-size: 13px; }
.etb .etb-menu button:hover { background: var(--hover); color: var(--ink); }
.canvas .pg .editing { outline: 2px solid var(--brand) !important; outline-offset: 2px; border-radius: 1px; cursor: text; caret-color: var(--brand); }
.canvas .pg .b.sel [data-ed]:empty::before, .canvas .pg .editing:empty::before { content: 'Type something…'; color: #9AA0A8; font-weight: 400; }
.canvas.is-editing .pg-body { overflow: visible; }
.canvas .pg [data-edit] { cursor: text; }
.canvas .pg [data-edit]:hover:not(.editing) { outline: 1px dashed rgba(75,68,214,.7); outline-offset: 3px; }
.canvas .pg .b.sel [data-ed] { cursor: text; }
.canvas .pg .cell-sel { box-shadow: inset 0 0 0 2px var(--brand); }
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.act-grid .btn { justify-content: flex-start; }
.kbd-list div { padding: 3px 0; }
kbd { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--ink-2); }
.fr-res { margin-top: 14px; max-height: 220px; overflow: auto; }
.fr-hit { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 6px; border-radius: 7px; font-size: 13px; }
.fr-hit:hover { background: var(--hover); }
.fr-hit .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-hit mark { background: #FDE68A; border-radius: 2px; }

/* export */
.fmt-cards { display: grid; gap: 10px; }
.fmt-card { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; cursor: pointer; transition: .12s; }
.fmt-card:hover { border-color: #CFCEC8; }
.fmt-card.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.fmt-card b { display: block; margin-bottom: 2px; }
.fmt-card .radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #CFCEC8; flex: none; }
.fmt-card.on .radio { border: 5px solid var(--ink); }
.fmt-ico { width: 40px; height: 48px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.fmt-ico.pdf { background: #FDECEA; color: #C2362B; }
.fmt-ico.docx { background: #E8F0FE; color: #1A56DB; }
.ex-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 9px; background: var(--brand-soft); color: #2F2A8F; font-size: 13.5px; }

/* manual edit */
.b.has-mt { padding-top: var(--mt) !important; }
.ov { position: absolute; z-index: 3; box-sizing: border-box; }
.ov-img img { width: 100%; height: 100%; display: block; }
.ov-text > div { white-space: pre-wrap; overflow-wrap: break-word; }
.canvas .pg .ov { cursor: move; }
.canvas .pg .ov:hover, .canvas .pg .slot:hover { outline: 1px dashed rgba(75,68,214,.7); outline-offset: 2px; }
.canvas .pg .ov.sel, .canvas .pg .slot.sel { outline: 2px solid var(--brand); outline-offset: 2px; }
.canvas .pg .slot { cursor: move; }
.canvas .pg .slot.editing, .canvas .pg .ov .editing { cursor: text; }
.canvas .pg img[data-img] { cursor: pointer; }
.ov-h { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--brand); border-radius: 3px; z-index: 5; }
.ov-h.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ov-h.e { right: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.ins-sec { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.ins-sec:last-child { border-bottom: 0; }
.ins-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.ins-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.ins-row > span:first-child { color: var(--ink-2); }
.ins-range { display: flex; align-items: center; gap: 8px; }
.ins-range input[type=range] { flex: 1; }
.ins-range .v { width: 46px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ins-num { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: var(--surface); }
.ins-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ins-2 label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.tog { display: inline-flex; gap: 4px; }
.tog button { width: 32px; height: 30px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; display: grid; place-items: center; }
.tog button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.clr-x { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0 2px; }
.clr-x:hover { color: var(--ink); text-decoration: underline; }
.ins-text { width: 100%; min-height: 84px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; resize: vertical; background: var(--surface); }
.img-prev { width: 100%; max-height: 140px; object-fit: contain; border-radius: 6px; background: var(--canvas); border: 1px solid var(--line); display: block; }
.canvas-bar .add-btn { display: inline-flex; gap: 6px; align-items: center; width: auto; padding: 0 10px; font-size: 13px; }

/* ======================================================================
   Editor v2 — edit mode, selection layer, contextual toolbar, popovers, inspector
   ====================================================================== */
/* old in-page outlines are replaced by the selection layer */
.canvas .pg .b:hover, .canvas .pg .b.sel, .canvas .pg .ov:hover, .canvas .pg .ov.sel, .canvas .pg .slot:hover, .canvas .pg .slot.sel, .canvas .pg [data-edit]:hover:not(.editing) { outline: none; }
.canvas .pg .b.warn { outline: 2px solid rgba(217,119,6,.55); outline-offset: 3px; }
.canvas:not(.mode-edit) .pg .b, .canvas:not(.mode-edit) .pg .slot, .canvas:not(.mode-edit) .pg .ov, .canvas:not(.mode-edit) .pg [data-edit] { cursor: pointer; }
.canvas.mode-edit .pg .b, .canvas.mode-edit .pg [data-edit] { cursor: default; }
.canvas.mode-edit .pg .ov, .canvas.mode-edit .pg .slot[data-sid] { cursor: move; }
.canvas.mode-edit .pg .editing { cursor: text; }
.canvas .pg .editing { outline: none !important; }
.canvas .pg .cell-sel { box-shadow: inset 0 0 0 2px var(--brand); }

.mode-seg .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.mode-seg .seg button svg.i { width: 13px; height: 13px; }
.edit-pill { display: none; position: sticky; top: 12px; z-index: 6; margin: 12px auto -44px; width: max-content; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; }
.edit-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.edit-pill .muted { font-weight: 400; }
.edit-pill .btn { border-radius: 99px; height: 28px; }
.canvas.mode-edit .edit-pill { display: flex; }
.canvas.mode-edit { background: #E3E2DE; }
.canvas.mode-edit .canvas-inner { padding-top: 64px; }

#sel-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
#sel-layer button, #sel-layer .sel-h, #sel-layer .ctxbar { pointer-events: auto; }
.sel-frame, .hov-frame { position: absolute; box-sizing: border-box; border-radius: 2px; }
.sel-frame { border: 1.5px solid var(--brand); margin: -3px 0 0 -3px; padding: 3px; box-sizing: content-box; }
.sel-frame.is-typing { border-width: 2px; }
.hov-frame { border: 1px solid rgba(75,68,214,.55); margin: -3px 0 0 -3px; padding: 3px; box-sizing: content-box; }
.sel-chip, .hov-chip { position: absolute; left: -1.5px; top: -22px; height: 19px; padding: 0 7px; border-radius: 5px 5px 5px 0; font-size: 11px; font-weight: 600; line-height: 19px; white-space: nowrap; }
.sel-chip { background: var(--brand); color: #fff; }
.hov-chip { background: rgba(75,68,214,.12); color: var(--brand); top: -21px; }
.sel-h { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--brand); border-radius: 2px; }
.h-nw { left: -5px; top: -5px; cursor: nwse-resize; } .h-n { left: calc(50% - 4.5px); top: -5px; cursor: ns-resize; } .h-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.h-e { right: -5px; top: calc(50% - 4.5px); cursor: ew-resize; } .h-se { right: -5px; bottom: -5px; cursor: nwse-resize; } .h-s { left: calc(50% - 4.5px); bottom: -5px; cursor: ns-resize; }
.h-sw { left: -5px; bottom: -5px; cursor: nesw-resize; } .h-w { left: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.sel-rail { position: absolute; display: flex; flex-direction: column; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.sel-rail button { width: 28px; height: 28px; border: 0; background: none; border-radius: 7px; display: grid; place-items: center; color: var(--ink-2); }
.sel-rail button:hover { background: var(--hover); color: var(--ink); }
.sel-rail button.danger:hover { background: var(--err-soft); color: var(--err); }
.sel-rail svg.i { width: 15px; height: 15px; }
.sel-plus { position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.sel-plus:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.sel-plus svg.i { width: 14px; height: 14px; }

.ctxbar { position: absolute; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 6px 22px rgba(16,17,20,.12); white-space: nowrap; animation: fade .12s; }
.ctxbar button { height: 30px; min-width: 30px; padding: 0 7px; border: 0; background: none; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; color: var(--ink-2); }
.ctxbar button:hover { background: var(--hover); color: var(--ink); }
.ctxbar button.on { background: var(--ink); color: #fff; }
.ctxbar button.off { opacity: .35; pointer-events: none; }
.ctxbar button.txt { font-weight: 500; }
.ctxbar button.dd svg.i:last-child { width: 12px; height: 12px; opacity: .6; }
.ctxbar button b, .ctxbar button i { font-size: 14px; }
.ctxbar .fnt { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.ctxbar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.ctxbar .stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; height: 28px; margin: 0 2px; }
.ctxbar .stepper button { height: 26px; min-width: 22px; padding: 0; font-size: 15px; }
.ctxbar .stepper input { width: 38px; border: 0; text-align: center; font-size: 13px; background: none; -moz-appearance: textfield; }
.ctxbar .stepper input::-webkit-inner-spin-button { display: none; }
.swatch { width: 18px; height: 18px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); flex: none; }
.swatch.fill { border-radius: 4px; background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%), linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%); background-size: 8px 8px; background-position: 0 0, 4px 4px; }
.swatch.fill[style*="background:#"], .swatch.fill[style*="background: #"] { background-image: none; }

.pop { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(16,17,20,.18); padding: 6px; max-height: min(460px, 70vh); overflow: auto; animation: fade .1s; font-size: 13px; }
.pop-h { font-weight: 600; font-size: 13px; padding: 6px 8px 8px; display: flex; justify-content: space-between; }
.pop-sub { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 8px 4px; }
.pop-foot { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 4px 2px; border-top: 1px solid var(--line-2); margin-top: 8px; }
.pop .color-in { margin: 2px 6px 4px; }
.pop-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; margin: 2px 2px 4px; height: 34px; color: var(--muted); }
.pop-search input { border: 0; outline: 0; flex: 1; background: none; font-size: 13px; }
.sw-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 8px 4px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); cursor: pointer; }
.sw:hover { transform: scale(1.08); }
.sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.font-list { max-height: 320px; overflow: auto; }
.font-opt, .menu-i { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 14px; color: var(--ink); }
.font-opt:hover, .menu-i:hover { background: var(--hover); }
.font-opt.on, .menu-i.on { color: var(--brand); }
.font-opt svg.i, .menu-i svg.i { width: 14px; height: 14px; color: var(--brand); }
.menu-i { font-size: 13.5px; }
.menu-i kbd { font-size: 10.5px; }
.menu-i.danger { color: var(--err); }
.menu-sep { height: 1px; background: var(--line-2); margin: 4px 6px; }
.menu-sep + .menu-sep, .menu-sep:first-child, .menu-sep:last-child { display: none; }
.seg-ico { display: inline-flex; gap: 2px; background: var(--hover); border-radius: 9px; padding: 3px; }
.seg-ico button { width: 32px; height: 28px; border: 0; background: none; border-radius: 7px; display: grid; place-items: center; color: var(--muted); position: relative; }
.seg-ico button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.seg-ico.sm button { width: 30px; height: 26px; }
.jst-ico svg path { d: path("M4 6h16M4 10h16M4 14h16M4 18h16"); }
.pop-row { display: grid; grid-template-columns: 78px 1fr 52px 18px; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12.5px; color: var(--ink-2); }
.pop-row input[type=range] { width: 100%; }
.pop-row .mini { width: 52px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; background: var(--surface); }
.pop-row em, .pop-row .v { font-style: normal; color: var(--muted); font-size: 11.5px; }
.pop-row:has(.v) { grid-template-columns: 78px 1fr 40px; }
.pop-ins .ins-list { max-height: 360px; overflow: auto; }
.ins-i { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 6px 8px; border-radius: 8px; }
.ins-i:hover, .ins-i:focus-visible { background: var(--hover); outline: 0; }
.ins-i b { display: block; font-size: 13px; font-weight: 500; }
.ins-i small { display: block; font-size: 11.5px; color: var(--muted); }
.ins-ic { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); flex: none; background: var(--surface); }
.ins-ic svg.i { width: 15px; height: 15px; }
.ratio-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; }
.ratio-row button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 4px 6px; font-size: 11px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ratio-row button.on { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.ratio-row .rt { width: 22px; max-height: 22px; border: 1.5px solid currentColor; border-radius: 2px; }
.focal { position: relative; margin: 4px; border-radius: 8px; overflow: hidden; cursor: crosshair; touch-action: none; }
.focal img { display: block; width: 100%; opacity: .9; }
.focal-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--brand), 0 2px 6px rgba(0,0,0,.3); background: rgba(75,68,214,.35); pointer-events: none; }

/* inspector */
.rp-body.insp { padding: 0 0 24px; }
.ins-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.ins-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.ins-head .crumb { font-size: 11.5px; color: var(--muted); }
.ins-head b { font-size: 14px; }
.ins-head .icon-btn.danger:hover { color: var(--err); background: var(--err-soft); }
.style-pill { display: flex; align-items: center; gap: 6px; margin: 12px 14px 0; padding: 8px 8px 8px 10px; border-radius: 9px; background: var(--canvas); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.style-pill b { color: var(--ink); font-weight: 600; }
.isec { border-bottom: 1px solid var(--line-2); }
.isec-h { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 12px 14px; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; text-align: left; }
.isec-h svg.i { width: 13px; height: 13px; transition: transform .15s; color: var(--faint); }
.isec.closed .isec-h svg.i { transform: rotate(-90deg); }
.isec-b { padding: 0 14px 14px; }
.isec.closed .isec-b { display: none; }
.irow { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.irow:first-child { margin-top: 0; }
.igrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; align-items: center; }
.nf { display: flex; align-items: center; height: 32px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface); overflow: hidden; }
.nf:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.nf .scrub { padding: 0 6px 0 9px; font-size: 11.5px; color: var(--muted); cursor: ew-resize; user-select: none; height: 100%; display: flex; align-items: center; min-width: 26px; }
.nf .scrub:hover { color: var(--brand); }
.nf input { flex: 1; min-width: 0; border: 0; outline: 0; height: 100%; font-size: 13px; background: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.nf input::-webkit-inner-spin-button { display: none; }
.nf em { font-style: normal; font-size: 11px; color: var(--muted); padding-right: 8px; }
body.scrubbing, body.scrubbing * { cursor: ew-resize !important; user-select: none; }
.ff, .cf { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 8px 0 10px; font-size: 13px; text-align: left; }
.ff:hover, .cf:hover { border-color: #CFCEC8; }
.ff > span:first-child { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff svg.i { width: 12px; height: 12px; color: var(--faint); }
.cf { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.cf-x { color: var(--muted); font-family: var(--font); font-size: 15px; padding: 0 2px; }
.cf-x:hover { color: var(--ink); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.img-card { border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#EEE 0 25%, #FFF 0 50%) 0 0/12px 12px; border: 1px solid var(--line); margin-bottom: 8px; }
.img-card img { display: block; width: 100%; max-height: 160px; object-fit: contain; }
.sbox { position: relative; border: 1px dashed #CFCEC8; border-radius: 8px; background: var(--canvas); height: 116px; margin-top: 2px; }
.sb-lbl { position: absolute; left: 8px; top: 6px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sb-inner { position: absolute; left: 62px; right: 62px; top: 38px; bottom: 38px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.sb-in { position: absolute; width: 44px; height: 24px; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.sb-in::-webkit-inner-spin-button { display: none; }
.sb-in:hover, .sb-in:focus { border-color: var(--line); background: var(--surface); outline: 0; }
.sb-t { left: calc(50% - 22px); top: 9px; } .sb-b { left: calc(50% - 22px); bottom: 9px; }
.sb-l { left: 10px; top: calc(50% - 12px); } .sb-r { right: 10px; top: calc(50% - 12px); }
.ins-add { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.lyr { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.lyr:hover { background: var(--hover); }
.lyr.off { opacity: .55; }
.lyr-b { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; border: 0; background: none; text-align: left; padding: 6px 6px; }
.lyr-b b { display: block; font-size: 12.5px; font-weight: 500; }
.lyr-b small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.lyr-ic { width: 26px; height: 26px; border-radius: 6px; background: var(--canvas); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-2); flex: none; }
.lyr-ic svg.i { width: 14px; height: 14px; }
.lyr-eye { width: 28px; height: 28px; border: 0; background: none; border-radius: 6px; color: var(--muted); display: grid; place-items: center; opacity: 0; }
.lyr:hover .lyr-eye, .lyr.off .lyr-eye { opacity: 1; }
.lyr-eye:hover { color: var(--ink); background: var(--surface); }
.lyr-g { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 4px; }
.lyr-g:first-child { margin-top: 0; }
.ins-tip { padding: 12px 14px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* editable covers */
.pg-dim { position: absolute; inset: 0; pointer-events: none; }
.pg.cover > .pg-bg { z-index: 0; }
.pg.cover .cv-top, .pg.cover .cv-mid, .pg.cover .cv-foot, .pg.cover .cv-shape { z-index: 1; }
.cv-logo { display: inline-block; }
.cv-bar { display: block; }

/* ======================================================================
   Word / PandaDoc-style editor
   ====================================================================== */
.rv.wd { grid-template-rows: 56px 44px 1fr; }
.rv.wd .rv-main { grid-template-columns: 168px minmax(0, 1fr) 300px 56px; }
.rv.wd .rv-main.panel-closed { grid-template-columns: 168px minmax(0, 1fr) 0 56px; }
.rv.wd .rv-main.panel-closed .rpanel { display: none; }
.rv.wd .rpanel { border-left: 1px solid var(--line); }
.rv.wd .canvas-inner { padding-top: 28px; }

/* formatting toolbar */
.fmtbar { display: flex; align-items: center; gap: 2px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.fb-g { display: flex; align-items: center; gap: 1px; padding: 0 6px; border-right: 1px solid var(--line-2); height: 28px; flex: none; }
.fb-g:last-of-type, .fb-g.last { border-right: 0; }
.fb { height: 30px; min-width: 30px; padding: 0 6px; border: 0; background: none; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--ink-2); font-size: 13px; }
.fb:hover { background: var(--hover); color: var(--ink); }
.fb.on { background: var(--brand-soft); color: var(--brand); }
.fb[disabled], .fb.off { opacity: .4; pointer-events: none; }
.fb b, .fb i, .fb u, .fb s { font-size: 14px; font-family: Georgia, serif; }
.fb b { font-family: var(--font); }
.fb svg.i { width: 16px; height: 16px; }
.fb.dd svg.i:last-child { width: 11px; height: 11px; opacity: .55; }
.fb.dd.wide { width: 128px; justify-content: space-between; border: 1px solid var(--line); height: 28px; }
.fb.dd.font { width: 132px; justify-content: space-between; border: 1px solid var(--line); height: 28px; }
.fb.dd.font span, .fb.dd.wide span { overflow: hidden; text-overflow: ellipsis; max-width: 100px; text-align: left; }
.fb.txt { font-weight: 500; }
.fb-size { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; height: 28px; margin-left: 4px; }
.fb-size .fb { height: 26px; min-width: 22px; padding: 0; font-size: 15px; }
.fb-size input { width: 40px; border: 0; text-align: center; font-size: 13px; background: none; -moz-appearance: textfield; }
.fb-size input::-webkit-inner-spin-button { display: none; }
.fb-a { position: relative; display: inline-flex; flex-direction: column; align-items: center; font-weight: 600; font-size: 14px; line-height: 1; }
.fb-a i { display: block; width: 16px; height: 3px; border-radius: 1px; margin-top: 2px; background: #111; }
.fb-a svg.i { width: 15px; height: 15px; }
.fb-lbl { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px 0 2px; }
.fmtbar .fb-g.img, .fmtbar .fb-g.tbl { display: none; }
.fmtbar.show-img .fb-g.img, .fmtbar.show-tbl .fb-g.tbl { display: flex; }
.fmtbar.show-img .fb-g.img { background: var(--brand-soft); border-radius: 8px; border-right: 0; margin-right: 6px; }
.fmtbar .blk-only { display: none; }
.fmtbar.show-img-blk .blk-only { display: inline-flex; }
.fmtbar.no-text .fb-g.t { opacity: .35; pointer-events: none; }
.fmtbar.show-img .fb-g.t { display: none; }
.fmtbar.viewing .fb-g:not(.last) { opacity: .35; pointer-events: none; }
.fb.mode { border: 1px solid var(--line); height: 28px; }
.style-i { justify-content: space-between; }
.si-title { font-size: 18px; font-weight: 700; } .si-subtitle { font-size: 14px; color: var(--muted); }
.si-h1 { font-size: 17px; font-weight: 700; } .si-h2 { font-size: 15px; font-weight: 650; } .si-h3 { font-size: 14px; font-weight: 650; }
.si-quote { font-style: italic; } .si-caption { font-size: 12px; color: var(--muted); } .si-callout { padding: 1px 6px; background: var(--brand-soft); border-radius: 4px; }
.turn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 2px 6px 4px; }
.turn-grid button { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 6px 8px; font-size: 12.5px; text-align: left; }
.turn-grid button:hover { border-color: #CFCEC8; }
.turn-grid button.on { border-color: var(--brand); color: var(--brand); }

/* right icon rail (PandaDoc) */
.rrail { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; }
.rrail button { position: relative; width: 46px; border: 0; background: none; border-radius: 9px; padding: 7px 0 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.rrail button:hover { background: var(--hover); color: var(--ink); }
.rrail button.on { background: var(--brand-soft); color: var(--brand); }
.rrail button svg.i { width: 18px; height: 18px; }
.rrail em { position: absolute; top: 3px; right: 5px; font-style: normal; font-size: 10px; font-weight: 700; background: var(--warn); color: #fff; border-radius: 99px; min-width: 15px; height: 15px; line-height: 15px; padding: 0 3px; }
.rp-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.rp-head b { font-size: 14px; }
.rp-head .small { flex: 1; }
.rp-head > b + .icon-btn, .rp-head .icon-btn { margin-left: auto; }
.rp-sec { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.rp-sec .grp:first-child { padding-top: 0; }
.rp-sub { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.rv.wd .rp-body { padding: 0 0 24px; }
.rv.wd .rp-body > .rp-sec .grp { padding: 12px 0; }

/* content tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: grab; text-align: left; }
.tile:hover { border-color: #CFCEC8; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.tile:active { cursor: grabbing; }
.tile-ic { color: var(--muted); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.tile-ic svg.i { width: 16px; height: 16px; }

/* text styles panel */
.sty { border-bottom: 1px solid var(--line-2); }
.sty-h { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 12px 16px; text-align: left; }
.sty-h:hover { background: var(--hover); }
.sty-h .sty-s { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sty-h svg.i { width: 13px; height: 13px; color: var(--faint); transform: rotate(-90deg); transition: transform .15s; }
.sty.open .sty-h svg.i { transform: none; }
.sty-b { padding: 2px 16px 16px; }
.input.sm { height: 32px; font-size: 13px; }

/* editable text on the page */
.canvas.mode-edit .pg [contenteditable="true"] { outline: none; cursor: text; caret-color: var(--brand); }
.canvas.mode-edit .pg [contenteditable="true"]:empty::before { content: 'Type here, or press / to insert a heading, list, table…'; color: var(--muted); font-weight: 400; font-style: normal; pointer-events: none; }
.canvas.mode-edit .pg li[contenteditable="true"]:empty::before, .canvas.mode-edit .pg td[contenteditable="true"]:empty::before, .canvas.mode-edit .pg th[contenteditable="true"]:empty::before { content: ''; }
.canvas.mode-edit .pg [contenteditable="true"]:focus { background: rgba(75,68,214,.035); box-shadow: 0 0 0 3px rgba(75,68,214,.035); border-radius: 2px; }
.canvas.mode-edit .pg .slot[contenteditable="true"]:hover, .canvas.mode-edit .pg [data-ovtext]:hover { box-shadow: 0 0 0 1px rgba(75,68,214,.35); }
.canvas.mode-edit .pg img[data-img], .canvas.mode-edit .pg .ov-img { cursor: pointer; }
.pg a { color: inherit; text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 2px; }
.canvas .pg .b.warn { outline: none; box-shadow: -4px 0 0 0 rgba(217,119,6,.7); }

/* block gutter */
.gutter { position: absolute; display: flex; gap: 1px; pointer-events: auto; animation: fade .12s; }
.gutter button { width: 24px; height: 24px; border: 0; background: none; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.gutter button:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.gutter .grip { cursor: grab; }
.gutter svg.i { width: 15px; height: 15px; }
body.dragging-block, body.dragging-block * { cursor: grabbing !important; user-select: none; }
#drop { position: absolute; height: 3px; background: var(--brand); border-radius: 2px; pointer-events: none; display: none; box-shadow: 0 0 0 2px rgba(75,68,214,.15); }
#drop::before { content: ''; position: absolute; left: -5px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }

/* object frames (images, text boxes, template text) */
.obj-frame { position: absolute; border: 1.5px solid var(--brand); margin: -2px 0 0 -2px; padding: 2px; box-sizing: content-box; border-radius: 2px; }
.obj-chip { position: absolute; left: -1.5px; top: -21px; height: 18px; padding: 0 7px; border-radius: 5px 5px 5px 0; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.obj-grip { position: absolute; right: -2px; top: -24px; width: 22px; height: 20px; border-radius: 5px; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: move; pointer-events: auto; }
.obj-grip svg.i { width: 13px; height: 13px; }
#sel-layer .obj-frame .sel-h { pointer-events: auto; }

/* ---------- storage notice & backup ---------- */
.store-note { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 26px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13px; color: var(--ink-2); }
.store-note > svg.i { color: var(--brand); }
.store-note .grow { min-width: 220px; }
.store-note b { color: var(--ink); font-weight: 600; }
.side-acts { display: flex; gap: 6px; margin-top: 6px; }
.linkish { border: 0; background: none; padding: 0; color: var(--ink-2); font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.linkish:hover { color: var(--ink); }

/* toolbar: overflow menu + edit/view toggle */
.mode-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--hover); border-radius: 8px; }
.mode-seg .fb { height: 26px; color: var(--muted); }
.mode-seg .fb.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,17,20,.08); }
.turn-grid.al4 { grid-template-columns: repeat(4, 1fr); }
.turn-grid.al4 button { display: grid; place-items: center; }
@media (max-width: 1180px) { .fmtbar .fb-g.al { display: none; } }
.menu-i > svg.i:first-child, .menu-i > s:first-child { color: var(--ink-2); }
.menu-i > svg.i:first-child + span, .menu-i > s:first-child + span { flex: 1; }
.font-opt:focus-visible, .menu-i:focus-visible, .turn-grid button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stage-now { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-now:empty { display: none; }
.canvas .pg .b.multi-sel { background: rgba(75,68,214,.12); box-shadow: 0 0 0 4px rgba(75,68,214,.12); border-radius: 2px; }
.pop-note { margin: 0; padding: 4px 10px 8px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.pop-acts { display: flex; justify-content: flex-end; gap: 6px; padding: 0 8px 6px; }

/* ---------- reflow: wizard title, stepper semantics, narrow editor ---------- */
.wiz-top .ttl { font-size: 14px; margin: 0; white-space: nowrap; }
.wiz-top .ttl-s { display: none; }
ol.stepper { list-style: none; margin: 0; padding: 0; }
.shell > .main { min-width: 0; }
@media (max-width: 900px) {
  .wiz-top .ttl-l { display: none; }
  .wiz-top .ttl-s { display: inline; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { min-width: 0; }
  .side .nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .side .nav a { flex: none; }
  .wiz-top .stepper .step span.lbl { display: inline; }
  .rv.wd .rv-main, .rv.wd .rv-main.panel-closed { grid-template-columns: minmax(0, 1fr) 56px; }
  .rv.wd .thumbs { display: none; }
  /* panels open as a bottom sheet over the page instead of disappearing */
  .rv.wd .rv-main:not(.panel-closed) .rpanel { display: flex; position: fixed; left: 0; right: 56px; bottom: 0; max-height: 58vh; z-index: 30; border: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(16,17,20,.14); overflow: auto; }
  .rv-top .rv-brand, .rv-top #doc-pages { display: none; }
  .rv-top .title-in { min-width: 0; flex: 1; }
}
@media (max-width: 560px) {
  .wiz-top { grid-template-columns: auto 1fr; gap: 12px; }
  .wiz-top .stepper { justify-self: end; gap: 4px; }
  .wiz-top .step-line { width: 14px; }
  .wiz-top > div:last-child { display: none; }
  .wiz-top .stepper .step span.lbl { display: none; }
}
.toast { display: flex; align-items: center; gap: 10px; }
.toast .toast-act { background: #2A2C31; color: #fff; border-color: #3A3C42; }
.toast-x { border: 0; background: none; color: #C9CBD0; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; margin-right: -6px; }
.toast-x:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- one focus ring everywhere (low specificity so field wrappers can take over) ---------- */
:where(button, a[href], [role="button"], [role="menuitem"], [role="radio"], [tabindex="0"], select, input, textarea, summary):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pop-search:focus-within, .color-in:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.sb-in:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.fb:focus-visible, .rrail button:focus-visible, .gutter button:focus-visible, .tile:focus-visible { outline-offset: 0; }
/* larger hit areas for the small steppers */
.fb-size .fb { min-width: 26px; height: 26px; }
.kbd-sheet { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; margin-top: 14px; max-height: 60vh; overflow: auto; }
.kbd-sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 6px; }
.kbd-sheet dl { margin: 0; }
.kbd-sheet dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.kbd-sheet dt { color: var(--ink-2); }
.kbd-sheet dd { margin: 0; white-space: nowrap; }
.hero.hero-compact { grid-template-columns: minmax(0, 1fr) auto; padding: 20px 24px; gap: 16px 24px; }
.hero.hero-compact h1 { font-size: 22px; margin: 0; }
.hero.hero-compact p { margin: 6px 0 0; font-size: 14px; }
@media (max-width: 820px) { .hero.hero-compact { grid-template-columns: 1fr; } }
.rv { grid-template-columns: minmax(0, 1fr); }
.rv-top, .fmtbar { min-width: 0; }
@media (max-width: 820px) {
  .rv-top { gap: 6px; padding: 0 8px; }
  .rv-top .btn-l { display: none; }
  .rv-top #save-state { font-size: 0; gap: 0; padding: 0 7px; }
  .rv-top [data-act="regen-doc"] { width: 36px; padding: 0; }
}
.tpl-photo { position: absolute; object-fit: cover; display: block; }
.ov.under { z-index: 1; }
.tplpage .slot { z-index: 2; }
.lift-card { display: flex; gap: 10px; margin: 12px 14px 4px; padding: 12px; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 10px; font-size: 12.5px; color: var(--ink-2); }
.lift-card > svg.i { color: var(--brand); margin-top: 2px; }
.lift-card b { color: var(--ink); font-size: 13px; }
.lift-card p { margin: 4px 0 10px; line-height: 1.45; }
.rng { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.rng input { width: 100%; accent-color: var(--brand); }
.fmtbar .ov-only { display: none; }
.fmtbar.show-img:not(.show-img-blk) .ov-only { display: inline-flex; }
.tog.align6 { display: grid; grid-template-columns: repeat(6, 1fr); }
.menu-i input[type=checkbox] { accent-color: var(--brand); }
.page-frame { position: absolute; outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 1px; pointer-events: none; }
.page-frame .obj-chip { position: absolute; left: -3px; top: -30px; }
.canvas.mode-edit .pg { cursor: default; }
/* pin the editor columns so hiding the panel can't shift the rail into its empty slot */
.rv.wd .rv-main > .thumbs { grid-column: 1; }
.rv.wd .rv-main > .canvas { grid-column: 2; }
.rv.wd .rv-main > .rpanel { grid-column: 3; }
.rv.wd .rv-main > .rrail { grid-column: 4; }
@media (max-width: 820px) {
  .rv.wd .rv-main > .canvas { grid-column: 1; }
  .rv.wd .rv-main > .rrail { grid-column: 2; }
}
.slot-box { position: absolute; z-index: 1; }
.canvas.mode-edit .pg .slot-box { cursor: move; }
.canvas.mode-edit .pg .slot[data-edit], .canvas.mode-edit .pg [data-edit] { cursor: text; }

/* ---------- templates gallery ---------- */
.tpl-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tpl-cats button { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--field); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.tpl-cats button:hover { border-color: var(--ink-2); }
.tpl-cats button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tpl-card2 { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.tpl-prev { border: 0; padding: 18px 18px 0; background: var(--hover); cursor: pointer; display: block; width: 100%; }
.tpl-prev:hover .tpl-sheet { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(16,17,20,.14); }
.tpl-mini { height: 190px; overflow: hidden; display: flex; justify-content: center; }
.tpl-sheet { width: 150px; min-height: 212px; background: #fff; border-radius: 3px 3px 0 0; box-shadow: 0 2px 10px rgba(16,17,20,.1); padding: 14px 13px; display: flex; flex-direction: column; gap: 5px; transition: transform .15s, box-shadow .15s; }
.tpl-sheet b, .tpl-sheet i, .tpl-sheet span { display: block; }
.tpl-sheet .m-title { height: 9px; width: 78%; background: var(--ink); border-radius: 2px; margin-bottom: 1px; }
.tpl-sheet .m-sub { height: 4px; width: 92%; background: #B9BCC2; border-radius: 2px; margin-bottom: 4px; }
.tpl-sheet .m-h1 { height: 5px; width: 46%; background: var(--brand); border-radius: 2px; margin-top: 4px; }
.tpl-sheet .m-h2 { height: 4px; width: 60%; background: #6B6F78; border-radius: 2px; margin-top: 2px; }
.tpl-sheet .m-p { display: flex; flex-direction: column; gap: 2.5px; }
.tpl-sheet .m-p i { height: 2.5px; background: #DADCE0; border-radius: 2px; }
.tpl-sheet .m-list { display: flex; flex-direction: column; gap: 2.5px; padding-left: 7px; }
.tpl-sheet .m-list i { height: 2.5px; width: 80%; background: #DADCE0; border-radius: 2px; position: relative; }
.tpl-sheet .m-list i::before { content: ''; position: absolute; left: -6px; top: -0.5px; width: 3px; height: 3px; border-radius: 50%; background: var(--brand); }
.tpl-sheet .m-tbl { display: flex; flex-direction: column; gap: 1.5px; margin: 2px 0; }
.tpl-sheet .m-tbl > span { display: flex; gap: 2px; }
.tpl-sheet .m-tbl > span i { flex: 1; height: 4px; background: #ECEDEF; }
.tpl-sheet .m-tbl > span.hd i { background: var(--brand); opacity: .75; }
.tpl-sheet .m-call { height: 12px; background: var(--brand-soft); border-left: 2px solid var(--brand); border-radius: 2px; margin: 2px 0; }
.tpl-info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tpl-meta { font-size: 12px; color: var(--muted); }
.tpl-outline { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.tpl-outline li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.tpl-outline li:last-child { border-bottom: 0; }
.tpl-outline .ol-k { color: var(--muted); font-size: 12px; }
.tpl-outline .ol-t { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-outline .ol-title .ol-t, .tpl-outline .lv1 .ol-t { color: var(--ink); font-weight: 600; }
.tpl-outline .lv2 .ol-t { padding-left: 12px; }
/* template preview */
.modal.modal-preview { width: 680px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.tp-head { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.tp-brand { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.tp-pages { margin-top: 16px; flex: 1; min-height: 240px; overflow: auto; background: var(--hover); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.tp-page { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tp-page > div { box-shadow: 0 2px 12px rgba(16,17,20,.14); background: #fff; }
.tp-page figcaption { font-size: 12px; color: var(--muted); }
.tp-loading { margin: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

/* ---------- built-in document formats (template designs) ---------- */
/* Résumé: single column, ATS-safe; name ~22pt, section heads uppercase with a rule, dates as quiet captions */
.pg.doc-resume .t-title { font-size: 2.1em; letter-spacing: -.01em; color: var(--tx); padding-bottom: .05em; }
.pg.doc-resume .t-sub { font-size: .98em; color: var(--sec); border-bottom: 0; padding-bottom: .2em; line-height: 1.5; }
.pg.doc-resume .b-h1 { padding-top: 1.35em; }
.pg.doc-resume .h1 { font-size: 1em; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--tx); padding-bottom: .3em; border-bottom: 1px solid var(--tx); }
.pg.doc-resume .b-h2 { padding-top: .9em; }
.pg.doc-resume .h2 { font-size: 1em; font-weight: 700; color: var(--tx); letter-spacing: 0; }
.pg.doc-resume .b-caption { padding-top: .1em; }
.pg.doc-resume .cap { font-weight: 400; font-style: italic; color: var(--sec); font-size: .92em; }
.pg.doc-resume .b-list { padding-top: .35em; }
.pg.doc-resume .b li::marker { color: var(--tx); }

/* Invoice: big title, label/value details, parties side by side, ruled line items, right-aligned totals */
.pg.doc-invoice .t-title { font-size: 2.5em; font-weight: 600; letter-spacing: -.03em; color: var(--tx); padding-bottom: .1em; }
.pg.doc-invoice .tbl.tv-meta { width: auto; font-size: .9em; }
.pg.doc-invoice .tbl.tv-meta th, .pg.doc-invoice .tbl.tv-meta td { background: none !important; border: 0 !important; padding: .12em 1.6em .12em 0; text-align: left !important; font-weight: 400; color: var(--tx); text-transform: none; letter-spacing: 0; font-size: 1em; }
.pg.doc-invoice .tbl.tv-meta th { font-weight: 600; }
.pg.doc-invoice .tbl.tv-meta tr > :first-child { color: var(--sec); width: 10em; white-space: nowrap; }
.pg.doc-invoice .b-table:has(.tv-parties) { padding-top: 2em; }
.pg.doc-invoice .tbl.tv-parties { table-layout: fixed; }
.pg.doc-invoice .tbl.tv-parties th, .pg.doc-invoice .tbl.tv-parties td { background: none !important; border: 0 !important; padding: 0 1.4em .2em 0; text-align: left !important; vertical-align: top; line-height: 1.5; }
.pg.doc-invoice .tbl.tv-parties th { color: var(--sec); font-size: .78em; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding-bottom: .5em; }
.pg.doc-invoice .b-table:has(.tv-items) { padding-top: 2.2em; }
.pg .tbl.tv-items th { background: none !important; color: var(--sec) !important; font-size: .78em; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--tx) !important; padding-bottom: .6em; }
.pg .tbl.tv-items td { background: none !important; border-bottom: 1px solid var(--bd); padding: .65em .7em; }
.pg .tbl.tv-items tr.sum td, .pg .tbl.tv-items tr.grand td { border-bottom: 0; padding-top: .35em; padding-bottom: .35em; }
.pg .tbl.tv-items tr.sum td:first-child, .pg .tbl.tv-items tr.grand td:first-child { text-align: right; color: var(--sec); }
.pg .tbl.tv-items tr.sum:first-of-type td, .pg .tbl.tv-items tr:not(.sum):not(.grand) + tr.sum td { padding-top: .9em; }
.pg .tbl.tv-items tr.grand td { font-weight: 700; font-size: 1.15em; color: var(--tx); border-top: 1.5px solid var(--tx); padding-top: .6em; }
.pg .tbl.tv-items tr.grand td:first-child { color: var(--tx); }
.pg.doc-invoice .b-h2 { padding-top: 2em; }
.pg.doc-invoice .h2 { font-family: var(--bf); font-size: .78em; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--sec); }
.pg.doc-invoice .b-h2 + .b-paragraph { padding-top: .4em; }
.pg.doc-invoice p { line-height: 1.55; }

/* Business letter, full block: letterhead, everything flush left, blank line between parts */
.pg.doc-letter .t-title { font-size: 1.45em; font-weight: 700; letter-spacing: .01em; color: var(--p); }
.pg.doc-letter .t-sub { font-size: .82em; color: var(--sec); border-bottom: 1px solid var(--bd); padding-bottom: 1.1em; }
.pg.doc-letter .b-paragraph { padding-top: 1.05em; }
.pg.doc-letter .b-subtitle + .b-paragraph { padding-top: 2.6em; }
.pg.doc-letter .b-h2 { padding-top: 1.05em; }
.pg.doc-letter .h2 { font-family: var(--bf); font-size: 1em; font-weight: 700; color: var(--tx); letter-spacing: 0; }
.pg.doc-letter p { line-height: 1.5; }
.pg.doc-letter .b-caption { padding-top: 1.8em; }
.pg.doc-letter .cap { font-weight: 400; font-size: .86em; }

/* Proposal: editorial headings, ruled sections, signature block */
.pg.doc-proposal .h1 { padding-bottom: .35em; border-bottom: 1px solid var(--bd); }
.pg .tbl.tv-sign { table-layout: fixed; }
.pg .tbl.tv-sign th, .pg .tbl.tv-sign td { background: none !important; border: 0 !important; text-align: left !important; padding: 0 2em 0 0; }
.pg .tbl.tv-sign th { font-size: .78em; color: var(--sec); text-transform: uppercase; letter-spacing: .08em; padding-bottom: .4em; }
.pg .tbl.tv-sign td { padding-top: 1.6em; border-bottom: 1px solid var(--tx) !important; padding-bottom: .25em; color: var(--sec); font-size: .9em; }
/* proposals in layout mode keep sections flowing: normal-size section heads, no section-opener rule */
.pg.doc-proposal.synth .h1 { font-size: 1.6em; padding-bottom: .35em; }
.pg.doc-proposal.synth .b-h1.first::before { display: none; }
/* roomier template cards */
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 20px; }
.tpl-prev { padding: 24px 24px 0; }
.tpl-mini { height: 228px; }
.tpl-sheet { width: 178px; min-height: 252px; padding: 16px 15px; gap: 6px; }
.tpl-info { padding: 18px 20px 20px; gap: 8px; }
.tpl-info b { font-size: 15px; }
.tpl-info > .row:last-child { margin-top: auto !important; padding-top: 8px; }
/* page thumbnails: add / duplicate on hover */
.thumb-wrap { position: relative; }
.thumb-acts { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 2px; padding: 2px; background: var(--surface); border-radius: 8px; box-shadow: 0 2px 8px rgba(16,17,20,.16); opacity: 0; transition: opacity .12s; }
.thumb-wrap:hover .thumb-acts, .thumb-acts:focus-within { opacity: 1; }
.thumb-acts .icon-btn { width: 26px; height: 26px; color: var(--ink-2); }
.canvas-bar .icon-btn[disabled] { opacity: .35; pointer-events: none; }
@media (hover: none) { .thumb-acts { opacity: 1; } }
/* saved-brand picker: colours on top, then a 2-line name, then fonts */
.saved-brands { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pick { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; min-width: 0; }
.pick .pick-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; font-size: 14px; width: 100%; overflow-wrap: anywhere; }
.pick .small { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* saved brand cards: even heights, readable names */
.brand-card { gap: 12px; min-width: 0; height: 100%; }
.brand-pages { height: 76px; align-items: flex-end; overflow: hidden; }
.brand-pages img { width: auto; height: 72px; max-width: calc(25% - 5px); object-fit: cover; object-position: top; background: #fff; }
.brand-pages-empty { display: flex; align-items: center; height: 72px; width: 100%; justify-content: center; background: var(--hover); border-radius: 6px; }
.brand-meta { min-width: 0; }
.brand-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.brand-type { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-acts { margin-top: auto; }
/* blank document */
.blank-opts { display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.blank-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; cursor: pointer; min-width: 0; }
.blank-opt:hover { border-color: var(--ink-2); }
.blank-opt .grow { display: flex; flex-direction: column; gap: 2px; }
.blank-opt .pick-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.blank-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); flex: none; }
.tpl-sheet-blank { align-items: center; justify-content: center; color: var(--muted); }
.tpl-sheet-blank svg.i { width: 28px; height: 28px; }
.tpl-blank .tpl-prev:hover .tpl-sheet-blank { color: var(--brand); }
.tpl-chosen { display: grid; grid-template-columns: 220px 1fr; overflow: hidden; padding: 0; max-width: 640px; margin: 0 auto; }
.tpl-chosen .tpl-prev { padding: 18px 18px 0; }
@media (max-width: 600px) { .tpl-chosen { grid-template-columns: 1fr; } }
