:root{
  --page-w: 210mm;
  --page-h: 297mm;

  --pad-x: 15mm;
  --pad-y: 14mm;
  --page-margin-bottom: 14mm;
  --page-margin-top-continued: 14mm;

  --blue: #2B5FB8;
  --text: #111827;
  --muted: #6B7280;

  --line: #E5E7EB;
  --line-strong: #D1D5DB;

  --card-bg: #F6F7FB;
  --card-stroke: #E5E7EB;

  --chip-bg: #EEF1F5;
  --chip-stroke: #D7DDE6;
}

*{ box-sizing: border-box; }

.skip-link{
  position: absolute;
  top: -100px;
  left: 8px;
  padding: 8px 12px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  border-radius: 8px;
  z-index: 200;
  transition: top 0.2s;
}
.skip-link:focus{
  top: 8px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.fast-tooltip{
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
  background: #374151;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.fast-tooltip--visible{
  opacity: 1;
}

body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: #f3f4f6;
}

/* ================= APP LAYOUT ================= */

.app{
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  gap: 16px;
  padding: 16px;
}
.panel{ grid-column: 1; }
.app-preview-wrap{ grid-column: 2; }

.app-tabs{
  display: none;
  gap: 0;
  margin-bottom: 10px;
}
.app-tab{
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;
}
.app-tab[aria-selected="true"]{
  background: #fff;
  color: var(--text);
  border-bottom-color: #fff;
  z-index: 1;
}
.app-tab:first-child{ border-radius: 10px 0 0 0; }
.app-tab:last-child{ border-radius: 0 10px 0 0; }
.app-preview-wrap{ min-width: 0; }
.preview-hint{
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--muted);
}
.field-hint{
  margin: 4px 0 0 0;
  font-size: 11px;
  color: var(--muted);
}
.field-hint[hidden]{ display: none; }
.field-hint--validation{ color: var(--muted); }

@media (max-width: 900px) {
  .app{
    grid-template-columns: 1fr;
    grid-template-areas: "tabs" "content";
  }
  .app-tabs{
    display: flex;
    grid-area: tabs;
  }
  .panel{
    position: static;
    height: auto;
    max-height: 60vh;
    grid-area: content;
  }
  .app-preview-wrap{
    grid-area: content;
    display: none;
  }
  .app.app--show-preview .panel{
    display: none !important;
  }
  .app.app--show-preview .app-preview-wrap{
    display: block !important;
  }
}

.panel{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  position: sticky;
  top: 100px;
  height: calc(100vh - 120px);
  overflow: auto;
}

.field{
  margin-bottom: 10px;
}

