/* =========================================================
   Hostinger Downloadable — Document styles
   A4 paper, headers/footers, content blocks
   These styles apply to the printable document (.doc / .page)
   ========================================================= */

:root {
  --a4-w: 794px;   /* 210mm @ ~96dpi */
  --a4-h: 1123px;  /* 297mm @ ~96dpi */
  --doc-pad-x: 56px;
  --doc-pad-y: 56px;

  --doc-ink: var(--h-fg-neutral-default, #18181A);
  --doc-muted: #58585E;
  --doc-rule: #E5E5EA;
}

/* ---------- Document container ---------- */
.doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 28px 28px 48px;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--doc-ink);
}

.page {
  position: relative;
  width: var(--a4-w);
  height: var(--a4-h);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 14px 40px rgba(0,0,0,.08);
  border-radius: 2px;
  overflow: hidden;
  break-after: page;
  page-break-after: always;
}
.page:last-child {
  break-after: auto;
  page-break-after: auto;
}

/* Page body — has padding, header/footer sit outside inset */
.page__body {
  position: absolute;
  inset: 0;
  padding: 88px var(--doc-pad-x) 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

/* ---------- Page header (inner pages) ---------- */
.pg-head {
  position: absolute;
  top: 0;
  left: var(--doc-pad-x);
  right: var(--doc-pad-x);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--doc-rule);
  font-size: 11px;
  color: var(--doc-muted);
}
.pg-head__logo {
  display: inline-flex;
  align-items: center;
  color: var(--doc-ink);
}
.pg-head__logo .hg-logo {
  height: 14px; width: 70px; display: block;
  color: var(--doc-ink);
}
.pg-head__sub {
  text-align: right;
  letter-spacing: 0.02em;
}

/* ---------- Page footer ---------- */
.pg-foot {
  position: absolute;
  left: var(--doc-pad-x);
  right: var(--doc-pad-x);
  bottom: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--doc-rule);
  font-size: 10.5px;
  color: var(--doc-muted);
  text-align: center;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   COVER PAGES
   The cover-header is used in two modes:
     • --full     : full-page hero (when TOC is enabled)
     • --compact  : top header on the first content page (when TOC is disabled)
   Variants:
     • cover-band   : edge-to-edge purple band, white logo + white title
     • cover-accent : white background, violet logo + violet title, branded shapes top-right
   ========================================================= */

/* When the page is a cover page (full or inline), kill the page__body padding
   so the band can extend edge-to-edge. */
.page--cover-full .page__body,
.page--cover-inline .page__body {
  padding: 0;
}
.page--cover-full {
  /* full-page hero — header fills the whole page */
}

/* Inline cover page: cover-header at top, content body below.
   The body picks up its own horizontal padding. */
.page__body--cover-inline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ============ Variant A — purple band ============ */

.cover-band {
  position: relative;
  background: var(--h-primary-500);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.cover-band__shapes {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 65%;
  pointer-events: none;
  opacity: 0.95;
}
.cover-band__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}
.cover-band__brand .hg-logo {
  height: 35px; width: 171px; display: block;
  color: #fff;
}
.cover-band__sublab {
  font-size: 11px;
  color: rgba(255,255,255,0.78);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}
.cover-band__title {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff;
  text-wrap: pretty;
}
.cover-band__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}
.cover-band__crumbs span + span::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  background: rgba(255,255,255,0.55);
  margin-right: 12px;
  transform: translateY(-2px);
}

/* Full-page band hero: fills entire A4. Logo top-left, title mid-page,
   crumbs bottom-left. Shapes anchored right side. */
