/*
 * Editor chrome for the quote builder — everything the client never sees.
 * The document itself is styled by document.css and is deliberately untouched
 * by anything here, so the preview cannot drift from the print output.
 */

@font-face {
  font-family: "Somar Sans";
  src: url("../fonts/SomarSans-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Somar Sans";
  src: url("../fonts/SomarSans-ExtraBold.otf") format("opentype");
  font-weight: 500 900;
  font-display: swap;
}
/* dash / ellipsis / nbsp — glyphs Somar Sans doesn't carry */
@font-face {
  font-family: "Somar Sans";
  src: local("Segoe UI"), local("Helvetica Neue"), local("Arial");
  unicode-range: U+00A0, U+2010-2015, U+2026;
}

:root {
  --brand: #a7020f;
  --brand-dark: #141414;
  --brand-deep: #000000;
  --brand-soft: #f4e3e4;
  --brand-pale: #f5f5f5;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e4e1de;
  --surface: #fbfaf9;
  --radius: .85rem;
  --shadow-sm: 0 8px 24px -18px rgba(20, 20, 20, .28);
  --mobile-actions-h: 4.75rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Somar Sans", Tahoma, Arial, sans-serif;
  font-synthesis: none;
  line-height: 1.7;
  overscroll-behavior-y: contain;
}

button, input, textarea { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---- login ---------------------------------------------------------------- */
.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 15% 12%, rgba(167, 2, 15, .35), transparent 45%),
    var(--brand-deep);
}
.login-card {
  width: min(100%, 25rem);
  border-radius: 1.35rem;
  background: #fff;
  padding: 2rem 1.75rem 2.25rem;
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, .8);
}
.login-logo { display: block; width: 8rem; margin-inline: auto; }
.login-strip {
  height: .5rem;
  margin: 1.35rem -1.75rem 1.5rem;
  background: var(--brand);
}
.login-card h1 { margin: 0; color: var(--brand-dark); font-size: 1.35rem; font-weight: 900; text-align: center; }
.login-sub { margin: .35rem 0 1.5rem; color: var(--muted); font-size: .9rem; text-align: center; }
.login-card label { display: block; margin-bottom: .35rem; color: var(--brand-dark); font-size: .85rem; font-weight: 900; }
.login-card input {
  width: 100%;
  min-height: 3rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--brand-pale);
  padding: 0 .9rem;
}
.login-card input:focus { border-color: var(--brand); background: #fff; }
.login-card button {
  width: 100%;
  min-height: 3rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  transition: background-color .2s ease;
}
.login-card button:hover { background: var(--brand-dark); }
.login-error {
  margin: 0 0 1.1rem;
  border: 1px solid #f0c7c7;
  border-inline-start: 4px solid #b3261e;
  border-radius: var(--radius);
  background: #fdf3f3;
  padding: .75rem .9rem;
  color: #7c1d16;
  font-size: .85rem;
  line-height: 1.7;
}
.login-error code { display: block; margin-top: .4rem; font-size: .78rem; word-break: break-all; }

/* ---- app shell ------------------------------------------------------------ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .6rem;
  border-block-end: 1px solid var(--line);
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-deep));
  padding: .7rem clamp(.75rem, 2vw, 1.25rem);
  color: #fff;
}
.header-brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.header-brand img { height: 2rem; width: auto; flex: none; }
.header-brand span { display: none; color: rgba(255, 255, 255, .72); font-size: .78rem; font-weight: 900; }
.app-header .spacer { flex: 1; }
.app-actions { display: flex; align-items: center; gap: .55rem; }
.app-user { display: inline-flex; align-items: center; gap: .45rem; color: rgba(255, 255, 255, .68); font-size: .82rem; white-space: nowrap; }
.app-user a { border-inline-start: 1px solid rgba(255, 255, 255, .2); padding-inline-start: .45rem; color: rgba(255, 255, 255, .82); }

.seg { display: inline-flex; border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; padding: .2rem; }
.seg button {
  min-height: 2.2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0 .95rem;
  color: rgba(255, 255, 255, .7);
  font-size: .85rem;
  font-weight: 900;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--brand-dark); }

.btn {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .08);
  padding: 0 .9rem;
  color: #fff;
  font-size: .85rem;
  font-weight: 900;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}
.btn:hover { background: rgba(255, 255, 255, .18); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: wait; transform: none; }
.btn--primary { border-color: transparent; background: #fff; color: var(--brand-dark); }
.btn--primary:hover { background: #f1e7e7; }
.btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100dvh - 3.9rem);
}

/* ---- editor --------------------------------------------------------------- */
.editor {
  position: sticky;
  top: 3.9rem;
  max-height: calc(100dvh - 3.9rem);
  overflow-y: auto;
  border-inline-end: 1px solid var(--line);
  background: #f6f4f2;
  padding: 1.1rem clamp(.8rem, 1.6vw, 1.15rem) 4rem;
}
.editor-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .25rem .75rem;
  padding: .25rem .15rem .9rem;
}
.eyebrow { display: block; color: var(--muted); font-size: .7rem; font-weight: 900; }
.editor-intro h1 { margin: 0; color: var(--brand-dark); font-size: 1.25rem; line-height: 1.45; }
.editor-intro p { grid-column: 1 / -1; margin: .2rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.6; }
.draft-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: .25rem .55rem;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
  white-space: nowrap;
}
.draft-status::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: #2f8f63; }

