:root {
  --bg: #f4f5f9;
  --panel: #ffffff;
  --ink: #1d2030;
  --muted: #6b7088;
  --line: #e2e4ee;
  --accent: #6c4cf5;
  --accent-ink: #ffffff;
  --accent-soft: #efeafe;
  --danger: #d6455d;
  --ok: #1f9d61;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 50, .06), 0 4px 16px rgba(20, 20, 50, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- sidebar ---------- */
#sidebar { width: 236px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; font-weight: 700; font-size: 17px; }
.brand img { width: 28px; height: 28px; }
#nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--accent-soft); font-weight: 600; }
.nav-ico { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; flex: none; }
.side-foot { font-size: 12px; color: var(--muted); padding: 12px 18px; border-top: 1px solid var(--line); }

/* ---------- main ---------- */
#main { flex: 1; overflow-y: auto; padding: 22px 30px 60px; }
#tool-head h1 { margin: 0; font-size: 22px; }
#tool-head p { margin: 4px 0 18px; color: var(--muted); font-size: 14px; max-width: 760px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.drop { border: 2px dashed #c9c4ef; border-radius: var(--radius); background: #fbfaff; padding: 34px 20px; text-align: center; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { display: block; font-size: 16px; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 13px; }
.drop.compact { padding: 12px; }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row + .row { margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field > input, .field > select, .field > textarea { color: var(--ink); }
input[type=text], input[type=number], select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; min-width: 0; }
input[type=number] { width: 90px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }

.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #c6c9d8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.hint { font-size: 13px; color: var(--muted); }
.note { font-size: 13px; background: #fff8e6; border: 1px solid #f3dfa6; padding: 8px 10px; border-radius: 8px; color: #6a5212; }
.note.ok { background: #e9f8f0; border-color: #b7e6cc; color: #145c39; }

/* ---------- file list ---------- */
.files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; position: relative; cursor: grab; }
.file.dragging { opacity: .4; }
.file.drop-before { box-shadow: -4px 0 0 var(--accent); }
.file .thumb { height: 150px; display: grid; place-items: center; background: var(--bg); border-radius: 6px; overflow: hidden; }
.file .thumb img, .file .thumb canvas { max-width: 100%; max-height: 150px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.file .name { font-size: 12px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .meta { font-size: 11px; color: var(--muted); }
.file .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; line-height: 22px; padding: 0; }
.file input[type=text] { width: 100%; margin-top: 4px; font-size: 12px; padding: 4px 6px; }

/* ---------- page grid ---------- */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 12px; }
.pg { background: #fff; border: 2px solid transparent; border-radius: 8px; padding: 8px; text-align: center; position: relative; user-select: none; box-shadow: var(--shadow); }
.pg .thumb { height: 170px; display: grid; place-items: center; }
.pg .thumb canvas { max-width: 100%; max-height: 165px; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; background: #fff; }
.pg .num { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pg.sel { border-color: var(--accent); background: var(--accent-soft); }
.pg.del { opacity: .35; }
.pg.del .thumb::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 60px; color: var(--danger); }
.pg .tools { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; }
.pg:hover .tools { display: flex; }
.pg .tools button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; padding: 0; font-size: 14px; }
.pg.selectable { cursor: pointer; }
.pg.draggable { cursor: grab; }
.pg.drop-before { box-shadow: -5px 0 0 var(--accent); }

/* ---------- editor ---------- */
.ed-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.ed-toolbar { position: sticky; top: -22px; z-index: 5; background: var(--bg); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ed-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.ed-page canvas { display: block; }
.ed-layer { position: absolute; inset: 0; }
.ed-layer.adding { cursor: text; }
.ti { position: absolute; border-radius: 2px; cursor: text; }
.ti:hover { background: rgba(108, 76, 245, .12); outline: 1px solid rgba(108, 76, 245, .5); }
.ti.edited { outline: 1px dashed rgba(31, 157, 97, .8); }
.ti.active { outline: 2px solid var(--accent); }
.ed-white { position: absolute; z-index: 2; pointer-events: none; }
.ed-wrap2 { position: absolute; z-index: 3; white-space: nowrap; }
.ed-field { display: inline-block; white-space: pre; outline: 1.5px dashed var(--accent); outline-offset: 1px; border-radius: 1px; padding: 0; margin: 0; background: transparent; caret-color: var(--accent); cursor: text; min-height: 1em; }
.ed-field:focus { outline-style: solid; }
.ed-grip { position: absolute; left: -22px; top: 50%; transform: translateY(-50%); width: 16px; height: 22px; display: grid; place-items: center; font-size: 13px; line-height: 1; color: #fff; background: var(--accent); border-radius: 4px; cursor: grab; user-select: none; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.ed-wrap2.moving .ed-grip { cursor: grabbing; }
.ed-wrap2.moving .ed-field { outline-color: #1f9d61; }
.ed-side { position: sticky; top: 50px; }
.ed-side h3 { margin: 0 0 10px; font-size: 15px; }
.ed-side .field { margin-bottom: 10px; }
.ed-side .field input[type=number] { width: 100%; }
.swatch { width: 38px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.status { font-size: 12.5px; margin-top: 10px; }
.updating { font-size: 12px; color: var(--muted); }

/* ---------- conversion preview ---------- */
.preview-frame { background: #e9eaf0; border-radius: var(--radius); padding: 16px; overflow: auto; max-height: 70vh; }
.preview-frame .docx-wrapper { background: transparent !important; padding: 0 !important; }
.sheet-table { border-collapse: collapse; font-size: 11px; background: #fff; margin-bottom: 18px; }
.sheet-table td, .sheet-table th { border: 1px solid #c8cbd6; padding: 2px 5px; }
.sheet-title { font-weight: 700; margin: 8px 0; }
.epub-page { background: #fff; max-width: 760px; margin: 0 auto 16px; padding: 40px 54px; box-shadow: var(--shadow); line-height: 1.5; }
.epub-page img, .epub-page svg { max-width: 100%; height: auto; }
.slide-box { margin: 0 auto 14px; box-shadow: var(--shadow); background: #fff; }

#print-root { display: none; }

/* ---------- toast / busy ---------- */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: #222433; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; transition: .25s; z-index: 100; max-width: 80vw; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }
#busy { position: fixed; inset: 0; background: rgba(244,245,249,.75); display: grid; place-content: center; justify-items: center; gap: 12px; z-index: 90; font-size: 15px; }
#busy[hidden] { display: none; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- print (Office / EPUB → PDF) ---------- */
@media print {
  html, body { background: #fff !important; height: auto; overflow: visible; display: block; }
  #sidebar, #main, #toast, #busy { display: none !important; }
  #print-root { display: block !important; }
  #print-root .docx-wrapper { background: #fff !important; padding: 0 !important; display: block !important; }
  #print-root .docx-wrapper > section.docx { box-shadow: none !important; margin: 0 !important; page-break-after: always; break-after: page; }
  #print-root .epub-page { box-shadow: none; max-width: none; margin: 0; padding: 0; }
  #print-root .epub-chapter { break-before: page; }
  #print-root .epub-chapter:first-child { break-before: auto; }
  #print-root .slide-box { box-shadow: none; margin: 0; break-after: page; page-break-after: always; }
  #print-root .sheet-block { break-after: page; }
  #print-root .sheet-block:last-child { break-after: auto; }
}

/* ---------- redact ---------- */
.rd-box { position: absolute; background: rgba(20, 20, 30, .55); outline: 2px solid #d6455d; z-index: 2; }
.rd-box.drawing { background: rgba(214, 69, 93, .2); outline-style: dashed; }
.rd-x { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #d6455d; color: #fff; font-size: 13px; line-height: 20px; padding: 0; cursor: pointer; display: none; }
.rd-box:hover .rd-x { display: block; }
.rd-text { position: absolute; cursor: pointer; border-radius: 2px; z-index: 1; }
.rd-text:hover { background: rgba(214, 69, 93, .18); outline: 1px solid rgba(214, 69, 93, .6); }

/* ---------- sign & fill ---------- */
.sg-layer.placing { cursor: copy; }
.sg-item { position: absolute; z-index: 3; outline: 1px dashed rgba(108, 76, 245, .6); }
.sg-item:hover { outline: 1.5px solid var(--accent); }
.sg-item img { width: 100%; height: 100%; display: block; pointer-events: none; cursor: move; }
.sg-item:not(.sg-text) { cursor: move; }
.sg-edit { font-family: "PS Liberation Sans", Arial, sans-serif; line-height: 1.2; white-space: pre; outline: none; min-width: 20px; padding: 0 1px; }
.sg-mark { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; line-height: 1; }
.sg-grip { position: absolute; left: -20px; top: 0; width: 16px; height: 20px; background: var(--accent); color: #fff; border-radius: 4px; font-size: 12px; display: none; place-items: center; cursor: grab; }
.sg-del { position: absolute; right: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font-size: 13px; line-height: 20px; padding: 0; cursor: pointer; display: none; }
.sg-resize { position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; background: #fff; border: 2px solid var(--accent); border-radius: 2px; cursor: nwse-resize; display: none; }
.sg-item:hover .sg-grip, .sg-item:focus-within .sg-grip { display: grid; }
.sg-item:hover .sg-del, .sg-item:hover .sg-resize, .sg-item:focus-within .sg-del, .sg-item:focus-within .sg-resize { display: block; }
.sg-field { position: absolute; z-index: 2; border: 1px solid rgba(59, 130, 246, .55); background: rgba(219, 234, 254, .55); border-radius: 2px; padding: 0 3px; font-family: Arial, sans-serif; min-width: 0; }
.sg-field:focus { outline: 2px solid #3b82f6; background: rgba(219, 234, 254, .85); }
textarea.sg-field { resize: none; }
.sg-cb { margin: 0; padding: 0; accent-color: #1d4ed8; }
.sg-modal { position: fixed; inset: 0; background: rgba(15, 18, 35, .45); display: grid; place-items: center; z-index: 80; }
.sg-dialog { width: min(620px, 92vw); }
.sg-dialog h3 { margin: 0 0 10px; }
.sg-dialog .seg { margin-bottom: 10px; }
.sg-pad { width: 100%; height: auto; border: 1px dashed #c9c4ef; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; display: block; margin-bottom: 8px; }
.sg-fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.sg-font { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px; font-size: 28px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-font.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- annotate ---------- */
.an-tools .btn { gap: 4px; }
.an-ico { display: inline-block; min-width: 14px; text-align: center; }
.an-svg { position: absolute; inset: 0; overflow: visible; }
.an-layer { cursor: crosshair; }
.an-layer[data-tool="select"] { cursor: default; }
.an-layer[data-tool="note"], .an-layer[data-tool="freetext"] { cursor: copy; }
.an-item { cursor: pointer; }
.an-item.sel { filter: drop-shadow(0 0 2px #6c4cf5) drop-shadow(0 0 1px #6c4cf5); }
.an-ft { position: absolute; z-index: 3; font-family: "PS Liberation Sans", Arial, sans-serif; line-height: 1.2; white-space: pre; padding: 0 2px; outline: 1px dashed rgba(108, 76, 245, .6); cursor: text; min-height: 1em; }
.an-ft.sel, .an-ft:focus { outline: 1.5px solid var(--accent); }
.an-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.an-sw.on { box-shadow: 0 0 0 2px var(--accent); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- editor: images & find ---------- */
.ti.ti-img { cursor: move; }
.ti.ti-img:hover { background: rgba(59, 130, 246, .08); outline: 1px dashed rgba(59, 130, 246, .7); }
.ed-imgsel { position: absolute; z-index: 4; outline: 2px solid #3b82f6; background: rgba(59, 130, 246, .08); cursor: move; }
.ed-imgrs { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid #3b82f6; border-radius: 2px; cursor: nwse-resize; }
.ed-findbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.ed-findbar[hidden] { display: none; }
.ed-findbar input[type=text] { width: 180px; }


/* Editor: paragraphs */
.ed-field.ed-para { white-space: pre-wrap; word-wrap: break-word; display: block; }
.ed-wrap2.para .ed-grip { top: 0; transform: none; }

/* One document across tools */
.use-current { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.next-bar { position: fixed; right: 20px; bottom: 20px; z-index: 50; background: #fff; border: 1px solid var(--line, #e3e5ec); border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(20, 20, 40, .18); display: grid; gap: 8px; max-width: 560px; animation: nb-in .2s ease-out; }
.next-bar .x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 18px; cursor: pointer; color: #888; }
@keyframes nb-in { from { transform: translateY(10px); opacity: 0; } }

/* Two-column tool layouts (stamp, crop, metadata, compare) */
.st-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .st-grid { grid-template-columns: 1fr; } }
.st-preview { display: grid; place-items: center; min-height: 300px; background: #eef0f5; border-radius: 8px; padding: 10px; }
.st-preview canvas { box-shadow: 0 2px 10px rgba(0,0,0,.15); background: #fff; }
.st-three input { flex: 1; min-width: 0; }
.st-bates { margin: 6px 0 4px 24px; }
.cr-stage { display: grid; place-items: center; background: #eef0f5; border-radius: 8px; padding: 10px; min-height: 300px; }
.cr-wrap { position: relative; box-shadow: 0 2px 10px rgba(0,0,0,.15); user-select: none; }
.cr-wrap.drawing { cursor: crosshair; }
.cr-wrap canvas { display: block; }
.cr-box { position: absolute; display: none; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(20, 20, 40, .35); pointer-events: none; }
.md-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.md-table th { text-align: left; color: var(--muted, #6b7280); font-weight: 500; padding: 6px 10px 6px 0; vertical-align: top; white-space: nowrap; }
.md-table td { padding: 6px 0; border-bottom: 1px solid var(--line, #eceef3); word-break: break-word; }
.cmp-list { max-height: 260px; overflow: auto; display: grid; gap: 4px; margin-top: 8px; }
.cmp-item { text-align: left; display: flex; gap: 10px; align-items: baseline; background: #fafbfc; border: 1px solid var(--line, #eceef3); border-radius: 6px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.cmp-item:hover { border-color: var(--accent); }
.cmp-item del { color: #c42f4a; background: #fde8ec; text-decoration: line-through; }
.cmp-item ins { color: #13804b; background: #e3f7ec; text-decoration: none; }
.cmp-pages { display: grid; gap: 16px; }
.cmp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-height: 200px; }
.cmp-cell { display: grid; justify-items: center; padding-top: 22px; }
.cmp-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.cmp-page canvas { display: block; }
.cmp-label { position: absolute; top: -20px; left: 0; font-size: 12px; color: var(--muted, #6b7280); }
.cmp-mark { position: absolute; border-radius: 2px; pointer-events: none; }
.cmp-mark.del { background: rgba(214, 69, 93, .28); outline: 1px solid rgba(214, 69, 93, .7); }
.cmp-mark.ins { background: rgba(31, 157, 97, .25); outline: 1px solid rgba(31, 157, 97, .7); }
.cmp-mark.flash { animation: cmp-flash 1.2s ease-out 2; }
@keyframes cmp-flash { 50% { box-shadow: 0 0 0 6px rgba(108, 76, 245, .5); } }
.cmp-pix { position: absolute; left: 0; top: 0; pointer-events: none; mix-blend-mode: multiply; }
.cmp-missing { display: grid; place-items: center; height: 200px; width: 100%; color: var(--muted, #6b7280); border: 1px dashed var(--line, #dfe2ea); border-radius: 8px; font-size: 13px; }
.batch-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.batch-list li { display: grid; grid-template-columns: 1fr auto minmax(120px, auto) auto; gap: 12px; align-items: center; padding: 6px 10px; border: 1px solid var(--line, #eceef3); border-radius: 6px; font-size: 13px; }
.batch-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-list .state { color: var(--muted, #6b7280); }
.batch-list .state.ok { color: #13804b; } .batch-list .state.err { color: #c42f4a; }
.batch-list .x { border: 0; background: none; cursor: pointer; font-size: 16px; color: #999; }
.batch-opts { margin-top: 10px; display: grid; gap: 10px; }

/* Home screen and tool search */
.brand { text-decoration: none; color: inherit; }
.nav-search { padding: 0 12px 4px; }
.nav-search input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--bg); font-size: 13px; }
.nav-search input:focus { background: #fff; }
.nav-item.home { margin-top: 4px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.home-group { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 2px 0; }
.home-card { display: flex; gap: 12px; align-items: flex-start; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; font: inherit; }
.home-card:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(108, 76, 245, .12); transform: translateY(-1px); }
.home-text { display: grid; gap: 3px; }
.home-text strong { font-size: 14px; }
.home-text > span { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nav-ico.big { width: 36px; height: 36px; border-radius: 9px; font-size: 15px; }

/* Consistent form controls (inputs created without an explicit type too) */
input:not([type]), input[type=text], input[type=url], input[type=password], input[type=email], input[type=search] { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; min-width: 0; }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.btn:focus-visible, .nav-item:focus-visible, .home-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.loaded { display: flex; gap: 12px; align-items: baseline; justify-content: center; padding: 10px 14px; border-width: 1px; }
.drop.loaded strong { margin: 0; font-size: 14px; }

/* License / Pro */
.pro-tag { margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 5px; }
.home-text strong .pro-tag, .seg .pro-tag { margin-left: 6px; vertical-align: 1px; }
.seg button.on .pro-tag { background: rgba(255,255,255,.25); color: #fff; }
body.is-pro .pro-tag { display: none; }
.pw-card { position: relative; max-width: 560px; margin: 10px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(30, 20, 80, .10); padding: 32px 34px 26px; text-align: center; }
.pw-card.small { margin: 0; width: min(520px, 92vw); max-height: 92vh; overflow: auto; }
.pw-card h2 { margin: 10px 0 6px; font-size: 22px; }
.pw-sub { color: var(--muted); margin: 0 0 16px; }
.pw-badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: #fff; background: linear-gradient(135deg, #6c4cf5, #9b6bff); border-radius: 999px; padding: 4px 10px; }
.pw-points { list-style: none; padding: 0; margin: 0 auto 18px; text-align: left; display: grid; gap: 8px; max-width: 420px; }
.pw-points li { padding-left: 26px; position: relative; font-size: 14px; color: var(--muted); }
.pw-points li strong { color: var(--ink); }
.pw-points li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.pw-price { display: flex; gap: 10px; align-items: baseline; justify-content: center; margin-bottom: 14px; }
.pw-price s { color: var(--muted); font-size: 18px; }
.pw-price strong { font-size: 34px; letter-spacing: -.02em; }
.pw-price span { color: var(--muted); font-size: 13px; }
.btn.big { padding: 12px 26px; font-size: 16px; border-radius: 10px; }
.pw-have { margin-top: 14px; text-align: left; }
.pw-have summary { cursor: pointer; color: var(--accent); font-size: 14px; text-align: center; }
.pw-keyrow { display: flex; gap: 8px; margin-top: 10px; }
.pw-key { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pw-free { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; justify-items: center; }
.pw-modal { position: fixed; inset: 0; z-index: 100; background: rgba(15, 12, 35, .45); display: grid; place-items: center; backdrop-filter: blur(2px); }
.pw-x { position: absolute; top: 10px; right: 14px; border: 0; background: none; font-size: 22px; color: #999; cursor: pointer; }
.lic-foot { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.lic-foot strong { color: var(--accent); }
.lic-foot.pro { background: #fff; }
.lic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.side-note { margin-top: 8px; }
.pw-msg { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 0; text-align: left; }
.pw-msg.err { color: var(--danger); }

/* OCR */
.ocr-text { width: 100%; margin-top: 12px; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.ed-ocr { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); z-index: 4; display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line, #e3e5ec); border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 16px rgba(20, 20, 40, .12); font-size: 13px; white-space: nowrap; }
.ti.ocr:hover { outline-color: #e2702a; }
.welcome { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; background: linear-gradient(135deg, #f1ecff, #fbfaff); border: 1px solid #ddd3ff; border-radius: 14px; padding: 22px 26px; margin-bottom: 16px; }
.welcome h2 { margin: 0 0 6px; font-size: 20px; }
.welcome p { margin: 0 0 10px; color: var(--muted); }
.welcome ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.welcome-actions { display: grid; gap: 8px; }
@media (max-width: 900px) { .welcome { grid-template-columns: 1fr; } }

/* try before you buy */
.try-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: #f3efff; border: 1px solid #e2d9ff; color: #3d2e7a; font-size: 13.5px; }
.try-note .btn { margin-left: auto; }
.pw-badge.ok { background: linear-gradient(135deg, #16a34a, #22c55e); }

/* fill any form: blanks found on forms without fields, and My details */
.sg-blank { position: absolute; border: 1.5px dashed rgba(108, 76, 245, .55); background: rgba(108, 76, 245, .07); border-radius: 3px; cursor: text; z-index: 2; transition: background .12s; }
.sg-blank:hover { background: rgba(108, 76, 245, .18); border-style: solid; }
.sg-blank.check { cursor: pointer; }
.sg-fillbar { margin-top: 6px; }
.btn.primary-soft { background: #efe9ff; color: #4b2fd0; border-color: #d9ccff; font-weight: 600; }
.btn.primary-soft:hover { background: #e4dbff; }
.dt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 10px; }
.dt-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: #555; }
.dt-grid input { padding: 8px 10px; border: 1px solid #d6d6e0; border-radius: 8px; font: inherit; font-size: 14px; color: #111; }
@media (max-width: 640px) { .dt-grid { grid-template-columns: 1fr; } }
