/* Creative brief builder — page styles (screen + print). */
.bf { display: grid; grid-template-columns: minmax(0, 1fr) 452px; gap: 22px; padding: 22px var(--g) 40px; align-items: start; }
.bf-main { min-width: 0; }

/* ---------- progress rail ---------- */
.rail { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); margin-bottom: 14px; padding: 0 4px; }
.rail-line { position: absolute; left: calc(100% / 16); right: calc(100% / 16); top: 21px; height: 1px; background: var(--line2); }
.rail-line i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .7s var(--ease); }
.rail button { position: relative; display: grid; justify-items: center; gap: 8px; padding: 6px 2px; color: var(--muted); transition: color .3s; }
.rail button b { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 400; font-size: 10.5px; background: var(--bg); border: 1px solid var(--line2); transition: background .35s, color .35s, border-color .35s, box-shadow .35s; }
.rail button span { font-size: 12.5px; white-space: nowrap; }
.rail button:hover { color: var(--ink); }
.rail button:hover b { border-color: var(--muted); }
.rail button.ok b { border-color: var(--accent); color: var(--accent); }
.rail button.on { color: var(--ink); }
.rail button.on b { background: var(--ink); border-color: var(--ink); color: #0a0a09; box-shadow: 0 0 0 5px rgba(238,233,223,.07); }
.rail button.ok:not(.on) b { background: var(--bg); }
.rail button[data-goto="8"] b { font-family: var(--sans); font-size: 14px; }

/* ---------- step card ---------- */
.stage { position: relative; padding: 34px clamp(20px, 3.4vw, 46px) 0; min-height: 540px; display: flex; flex-direction: column; overflow: clip; }
.stage::before { content: ""; position: absolute; right: -120px; top: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(closest-side, rgba(216,162,0,.07), transparent); pointer-events: none; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.step { display: none; flex: 1; padding-bottom: 28px; }
.step.on { display: block; }
.st-k { color: var(--accent); font-size: 10.5px; margin-bottom: 18px; }
.step h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 4.6vw, 64px); line-height: .95; letter-spacing: -.02em; margin-bottom: 12px; }
.step h2 em { font-style: italic; color: var(--soft); }
.st-p { color: var(--muted); max-width: 520px; margin-bottom: 28px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.g2 .full { grid-column: 1 / -1; }
.stage .field { margin-bottom: 18px; }
.stage .inp { padding: 12px 14px; font-size: 15px; border-radius: 11px; background: rgba(24,24,22,.8); }
.stage textarea.inp { min-height: 0; }
.stage .inp::placeholder { color: var(--faint); }
.stage input[type=date].inp { color-scheme: dark; }
.field.req > span::after { content: "Required"; color: var(--faint); }
.err { display: none; color: var(--bad); font-size: 12.5px; }
.field.bad .inp { border-color: var(--bad); }
.field.bad .err, .err.on { display: block; animation: shake .4s; }
.err.on { margin-top: 10px; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
[data-show] { display: none; }
[data-show].on { display: grid; margin-top: 16px; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.chips { gap: 8px; }
.stage .chip { padding: 8px 14px; font-size: 13.5px; }
.chips.big .chip { padding: 11px 18px; font-size: 14.5px; }
.chip.on { box-shadow: 0 0 0 4px rgba(238,233,223,.06); }
.stage .seg button { padding: 8px 15px; font-size: 13px; }
.field > span .seg.cur { margin-left: auto; padding: 3px; text-transform: none; letter-spacing: 0; }
.field > span .seg.cur button { padding: 3px 10px; font-family: var(--mono); font-size: 10.5px; }
.step-n { display: flex; align-items: center; gap: 8px; }
.step-n .inp { width: 74px; text-align: center; -moz-appearance: textfield; }
.step-n .inp::-webkit-inner-spin-button { -webkit-appearance: none; }
.step-n .btn.icon { width: 44px; height: 44px; }

.st-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 20px; margin-top: auto; border-top: 1px solid var(--line); background: var(--bg2); z-index: 2; }
.st-foot .btn { padding: 11px 20px; font-size: 14px; }
.st-foot .btn svg { width: 15px; height: 15px; }
.st-hint { font-size: 12px; }
.stage[data-step="8"] .st-foot #bNext, .stage[data-step="8"] .st-hint, .stage[data-step="9"] .st-foot { display: none; }
.under { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 4px 0; }
.under .hint { font-size: 12px; }

/* send step */
.send-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.send-acts.sm { margin-top: 14px; }
.btn.big { padding: 15px 24px; font-size: 15px; }
.btn.big svg { width: 18px; height: 18px; }
#bSend.wait { opacity: .75; }
#bSend.busy { pointer-events: none; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0,0,0,.25); border-top-color: #0a0a09; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { margin-top: 22px; display: grid; gap: 8px; max-width: 620px; }
.note span { display: block; font-size: 13px; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line2); }
.note b { font-weight: 400; color: var(--ink); }
.note a { color: var(--accent); text-decoration: underline; }
.meter-inline, .doc-inline { display: none; }
.step.done h2 em { color: var(--accent); }

/* ---------- side: meter + paper ---------- */
.bf-side { position: sticky; top: calc(var(--hdr) + 6px); display: grid; gap: 12px; max-height: calc(100vh - var(--hdr) - 48px); grid-template-rows: auto minmax(0, 1fr) auto; }
.meter { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg2); }
.m-top { display: flex; justify-content: space-between; align-items: baseline; }
.m-top .mono { color: var(--muted); font-size: 10px; }
.m-top b { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; }
.m-top b i { font-style: normal; font-size: 18px; color: var(--muted); margin-left: 2px; }
.m-bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 10px 0 8px; }
.m-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6700, var(--accent), var(--accent2)); transform-origin: left; transition: transform .8s var(--ease); }
.m-word { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--soft); }
.m-miss { list-style: none; margin-top: 8px; display: grid; gap: 2px; }
.m-miss button { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); transition: color .25s; }
.m-miss li:first-child button { border-top: 0; }
.m-miss button:hover { color: var(--ink); }
.m-miss svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; }
.m-ok { color: var(--ok); font-size: 13px; margin-top: 6px; }
.paper-wrap { overflow: auto; border-radius: 10px; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; min-height: 0; }
.side-acts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ---------- the document (shared by preview, review and print) ---------- */
.doc { --p: #f5f1e8; --pi: #161513; --pm: #77726a; --pf: #c2bbad; --pl: #ddd6c8; --pg: #9a7400;
  background: var(--p); color: var(--pi); font-family: var(--sans); font-weight: 300; font-size: 11.2px; line-height: 1.5; padding: 2.6em 2.6em 2em; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.45); position: relative; }