.field label{
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.field input,
.field textarea,
.field select{
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
}

.field textarea{
  min-height: 70px;
  resize: vertical;
  transition: height 0.2s ease-out, min-height 0.2s ease-out;
}
.field textarea:focus{
  min-height: 180px;
  outline: none;
}

.field__label-row{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.field__label-row label,
.field__label-row strong{
  flex: 1;
  min-width: 0;
}
.field--exp-heading .field__label-row strong{
  font-size: inherit;
}
.section-title-inline{
  display: block;
  width: 100%;
  margin-top: 6px;
  margin-bottom: 4px;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--blue);
  border-radius: 6px;
}
.section-title-inline[hidden]{
  display: none !important;
}
.section-title-inline-hint{
  margin: 2px 0 6px 0;
  font-size: 12px;
  color: var(--muted);
}
.section-title-inline-hint[hidden]{
  display: none !important;
}

.row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-btn{
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.edit-section-title-btn{
  padding: 2px 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
}
.edit-section-title-btn:hover{
  background: var(--card-bg);
}

/* Save button for section title — override .mini-btn so label is visible */
.section-title-done-btn.section-title-done-btn,
button.section-title-done-btn{
  margin-top: 6px;
  padding: 8px 14px;
  min-width: 80px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.section-title-done-btn .section-title-done-btn__label{
  display: inline-block;
  color: #fff;
  font-size: inherit;
  font-weight: inherit;
}
.section-title-done-btn:hover{
  filter: brightness(1.08);
  background: var(--blue);
  color: #fff;
}
.section-title-done-btn[hidden]{
  display: none !important;
}

.expItem{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fafafa;
}
.expItem__drag-row{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px -4px 10px -4px;
  padding: 6px 8px;
  background: var(--line);
  border-radius: 8px;
}
.expItem-dragHandle{
  cursor: grab;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  user-select: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
}
.expItem-dragHandle:hover{
  color: var(--text);
  background: #fff;
  border-color: var(--muted);
}
.expItem-dragHandle:active{ cursor: grabbing; }
.expItem-dragHandle__icon{
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
}
.expItem-dragHandle__label{
  white-space: nowrap;
}
.expItem--dragging .expItem-dragHandle{ cursor: grabbing; }
.expItem--dragging .expItem__drag-row{ background: var(--card-bg); }
.expItem--dragging{ opacity: 0.85; }
.expItem--drop-target{
  outline: 2px dashed var(--blue);
  outline-offset: 2px;
}

.expActions{
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.toolbar__import{
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.toolbar__import-row{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar__import-label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.toolbar__import-area{
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: 12px/1.5 monospace;
  resize: vertical;
  box-sizing: border-box;
}

.toolbar__import .mini-btn{
  flex-shrink: 0;
}

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

/* ================= TOOLBAR ================= */

.toolbar{
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 8px;
  z-index: 10;
}

.toolbar__row{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.toolbar__row .toolbar__logo{
  margin-right: 4px;
}

.toolbar__row .toolbar__title{
  margin-right: 8px;
}

.toolbar__row button{
  height: 40px;
  box-sizing: border-box;
  padding: 0 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.toolbar__locale{
  margin-left: auto;
}

.toolbar__template .template-select{
  min-width: 100px;
}

.toolbar__split-toggle{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.toolbar__split-toggle input[type="checkbox"]{
  margin: 0;
}

.locale-select{
  height: 36px;
  padding: 0 28px 0 10px;
  min-width: 56px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.locale-select:hover,
.locale-select:focus{
  border-color: var(--blue);
  outline: none;
}

.toolbar__logo{
  width: 72px;
  height: 72px;
  max-width: 72px;
  max-height: 72px;
  display: block;
  margin-right: 10px;
  object-fit: contain;
}

.toolbar__title{
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  margin-right: 8px;
}

button{
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible{
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.hint{
  color: var(--muted);
  font-size: 12px;
}

.json-error{
  margin: 6px 0 0;
  font-size: 12px;
  color: #b91c1c;
  min-height: 1.4em;
}

.json-error:empty,
.json-error[hidden]{
  display: none;
}

.json-error--success{
  color: #059669;
}

/* ================= MODAL ================= */

.modal{
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden]{
  display: none;
}

.modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal__box{
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal__title{
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 700;
}

.modal__input{
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  margin-bottom: 16px;
}

.modal__hint{
  margin: 6px 0 0;
  font-size: 12px;
}

.modal__actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal__actions--wrap{ flex-wrap: wrap; }
.mini-btn--secondary{
  background: transparent;
  color: var(--muted);
}
.mini-btn--secondary:hover{ color: var(--text); }
.mini-btn--ats{
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.mini-btn--ats:hover{ background: #234a9e; color: #fff; }
.mini-btn--design{
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.mini-btn--design:hover{ background: #020617; color: #fff; }
.mini-btn--ats{
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.mini-btn--ats:hover{ background: #234a9e; color: #fff; }

@media print{
  .modal{ display: none !important; }
}

/* ================= DOCUMENT ================= */

.doc{
  display: grid;
  gap: 0;
  padding: 20px 0;
}

.page{
  width: var(--page-w);
  min-height: var(--page-h);
  margin: 0 auto;
  background: #fff;
  padding: var(--pad-y) var(--pad-x);
  padding-bottom: var(--page-margin-bottom);
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.page{
  max-height: var(--page-h);
  overflow: hidden;
}
/* Все страницы одной высоты; при переполнении создаётся 3-я (и далее) с теми же отступами */
.doc.doc--two-pages .page,
.doc.doc--multi-pages .page{
  max-height: var(--page-h);
  overflow: hidden;
}

/* Разрыв между страницами в превью — явный блок между страницами */
.page-break-preview{
  width: var(--page-w);
  margin: 28px auto 0;
  padding: 20px 0;
  background: #e5e7eb;
  border-top: 3px solid var(--line-strong);
  border-bottom: 3px solid var(--line-strong);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.15em;
  box-sizing: border-box;
  flex-shrink: 0;
}
.page-break-preview span{ font-weight: 700; color: var(--text); }
/* Все продолжения (страницы 2, 3, …) — одинаковые отступы */
.page-break-preview + .page{
  margin-top: 0;
  padding-top: var(--page-margin-top-continued);
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
  padding-bottom: var(--page-margin-bottom);
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.page--empty{ min-height: 120px; }

.page--empty-state{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}
.empty-state__text{
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

.exp-empty-hint{
  margin-top: 8px;
}

.doc.pdf-export .page-break-preview,
.doc.pdf-export .page--empty{ display: none !important; }
.doc.pdf-export .page--empty-state{ display: none !important; }

/* Export PDF: фиксированная ширина и обрезка, чтобы верстка не съезжала */
.doc.pdf-export{
  width: 794px;
  max-width: 794px;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.doc.pdf-export .page{
  margin: 0;
  width: 794px;
  max-width: 794px;
  min-width: 794px;
  height: 1122px;
  max-height: 1122px;
  min-height: 1122px;
  box-sizing: border-box;
  overflow: hidden;
  padding: var(--pad-y) var(--pad-x);
  padding-bottom: var(--page-margin-bottom);
}
/* В экспорте все страницы фиксированной высоты (в т.ч. последняя) */
.doc.pdf-export .page:last-child{
  max-height: 1122px;
  min-height: 1122px;
  height: 1122px;
  overflow: hidden;
}
.doc.pdf-export .page-break-preview + .page{
  padding-top: var(--page-margin-top-continued);
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
  padding-bottom: var(--page-margin-bottom);
}

/* ================= HEADER ================= */

.header{
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.name{
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.headline{
  margin: 8px 0 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 500;
}

.header__right{
  text-align: right;
  min-width: 230px;
}

.contact{
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 500;
}

.contact__link,
.contact a{
  color: inherit;
  text-decoration: none;
}
.contact__link:hover,
.contact a:hover{
  text-decoration: underline;
}

/* ================= SECTIONS ================= */

.section--divider {
  border-top: 1px solid #e5e7eb;
  padding-top: 18px;
  margin-top: 18px;
}

.section{
  margin-top: 18px;
}

.section__head{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.section__title{
  font-size: 12.5px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .14em;
  white-space: nowrap;
}

.section__line{
  height: 2px;
  flex: 1;
  background: var(--line-strong);
}

/* ================= BODY & LIST ================= */

.body{
  margin: 0;
  font-size: 13.5px;
  line-height: 1.52;
  color: var(--text);
}

.body--tight{
  margin-top: 4px;
  margin-bottom: 6px;
  color: var(--muted);
}

.list{
  margin: 8px 0 0 18px;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.52;
}

.list li{
  margin: 0 0 6px 0;
}

.list li::marker{
  color: #9CA3AF;
}

/* ================= CARD ================= */

.card{
  background: var(--card-bg);
  border: 1px solid var(--card-stroke);
  border-radius: 12px;
  padding: 7px 8px;
}

/* ================= CHIPS ================= */

.chips{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip{
  background: var(--chip-bg);
  border: 1px solid var(--chip-stroke);
  border-radius: 12px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ================= ATS TEMPLATE ================= */
/* ATS-friendly: single column, standard fonts, minimal styling for better parsing.
   Best practices: single column, 10–12pt body, standard fonts (Arial/Helvetica),
   no tables/graphics, simple bullets, no decorative lines, margins ≥0.5". */

.doc.doc--ats .page{
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.35;
}

.doc.doc--ats .header{
  flex-direction: column;
  gap: 6px;
}

.doc.doc--ats .header__right{
  text-align: left;
  min-width: 0;
}

.doc.doc--ats .header__right .contact{
  display: block;
}

.doc.doc--ats .name{
  font-size: 18pt;
  font-weight: 700;
  line-height: 1.2;
}

.doc.doc--ats .headline,
.doc.doc--ats .contact{
  color: #333;
  font-size: 11pt;
}

.doc.doc--ats .section__head--ats{
  margin-bottom: 8px;
}

.doc.doc--ats .section__head--ats .section__title{
  color: #000;
  letter-spacing: 0.05em;
  font-size: 12pt;
  font-weight: 700;
}

.doc.doc--ats .section__head--ats .section__line{
  display: none;
}

.doc.doc--ats .body,
.doc.doc--ats .list{
  font-size: 11pt;
  color: #000;
  line-height: 1.4;
}

.doc.doc--ats .list li::marker{
  color: #000;
}

.doc.doc--ats .card{
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.doc.doc--ats .ats-list-wrap .list{
  margin-left: 18px;
}

.doc.doc--ats .chip{
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  font-weight: 500;
}

.doc.doc--ats .exp__head{
  display: block;
  grid-template-columns: none;
  gap: 0;
}

.doc.doc--ats .exp__role{
  font-size: 12pt;
  font-weight: 700;
}

.doc.doc--ats .exp__meta{
  color: #333;
  font-size: 11pt;
  text-align: left;
  white-space: normal;
  margin-top: 2px;
}

.doc.doc--ats .section--divider{
  border-top: none;
  padding-top: 0;
  margin-top: 12px;
}

.doc.doc--ats .section.expBlock + .section.expBlock{
  border-top: none;
}

.doc.doc--allow-block-split .expBlock--continued .exp__head{
  margin-top: 0;
  opacity: 0.62;
}

/* Shown only on split continuations (added by pagination script) */
.expBlock--continued .expBlock__continued-label{
  margin: 0 0 6px 0;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.3;
}

.doc.doc--ats .expBlock--continued .expBlock__continued-label{
  font-size: 9.5pt;
  color: #555;
}

.doc.doc--allow-block-split .expBlock--continued .exp__role{
  font-size: 14px;
  font-weight: 600;
}

.doc.doc--allow-block-split .expBlock--continued .exp__meta{
  font-size: 12px;
  font-weight: 500;
}

/* ================= EXPERIENCE ================= */

.exp{
  margin-top: 12px;
}

.exp__head{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
}

.exp__role{
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.exp__meta{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}

/* Divider between experience blocks (more reliable than adjacency in print fragmentation) */
.exp--divider,
.exp + .exp{
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

/* ================= PRINT ================= */

@media print{

  body{ background: #fff; }

  .panel,
  .toolbar{ display: none !important; }

  .app{ display: block; padding: 0; }

  .no-print{ display: none !important; }

  .doc{
    gap: 0;
    padding: 0;
  }

  /* Печатный вид максимально повторяет экранный шаблон:
     та же ширина и внутренние отступы, но без тени. */
  .page{
    box-shadow: none;
    width: var(--page-w);
    margin: 0 auto;
    min-height: var(--page-h);
    padding: var(--pad-y) var(--pad-x);
    padding-bottom: var(--page-margin-bottom);
    /* no forced breaks by default */
    break-after: auto;
    page-break-after: auto;
  }

  /* В печати не показываем разделители «— Page 2 —» */
  .page-break-preview{
    display: none !important;
  }

  /* If a single .page gets split by the browser, @page margin still applies */

  /* break only if class is present */
  .page.page--break{
    break-after: page;
    page-break-after: always;
  }

  .page:last-child{
    break-after: auto;
    page-break-after: auto;
  }

  /* ✅ Prevent splitting an experience block across pages (page 1) */
  .exp{
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  /* ✅ Prevent splitting an experience block across pages (page 2) */
  .expBlock{
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .doc.doc--allow-block-split .exp,
  .doc.doc--allow-block-split .expBlock{
    break-inside: auto;
    page-break-inside: auto;
  }

  /* ✅ Prevent header being left at the bottom while bullets go to next page */
  .exp__head{
    break-after: avoid-page;
    page-break-after: avoid;
  }

  /* ✅ Keep section heads with the following content */
  .section__head{
    break-after: avoid-page;
    page-break-after: avoid;
  }

  /* ✅ Avoid splitting header (name/contacts) from next section */
  .header{
    break-after: avoid-page;
    page-break-after: avoid;
  }

  /* Lists are allowed to split to avoid big jumps/empty space */
  .list{
    break-inside: auto;
    page-break-inside: auto;
  }

  /* Ensure section dividers (page 2 experience blocks) are visible when printing */
  .section--divider,
  .section.expBlock + .section.expBlock{
    border-top: 1px solid #d1d5db !important;
    padding-top: 18px;
    margin-top: 18px;
  }

  @page{
    size: A4;
    margin: 18mm;
  }

  /* Server PDF / export: те же размеры, что и в превью — без этого первая страница может «растягиваться» и давать пустоту */
  .doc.pdf-export{
    width: 794px !important;
    max-width: 794px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .doc.pdf-export .page{
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    height: 1122px !important;
    min-height: 1122px !important;
    max-height: 1122px !important;
    margin: 0 !important;
    padding: var(--pad-y) var(--pad-x) !important;
    padding-bottom: var(--page-margin-bottom) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .doc.pdf-export .page:last-child{
    height: 1122px !important;
    min-height: 1122px !important;
    max-height: 1122px !important;
  }
  .doc.pdf-export .page-break-preview + .page{
    padding-top: var(--page-margin-top-continued) !important;
    padding-left: var(--pad-x) !important;
    padding-right: var(--pad-x) !important;
    padding-bottom: var(--page-margin-bottom) !important;
  }
  /* При печати каждая наша «страница» = один лист PDF, без пустых разрывов */
  .doc.pdf-export .page{ page-break-after: always; }
  .doc.pdf-export .page:last-child{ page-break-after: auto; }
}