.form-section {
  display: block;
  margin: 0 0 .85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.section-heading { display: flex; align-items: flex-start; gap: .7rem; margin-bottom: 1rem; }
.section-number {
  width: 2rem;
  height: 2rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: .65rem;
  background: #f1efec;
  color: var(--brand-dark);
  font-size: .82rem;
  font-weight: 900;
}
.section-heading h2 { margin: 0; color: var(--brand-dark); font-size: 1rem; line-height: 1.5; }
.section-heading p { margin: .1rem 0 0; color: var(--muted); font-size: .73rem; line-height: 1.55; }
.form-extra { margin-top: .75rem; }

.form-section--optional { padding: 0; overflow: hidden; }
.form-section--optional > summary {
  min-height: 4rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1rem;
  list-style: none;
  cursor: pointer;
}
.form-section--optional > summary::-webkit-details-marker { display: none; }
.summary-copy { flex: 1; min-width: 0; }
.summary-copy strong, .summary-copy small { display: block; }
.summary-copy strong { color: var(--brand-dark); font-size: .95rem; }
.summary-copy small { color: var(--muted); font-size: .7rem; }
.form-section--optional > summary > svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.form-section--optional[open] > summary > svg { transform: rotate(180deg); }
.optional-content { border-block-start: 1px solid var(--line); padding: 1rem; }

.approval-editor { display: grid; gap: 1rem; }
.approval-toggle {
  min-height: 3.5rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--brand-pale);
  padding: .75rem;
  cursor: pointer;
}
.approval-toggle input { width: 1.25rem; height: 1.25rem; flex: none; margin-top: .15rem; accent-color: var(--brand-dark); }
.approval-toggle span, .approval-toggle strong, .approval-toggle small { display: block; }
.approval-toggle strong { color: var(--brand-dark); font-size: .84rem; }
.approval-toggle small { margin-top: .1rem; color: var(--muted); font-size: .72rem; line-height: 1.55; }
#approval-fields { display: grid; gap: .9rem; }
#approval-fields[hidden] { display: none !important; }
.approval-kinds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  min-width: 0;
  border: 0;
}
.approval-kinds legend {
  width: 100%;
  margin-bottom: .45rem;
  color: var(--brand-dark);
  font-size: .78rem;
  font-weight: 900;
}
.approval-kinds label {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: #fff;
  padding: .65rem .75rem;
  cursor: pointer;
}
.approval-kinds input { width: 1.2rem; height: 1.2rem; flex: none; accent-color: var(--brand-dark); }
.approval-kinds span, .approval-kinds strong, .approval-kinds small { display: block; }
.approval-kinds strong { color: var(--brand-dark); font-size: .8rem; }
.approval-kinds small { color: var(--muted); font-size: .68rem; line-height: 1.45; }
.approval-kinds label:has(input:checked) { border-color: var(--brand-dark); background: var(--brand-pale); }
.approval-kinds label:has(input:disabled) { cursor: not-allowed; }
.approval-assets { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.approval-asset { min-width: 0; border: 1px solid var(--line); border-radius: .8rem; background: #fff; padding: .75rem; }
.approval-asset[hidden] { display: none !important; }
.approval-assets:has(.approval-asset[hidden]) { grid-template-columns: 1fr; }
.approval-asset label, .approval-asset label strong, .approval-asset label small { display: block; }
.approval-asset label strong { color: var(--brand-dark); font-size: .82rem; }
.approval-asset label small { color: var(--muted); font-size: .7rem; }
.approval-asset input[type="file"] {
  width: 100%;
  min-height: 2.75rem;
  margin-top: .6rem;
  border: 1px dashed var(--line);
  border-radius: .65rem;
  background: var(--brand-pale);
  padding: .45rem;
  font-size: .72rem;
  cursor: pointer;
}
.approval-preview {
  min-height: 6rem;
  display: grid;
  place-items: center;
  margin-top: .6rem;
  border-radius: .65rem;
  background: #f7f5f3;
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
  overflow: hidden;
}
.approval-preview img { display: block; max-width: 100%; max-height: 8rem; object-fit: contain; }
.asset-remove {
  width: 100%;
  min-height: 2.75rem;
  margin-top: .55rem;
  border: 1px solid #e3b7b3;
  border-radius: .6rem;
  background: #fff;
  color: #9b2c24;
  font-size: .76rem;
  font-weight: 900;
  cursor: pointer;
}
.asset-remove:disabled { opacity: .4; cursor: not-allowed; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid--one { grid-template-columns: 1fr; }

.field { display: block; min-width: 0; }
.field > span {
  display: block;
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 900;
  letter-spacing: .01em;
}
.field > span small { color: #8e8499; font-size: .68rem; font-weight: 400; }
.field input, .field textarea, .row input {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--brand-pale);
  padding: .5rem .75rem;
  font-size: .9rem;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.field textarea { min-height: 6rem; resize: vertical; line-height: 1.8; }
.field input:focus, .field textarea:focus, .row input:focus { border-color: var(--brand-dark); background: #fff; box-shadow: 0 0 0 3px rgba(20, 20, 20, .12); outline: none; }
.field input::placeholder, .row input::placeholder { color: #a49daf; }

.hint { margin: .4rem 0 0; color: var(--muted); font-size: .74rem; line-height: 1.65; }
.hint--top {
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--brand-dark);
  border-radius: .6rem;
  background: var(--brand-pale);
  padding: .7rem .9rem;
  font-size: .78rem;
}
.hint--top b { color: var(--brand-dark); }

/* ---- repeatable rows ------------------------------------------------------ */
.rows { display: grid; gap: .55rem; }
.row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: .75rem;
}
.row-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.row-n {
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  border-radius: .4rem;
  background: #f1efec;
  color: var(--brand-dark);
  font-size: .72rem;
  font-weight: 900;
}
.row-kind { flex: 1; min-width: 0; color: var(--brand-dark); font-size: .82rem; }
.row-actions { display: flex; align-items: center; gap: .35rem; }
.row-drag, .row-del, .line-del {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}
.row-drag svg, .row-del svg, .line-del svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row-drag:hover { color: var(--brand-dark); border-color: var(--brand-dark); }
.row-del:hover, .line-del:hover { color: #b3261e; border-color: #e3b7b3; }
.row-drag:disabled { opacity: .35; cursor: not-allowed; }
.row > .field { margin-top: 0; }
.row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .6rem; }

.lines { display: grid; gap: .45rem; margin-top: .7rem; }
.line { display: flex; gap: .35rem; }
.line input { min-height: 2.65rem; font-size: .86rem; }
.line-add {
  justify-self: start;
  min-height: 2.65rem;
  border: 1px dashed var(--line);
  border-radius: .45rem;
  background: transparent;
  padding: 0 .7rem;
  color: var(--brand-dark);
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
}
.line-add:hover { border-color: var(--brand-dark); background: var(--brand-pale); }

.add {
  width: 100%;
  min-height: 2.9rem;
  margin-top: .55rem;
  border: 1px dashed var(--brand-dark);
  border-radius: var(--radius);
  background: var(--brand-pale);
  color: var(--brand-dark);
  font-weight: 900;
  cursor: pointer;
}
.add:hover { background: var(--brand-soft); }

/* ---- running totals ------------------------------------------------------- */
.summary {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 1.5rem -1.15rem 0;
  border-block-start: 1px solid var(--line);
  background: var(--line);
  box-shadow: 0 -10px 24px -22px rgba(20, 20, 20, .4);
}
.summary div { background: #fff; padding: .55rem .5rem; text-align: center; }
.summary span { display: block; color: var(--muted); font-size: .68rem; font-weight: 900; }
.summary b { color: var(--brand-dark); font-size: .92rem; font-weight: 900; direction: ltr; unicode-bidi: isolate; }
.summary div:last-child { background: var(--brand-dark); }
.summary div:last-child span { color: #e7cbce; }
.summary div:last-child b { color: #fff; }

/* ---- preview -------------------------------------------------------------- */
.preview {
  position: sticky;
  top: 3.9rem;
  height: calc(100dvh - 3.9rem);
  overflow: hidden auto;
  background: #ece9e6;
  padding: 1rem .75rem 3rem;
}
.stage { display: flex; justify-content: center; }
.sheets { transform-origin: top center; }
.sheets .sheet { box-shadow: 0 18px 45px -25px rgba(0, 0, 0, .4); }
.sheets .sheet + .sheet { margin-top: 1rem; }

/* ---- mobile --------------------------------------------------------------- */
.panel-switch { display: none; }

@media (max-width: 62rem) {
  .panel-switch { display: inline-flex; }
  .app { grid-template-columns: 1fr; }

  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .55rem .75rem;
    padding: max(.6rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) .65rem max(.75rem, env(safe-area-inset-left));
  }
  .header-brand { min-width: 0; }
  .header-brand img { height: 1.7rem; width: auto; }
  .header-brand span { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-header .spacer { display: none; }
  .panel-switch { grid-column: 1 / -1; width: 100%; min-height: 2.85rem; }
  .app-header .seg button { min-height: 2.45rem; flex: 1; padding: 0 .75rem; font-size: .82rem; }
  .app-user { justify-self: end; font-size: .74rem; }
  .user-name { display: none; }

  .app-actions {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    border-block-start: 1px solid var(--line);
    background: rgba(255, 255, 255, .97);
    padding: .5rem max(.75rem, env(safe-area-inset-right)) max(.5rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
    box-shadow: 0 -12px 30px -22px rgba(20, 20, 20, .4);
    backdrop-filter: blur(14px);
  }
  .app-actions .btn {
    min-width: 0;
    min-height: 3.25rem;
    justify-content: center;
    border-color: var(--line);
    background: #fff;
    padding: 0 .45rem;
    color: var(--brand-dark);
    font-size: .76rem;
  }
  .app-actions .btn:hover { background: var(--brand-pale); }
  .app-actions .btn--primary { border-color: var(--brand-dark); background: var(--brand-dark); color: #fff; }
  .app-actions .btn--primary:hover { background: var(--brand-dark); }
  .app-actions .btn-icon { width: 1.15rem; height: 1.15rem; }

  .app { padding-bottom: calc(var(--mobile-actions-h) + env(safe-area-inset-bottom)); }
  .editor, .preview { position: static; max-height: none; height: auto; border-inline-end: 0; }
  .editor { padding: .8rem .75rem 1.25rem; }
  .preview { min-height: calc(100dvh - 7rem); padding-bottom: 2rem; }
  .summary {
    position: static;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin: 1rem 0 0;
    border: 1px solid var(--line);
    border-radius: 1rem;
    overflow: hidden;
  }
  .summary div { min-height: 3.5rem; display: grid; align-content: center; }
  body[data-view="preview"] .editor { display: none; }
  /*
   * The preview is parked off-screen rather than display:none. The paginator
   * decides page breaks by measuring the live sheets, and a display:none
   * subtree has no box to measure — hiding it that way silently produced a
   * mis-paginated document whenever the phone was on the data tab.
   */
  body[data-view="form"] .preview {
    position: fixed;
    top: 0;
    inset-inline-start: -300vw;
    width: 100vw;
    height: 100vh;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 30rem) {
  .grid { grid-template-columns: 1fr; }
  .editor-intro h1 { font-size: 1.2rem; }
  .form-section { padding: .9rem; }
  .form-section--optional { padding: 0; }
  .field input, .field textarea, .row input { min-height: 3rem; font-size: 1rem; }
  .row-drag, .row-del, .line-del { width: 2.75rem; height: 2.75rem; }
  .row-head { gap: .4rem; }
  .row-actions { gap: .3rem; }
  .line input { min-height: 2.75rem; }
  .add, .line-add { min-height: 2.75rem; }
  .hint { font-size: .78rem; }
  .app-actions .btn { flex-direction: column; gap: .08rem; line-height: 1.2; }
  .approval-assets { grid-template-columns: 1fr; }
}

@media (max-width: 22rem) {
  .row-grid { grid-template-columns: 1fr; }
  .header-brand span { display: none; }
}

@media (max-width: 62rem) and (max-height: 30rem) and (orientation: landscape) {
  .app-header {
    grid-template-columns: auto minmax(15rem, 1fr) auto;
    gap: .65rem;
    padding: .4rem max(.75rem, env(safe-area-inset-right)) .4rem max(.75rem, env(safe-area-inset-left));
  }
  .header-brand img { height: 1.5rem; width: auto; }
  .header-brand span { display: none; }
  .panel-switch { grid-column: 2; grid-row: 1; min-height: 2.5rem; }
  .app-header .seg button { min-height: 2.1rem; }
  .app-user { grid-column: 3; grid-row: 1; }
  .app-actions { padding-top: .35rem; padding-bottom: max(.35rem, env(safe-area-inset-bottom)); }
  .app-actions .btn { min-height: 2.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---- print ---------------------------------------------------------------- */
@page { size: 210mm 297mm; margin: 0; }

@media print {
  html, body {
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }
  .app-header, .editor, .panel-switch { display: none !important; }
  .app {
    display: block;
    width: 210mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .preview {
    position: static !important;
    inset-inline-start: auto !important;
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff;
    display: block !important;
    visibility: visible !important;
  }
  .stage, .sheets {
    display: block;
    width: 210mm !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .sheets { transform: none !important; transform-origin: top left !important; }
  .sheets .sheet {
    width: 210mm !important;
    /* Avoid a fractional-pixel spill onto a trailing blank page in Chromium. */
    height: 296.8mm !important;
    min-height: 296.8mm !important;
    max-height: 296.8mm !important;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: auto;
    page-break-after: auto;
    margin: 0 !important;
    box-shadow: none;
  }
  .sheets .sheet:not(:last-child) { break-after: page; page-break-after: always; }
  .sheets .sheet:last-child { break-after: avoid; page-break-after: avoid; }
  .sheet, .sheet *, .sheet::before, .sheet::after,
  .head--cover .head-band::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