.doc::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(120% 80% at 100% 0, rgba(216,162,0,.08), transparent 50%); }
.d-lh { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.6em; padding-bottom: 1.3em; border-bottom: 1px solid var(--pi); }
.d-brand { display: flex; gap: .8em; align-items: center; }
.d-brand img { width: 2.6em; height: 2.6em; filter: invert(1); }
.d-brand b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.75em; line-height: 1; letter-spacing: -.01em; }
.d-brand span, .d-ref span, .d-k, .doc dt, .doc h4, .d-ft { font-family: var(--mono); font-size: .64em; letter-spacing: .09em; text-transform: uppercase; color: var(--pm); }
.d-brand span { display: block; margin-top: .5em; }
.d-ref { text-align: right; display: grid; gap: .2em; }
.d-ref b { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.35em; line-height: 1.1; }
.d-title { margin: 2em 0 1em; }
.d-k { color: var(--pg); display: flex; align-items: center; gap: .8em; }
.d-k::before { content: ""; width: .7em; height: .7em; border-radius: 50%; background: #D8A200; }
.d-title h3 { font-family: var(--serif); font-weight: 400; font-size: 3.1em; line-height: .95; letter-spacing: -.02em; margin-top: .25em; overflow-wrap: anywhere; }
.d-sum { font-family: var(--serif); font-size: 1.5em; line-height: 1.28; padding: .1em 0 .1em .9em; border-left: 2px solid #D8A200; margin-bottom: 2em; color: #2a2825; }
.d-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.8em 2.2em; }
.d-sec { min-width: 0; break-inside: avoid; }
.d-sec.wide { grid-column: 1 / -1; }
.doc h4 { font-weight: 400; color: var(--pi); padding-bottom: .7em; margin-bottom: .6em; border-bottom: 1px solid var(--pl); }
.doc dl { display: grid; gap: .45em; }
.doc dl div { display: grid; grid-template-columns: 7.2em minmax(0, 1fr); gap: 1em; }
.d-sec.wide dl div { grid-template-columns: 7.2em minmax(0, 1fr); }
.doc dt { padding-top: .35em; }
.doc dd { overflow-wrap: anywhere; }
.d-ph { color: var(--pf); }
.d-q { font-family: var(--serif); font-style: italic; font-size: 1.32em; line-height: 1.25; }
.d-tags { display: flex; flex-wrap: wrap; gap: .35em; }
.d-tags i { font-style: normal; padding: .1em .75em; border: 1px solid var(--pl); border-radius: 99px; font-size: .92em; }
.d-links { display: grid; gap: .1em; }
.d-links a { color: var(--pi); text-decoration: underline; text-decoration-color: #D8A200; text-underline-offset: 2px; overflow-wrap: anywhere; }
.d-ft { display: flex; justify-content: space-between; gap: 1em; flex-wrap: wrap; margin-top: 2.4em; padding-top: 1em; border-top: 1px solid var(--pl); }
.doc.preview { font-size: 10.6px; }

/* mobile "preview" pill */
.peek { display: none; flex: none; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; border: 1px solid var(--line2); color: var(--soft); font-size: 12.5px; }
.peek .ring { --p: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 10px; color: var(--ink); background: radial-gradient(closest-side, var(--bg2) 80%, transparent 82%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line2) 0); }
.peek-modal .box { width: min(560px, 100%); }
.peek-modal .body { padding: 14px; }
.peek-meter .meter, .peek-meter { margin-bottom: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .bf { grid-template-columns: minmax(0, 1fr) 380px; } .rail button span { font-size: 11.5px; } }
@media (max-width: 960px) {
  .bf { grid-template-columns: 1fr; }
  .bf-side { display: none; }
  .peek { display: inline-flex; }
  .stage[data-step="8"] .st-foot { position: static; }
  .meter-inline { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; }
  .doc-inline { display: block; margin-bottom: 18px; }
  .doc-inline .doc { font-size: 10.4px; padding: 2em 1.6em 1.6em; }
}
@media (max-width: 640px) {
  .bf { padding: 14px 16px 30px; }
  .rail { grid-template-columns: repeat(8, 1fr); margin-bottom: 10px; padding: 0; }
  .rail-line { top: 19px; }
  .rail button { padding: 4px 0; gap: 0; }
  .rail button b { width: 27px; height: 27px; font-size: 9.5px; }
  .rail button span { display: none; }
  .stage { padding: 24px 18px 0; min-height: 0; border-radius: 16px; }
  .step h2 { font-size: 42px; }
  .st-p { margin-bottom: 22px; }
  .g2 { grid-template-columns: 1fr; }
  .st-hint { display: none; }
  .st-foot { padding: 14px 0 16px; }
  .st-foot .btn { flex: 1; padding: 11px 12px; }
  .peek .pk-l { display: none; }
  .peek { padding: 4px; }
  .send-acts .btn { width: 100%; }
  .send-acts.sm .btn { width: auto; flex: 1; padding: 9px 10px; }
  .doc-inline .doc { font-size: 9.6px; }
  .doc-inline .doc .d-body { grid-template-columns: 1fr; }
  .doc-inline .doc .d-lh { flex-direction: column; }
  .doc-inline .doc .d-ref { text-align: left; }
  .peek-modal .doc .d-body { grid-template-columns: 1fr; }
  .peek-modal { padding: 10px; }
}

/* ---------- print: a one-page brief on A4 ---------- */
@page { size: A4 portrait; margin: 14mm; }
#printRoot { display: none; }
#printRoot .pr-page { width: 182mm; }
#printRoot .doc { font-size: 11.5pt; padding: 0; border-radius: 0; box-shadow: none; background: #fff; --p: #fff; }
#printRoot .doc::after { display: none; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.stage[data-step="8"] .peek, .stage[data-step="9"] .peek { display: none !important; }
.stage[data-step="9"] { min-height: 420px; }
