/* ============================================================
   Раздел "Сервисы": каталог (tools.html), PDF-инструменты (pdf.html), изображения (img.html).
   Вся обработка файлов идет в браузере, стили только для интерфейса.
   ============================================================ */

/* ---------- Каталог сервисов ---------- */
.svc-note { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); max-width: 760px; margin-top: 28px; color: var(--muted); font-size: var(--fs-15); }
.svc-note svg { flex: none; width: 22px; height: 22px; color: var(--success); margin-top: 2px; }
.svc-note b { color: var(--ink); }
.svc-group + .svc-group { margin-top: var(--head-gap); }
.svc-group-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.svc-group-head .h2 { font-size: clamp(1.5rem, 1rem + 1.6vw, 2.25rem); }
.svc-group-head p { color: var(--muted); max-width: 36em; }

/* ---------- Сетка инструментов ---------- */
.tool-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tool-filter button { font: inherit; font-size: var(--fs-14); font-weight: 600; padding: 9px 16px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: background-color .2s, color .2s, border-color .2s; }
.tool-filter button:hover { border-color: var(--primary); color: var(--primary); }
.tool-filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--gap); }
.tool-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 20px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: transform .35s var(--ease), border-color .3s, box-shadow .3s; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.tool-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.tool-card[hidden] { display: none; }
.tool-card b { font-family: var(--display); font-size: var(--fs-18); font-weight: 700; letter-spacing: -.01em; }
.tool-card span:last-child { color: var(--muted); font-size: var(--fs-14); line-height: 1.5; }
.tool-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--c, var(--primary)); }
.tool-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-card .tool-ic { margin-bottom: 4px; }

/* Цвета групп инструментов */
.c-org { --c: #e0533d; }
.c-opt { --c: #1f9d6b; }
.c-conv { --c: #d99a06; }
.c-edit { --c: #7b4fd6; }
.c-sec { --c: #1f4fd8; }
.c-create { --c: #c2336b; }
[data-theme="dark"] .c-sec { --c: #3f6fe8; }

/* ---------- Рабочая область инструмента ---------- */
.pdf-app { min-height: 50vh; }
.pdf-view[hidden] { display: none !important; }
.pdf-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.pdf-head .tool-ic { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.pdf-head .tool-ic svg { width: 28px; height: 28px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-14); font-weight: 600; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; margin-bottom: 20px; }
.back-link:hover { color: var(--primary); }
.back-link svg { width: 16px; height: 16px; transform: rotate(180deg); }

/* Зона перетаскивания */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: clamp(40px, 7vw, 80px) 24px; border-radius: var(--r-lg); border: 2px dashed var(--line-2); background: var(--surface); transition: border-color .25s, background-color .25s, transform .3s var(--ease); }
.drop.is-over { border-color: var(--primary); background: var(--primary-tint); transform: scale(1.01); }
.drop-ic { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: var(--c, var(--primary)); box-shadow: 0 16px 32px -14px var(--c, var(--primary)); }
.drop-ic svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-btn { display: inline-flex; align-items: center; gap: 10px; padding: 18px 34px; border-radius: var(--pill); border: 0; background: var(--c, var(--primary)); color: #fff; font: inherit; font-size: var(--fs-18); font-weight: 700; cursor: pointer; box-shadow: 0 14px 30px -12px var(--c, var(--primary)); transition: transform .16s var(--ease-out), filter .2s; }
.drop-btn:hover { filter: brightness(1.08); }
.drop-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop-btn:active { transform: scale(.97); }
.drop-hint { color: var(--muted); font-size: var(--fs-15); }
.drop-sub { color: var(--dim); font-size: var(--fs-13); max-width: 34em; }

/* Перетаскивание файлов поверх всей страницы */
.drop-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 16%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); pointer-events: none; opacity: 0; transition: opacity .2s; }
.drop-overlay.is-on { opacity: 1; }
.drop-overlay div { padding: 28px 40px; border-radius: var(--r-lg); border: 2px dashed var(--primary); background: var(--surface); color: var(--ink); font-family: var(--display); font-size: var(--fs-22); font-weight: 700; box-shadow: var(--shadow-lg); }

/* Рабочее поле: список слева, параметры справа */
.ws { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ws-main { min-width: 0; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg-2); padding: 18px; min-height: 360px; }
.ws-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.ws-bar .grow { flex: 1; }
.ws-count { color: var(--muted); font-size: var(--fs-14); }
.ws-aside { position: sticky; top: calc(var(--header-h, 76px) + 16px); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); padding: 22px; display: grid; gap: 20px; max-height: calc(100vh - var(--header-h, 76px) - 32px); overflow: auto; }
.ws-aside h2 { font-family: var(--display); font-size: var(--fs-20); font-weight: 700; }

/* Кнопки панели */
.mini-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-14); font-weight: 600; cursor: pointer; transition: border-color .2s, color .2s, background-color .2s; }
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mini-btn.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.add-fab { width: 40px; height: 40px; padding: 0; justify-content: center; background: var(--c, var(--primary)); border-color: transparent; color: #fff; }
.add-fab:hover { color: #fff; filter: brightness(1.08); border-color: transparent; }
.add-fab svg { width: 20px; height: 20px; }

/* Карточки файлов и страниц */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.cards.pages { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 10px 10px; border-radius: var(--r); border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: border-color .2s, opacity .2s, box-shadow .2s; }
.card:hover { border-color: var(--line-2); }
.card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.card.is-sel { border-color: var(--c, var(--primary)); }
.card.is-del { opacity: .45; }
.card.is-del .thumb::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 8px, rgba(180, 35, 24, .16) 8px 16px); }
.thumb { position: relative; width: 100%; aspect-ratio: 1 / 1.25; display: grid; place-items: center; overflow: hidden; }
.thumb canvas, .thumb .blank { max-width: 100%; max-height: 100%; box-shadow: 0 1px 3px rgba(15, 26, 46, .18); background: #fff; transition: transform .35s var(--ease); }
.thumb .blank { width: 76%; aspect-ratio: 1 / 1.414; }
.thumb .spin { width: 26px; height: 26px; }
.card-name { width: 100%; font-size: var(--fs-13); font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: var(--fs-12); color: var(--muted); }
.card-acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; z-index: 2; }
.card:hover .card-acts, .card:focus-within .card-acts { opacity: 1; }
@media (hover: none) { .card-acts { opacity: 1; } }
.card-acts button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: var(--shadow); }
.card-acts button:hover { color: var(--primary); border-color: var(--primary); }
.card-acts button.danger:hover { color: var(--danger); border-color: var(--danger); }
.card-acts svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.card-badge { position: absolute; top: 8px; left: 8px; z-index: 2; min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--pill); display: grid; place-items: center; font-size: var(--fs-12); font-weight: 700; color: #fff; background: var(--c, var(--primary)); }
.card-check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); display: grid; place-items: center; }
.card.is-sel .card-check { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); }
.card.is-sel .card-check::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.card.is-del .card-check { background: var(--danger); border-color: var(--danger); }
.card.is-del .card-check::after { content: "\00d7"; color: #fff; font-weight: 700; font-size: 16px; line-height: 1; border: 0; width: auto; height: auto; transform: none; }
.range-tag { font-size: var(--fs-12); font-weight: 700; color: var(--c, var(--primary)); }

/* Перетаскивание карточек */
.card.is-ghost { position: fixed; z-index: 95; pointer-events: none; cursor: grabbing; box-shadow: var(--shadow-lg); transform: rotate(2deg) scale(1.04); opacity: .95; margin: 0; }
.card.is-holder { opacity: .25; border: 2px dashed var(--c, var(--primary)); box-shadow: none; }
.card.is-holder > * { visibility: hidden; }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; }