.cover-band--full {
  position: absolute;
  inset: 0;
  padding: 56px 56px 72px;
  display: flex;
}
.cover-band--full .cover-band__shapes {
  width: 58%;
  opacity: 1;
}
.cover-band--full .cover-band__inner {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  position: relative;
  z-index: 1;
}
.cover-band--full .cover-band__sublab {
  margin-top: 6px;
}
.cover-band--full .cover-band__lede {
  align-self: center;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  max-width: 22ch;
  text-wrap: pretty;
  margin: 0;
}
.cover-band--compact .cover-band__lede {
  font-size: 14px;
  line-height: 1.4;
  color: rgba(255,255,255,0.85);
  margin: 0 0 18px;
  max-width: 28ch;
}
.cover-accent__lede {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--h-text-secondary, #58585E);
  max-width: 28ch;
  margin: 16px 0 0;
}
.cover-band--full .cover-band__title {
  font-size: 64px;
  line-height: 1.02;
  max-width: 12ch;
  align-self: end;
  margin: 0 0 24px 0;
}
.cover-band--full .cover-band__crumbs {
  font-size: 13px;
  align-self: end;
}

/* Compact band header (top of page 1, content sits below) — smaller, tighter */
.cover-band--compact {
  padding: 36px 56px 44px;
  /* edge to edge — page__body has no padding for cover pages */
}
.cover-band--compact .cover-band__brand {
  margin-bottom: 28px;
}
.cover-band--compact .cover-band__sublab {
  margin: 0 0 22px;
}
.cover-band--compact .cover-band__title {
  font-size: 34px;
  line-height: 1.08;
  max-width: 22ch;
  margin: 0 0 8px;
}
.cover-band--compact .cover-band__crumbs {
  margin-top: 18px;
}

/* ============ Variant B — accent (white) ============ */

.cover-accent {
  position: relative;
  background: #fff;
  color: var(--h-primary-500);
  overflow: hidden;
  isolation: isolate;
}
.cover-accent__shapes {
  position: absolute;
  top: 0; right: 0;
  width: 40%;
  height: 70%;
  pointer-events: none;
  opacity: 0.95;
}
.cover-accent__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}
.cover-accent__brand .hg-logo {
  height: 35px; width: 171px; display: block;
  color: var(--h-primary-500);
}
.cover-accent__sublab {
  font-size: 11px;
  color: var(--doc-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}
.cover-accent__title {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--h-primary-500);
  text-wrap: pretty;
}
.cover-accent__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--doc-muted);
}
.cover-accent__crumbs span + span::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  background: var(--h-primary-500);
  margin-right: 12px;
  transform: translateY(-2px);
}

/* Full-page accent hero */
.cover-accent--full {
  position: absolute;
  inset: 0;
  padding: 56px 56px 72px;
  display: flex;
}
.cover-accent--full .cover-accent__shapes {
  width: 50%;
  height: 75%;
}
.cover-accent--full .cover-accent__inner {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  position: relative;
  z-index: 1;
}
.cover-accent--full .cover-accent__sublab {
  margin-top: 6px;
}
.cover-accent--full .cover-accent__title {
  font-size: 64px;
  line-height: 1.02;
  max-width: 12ch;
  align-self: end;
  margin: 0 0 24px 0;
}
.cover-accent--full .cover-accent__crumbs {
  font-size: 13px;
  align-self: end;
  color: var(--doc-muted);
}

/* Compact accent header (top of page 1) */
.cover-accent--compact {
  padding: 36px 56px 40px;
  border-bottom: 1px solid var(--h-primary-200);
}
.cover-accent--compact .cover-accent__shapes {
  width: 28%;
  height: 100%;
}
.cover-accent--compact .cover-accent__brand {
  margin-bottom: 28px;
}
.cover-accent--compact .cover-accent__sublab {
  margin: 0 0 22px;
}
.cover-accent--compact .cover-accent__title {
  font-size: 34px;
  line-height: 1.08;
  max-width: 22ch;
  margin: 0 0 8px;
}
.cover-accent--compact .cover-accent__crumbs {
  margin-top: 18px;
}

/* Inline-cover page: content area sits beneath the compact header.
   Use horizontal padding here since the header is edge-to-edge. */
