/* merge-pdf: port of toolster.net instruments/merge_pdf/assets/merge_pdf.css. The toolster part goes
   down to "end of toolster part"; below it are the page frame, undo/redo and a scoped stand-in for
   the Bootstrap classes toolster relies on (statepdf has no Bootstrap). */
.mpdf {
    --mpdf-red: #d9302c;
    --mpdf-red-d: #b92420;
    --mpdf-red-soft: #fdf0ef;
    --mpdf-red-line: #f3c9c6;
    --mpdf-group-line: #efb7b4;
    --mpdf-ink: #2c2e33;
    --mpdf-muted: #74777f;
    --mpdf-line: #e4e5e9;
    --mpdf-bg: #f6f6f8;
    --mpdf-thumb-bg: #efefff; /* thumbnail backing, owner 04.12.2026 */
    --mpdf-white: #fff;
    --mpdf-dark: #26282d;
    --mpdf-col: 196px;
    --mpdf-thumb-h: 190px;
    --mpdf-z-bar: 20;
    --mpdf-z-pop: 1050;
    --mpdf-z-ghost: 1060;
    --mpdf-z-busy: 1075;
    --mpdf-z-modal: 1080;
    --mpdf-z-toast: 1085;
    --mpdf-z-veil: 1090;
    color: var(--mpdf-ink);
    -webkit-tap-highlight-color: transparent;
}
.mpdf-red {
    --bs-btn-bg: var(--mpdf-red);
    --bs-btn-border-color: var(--mpdf-red);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--mpdf-red-d);
    --bs-btn-hover-border-color: var(--mpdf-red-d);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--mpdf-red-d);
    --bs-btn-active-border-color: var(--mpdf-red-d);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--mpdf-red);
    --bs-btn-disabled-border-color: var(--mpdf-red);
    font-weight: 600;
}

/* start */
.mpdf-start { display: flex; flex-direction: column; align-items: center; padding: 26px 0 50px; }
.mpdf-bigbtn { font-size: 22px; padding: 22px 64px; border-radius: 12px; }
.mpdf-drophint { margin-top: 12px; color: var(--mpdf-muted); font-size: 14px; }
.mpdf-privacy { margin-top: 26px; color: var(--mpdf-muted); font-size: 13px; }

/* top bar */
.mpdf-bar { position: sticky; top: 0; z-index: var(--mpdf-z-bar); background: var(--mpdf-white); border-bottom: 1px solid var(--mpdf-line); display: flex; align-items: center; gap: 10px; padding: 12px 0; margin-bottom: 16px; }
.mpdf-addwrap { position: relative; flex: none; }
.mpdf-addbtn { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--mpdf-red); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; }
.mpdf-addbtn:hover { background: var(--mpdf-red-d); }
/* the font "+" sits low in its line box (bi vertical-align -.125em + font metrics): draw it with CSS, exactly centered */
.mpdf-addbtn i { display: block; width: 18px; height: 18px; flex: none; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; }
.mpdf-addbtn i::before { content: none; }
.mpdf-modes .btn { --bs-btn-border-color: var(--mpdf-line); --bs-btn-color: var(--mpdf-ink); --bs-btn-hover-bg: var(--mpdf-bg); --bs-btn-hover-border-color: var(--mpdf-line); --bs-btn-hover-color: var(--mpdf-ink); --bs-btn-active-bg: var(--mpdf-red-soft); --bs-btn-active-color: var(--mpdf-red-d); --bs-btn-active-border-color: var(--mpdf-line); font-size: 13px; padding: 8px 14px; }
.mpdf-modes .btn.is-on { background: var(--mpdf-red-soft); color: var(--mpdf-red-d); font-weight: 600; }
.mpdf-sp { flex: 1; }
.mpdf-sum { color: var(--mpdf-muted); font-size: 13px; white-space: nowrap; }
.mpdf-merge { font-size: 18px; padding: 11px 44px; border-radius: 10px; white-space: nowrap; }.mpdf-round { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--mpdf-white); color: var(--mpdf-ink); border: 1px solid var(--mpdf-line); display: flex; align-items: center; justify-content: center; }
.mpdf-round:hover { background: var(--mpdf-bg); }