/* ---------- Параметры ---------- */
.opt { display: grid; gap: 10px; }
.opt > label, .opt-title { font-size: var(--fs-14); font-weight: 700; color: var(--ink); }
.opt small, .opt-help { font-size: var(--fs-13); color: var(--muted); line-height: 1.45; }
.opt input[type="text"], .opt input[type="number"], .opt input[type="password"], .opt select, .opt textarea { width: 100%; font: inherit; font-size: var(--fs-15); color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; }
.opt input:focus, .opt select:focus, .opt textarea:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.opt input[type="range"] { width: 100%; accent-color: var(--c, var(--primary)); }
.opt input[type="color"] { width: 48px; height: 38px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); padding: 3px; cursor: pointer; }
.opt-row { display: flex; gap: 10px; align-items: center; }
.opt-row > * { flex: 1; min-width: 0; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-14); cursor: pointer; color: var(--ink-2); }
.chk input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--c, var(--primary)); }
.seg { display: grid; gap: 8px; }
.seg.cols-2 { grid-template-columns: 1fr 1fr; }
.seg.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg label { position: relative; display: grid; gap: 2px; padding: 11px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); cursor: pointer; font-size: var(--fs-14); font-weight: 600; transition: border-color .2s, background-color .2s; }
.seg label small { font-weight: 400; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label.is-checked { border-color: var(--c, var(--primary)); background: var(--primary-tint); background: color-mix(in srgb, var(--c, var(--primary)) 9%, transparent); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 1px; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 38px); gap: 6px; }
.pos-grid label { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }
.pos-grid label::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.pos-grid label.is-checked::after { background: var(--c, var(--primary)); }
.pos-grid label.off { visibility: hidden; }