.page--cover-inline .page__body--cover-inline {
  /* the cover-header is in normal flow at top of page; we need to push content
     below it. Use CSS grid so it auto-flows. */
}
.page--cover-inline {
  display: block;
}
.page--cover-inline .cover-band--compact,
.page--cover-inline .cover-accent--compact {
  position: relative;
}
.page--cover-inline .page__body--cover-inline {
  position: static;
  inset: auto;
  padding: 28px var(--doc-pad-x) 64px;
  flex: 1;
  overflow: hidden;
  /* Compute remaining height for overflow detection */
  height: auto;
}

/* For overflow-based pagination to work, the inline-cover body needs a bounded height.
   We use the page's known height minus the cover header height.
   Cover compact band ≈ 22+28 padding + ~80 content = ~130px. Reserve a hard min via flex. */
.page--cover-inline {
  display: flex;
  flex-direction: column;
}
.page--cover-inline .page__body--cover-inline {
  flex: 1 1 auto;
  min-height: 0;
}

/* =========================================================
   CONTENTS PAGE
   ========================================================= */
.toc__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--doc-muted);
  margin: 0 0 8px;
}
.toc__heading {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 28px;
  font-weight: 700;
}
.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc__list li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: baseline;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--doc-rule);
}
.toc__list li:last-child { border-bottom: 1px solid var(--doc-rule); }
.toc__num {
  font-weight: 900;
  font-size: 22px;
  color: var(--h-primary-500);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.toc__name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.toc__desc {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--doc-muted);
  line-height: 1.4;
  margin-top: 4px;
}
.toc__pg {
  font-size: 12px;
  color: var(--doc-muted);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   CONTENT BLOCKS
   ========================================================= */

/* Heading block */
.b-heading {
  margin: 4px 0 0;
  letter-spacing: -0.015em;
  font-weight: 700;
}
.b-heading--h1 { font-size: 32px; line-height: 1.1; }
.b-heading--h2 {
  font-size: 22px;
  line-height: 1.2;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--doc-rule);
}
.b-heading--h3 { font-size: 17px; line-height: 1.3; }
.b-heading__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--h-primary-500);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.b-heading__eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--h-primary-500);
}

/* Paragraph */
.b-para {
  font-size: 14px;
  line-height: 1.55;
  color: var(--doc-ink);
  margin: 0;
}
.b-para--lede {
  font-size: 16px;
  line-height: 1.5;
  color: var(--doc-ink);
}
.b-para strong { font-weight: 700; }

/* Intro callout (purple-tinted box, used on first content page) */
.b-intro {
  border: 1px solid var(--h-primary-200);
  background: var(--h-primary-50);
  border-radius: 6px;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.5;
}
.b-intro strong { color: var(--h-primary-700); font-weight: 700; }

/* Checklist (interactive checkboxes) */
.b-checklist {
  display: grid;
  gap: 8px;
}
.b-checklist__item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--doc-rule);
  border-radius: 6px;
  background: #fff;
}
.b-checklist__item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--h-neutral-400);
  border-radius: 3px;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: #fff;
  flex-shrink: 0;
}
.b-checklist__item input[type="checkbox"]:checked {
  background: var(--h-primary-500);
  border-color: var(--h-primary-500);
}
.b-checklist__item input[type="checkbox"]:checked::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.b-checklist__label {
  font-size: 13.5px;
  line-height: 1.45;
}
.b-checklist__label b {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
}

/* Numbered list (use cases) */
.b-numlist {
  display: grid;
  gap: 10px;
  counter-reset: nlist;
}
.b-numlist__item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--doc-rule);
  border-radius: 8px;
  counter-increment: nlist;
  align-items: center;
}
.b-numlist__main { min-width: 0; }
.b-numlist__item::before {
  content: counter(nlist, decimal-leading-zero);
  font-weight: 900;
  font-size: 22px;
  color: var(--h-primary-500);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.b-numlist__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0 0 4px;
}
.b-numlist__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--doc-muted);
  margin: 0;
}