/* grid */
.mpdf-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fit, var(--mpdf-col)); justify-content: center; row-gap: 12px; align-items: start; padding-bottom: 24px; }
.mpdf-cell { position: relative; padding: 10px; user-select: none; touch-action: manipulation; outline: 0; }
.mpdf-cell.is-gone { display: none; }
.mpdf-cell:focus-visible .mpdf-thumb { box-shadow: 0 0 0 2px var(--mpdf-red); }
.mpdf-thumb { position: relative; height: var(--mpdf-thumb-h); border-radius: 9px; background: var(--mpdf-thumb-bg); display: flex; align-items: center; justify-content: center; cursor: grab; }
.mpdf-thumb:hover { box-shadow: 0 0 0 1px var(--mpdf-red-line); }
.mpdf-stack { position: relative; flex: none; isolation: isolate; }
.mpdf-stack.is-multi::before, .mpdf-stack.is-multi::after { content: ""; position: absolute; inset: 0; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.mpdf-stack.is-multi::before { transform: translate(4px, 4px); }
.mpdf-stack.is-multi::after { transform: translate(8px, 8px); z-index: -1; }
.mpdf-sheet { position: absolute; left: 50%; top: 50%; z-index: 1; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .28); overflow: hidden; transition: transform .18s; }
.mpdf-sheet img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.mpdf-count { position: absolute; right: 7px; bottom: 7px; min-width: 30px; height: 24px; padding: 0 8px; border: 0; border-radius: 12px; background: rgba(32, 33, 38, .82); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 3px; transition: background .12s; z-index: 2; }
.mpdf-count:hover { background: var(--mpdf-red); }
.mpdf-acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; opacity: 0; transition: opacity .1s; z-index: 2; }
.mpdf-thumb:hover .mpdf-acts, .mpdf-acts:has(:focus-visible), .mpdf-cell.is-menu .mpdf-acts { opacity: 1; }
/* card buttons: tinted grey disc + dark bold icon — readable over any page (idea of iLovePDF, own tint; owner 04.12.2026) */
.mpdf-act { width: 26px; height: 26px; padding: 0; border: 1px solid rgba(40, 46, 66, .16); border-radius: 50%; background: #e6e8ef; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); display: flex; align-items: center; justify-content: center; color: #26282e; font-size: 14px; }
.mpdf-act:hover { background: #d9dce6; color: var(--mpdf-red); }
.mpdf-act .mpdf-svg [stroke] { stroke-width: 2; }
.mpdf-svg { width: 1.1em; height: 1.1em; display: block; flex: none; }
.mpdf-cap { margin-top: 7px; font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 19px; }
/* file label: the name on the file's colour; a page also gets «стр. N» under it (owner 04.12.2026: borders of files by colour, no frame) */
.mpdf-chip { display: inline-block; max-width: 100%; vertical-align: top; overflow: hidden; text-overflow: ellipsis; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 18px; }
.mpdf-cnum { display: block; margin-top: 1px; color: var(--mpdf-muted); font-size: 12px; }
/* red is last: it is the brand/alarm colour of the page */
.mpdf-c0 { background: #dbe9ff; color: #1f4f9c; }
.mpdf-c1 { background: #dcf2e2; color: #1d6634; }
.mpdf-c2 { background: #fff0c7; color: #7f5300; }
.mpdf-c3 { background: #ece2ff; color: #5a2f9c; }
.mpdf-c4 { background: #d5f1f1; color: #0f5e5c; }
.mpdf-c5 { background: #ffe0f0; color: #962260; }
.mpdf-c6 { background: #e4e9f0; color: #36475c; }
.mpdf-c7 { background: #fde2e1; color: #a32420; }
.mpdf-c-blank { background: #eeeef2; color: #6b6c78; }
/* the empty place the dragged cards will drop into; neighbours slide apart around it (owner 04.12.2026) */
.mpdf-slot { position: relative; pointer-events: none; }
.mpdf-slot::before { content: ""; position: absolute; left: 10px; right: 10px; top: 10px; height: var(--slot-h, calc(100% - 20px)); border: 2px dashed var(--mpdf-red-line); border-radius: 9px; background: var(--mpdf-red-soft); }


/* error and reading cards */
.mpdf-cell.is-err .mpdf-thumb { background: var(--mpdf-red-soft); cursor: default; padding: 12px; flex-direction: column; gap: 6px; text-align: center; font-size: 13px; line-height: 1.3; color: var(--mpdf-red-d); }
.mpdf-cell.is-err .bi-exclamation-triangle { font-size: 22px; }
.mpdf-cell.is-err .mpdf-acts { opacity: 1; pointer-events: auto; }
.mpdf-cell.is-load .mpdf-thumb { cursor: default; color: var(--mpdf-muted); flex-direction: column; gap: 8px; font-size: 13px; }

/* «+» after the last card: add more files at any stage (owner 05.12.2026) */
.mpdf-addcell__btn { width: 100%; border: 2px dashed var(--mpdf-line); background: transparent; cursor: pointer; flex-direction: column; gap: 10px; color: var(--mpdf-muted); font-size: 13px; transition: border-color .15s, color .15s, background-color .15s; }
.mpdf-addcell__btn:hover, .mpdf-addcell__btn:focus-visible { border-color: var(--mpdf-red); color: var(--mpdf-red-d); background: var(--mpdf-red-soft); outline: 0; }
.mpdf-addcell__plus { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--mpdf-red); color: #fff; flex: none; }
.mpdf-addcell__plus::before { content: ''; position: absolute; inset: 13px; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; }
.mpdf-addcell__btn:hover .mpdf-addcell__plus { background: var(--mpdf-red-d); }

/* drag */
.mpdf-ghost { position: fixed; z-index: var(--mpdf-z-ghost); pointer-events: none; transform: rotate(-2deg); box-shadow: 0 12px 28px rgba(0, 0, 0, .25); border-radius: 9px; background: #fff; opacity: .96; display: flex; align-items: center; justify-content: center; }
.mpdf-ghost__n { position: absolute; right: -8px; top: -8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--mpdf-red); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* menus */
.mpdf-pop.dropdown-menu { position: fixed; z-index: var(--mpdf-z-pop); min-width: 224px; max-width: calc(100vw - 24px); --bs-dropdown-link-active-bg: var(--mpdf-red); font-size: 14px; }
.mpdf-pop .dropdown-item { display: flex; align-items: center; gap: 9px; }
.mpdf-pop .dropdown-item .bi { color: var(--mpdf-muted); }
.mpdf-pop .dropdown-item.is-danger, .mpdf-pop .dropdown-item.is-danger .bi { color: var(--mpdf-red-d); }
.mpdf-pop__row { padding: 6px 16px; }
.mpdf-pop .form-check-input:checked { background-color: var(--mpdf-red); border-color: var(--mpdf-red); }
.mpdf-pop small { display: block; color: var(--mpdf-muted); font-size: 12px; line-height: 1.3; }
.mpdf-pop .is-bad { border-color: var(--mpdf-red); background: var(--mpdf-red-soft); }

/* toast */
.mpdf-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--mpdf-z-toast); background: var(--mpdf-dark); color: #fff; border-radius: 9px; padding: 9px 14px; font-size: 14px; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 24px); }
.mpdf-toast button { border: 0; background: none; color: #ffb4b0; font-weight: 600; white-space: nowrap; padding: 0; }

/* preview */
.mpdf-modal { position: fixed; inset: 0; z-index: var(--mpdf-z-modal); background: rgba(20, 21, 25, .72); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px; }
.mpdf-modal__stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.mpdf-modal__stage canvas, .mpdf-modal__stage img { display: block; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.mpdf-modal__tools { display: flex; align-items: center; background: #fff; border-radius: 10px; margin-top: 12px; overflow: hidden; }
.mpdf-modal__tools button, .mpdf-modal__tools span { padding: 9px 13px; display: flex; border: 0; background: none; color: var(--mpdf-ink); }
.mpdf-modal__tools button:hover { background: var(--mpdf-bg); }
.mpdf-modal__close { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; }

/* building */
.mpdf-busy { position: fixed; inset: 0; z-index: var(--mpdf-z-busy); background: rgba(255, 255, 255, .86); display: flex; align-items: center; justify-content: center; }
.mpdf-busy[hidden] { display: none; }
.mpdf-busy__box { text-align: center; }
.mpdf-busy__text { font-size: 20px; font-weight: 600; }
.mpdf-progress { --bs-progress-bar-bg: var(--mpdf-red); --bs-progress-height: 8px; width: 280px; margin: 14px auto 8px; }
.mpdf-link { --bs-btn-color: var(--mpdf-red-d); --bs-btn-hover-color: var(--mpdf-red); --bs-btn-active-color: var(--mpdf-red); font-size: 14px; font-weight: 600; text-decoration: none; }

/* result */
.mpdf-done { display: flex; flex-direction: column; align-items: center; padding: 26px 0 40px; }
.mpdf-done[hidden] { display: none; }
.mpdf-start[hidden] { display: none; }
.mpdf-done__title { font-size: 30px; font-weight: 700; line-height: 1.12; margin: 0 0 22px; }
/* the description under the tool is for the start screen; while working it would only lengthen the page */
.mpdf:not([data-screen="start"]) ~ .tool-about { display: none; }
.mpdf-donerow { display: flex; align-items: center; gap: 12px; }
.mpdf-round[hidden] { display: none; }
.mpdf-dlbtn { font-size: 22px; padding: 18px 52px; border-radius: 12px; display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.mpdf-meta { margin-top: 14px; color: var(--mpdf-muted); font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.mpdf-namewrap { display: inline-flex; align-items: baseline; max-width: 100%; }
.mpdf-fname { border: 0; border-bottom: 1px dashed #b5b7be; padding: 0 2px; font-weight: 600; color: var(--mpdf-ink); background: none; outline: 0; text-align: right; max-width: 70vw; }
.mpdf-fname:focus { border-bottom-color: var(--mpdf-red); }
.mpdf-done .mpdf-link { margin-top: 14px; }
.mpdf-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; width: 100%; margin-top: 14px; }
.mpdf-strip[hidden] { display: none; }
.mpdf-strip .mpdf-thumb { height: 96px; cursor: default; }
.mpdf-strip .mpdf-cap { margin-top: 3px; font-size: 11px; color: var(--mpdf-muted); min-height: 0; }

.mpdf-veil { position: fixed; inset: 0; z-index: var(--mpdf-z-veil); background: rgba(217, 48, 44, .09); border: 3px dashed var(--mpdf-red); display: none; align-items: center; justify-content: center; color: var(--mpdf-red-d); font-size: 24px; font-weight: 600; pointer-events: none; }
.mpdf-veil.is-on { display: flex; }

@media (hover: none) {
    .mpdf-acts, .mpdf-thumb:hover .mpdf-acts { opacity: 0; pointer-events: none; }
    .mpdf-cell.is-sel .mpdf-acts { opacity: 1; pointer-events: auto; }
    .mpdf-thumb:hover { box-shadow: none; }
    .mpdf-cell.is-sel .mpdf-thumb { box-shadow: 0 0 0 2px var(--mpdf-red); }
}
@media (max-width: 640px) {
    .mpdf { --mpdf-thumb-h: 128px; }
    .mpdf-bigbtn { font-size: 19px; padding: 18px 30px; }
    .mpdf-grid { grid-template-columns: repeat(auto-fit, 33.33%); row-gap: 6px; }
    .mpdf-cell { padding: 5px; }
    .mpdf-act { width: 24px; height: 24px; font-size: 13px; }
    .mpdf-acts { top: 3px; right: 3px; gap: 2px; }
    .mpdf-count { right: 4px; bottom: 4px; height: 22px; min-width: 26px; padding: 0 6px; }
    .mpdf-cap { font-size: 12px; margin-top: 4px; }
    .mpdf-merge { flex: 1; padding: 11px 8px; font-size: 16px; }
    .mpdf-merge { min-width: 0; }
    .mpdf-addbtn { width: 46px; height: 46px; }
    .mpdf-bar { padding: 9px 0; margin-bottom: 8px; gap: 6px; }
    .mpdf-modes .btn { padding: 8px 8px; }
    .mpdf-donerow { flex-wrap: wrap; justify-content: center; }
    .mpdf-dlbtn { font-size: 19px; padding: 16px 28px; }
    .mpdf-done__title { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
    .mpdf * { transition: none !important; animation-duration: .01ms !important; }
}
/* ===== end of toolster part ===== */

/* statepdf page frame: the start screen is statepdf's own (site.css), work and result sit in a white panel */
.mpdf[data-screen="start"] .merge-panel { display: none; }
.merge-panel { max-width: 1100px; margin: 22px auto 40px; padding: 4px clamp(10px, 2.4vw, 26px) 10px; background: #fff; border: 1px solid var(--line, #e4e4eb); border-radius: 18px; }
.merge-title { margin: 14px 0 2px; font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.15; }
.mpdf[data-screen="done"] .merge-title { display: none; }
/* title row: «+» add before the heading, ⚙ build settings in the right corner; ⇅ order opens the bar; ⚙ and ⇅ bare icons (owner 04.12.2026) */
.merge-title { display: flex; align-items: center; gap: 14px; }
.merge-title__text { flex: 1; min-width: 0; }
.merge-title .mpdf-addwrap { letter-spacing: 0; font-weight: 400; line-height: 1; }
.mpdf-plain { flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--mpdf-muted); font-size: 19px; line-height: 1; letter-spacing: 0; font-weight: 400; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mpdf-plain:hover { color: var(--mpdf-ink); background: var(--mpdf-bg); }
.mpdf-plain:focus-visible { outline: 2px solid var(--mpdf-red); outline-offset: 1px; }
.mpdf-bar > #mpdf-more { margin-right: -6px; }
/* «+» is secondary on the work screen: soft tint instead of the solid red of «Скачать», smaller (owner 04.12.2026) */
.merge-title .mpdf-addbtn { width: 40px; height: 40px; background: var(--mpdf-red-soft); color: var(--mpdf-red); box-shadow: inset 0 0 0 1px var(--mpdf-red-line); }
.merge-title .mpdf-addbtn:hover { background: #fbe1df; color: var(--mpdf-red-d); }
.merge-title .mpdf-addbtn i { width: 16px; height: 16px; }
/* «Скачать» on the heading row, right (owner 04.12.2026); no letter-spacing/weight from the heading */
.merge-title .mpdf-merge { flex: none; letter-spacing: 0; line-height: 1.5; }
/* ⇅ as wide as the «+» circle above it, so the icon sits on the circle's centre line (owner 04.12.2026) */
.mpdf-bar > #mpdf-sort { width: 40px; }
.mpdf-hist { width: 34px; height: 34px; font-size: 14px; }
.mpdf-hist:disabled { opacity: .35; }
/* several pages chosen at once (kept from the old statepdf merge) */
.mpdf-cell.is-pick .mpdf-thumb, .mpdf-cell.is-pick .mpdf-thumb:hover { box-shadow: 0 0 0 3px var(--mpdf-red); background: var(--mpdf-red-soft); }
/* corner checkbox: empty circle, red with a tick when chosen; shown on hover, while anything is chosen,
   and on a touch screen always in Pages mode */
.mpdf-tick { position: absolute; left: 6px; top: 6px; z-index: 3; width: 26px; height: 26px; padding: 0; border: 2px solid rgba(255, 255, 255, .95); border-radius: 50%; background: rgba(32, 33, 46, .28); color: transparent; font-size: 13px; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .12s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mpdf-tick:hover { background: rgba(32, 33, 46, .45); }
.mpdf-tick .mpdf-svg { width: 17px; height: 17px; }
.mpdf-thumb:hover .mpdf-tick, .mpdf-tick:focus-visible, .mpdf.has-pick .mpdf-tick { opacity: 1; pointer-events: auto; }
.mpdf-cell.is-pick .mpdf-tick { opacity: 1; pointer-events: auto; background: var(--mpdf-red); border-color: var(--mpdf-red); color: #fff; }
@media (hover: none) {
    .mpdf-thumb:hover .mpdf-tick { opacity: 0; pointer-events: none; }
    .mpdf.is-pages .mpdf-tick, .mpdf.has-pick .mpdf-tick, .mpdf-cell.is-pick .mpdf-tick { opacity: 1; pointer-events: auto; }
}
.mpdf-band { position: absolute; z-index: 1050; border: 1px solid #d9302c; background: rgba(217, 48, 44, .10); border-radius: 2px; pointer-events: none; }
.mpdf.is-banding, .mpdf.is-banding * { user-select: none; -webkit-user-select: none; }
.mpdf-pickbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: var(--mpdf-z-pop); display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 16px; background: var(--mpdf-dark); color: #fff; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 16px); }
.mpdf-pickbar[hidden] { display: none; }
.mpdf-pickn { font-size: 14px; font-weight: 600; white-space: nowrap; margin-right: 6px; }
.mpdf-pa { height: 36px; min-width: 36px; border: 0; border-radius: 8px; background: none; color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.mpdf-pa:hover { background: rgba(255, 255, 255, .12); }
.mpdf-pa.is-danger { color: #ffb4b0; }
.mpdf-pa--text { font-size: 13px; font-weight: 600; white-space: nowrap; }
.mpdf.has-pick .mpdf-toast { bottom: 84px; }
/* on a touch screen a tap chooses while something is chosen, so the card buttons would only get in the way */
@media (hover: none) { .mpdf.has-pick .mpdf-cell .mpdf-acts { opacity: 0; pointer-events: none; } }
.mpdf-progress.is-indet .progress-bar { width: 35%; animation: mpdf-indet 1.1s ease-in-out infinite; }
@keyframes mpdf-indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (max-width: 640px) {
    .mpdf-pickbar { bottom: 12px; padding: 4px 4px 4px 12px; gap: 0; }
    .mpdf-pa--text { display: none; }
    .mpdf-tick { width: 22px; height: 22px; font-size: 11px; left: 3px; top: 3px; }
    .mpdf-tick .mpdf-svg { width: 13px; height: 13px; }
}
@media (max-width: 640px) {
    .merge-panel { margin: 10px 6px 24px; border-radius: 14px; }
    .merge-title { font-size: 1rem; gap: 6px; }
    .merge-title .mpdf-addbtn { width: 34px; height: 34px; }
    .mpdf-bar > #mpdf-sort { width: 34px; }
    .merge-title .mpdf-merge { flex: none; padding: 7px 12px; font-size: 15px; }
    .mpdf-hist { display: none; }
}

/* scoped stand-in for the Bootstrap 5 pieces toolster uses (btn, btn-group, dropdown, form, progress, spinner) */
/* No --bs-* defaults are set here on purpose: toolster sets them with lower specificity (.mpdf-red), so only fallbacks. */
:where(.mpdf .btn) { display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px; font-size: 16px; line-height: 1.5; border: 1px solid var(--bs-btn-border-color, transparent); border-radius: 6px; background: var(--bs-btn-bg, transparent); color: var(--bs-btn-color, var(--mpdf-ink)); transition: background-color .15s, color .15s; }
:where(.mpdf .btn:hover) { background: var(--bs-btn-hover-bg, var(--bs-btn-bg, transparent)); color: var(--bs-btn-hover-color, var(--bs-btn-color, var(--mpdf-ink))); border-color: var(--bs-btn-hover-border-color, var(--bs-btn-border-color, transparent)); }
:where(.mpdf .btn:active) { background: var(--bs-btn-active-bg, var(--bs-btn-hover-bg, transparent)); color: var(--bs-btn-active-color, var(--bs-btn-hover-color, var(--mpdf-ink))); }
:where(.mpdf .btn:disabled) { background: var(--bs-btn-disabled-bg, var(--bs-btn-bg, transparent)); border-color: var(--bs-btn-disabled-border-color, var(--bs-btn-border-color, transparent)); opacity: .65; }
:where(.mpdf .btn-sm) { padding: 4px 10px; font-size: 14px; border-radius: 5px; }
:where(.mpdf .btn-link), :where(.mpdf .btn-link:hover), :where(.mpdf .btn-link:active) { background: none; border: 0; }
:where(.mpdf .btn-group) { display: inline-flex; }
:where(.mpdf .btn-group > .btn) { border-radius: 0; }
:where(.mpdf .btn-group > .btn:first-child) { border-radius: 6px 0 0 6px; }
:where(.mpdf .btn-group > .btn:last-child) { border-radius: 0 6px 6px 0; margin-left: -1px; }
.mpdf .mpdf-modes .btn.is-on { background: var(--mpdf-red-soft); color: var(--mpdf-red-d); }
:where(.mpdf .dropdown-menu) { padding: 8px 0; background: #fff; border: 1px solid rgba(0, 0, 0, .175); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); color: var(--mpdf-ink); text-align: left; }
:where(.mpdf .dropdown-item) { width: 100%; padding: 5px 16px; border: 0; background: none; color: var(--mpdf-ink); text-align: left; white-space: nowrap; }
:where(.mpdf .dropdown-item:hover), :where(.mpdf .dropdown-item:focus-visible) { background: #f1f2f4; }
:where(.mpdf .dropdown-item:active) { background: var(--mpdf-red); color: #fff; }
:where(.mpdf .dropdown-divider) { height: 0; margin: 8px 0; border-top: 1px solid rgba(0, 0, 0, .14); }
:where(.mpdf .dropdown-header) { margin: 0; padding: 6px 16px; font-size: 13px; font-weight: 400; color: #6c757d; white-space: nowrap; }
:where(.mpdf .form-control) { display: block; width: 100%; padding: 6px 12px; font-size: 16px; border: 1px solid #dee2e6; border-radius: 6px; background: #fff; color: var(--mpdf-ink); }
:where(.mpdf .form-control:focus) { border-color: #ec9a98; outline: 0; box-shadow: 0 0 0 3px rgba(217, 48, 44, .18); }
:where(.mpdf .form-control-sm) { padding: 4px 8px; font-size: 14px; border-radius: 5px; }
:where(.mpdf .form-check) { display: flex; gap: 8px; align-items: flex-start; }
:where(.mpdf .form-check-input) { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--mpdf-red); }
:where(.mpdf .progress) { display: flex; height: var(--bs-progress-height, 16px); overflow: hidden; background: #e9ecef; border-radius: 6px; }
:where(.mpdf .progress-bar) { background: var(--bs-progress-bar-bg, var(--mpdf-red)); transition: width .3s ease; }
:where(.mpdf .spinner-border) { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: mpdf-spin .75s linear infinite; }
@keyframes mpdf-spin { to { transform: rotate(360deg); } }

/* «Предпросмотр» left of «Скачать»: secondary, no fill (owner 04.12.2026); on a phone — the eye only */
.mpdf-look { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border: 1px solid var(--mpdf-line); border-radius: 10px; background: #fff; color: var(--mpdf-ink); font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1; cursor: pointer; }
.mpdf-look:hover { background: var(--mpdf-bg); }
.mpdf-look:focus-visible { outline: 2px solid var(--mpdf-red); outline-offset: 1px; }
.mpdf-look:disabled { opacity: .45; cursor: default; background: #fff; }
.mpdf-look i { font-size: 17px; color: var(--mpdf-muted); }
.merge-title .mpdf-look + .mpdf-merge { margin-left: -4px; }
/* preview window: the future PDF scrolls down, bookmarks on the left */
.mpdf-pv { position: fixed; inset: 0; z-index: var(--mpdf-z-modal); background: rgba(20, 21, 25, .62); display: flex; align-items: center; justify-content: center; padding: 20px; }
.mpdf-pv__box { width: min(1060px, 100%); height: 100%; background: #fff; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.mpdf-pv__head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--mpdf-line); }
.mpdf-pv__title { font-weight: 700; font-size: 17px; color: var(--mpdf-ink); }
.mpdf-pv__n { flex: 1; color: var(--mpdf-muted); font-size: 14px; }
.mpdf-pv__btn { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--mpdf-ink); font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mpdf-pv__btn:hover { background: var(--mpdf-bg); }
.mpdf-pv__btn[hidden] { display: none; }
.mpdf-pv.is-toc .mpdf-pv__tocbtn { background: var(--mpdf-red-soft); color: var(--mpdf-red); }
.mpdf-pv__body { flex: 1; min-height: 0; display: flex; position: relative; }
.mpdf-pv__toc { flex: none; width: 260px; overflow: auto; border-right: 1px solid var(--mpdf-line); padding: 10px 8px 20px; background: #fff; }
.mpdf-pv__toc[hidden] { display: none; }
.mpdf-pv__tochead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mpdf-muted); padding: 4px 10px 8px; }
.mpdf-pv__toc ul { list-style: none; margin: 0; padding: 0; }
.mpdf-pv__toc ul ul { padding-left: 14px; }
.mpdf-pv__toc button { width: 100%; display: flex; gap: 8px; align-items: baseline; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; font-size: 14px; line-height: 1.3; color: var(--mpdf-ink); cursor: pointer; }
.mpdf-pv__toc button:hover { background: var(--mpdf-bg); }
.mpdf-pv__toc button:disabled { cursor: default; color: var(--mpdf-muted); background: none; }
.mpdf-pv__toc button span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mpdf-pv__toc button em { flex: none; font-style: normal; font-size: 12px; color: var(--mpdf-muted); }
.mpdf-pv__pages { position: relative; flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; background: #e9eaee; padding: 20px 20px 40px; display: flex; flex-direction: column; align-items: center; gap: 6px; outline: 0; }
.mpdf-pv__wait { margin: auto; display: flex; align-items: center; gap: 10px; color: var(--mpdf-muted); font-size: 15px; }
.mpdf-pv__sheet { flex: none; display: flex; flex-direction: column; align-items: center; }
.mpdf-pv__paper { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); width: 560px; height: 792px; max-width: 100%; }
.mpdf-pv__paper canvas { display: block; }
.mpdf-pv__no { font-size: 12px; color: var(--mpdf-muted); padding: 5px 0 10px; }
@media (max-width: 640px) {
    .mpdf-look { width: 32px; height: 36px; padding: 0; justify-content: center; border: 0; background: none; }
    .mpdf-look i { font-size: 20px; }
    .mpdf-look span { display: none; }
    .merge-title .mpdf-look + .mpdf-merge { margin-left: -2px; }
    /* full screen on a phone: a big × in the header, Back closes too; bookmarks slide over the pages */
    .mpdf-pv { padding: 0; }
    .mpdf-pv__box { border-radius: 0; width: 100%; }
    .mpdf-pv__head { padding: 6px 6px 6px 8px; gap: 6px; }
    .mpdf-pv__btn { width: 44px; height: 44px; font-size: 20px; }
    .mpdf-pv:not(.has-toc) .mpdf-pv__title { padding-left: 10px; }
    .mpdf-pv__toc { position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); box-shadow: 8px 0 24px rgba(0, 0, 0, .18); transform: translateX(-105%); transition: transform .2s ease; }
    .mpdf-pv.is-toc .mpdf-pv__toc { transform: none; }
    .mpdf-pv__pages { padding: 12px 10px 30px; }
}
@media (min-width: 641px) { .mpdf-pv__tocbtn { display: none !important; } }
/* Phone-width card: the four buttons and the pick circle do not fit in one row (109 px) — while the buttons are up, the circle steps aside; once picking has started the buttons hide instead (rule above). */
@media (max-width: 640px) {
    .mpdf:not(.has-pick) .mpdf-cell:not(.is-pick).is-sel .mpdf-tick,
    .mpdf:not(.has-pick) .mpdf-cell:not(.is-pick) .mpdf-thumb:hover .mpdf-tick { opacity: 0; pointer-events: none; }
}

/* ===== engine mechanics switched on by a tool profile (app/merge.php $profiles) ===== */
.mpdf-main { min-width: 0; }
.mpdf-modes[hidden], #mpdf-more[hidden] { display: none; }

/* «+» in the gap between cards (profile gap): a blank page there; on hover of either neighbour (owner 05.12.2026, idea of iLovePDF) */
.mpdf-gap { position: absolute; z-index: 4; left: -15px; top: calc(10px + var(--mpdf-thumb-h) / 2 - 15px); width: 30px; height: 30px; padding: 0; border: 1px solid var(--mpdf-line); border-radius: 50%; background: #fff; color: var(--mpdf-muted); box-shadow: 0 1px 4px rgba(0, 0, 0, .14); display: flex; align-items: center; justify-content: center; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .1s, color .1s, transform .1s; cursor: pointer; }
.mpdf-gap.is-end { left: auto; right: -15px; }
.mpdf-gap:hover { color: var(--mpdf-red); border-color: var(--mpdf-red-line); transform: scale(1.1); }
.mpdf-cell:hover > .mpdf-gap, .mpdf-cell:hover + .mpdf-cell > .mpdf-gap:not(.is-end), .mpdf-gap:focus-visible { opacity: 1; pointer-events: auto; }
.mpdf.is-dragging .mpdf-gap, .mpdf.is-banding .mpdf-gap { opacity: 0 !important; pointer-events: none !important; }
@media (hover: none) { .mpdf-gap { display: none; } }
@media (max-width: 640px) { .mpdf-gap { top: calc(5px + var(--mpdf-thumb-h) / 2 - 15px); } }

/* file letter on the card label: the same letter as in the side panel */
.mpdf-chip__k { margin-right: 5px; font-weight: 800; }

/* side panel (profile side): right column on a wide screen, bottom sheet on a narrow one */
.mpdf.has-side .merge-panel { max-width: 1340px; }
.mpdf-side { display: flex; flex-direction: column; background: #fff; }
.mpdf-side__head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--mpdf-line); }
.mpdf-side__title { flex: 1; font-size: 18px; font-weight: 700; text-align: center; }
.mpdf-side__body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; }
.mpdf-side__row { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 8px; }
.mpdf-side__row + .mpdf-sorts, .mpdf-side__add + .mpdf-side__row { margin-top: 18px; }
.mpdf-side__label { font-size: 14px; font-weight: 600; color: var(--mpdf-ink); }
.mpdf-side__link { border: 0; background: none; padding: 0; color: var(--mpdf-red-d); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.mpdf-side__link:disabled { color: var(--mpdf-muted); text-decoration: none; cursor: default; opacity: .6; }
.mpdf-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mpdf-file { position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 6px 7px 4px; border: 1px solid var(--mpdf-line); border-radius: 9px; background: #fff; font-size: 14px; cursor: grab; user-select: none; }
.mpdf-file:hover { border-color: var(--mpdf-red-line); }
.mpdf-file.is-drag { z-index: 2; cursor: grabbing; box-shadow: 0 8px 20px rgba(0, 0, 0, .16); border-color: var(--mpdf-red-line); }
.mpdf-file__grip { flex: none; color: #a3a6ae; font-size: 15px; touch-action: none; padding: 2px; }
.mpdf-file__k { flex: none; min-width: 24px; height: 22px; padding: 0 5px; border-radius: 6px; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.mpdf-file__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpdf-file__n { flex: none; color: var(--mpdf-muted); font-size: 12px; }
.mpdf-file__rm { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--mpdf-muted); display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; }
.mpdf-file__rm:hover { background: var(--mpdf-red-soft); color: var(--mpdf-red); }
.mpdf-side__add { margin-top: 8px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px; border: 1px dashed #c9ccd4; border-radius: 9px; background: none; color: var(--mpdf-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.mpdf-side__add:hover { border-color: var(--mpdf-red); color: var(--mpdf-red-d); background: var(--mpdf-red-soft); }
.mpdf-sorts { display: flex; flex-direction: column; gap: 4px; }
.mpdf-sortb { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: var(--mpdf-bg); color: var(--mpdf-ink); font-size: 14px; text-align: left; cursor: pointer; }
.mpdf-sortb .bi { color: var(--mpdf-muted); font-size: 15px; }
.mpdf-sortb:hover:not(:disabled) { background: #eceef3; }
.mpdf-sortb:hover:not(:disabled) .bi { color: var(--mpdf-red); }
.mpdf-sortb:disabled { opacity: .45; cursor: default; }
.mpdf-side__foot { flex: none; padding: 14px 16px 16px; border-top: 1px solid var(--mpdf-line); }
.mpdf-go { width: 100%; font-size: 19px; padding: 14px 16px; border-radius: 11px; gap: 10px; }
.mpdf-side__close { display: none; }

@media (min-width: 901px) {
    .mpdf.has-side .mpdf-work:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 0 22px; align-items: start; }
    .mpdf-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); margin: 12px 0 16px; border: 1px solid var(--mpdf-line); border-radius: 14px; overflow: hidden; }
    /* the panel holds the order and the main button: ⇅ and the heading-row button are not needed */
    .mpdf.has-side .mpdf-bar > #mpdf-sort, .mpdf.has-side .merge-title .mpdf-merge { display: none; }
}
@media (max-width: 900px) {
    .mpdf-side { position: fixed; z-index: var(--mpdf-z-pop); left: 0; right: 0; bottom: 0; max-height: 78vh; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .22); transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
    .mpdf.is-sheet .mpdf-side { transform: none; visibility: visible; transition: transform .22s ease; }
    .mpdf-side__close { display: flex; }
    .mpdf-side__title { text-align: left; }
    /* on a narrow screen the main button stays in the heading row */
    .mpdf-side__foot { display: none; }
    .mpdf.is-sheet .mpdf-pickbar, .mpdf.is-sheet .mpdf-toast { z-index: calc(var(--mpdf-z-pop) + 1); }
}
