/* Flipbook converter layout (builds on style.css) */
[hidden] { display: none !important; }
.fapp { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.fmain { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; padding: 16px 18px; min-height: 0; }
.fside { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; padding-right: 2px; }
.panel h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; }
.step { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--cream); color: #1b1608; font-size: 13px; font-weight: 700; flex: none; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 16px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 14px; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--cream); background: rgba(233,214,169,.06); }
.drop .i { width: 34px; height: 34px; color: var(--cream); margin-bottom: 4px; }
.drop b { font-size: 15px; }
.drop span { font-size: 13px; color: var(--muted); }
.drop .types { margin-top: 4px; font-size: 12px; letter-spacing: .06em; color: var(--text); opacity: .8; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.ftype { flex: none; width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; }
.ftype.pdf { background: #d93a3a; } .ftype.docx { background: #2b6cd8; } .ftype.pptx { background: #d8662b; }
.finfo { min-width: 0; display: flex; flex-direction: column; }
.finfo b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.finfo span { font-size: 12px; color: var(--muted); }
.convert-progress .bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.convert-progress .bar div { height: 100%; width: 0; background: var(--cream); transition: width .2s; }
.prog-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tip { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.tip b { color: var(--text); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input[type=text], .field select { height: 38px; padding: 0 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 14px; }
.field input:focus, .field select:focus { border-color: var(--sel); outline: none; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button, .swatches .custom { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--c); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.swatches button.on { border-color: var(--cream); box-shadow: 0 0 0 3px rgba(233,214,169,.3); }
.swatches .custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatches .custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fpreview { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.preview-head h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; }
.preview-box { position: relative; flex: 1; min-height: 360px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #0f1621; }
.preview-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 20px; }
.preview-empty svg { width: 130px; color: var(--cream); opacity: .75; }
.preview-empty p { margin: 0; max-width: 44ch; }
.done-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.done-row #doneText { color: var(--ok); font-weight: 600; }
#render-area { position: absolute; left: -30000px; top: 0; width: 1400px; pointer-events: none; }
.modal-back.full { padding: 0; }
.full-box { position: fixed; inset: 0; background: #000; }
.full-box iframe { width: 100%; height: 100%; border: 0; }
.full-box .close { position: absolute; right: 14px; top: 64px; z-index: 2; }
@media (max-width: 900px) {
  .fapp { height: auto; }
  .fmain { grid-template-columns: 1fr; }
  .preview-box { min-height: 420px; }
}

/* ---------- mode tabs ---------- */
body.mode-pdf .flip-only { display: none !important; }
.fapp > .pdfmode { min-height: 0; }

/* ---------- PDF tools ---------- */
.pdfmode { display: flex; flex-direction: column; min-height: 0; padding: 12px 18px 16px; gap: 12px; }
.pdf-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); }
.bar-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.pinfo { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pdf-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.pdf-main { position: relative; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: #0f1621; padding: 14px; }
.pdf-main.over { border-color: var(--cream); background: #131d2b; }
.pdf-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pdf-files:empty { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; max-width: 320px; }
.fchip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.fchip b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fchip span { color: var(--muted); white-space: nowrap; }
.fchip button { width: 22px; height: 22px; border-radius: 50%; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; }
.fchip button:hover { background: rgba(255,92,92,.15); color: var(--err); }
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pcard { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: var(--panel); border: 2px solid transparent; cursor: pointer; user-select: none; transition: border-color .12s, transform .12s, opacity .12s; }
.pcard:hover { border-color: #3a4f6e; }
.pcard.sel { border-color: var(--sel); background: #1d2c45; }
.pcard.dragging { opacity: .35; }
.pcard.drop-before::before, .pcard.drop-after::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 4px; border-radius: 2px; background: var(--cream); }
.pcard.drop-before::before { left: -10px; } .pcard.drop-after::after { right: -10px; }
.pthumb { height: 180px; display: grid; place-items: center; background: #1a2433; border-radius: 6px; overflow: hidden; }
.pthumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 2px 8px rgba(0,0,0,.4); background: #fff; }
.pmeta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; }
.pnum { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.psrc { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); min-width: 0; }
.psrc i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.psrc em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.pcheck { position: absolute; top: 12px; left: 12px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid rgba(255,255,255,.7); background: rgba(15,22,33,.7); display: grid; place-items: center; }
.pcard.sel .pcheck { background: var(--sel); border-color: var(--sel); }
.pcard.sel .pcheck::after { content: ""; width: 10px; height: 6px; border: solid #0d1626; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.pacts { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; opacity: 0; transition: opacity .12s; }
.pcard:hover .pacts, .pcard:focus-within .pacts { opacity: 1; }
.pacts button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid rgba(255,255,255,.2); background: rgba(15,22,33,.85); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.pacts button:hover { background: #26364d; }
.pacts button.del:hover { background: rgba(255,92,92,.3); }
.pacts .i { width: 15px; height: 15px; }
.prot { position: absolute; bottom: 38px; right: 12px; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(0,0,0,.6); color: var(--cream); }
.pdf-empty { position: absolute; inset: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; }
.pdf-empty:hover { border-color: var(--cream); }
.pdf-empty svg { width: 64px; color: var(--cream); }
.pdf-empty b { color: var(--text); font-size: 16px; }
.pdf-side { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.pdf-side h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.pdf-side h3 .i { width: 18px; height: 18px; color: var(--cream); }
.split-modes { display: grid; gap: 6px; font-size: 13.5px; }
.split-modes label { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.split-modes label:has(input:checked) { background: var(--panel-2); }
.split-modes input { accent-color: var(--cream); }
.split-input, .split-every input { height: 36px; padding: 0 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 14px; }
.split-input:focus, .split-every input:focus { border-color: var(--sel); outline: none; }
.split-input.bad { border-color: var(--err); }
.split-every { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.split-every input { width: 80px; }
.split-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; min-height: 18px; }
.split-hint.err { color: var(--err); }
.pview { padding: 0; }
.pview-box { position: fixed; inset: 0; display: flex; flex-direction: column; background: rgba(8,12,18,.94); }
.pview-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 14px; }
.pview-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 12px 16px; }
.pview-stage canvas { max-width: calc(100% - 120px); max-height: 100%; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.pview-nav { width: 48px; height: 72px; border-radius: 14px; border: none; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.pview-nav:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.pview-nav:disabled { opacity: .2; cursor: default; }
.pview-nav svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) {
  .pdf-body { grid-template-columns: 1fr; }
  .pdf-main { min-height: 420px; }
  .pdf-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pthumb { height: 150px; }
  .pacts { opacity: 1; }
}

/* ---------- PDF editor ---------- */
body.mode-edit .flip-only { display: none !important; }
.editmode { display: flex; flex-direction: column; min-height: 0; padding: 12px 18px 16px; gap: 8px; }
.ed-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); }
.ed-bar .grow { flex: 1; }
.ed-tools { display: flex; gap: 2px; flex-wrap: wrap; }
.ed-tool { height: 36px; min-width: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.ed-tool:hover { background: var(--panel-2); }
.ed-tool.on { background: rgba(233,214,169,.16); border-color: rgba(233,214,169,.55); color: var(--cream); }
.ed-tool .i { width: 18px; height: 18px; }
.ed-tool:disabled { opacity: .35; cursor: not-allowed; }
.ed-props { display: flex; align-items: center; gap: 6px; }
.ed-props select, .ed-props input[type=number] { height: 32px; padding: 0 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 13px; }
.ed-props input[type=number] { width: 58px; }
.ed-color { position: relative; width: 32px; height: 32px; border-radius: 8px; border: 2px solid var(--line); overflow: hidden; cursor: pointer; }
.ed-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.ed-color span { display: block; width: 100%; height: 100%; }
.ed-zoom { min-width: 64px; justify-content: center; font-variant-numeric: tabular-nums; }
.btn.toggle.on { background: rgba(233,214,169,.16); border-color: var(--cream); color: var(--cream); }
.ed-hint { font-size: 12.5px; color: var(--muted); padding: 0 4px; min-height: 18px; }
.ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.ed-thumbs { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 6px 4px 0; }
.ed-thumb { border: 2px solid transparent; border-radius: 6px; padding: 0; background: #fff; cursor: pointer; position: relative; display: block; width: 100%; }
.ed-thumb canvas { display: block; width: 100%; height: auto; border-radius: 4px; }
.ed-thumb.cur { border-color: var(--cream); }
.ed-thumb span { position: absolute; right: 4px; bottom: 4px; font-size: 11px; padding: 0 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; }
.ed-pages { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: #0f1621; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.ed-pages.over { border-color: var(--cream); }
.ed-page { position: relative; flex: none; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.ed-page canvas.pdf { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ed-page svg.ann { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ed-page .lines { position: absolute; inset: 0; display: none; }
body.ed-tool-edit .ed-page .lines { display: block; }
.ed-line { position: absolute; border: 1.5px dashed rgba(122,168,255,.0); border-radius: 2px; cursor: text; background: rgba(122,168,255,.06); }
.ed-line:hover { border-color: #3d7bff; background: rgba(122,168,255,.18); }
.ed-page .pnum { position: absolute; top: -18px; left: 0; font-size: 11px; color: var(--muted); }
body.ed-tool-select svg.ann g[data-id] { cursor: move; }
body.ed-tool-text .ed-page, body.ed-tool-white .ed-page, body.ed-tool-hl .ed-page, body.ed-tool-box .ed-page,
body.ed-tool-ellipse .ed-page, body.ed-tool-arrow .ed-page, body.ed-tool-ink .ed-page { cursor: crosshair; }
body.ed-tool-text .ed-page { cursor: text; }
svg.ann .hit { fill: transparent; }
svg.ann .selbox { fill: none; stroke: #3d7bff; stroke-dasharray: 4 3; pointer-events: none; }
svg.ann .handle { fill: #fff; stroke: #3d7bff; cursor: nwse-resize; }
.ed-editor { position: absolute; z-index: 5; margin: 0; padding: 0 2px; border: 1.5px solid #3d7bff; border-radius: 2px; background: rgba(255,255,255,.92); resize: none; overflow: hidden; white-space: pre; line-height: 1.25; outline: none; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.sign-modal { width: min(760px, 100%); }
#signPad { width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border-radius: 10px; cursor: crosshair; touch-action: none; }
.sign-row { display: flex; align-items: center; gap: 10px; }
.sign-row .sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--c); cursor: pointer; padding: 0; }
.sign-row .sw.on { border-color: var(--cream); box-shadow: 0 0 0 3px rgba(233,214,169,.3); }
.sign-row .btn { margin-left: auto; }
@media (max-width: 900px) { .ed-body { grid-template-columns: 1fr; } .ed-thumbs { display: none; } }
svg.ann { pointer-events: none; }
body.ed-tool-select svg.ann .hit, body.ed-tool-select svg.ann .handle { pointer-events: all; }
@media (max-width: 1560px) {
  #edToFlip span { display: none; }
  .ed-bar { gap: 4px; }
  .ed-bar .bar-sep { margin: 0 2px; }
  .ed-tool { min-width: 34px; padding: 0 6px; }
}

/* ---------- PDF → Word ---------- */
body.mode-word .flip-only { display: none !important; }
.w-info { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-main.over { border-color: var(--cream); background: #131d2b; }
.w-preview { display: flex; justify-content: center; }
.w-preview .docx-wrapper { background: transparent !important; padding: 0 !important; }
.w-preview .docx-wrapper > section.docx { box-shadow: 0 10px 30px rgba(0,0,0,.45) !important; margin-bottom: 18px !important; }
.w-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15,22,33,.55); z-index: 3; }
.w-stats { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.w-stats b { color: var(--ok); font-weight: 600; }
.w-stats ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.5; }
.w-stats ul:empty { display: none; }
.wordmode .pdf-side .panel { display: flex; flex-direction: column; gap: 10px; }