/* Reference grid (categories with rows) */
.b-refgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.b-refgrid__cat {
  border: 1px solid var(--doc-rule);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.b-refgrid__head {
  background: var(--h-primary-500);
  color: #fff;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.b-refgrid__head .check {
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 2px;
}
.b-refgrid__row {
  display: grid;
  grid-template-columns: 1fr auto 1.1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--h-neutral-100);
  min-height: 50px;
}
.b-refgrid__row:nth-child(even) { background: #FAFAFB; }
.b-refgrid__name {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--doc-ink);
}
.b-refgrid__desc {
  font-size: 11px;
  line-height: 1.35;
  color: var(--h-neutral-700);
}
.b-refgrid__tagcell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
}

/* Generic reusable tag chip (used by checklist / numlist / steps / refgrid).
   Color is applied inline via background:<hex> on the element. */
.b-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.3;
}

/* Item layouts that pin a tag to the right of the row */
.b-checklist__item .b-tag { align-self: center; }
.b-numlist__item .b-tag { align-self: center; }
.b-steps__item .b-tag { align-self: start; margin-top: 2px; }

/* Step-by-step */
.b-steps { display: grid; gap: 14px; counter-reset: steps; }
.b-steps__item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  position: relative;
  counter-increment: steps;
  padding-bottom: 12px;
  align-items: start;
}
.b-steps__main { min-width: 0; }
.b-steps__item::before {
  content: counter(steps);
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  background: var(--h-primary-500);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.b-steps__title {
  font-size: 14.5px;
  font-weight: 700;
  margin: 2px 0 4px;
  line-height: 1.3;
}
.b-steps__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--doc-muted);
  margin: 0;
}

/* Prompt card (dark) */
.b-prompt {
  background: var(--h-neutral-900);
  color: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.b-prompt__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 6px;
}
.b-prompt--cli {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: #0E0E10;
  font-size: 12.5px;
}

/* Fillable text fields */
.b-form { display: grid; gap: 12px; }
.b-form__field { display: grid; gap: 6px; }
.b-form__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--doc-ink);
  letter-spacing: 0.005em;
}
.b-form__hint {
  font-size: 11.5px;
  color: var(--doc-muted);
  font-weight: 400;
  margin-left: 6px;
}
.b-form input[type="text"],
.b-form textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--h-primary-200);
  background: var(--h-primary-50);
  color: var(--doc-ink);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
.b-form input[type="text"]:focus,
.b-form textarea:focus {
  border-color: var(--h-primary-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(103,61,230,0.15);
}
.b-form textarea { min-height: 70px; }

/* Callout (tip / warning) */
.b-callout {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--h-primary-50);
  border: 1px solid var(--h-primary-200);
  font-size: 13px;
  line-height: 1.5;
}
.b-callout__icon {
  width: 20px; height: 20px;
  color: var(--h-primary-500);
  margin-top: 1px;
}
.b-callout--warning {
  background: #FEF6D6;
  border-color: rgba(247,198,8,0.45);
}
.b-callout--warning .b-callout__icon { color: var(--h-warning-700); }
.b-callout--info {
  background: #E8F2FE;
  border-color: rgba(46,147,238,0.3);
}
.b-callout--info .b-callout__icon { color: var(--h-info-600); }

/* Two-column comparison */
.b-twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.b-twocol__col {
  border: 1px solid var(--doc-rule);
  border-radius: 8px;
  padding: 16px 18px;
  background: #fff;
}
.b-twocol__head {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.b-twocol__head--good { color: var(--h-success-700); }
.b-twocol__head--bad  { color: var(--h-danger-700); }
.b-twocol__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.5;
  display: grid;
  gap: 6px;
}
.b-twocol__list li {
  padding-left: 18px;
  position: relative;
}
.b-twocol__list li::before {
  position: absolute;
  left: 0; top: 0;
  font-weight: 700;
}
.b-twocol__col--good .b-twocol__list li::before { content: "+"; color: var(--h-success-500); }
.b-twocol__col--bad .b-twocol__list li::before { content: "−"; color: var(--h-danger-500); }