.run-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 17px 20px; border-radius: var(--pill); border: 0; background: var(--c, var(--primary)); color: #fff; font: inherit; font-size: var(--fs-18); font-weight: 700; cursor: pointer; box-shadow: 0 14px 30px -14px var(--c, var(--primary)); transition: transform .16s var(--ease-out), filter .2s, opacity .2s; }
.run-btn:hover { filter: brightness(1.08); }
.run-btn:active { transform: scale(.98); }
.run-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.run-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.warn { padding: 10px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--ink-2); font-size: var(--fs-13); line-height: 1.45; }
.info { padding: 10px 12px; border-radius: var(--r-sm); background: var(--primary-tint); color: var(--ink-2); font-size: var(--fs-13); line-height: 1.45; }

/* ---------- Ход обработки ---------- */
.busy { display: grid; place-items: center; gap: 18px; padding: clamp(48px, 8vw, 96px) 24px; text-align: center; }
.busy h2 { font-family: var(--display); font-size: var(--fs-26); font-weight: 700; }
.bar { width: min(420px, 100%); height: 8px; border-radius: var(--pill); background: var(--bg-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c, var(--primary)); transition: width .25s; }
.busy p { color: var(--muted); font-size: var(--fs-14); }
.spin { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--c, var(--primary)); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Результат ---------- */
.done { display: grid; justify-items: center; gap: 18px; text-align: center; padding: clamp(32px, 6vw, 64px) 0 8px; }
.done h2 { font-family: var(--display); font-size: var(--fs-h2); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.done-sum { color: var(--muted); font-size: var(--fs-16); max-width: 40em; }
.done-sum b { color: var(--success); }
.done-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }
.dl-btn { display: inline-flex; align-items: center; gap: 12px; padding: 20px 40px; border-radius: var(--pill); border: 0; background: var(--c, var(--primary)); color: #fff; font: inherit; font-size: var(--fs-20); font-weight: 700; cursor: pointer; box-shadow: 0 16px 34px -14px var(--c, var(--primary)); transition: transform .16s var(--ease-out), filter .2s; }
.dl-btn:hover { filter: brightness(1.08); }
.dl-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.done-files { display: grid; gap: 6px; width: min(560px, 100%); text-align: left; }
.done-files li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-14); }
.done-files li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-files li span:nth-child(2) { color: var(--muted); font-size: var(--fs-13); white-space: nowrap; }
.done-files button { font: inherit; font-size: var(--fs-13); font-weight: 600; color: var(--primary); background: none; border: 0; cursor: pointer; padding: 2px 4px; }
.next-tools { width: 100%; margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.next-tools h3 { font-family: var(--display); font-size: var(--fs-18); font-weight: 700; margin-bottom: 14px; }
.next-tools .tool-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.next-tools .tool-card { flex-direction: row; align-items: center; padding: 12px 14px; gap: 12px; }
.next-tools .tool-card .tool-ic { width: 36px; height: 36px; border-radius: 10px; margin: 0; flex: none; }
.next-tools .tool-card .tool-ic svg { width: 20px; height: 20px; }
.next-tools .tool-card b { font-size: var(--fs-15); }
.next-tools .tool-card span:last-child { display: none; }

/* ---------- Окна ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(6, 13, 28, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-box { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 24px; display: grid; gap: 16px; }
.modal-box h2 { font-family: var(--display); font-size: var(--fs-22); font-weight: 700; }
.modal-acts { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-acts .run-btn { width: auto; padding: 12px 24px; font-size: var(--fs-16); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; font-size: var(--fs-14); font-weight: 600; padding: 10px 14px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--c, var(--primary)); }
.sig-pad { width: 100%; height: 200px; border-radius: var(--r); border: 1.5px dashed var(--line-2); background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sig-type { font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive; font-size: 2rem; padding: 18px 16px !important; background: #fff !important; color: #1a2b6d !important; }
.sig-colors { display: flex; gap: 8px; align-items: center; }
.sig-colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line-2); cursor: pointer; padding: 0; }
.sig-colors button[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--primary); }

/* ---------- Редактор страницы: подпись, правка, обрезка ---------- */
.ed { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ed-nav { display: flex; align-items: center; gap: 8px; }
.ed-nav span { font-size: var(--fs-14); color: var(--muted); min-width: 90px; text-align: center; }
.ed-stage { position: relative; display: grid; place-items: center; padding: 20px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); overflow: auto; min-height: 420px; }
.ed-page { position: relative; box-shadow: 0 2px 10px rgba(15, 26, 46, .22); background: #fff; line-height: 0; }
.ed-page > canvas { display: block; }
.ed-page.is-placing { cursor: copy; }
.ed-item { position: absolute; line-height: 1.2; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; outline: 1px dashed transparent; }
.ed-item:hover { outline-color: rgba(31, 79, 216, .5); }
.ed-item.is-active { outline: 1.5px solid #1f4fd8; }
.ed-item img, .ed-item canvas { width: 100%; height: 100%; display: block; pointer-events: none; }
.ed-item .txt { white-space: pre; pointer-events: none; }
.ed-item .rect { width: 100%; height: 100%; }
.ed-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: #1f4fd8; border: 2px solid #fff; cursor: nwse-resize; display: none; touch-action: none; }
.ed-del { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: #b42318; color: #fff; border: 2px solid #fff; cursor: pointer; display: none; place-items: center; padding: 0; font-size: 14px; line-height: 1; }
.ed-item.is-active .ed-handle { display: block; }
.ed-item.is-active .ed-del { display: grid; }
.ed-draw { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.ed-list { display: grid; gap: 6px; font-size: var(--fs-13); color: var(--muted); }
.crop-box { position: absolute; border: 2px solid var(--c, #7b4fd6); box-shadow: 0 0 0 9999px rgba(6, 13, 28, .45); cursor: move; touch-action: none; }
.crop-box i { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--c, #7b4fd6); border-radius: 3px; touch-action: none; }
.crop-box i[data-h="nw"] { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-box i[data-h="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-box i[data-h="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-box i[data-h="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.ed-page.crop-wrap { overflow: hidden; }

.ed-draw { z-index: 5; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-14); font-weight: 600; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; transition: border-color .2s, color .2s, background-color .2s; }
.chip:hover { border-color: var(--c, var(--primary)); color: var(--c, var(--primary)); }
.chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip.is-on { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); color: #fff; }
.sig-slot { display: grid; gap: 8px; }
.sig-chip { justify-content: center; padding: 8px; background: #fff; min-height: 72px; }
.sig-chip canvas { max-width: 100%; max-height: 56px; }
.cards.static .card { cursor: default; }
.cards.pickable .card { cursor: pointer; }
.card { -webkit-touch-callout: none; }
.crumbs a + a::before { content: "/"; display: inline-block; margin-right: 8px; color: var(--dim); }

/* ---------- Изображения ---------- */
.checker { background-color: #fff; background-image: linear-gradient(45deg, #e3e7ee 25%, transparent 25%), linear-gradient(-45deg, #e3e7ee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e3e7ee 75%), linear-gradient(-45deg, transparent 75%, #e3e7ee 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.thumb.checker { border-radius: 6px; }
.thumb.checker canvas { box-shadow: none; background: transparent; }
.img-wrap { box-shadow: 0 2px 10px rgba(15, 26, 46, .22); }
.blur-wrap { cursor: crosshair; touch-action: none; }
.blur-rect { border: 2px dashed #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .55); outline: none !important; }
.range-row { align-items: center; }
.range-row output { flex: none !important; min-width: 44px; text-align: right; font-size: var(--fs-14); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets .mini-btn { padding: 6px 12px; font-size: var(--fs-13); }
.ico-sizes { flex-wrap: wrap; gap: 8px 14px; }
.ico-sizes > * { flex: none !important; }
.done-preview { max-width: 100%; }
.done-preview canvas { display: block; max-width: 100%; max-height: 360px; border-radius: var(--r-sm); box-shadow: var(--shadow); background-color: #fff; background-image: linear-gradient(45deg, #e3e7ee 25%, transparent 25%), linear-gradient(-45deg, #e3e7ee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e3e7ee 75%), linear-gradient(-45deg, transparent 75%, #e3e7ee 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }

/* ---------- Уведомления ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 110; transform: translate(-50%, 20px); max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: var(--r); background: var(--navy); color: var(--on-navy); font-size: var(--fs-14); box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: #7a1810; }

.pdf-privacy { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; color: var(--muted); font-size: var(--fs-13); text-align: center; }
.pdf-privacy svg { width: 16px; height: 16px; flex: none; color: var(--success); }

/* ---------- Адаптив ---------- */
@media (max-width: 1023px) {
  .ws, .ed { grid-template-columns: minmax(0, 1fr); }
  .ws-aside { position: static; max-height: none; }
}
@media (max-width: 599px) {
  .ws-main { padding: 12px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cards.pages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 8px 6px 6px; }
  .card-acts button { width: 26px; height: 26px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tool-card b { font-size: var(--fs-16); }
  .tool-card b, .tool-card span:last-child { overflow-wrap: anywhere; hyphens: auto; }
  .tool-card { padding: 16px 14px; }
  .tool-card span:last-child { font-size: var(--fs-13); }
  .drop-btn { padding: 16px 26px; font-size: var(--fs-16); }
  .dl-btn { padding: 17px 28px; font-size: var(--fs-18); }
  .ed-stage { padding: 10px; min-height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-card, .drop, .thumb canvas { transition: none; }
  .spin { animation-duration: 2s; }
}

/* Отступ рабочей области от первого экрана меньше обычного раздела */
.section.pdf-sec { padding-top: clamp(28px, 4vw, 44px); }