/* Worksheet table (interactive) */
.b-table {
  border: 1px solid var(--doc-rule);
  border-radius: 6px;
  overflow: hidden;
}
.b-table__row {
  display: grid;
  border-top: 1px solid var(--doc-rule);
}
.b-table__row:first-child { border-top: 0; }
.b-table__row--head {
  background: var(--h-primary-500);
  color: #fff;
}
.b-table__cell {
  padding: 9px 12px;
  font-size: 12.5px;
  border-left: 1px solid var(--doc-rule);
  min-height: 38px;
  display: flex;
  align-items: center;
}
.b-table__cell:first-child { border-left: 0; }
.b-table__row--head .b-table__cell {
  font-weight: 700;
  font-size: 12px;
  border-left-color: rgba(255,255,255,0.2);
  letter-spacing: 0.01em;
}
.b-table__cell input {
  font-family: inherit;
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  padding: 4px 0;
  outline: none;
}
.b-table__cell input:focus {
  background: var(--h-primary-50);
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 3px;
}

/* Number column: narrow, centered, no input */
.b-table__cell--num {
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--doc-muted);
  font-size: 12px;
}
.b-table__row--head .b-table__cell--num {
  color: rgba(255,255,255,0.85);
}

/* Resize handle on header cell */
.b-table__row--head .b-table__cell {
  position: relative;
}
.b-table__resize {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
  /* Subtle visual cue on hover */
}
.b-table__resize::after {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  left: 50%;
  width: 2px;
  background: rgba(255,255,255,0);
  border-radius: 2px;
  transition: background 120ms ease;
}
.b-table__resize:hover::after,
body.is-resizing-col .b-table__resize::after {
  background: rgba(255,255,255,0.55);
}
body.is-resizing-col {
  cursor: col-resize !important;
  user-select: none;
}
body.is-resizing-col .b-table__cell input {
  pointer-events: none;
}

/* Hide resize handles in print/PDF */
@media print {
  .b-table__resize { display: none !important; }
}

/* Notes prompt — sits in the upper half of the closing CTA page */
.b-notes {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.b-notes__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.b-notes__eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--doc-muted);
  font-weight: 700;
}
.b-notes__title {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--doc-ink);
  margin: 0;
  max-width: 28ch;
  text-wrap: pretty;
}
.b-notes__sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--doc-muted);
  margin: 0;
  max-width: 56ch;
}
.b-notes__lines {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: 6px;
}
.b-notes__lines > span {
  display: block;
  height: 0;
  border-bottom: 1px solid var(--doc-rule);
}

/* CTA closing */
.b-cta {
  margin-top: auto;
  padding: 36px 36px 36px;
  border-radius: 14px;
  background: var(--h-primary-500);
  color: #fff;
  display: grid;
  gap: 12px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.b-cta__shapes {
  position: absolute;
  top: 0; right: 0;
  width: 180px; height: 100%;
  opacity: 0.55;
  z-index: -1;
}
.b-cta__title {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-weight: 700;
  margin: 0;
  max-width: 18ch;
}
.b-cta__body {
  font-size: 14.5px;
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
  margin: 0;
  max-width: 56ch;
}
.b-cta__btn {
  margin-top: 8px;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  color: var(--h-primary-700);
  font-weight: 700;
  font-size: 14px;
  border-radius: 8px;
  text-decoration: none;
  letter-spacing: 0.005em;
}
.b-cta__btn:hover { background: var(--h-primary-50); }
.b-cta__url {
  font-size: 11.5px;
  color: rgba(255,255,255,0.7);
  word-break: break-all;
}

/* Variant: minimal CTA (sign-off) */
.b-cta--minimal {
  background: transparent;
  color: var(--doc-ink);
  border: 1px solid var(--doc-rule);
  padding: 28px 32px;
}
.b-cta--minimal .b-cta__shapes { display: none; }
.b-cta--minimal .b-cta__title { color: var(--doc-ink); font-size: 22px; }
.b-cta--minimal .b-cta__body { color: var(--doc-muted); }
.b-cta--minimal .b-cta__btn {
  background: var(--h-primary-500);
  color: #fff;
}
.b-cta--minimal .b-cta__btn:hover { background: var(--h-primary-700); }
.b-cta--minimal .b-cta__url { color: var(--doc-muted); }

/* =========================================================
   PAGE-MODE OVERLAY (live block selection in preview)
   ========================================================= */
.block-wrap {
  position: relative;
}
.block-wrap[data-selectable="true"] {
  cursor: pointer;
  border-radius: 6px;
  outline: 1px dashed transparent;
  outline-offset: 4px;
  transition: outline-color 0.12s ease, background 0.12s ease;
}
.block-wrap[data-selectable="true"]:hover {
  outline-color: var(--h-primary-300);
}
.block-wrap.is-selected {
  outline: 1.5px solid var(--h-primary-500) !important;
  outline-offset: 4px;
}
.block-wrap__tag {
  position: absolute;
  top: -10px;
  left: -2px;
  background: var(--h-primary-500);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.block-wrap.is-selected .block-wrap__tag,
.block-wrap[data-selectable="true"]:hover .block-wrap__tag {
  opacity: 1;
}
.block-wrap__remove {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--h-danger-500);
  color: #fff;
  border: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 5;
}
.block-wrap.is-selected .block-wrap__remove {
  opacity: 1;
}

/* Duplicate button — sits next to the block label tag */
.block-wrap__dup {
  position: absolute;
  top: -12px;
  left: calc(var(--dup-offset, 0px) + 92px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff;
  color: var(--h-fg-neutral-default);
  border: 1px solid var(--h-stroke-default);
  font-family: var(--h-font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  z-index: 5;
  box-shadow: 0 1px 2px rgba(24, 24, 26, 0.06);
}
.block-wrap__dup svg { flex: 0 0 auto; }
.block-wrap__dup:hover {
  background: var(--h-primary-500);
  color: #fff;
  border-color: var(--h-primary-500);
}
.block-wrap.is-selected .block-wrap__dup,
.block-wrap[data-selectable="true"]:hover .block-wrap__dup {
  opacity: 1;
}

/* The duplicate button needs to clear the block-name tag, whose width
   varies per block. Anchor it to the right edge of the tag using grid
   tricks — simplest is to align with the tag baseline + a left offset
   that grows with the tag. We use a fixed 96px which fits all current
   labels ("Reference grid" being the longest). */

/* =========================================================
   PRINT — Render the preview DOM as the actual PDF.
   Strategy: hide the app shell, expose only .doc, set @page A4,
   and reset .page chrome (no shadow/radius) so each .page becomes
   a single PDF page with pixel parity to the on-screen preview.
   ========================================================= */
@page {
  size: A4;
  margin: 0;
}

@media print {
  /* Hide the entire app shell except the document and the SVG symbol defs
     (CTA page <use href="#bs-..."> needs the defs to be in the rendered DOM). */
  body > *:not(.print-host):not(#hg-shape-defs) { display: none !important; }
  .print-host { display: block !important; }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* The .doc container in the stage becomes the print host. */
  .doc {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    background: #fff !important;
  }

  /* Each page = one A4 sheet, no shell chrome. */
  .page {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    overflow: hidden !important;
    /* page-break-after: always is already set by .page rule */
  }
  .page:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  /* Block-selection chrome must not leak into print. */
  .block-wrap.is-selected,
  .block-wrap:hover,
  .block-wrap { outline: none !important; box-shadow: none !important; }
  .block-wrap__remove,
  .block-wrap__dup,
  .block-wrap__tag { display: none !important; }

  /* Keep on-screen "fillable input" tint off in print so the boxes
     look the same as the preview's printed state (white box + thin
     border). The preview already swaps these via media print elsewhere
     if defined; this is a safe net. */
  input[type="text"], input[type="email"], input[type="url"],
  input[type="number"], textarea {
    background: #fff !important;
    border: 1px solid #C9C9CF !important;
    color: #18181A !important;
  }

  /* Modern Chromium-based browsers preserve form widgets in PDF
     when the user picks "Save as PDF". We simply ensure they remain
     visible. */
}

/* When body.is-printing is set briefly while the dialog is opening,
   make sure layout is settled (no animations etc.). */
body.is-printing {
  /* No-op for now; reserved for future tweaks. */
}
