:root {
  --bg: #0f1222; --bg-soft: #161a30; --card: #1b2038; --card-2: #20264a; --line: #2a3157;
  --text: #eef1ff; --muted: #a3abce; --muted-2: #79829f; --accent: #6c8bff; --accent-2: #5cd6c0;
  --accent-grad: linear-gradient(135deg, #6c8bff 0%, #8a7bff 50%, #5cd6c0 100%);
  --good: #44d39b; --danger: #ff6b8a;
  --radius: 16px; --radius-sm: 11px; --shadow: 0 18px 50px -20px rgba(0,0,0,.65); --maxw: 1080px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(108,139,255,.18), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(92,214,192,.12), transparent 55%), var(--bg);
  color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased;
}
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
a { color: inherit; text-decoration: none; }

.site-header { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(14px);
  background: rgba(15,18,34,.72); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); display: grid; place-items: center; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.brand-accent { color: var(--accent); }
.brand-sub { color: var(--muted-2); font-weight: 500; font-size: .82rem;
  border-left: 1px solid var(--line); padding-left: 10px; margin-left: 2px; }
.nav { display: flex; align-items: center; gap: 24px; }
.nav a { color: var(--muted); font-weight: 500; font-size: .95rem; transition: color .15s; }
.nav a:hover { color: var(--text); }

.hero { padding: 60px 0 18px; text-align: center; }
.eyebrow { display: inline-block; font-size: .82rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-2); background: rgba(92,214,192,.1);
  border: 1px solid rgba(92,214,192,.25); padding: 6px 14px; border-radius: 999px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.08; margin: 20px 0 14px; font-weight: 800; letter-spacing: -.03em; }
.hero p { max-width: 620px; margin: 0 auto; color: var(--muted); font-size: 1.08rem; }
.hero p strong { color: var(--text); }

.ad-wrap { margin: 26px auto; }
.ad-slot { min-height: 90px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--muted-2); font-size: .78rem; }
.ad-slot:empty::after { content: "Advertisement"; letter-spacing: .1em; text-transform: uppercase; }

.tool { padding: 14px 0 24px; }
.pdf-card { background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }

.pdf-tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pdf-tabs::-webkit-scrollbar { display: none; }
.pdf-tab { font-family: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted);
  padding: 10px 18px; border-radius: 999px; transition: all .15s; }
.pdf-tab:hover { color: var(--text); border-color: var(--muted-2); }
.pdf-tab.active { background: var(--accent-grad); color: #0b0e1c; border-color: transparent; }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center;
  cursor: pointer; transition: border-color .18s, background .18s; background: rgba(255,255,255,.012); }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: rgba(108,139,255,.06); outline: none; }
.dropzone.dragover { border-color: var(--accent-2); background: rgba(92,214,192,.09); }
.dz-icon { color: var(--accent); display: flex; justify-content: center; margin-bottom: 10px; }
.dz-title { font-size: 1.12rem; font-weight: 600; margin: 0 0 6px; }
.dz-link { color: var(--accent); text-decoration: underline; }
.dz-hint { color: var(--muted-2); font-size: .88rem; margin: 0; }

.pdf-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pdf-row { display: flex; align-items: center; gap: 14px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  user-select: none; transition: box-shadow .15s, border-color .15s; }
.pdf-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pdf-row.dragging { box-shadow: var(--shadow); border-color: var(--accent); }
.pdf-row .drag-handle { color: var(--muted-2); flex-shrink: 0; cursor: grab; display: grid; place-items: center; touch-action: none; }
.pdf-row .drag-handle:hover { color: var(--muted); }
.pdf-ic { width: 44px; height: 44px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--card-2); border: 1px solid var(--line); color: var(--accent-2); font-weight: 700; font-size: .7rem; }
.pdf-meta { min-width: 0; flex: 1; }
.pdf-name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-sub { font-size: .82rem; color: var(--muted-2); margin-top: 2px; }
.pdf-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn { background: var(--card-2); border: 1px solid var(--line); color: var(--muted); width: 34px; height: 34px;
  border-radius: 9px; cursor: pointer; display: grid; place-items: center; transition: color .15s, border-color .15s; font-size: 1rem; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.split-info { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 16px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.split-info .pdf-ic { width: 48px; height: 48px; }
.split-info b { font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input[type=text] { background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: 11px 12px; border-radius: var(--radius-sm); font-size: .95rem; font-family: inherit; width: 100%; }
.field input:focus { outline: none; border-color: var(--accent); }
.field .hint { color: var(--muted-2); font-size: .8rem; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.btn { font-family: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; padding: 12px 20px;
  border-radius: var(--radius-sm); border: 1px solid transparent; transition: transform .12s, filter .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); color: #0b0e1c; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted-2); }

.status { margin-top: 14px; font-size: .9rem; color: var(--muted); min-height: 18px; }
.status.error { color: var(--danger); }
.status.ok { color: var(--good); }
.privacy-note { text-align: center; color: var(--muted-2); font-size: .9rem; margin-top: 18px; }

.content { padding: 40px 0 10px; }
.content h2 { text-align: center; font-size: clamp(1.5rem,3.4vw,2.1rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 28px; }
.use-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.use { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.use .ic { font-size: 1.5rem; margin-bottom: 8px; }
.use h3 { margin: 0 0 6px; font-size: 1.04rem; }
.use p { margin: 0; color: var(--muted); font-size: .92rem; }

.faq { padding: 36px 0 64px; }
.faq h2 { text-align: center; font-size: clamp(1.5rem,3.4vw,2.1rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 28px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 18px; margin: 0 auto 12px; max-width: 760px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; position: relative; padding-right: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 2px; top: 12px; font-size: 1.3rem; color: var(--accent); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 34px 0 26px; margin-top: 18px; background: rgba(0,0,0,.18); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--text); }
.footer-inner small { color: var(--muted-2); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ── Annotation stage ──────────────────────────────────────────────── */
.anno-stage { margin-top: 16px; }

.anno-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; margin-bottom: 12px;
}
.anno-tools-group, .anno-style-group, .anno-history-group, .anno-page-group {
  display: flex; align-items: center; gap: 5px;
}
.anno-tools-group { border-right: 1px solid var(--line); padding-right: 8px; }
.anno-style-group { border-right: 1px solid var(--line); padding-right: 8px; }
.anno-history-group { border-right: 1px solid var(--line); padding-right: 8px; }
.anno-zoom-group { border-right: 1px solid var(--line); padding-right: 8px; }
.anno-zoom-group { display: flex; align-items: center; gap: 5px; }
.anno-zoom-group .anno-page-label { min-width: 42px; }

.anno-tool {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
  display: grid; place-items: center; transition: color .15s, border-color .15s, background .15s;
}
.anno-tool:hover { color: var(--text); border-color: var(--accent); }
.anno-tool.active, .anno-tool[aria-pressed="true"] {
  background: var(--accent); color: #0b0e1c; border-color: var(--accent);
}
.anno-tool-del:hover { color: var(--danger); border-color: var(--danger); }

.anno-color {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: none; padding: 2px; cursor: pointer;
}
.anno-style-lbl {
  display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted-2);
}
.anno-range { width: 76px; accent-color: var(--accent); }
.anno-font-size {
  width: 54px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: 6px 8px; border-radius: 8px; font-family: inherit; font-size: .82rem; text-align: center;
}
.anno-font-sel {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: 6px 8px; border-radius: 8px; font-family: inherit; font-size: .82rem; cursor: pointer;
}
.anno-page-label { font-size: .9rem; color: var(--muted); min-width: 50px; text-align: center; }

.anno-canvas-wrap {
  background: #1a1a2e; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 20px; overflow: auto; min-height: 300px; display: flex; justify-content: center; align-items: flex-start;
}
.anno-canvas-stack { position: relative; line-height: 0; box-shadow: 0 12px 40px -12px rgba(0,0,0,.7); }
.anno-canvas-stack canvas { display: block; }
#annoOverlay, #fillOverlay, #redactOverlay {
  position: absolute; top: 0; left: 0; cursor: crosshair;
}
#annoOverlay.tool-select { cursor: default; }
#annoOverlay.tool-text { cursor: text; }
#annoOverlay.tool-erase { cursor: not-allowed; }

/* Fill & Sign specifics */
.fill-tool {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
  display: grid; place-items: center; transition: color .15s, border-color .15s, background .15s;
}
.fill-tool:hover { color: var(--text); border-color: var(--accent); }
.fill-tool.active { background: var(--accent); color: #0b0e1c; border-color: var(--accent); }

.sig-palette {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.sig-tabs { display: flex; gap: 6px; }
.sig-tab {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font-family: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.sig-tab.active { background: var(--accent); color: #0b0e1c; border-color: transparent; }
.sig-pad {
  background: #fff; border-radius: 8px; cursor: crosshair; display: block; touch-action: none;
}
.sig-actions { display: flex; gap: 8px; margin-top: 6px; }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.fill-input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: .92rem; font-family: inherit;
}
.fill-input:focus { outline: none; border-color: var(--accent); }

/* Redact */
.redact-tool {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
  display: grid; place-items: center; transition: all .15s;
}
.redact-tool:hover, .redact-tool.active {
  background: #1a1a1a; color: #fff; border-color: #444;
}
.redact-note { font-size: .82rem; color: var(--muted-2); flex: 1; }
.redact-note strong { color: var(--danger); }

/* Protect */
.protect-opts { margin-top: 18px; }
.protect-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.protect-tab {
  font-family: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted);
  padding: 9px 18px; border-radius: 999px; transition: all .15s;
}
.protect-tab:hover { color: var(--text); border-color: var(--muted-2); }
.protect-tab.active { background: var(--accent-grad); color: #0b0e1c; border-color: transparent; }

/* Floating text input on canvas */
.canvas-text-input {
  position: absolute; background: rgba(255,255,200,.96); color: #111;
  border: 1.5px dashed #888; border-radius: 4px;
  outline: none; padding: 3px 6px; font-family: inherit; resize: both; min-width: 80px; min-height: 26px;
  z-index: 10;
}

/* PDF editor (legacy) */
.edit-stage { margin-top: 16px; }
.edit-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.edit-pager { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.edit-pager .icon-btn { width: 34px; height: 34px; font-size: 1.1rem; }
.edit-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.edit-tools .btn { padding: 9px 14px; }
.edit-sel { display: inline-flex; align-items: center; gap: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
.edit-sel input[type=color] { width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 0; cursor: pointer; }
.edit-font { width: 66px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 8px; font-family: inherit; }
.edit-main { display: grid; grid-template-columns: 1fr 230px; gap: 16px; }
.edit-canvas-wrap { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; display: flex; justify-content: center; overflow: auto; }
.edit-stack { position: relative; line-height: 0; box-shadow: 0 10px 30px -12px rgba(0,0,0,.6); }
#edCanvas { display: block; max-width: 100%; }
.edit-overlay { position: absolute; inset: 0; }
.edit-obj { position: absolute; cursor: move; border: 1px dashed transparent; box-sizing: border-box; touch-action: none; }
.edit-obj.text { padding: 1px 3px; white-space: pre; font-family: Helvetica, Arial, sans-serif; line-height: 1.1; }
.edit-obj.text:focus { outline: none; }
.edit-obj.image { line-height: 0; }
.edit-obj.rect { background: #fff; }
.edit-bold { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; }
.edit-bold input[type=range] { width: 90px; }
.edit-obj.image img { display: block; width: 100%; height: 100%; pointer-events: none; }
.edit-obj.selected { border-color: var(--accent); }
.edit-obj .resize { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--accent); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; }
.edit-layers h4 { margin: 0 0 10px; font-size: .95rem; }
.layers-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.layer-row { display: flex; align-items: center; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; cursor: pointer; font-size: .82rem; }
.layer-row.selected { border-color: var(--accent); }
.layer-row .lname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.layer-row .lbtn { background: var(--card-2); border: 1px solid var(--line); color: var(--muted); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; flex-shrink: 0; }
.layer-row .lbtn:hover { color: var(--text); border-color: var(--accent); }

/* Organize pages */
.org-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-top: 18px; }
.org-card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px;
  transition: opacity .15s, box-shadow .15s, border-color .15s; user-select: none; }
.org-card.deleted { opacity: .4; }
.org-card.deleted .org-thumb-wrap { outline: 2px dashed var(--danger); outline-offset: -2px; }
.org-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.org-card.dragging { box-shadow: var(--shadow); border-color: var(--accent); }
.org-thumb-wrap { position: relative; background: #fff; border-radius: 8px; min-height: 120px; display: grid; place-items: center; overflow: hidden; }
.org-thumb { max-width: 100%; height: auto; display: block; transition: transform .25s; }
.org-num { position: absolute; left: 6px; top: 6px; background: rgba(15,18,34,.82); color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.org-grip { position: absolute; right: 6px; top: 6px; background: rgba(15,18,34,.72); color: #fff; padding: 5px; border-radius: 999px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.org-grip:hover { background: rgba(15,18,34,.9); }
.org-actions { display: flex; gap: 5px; justify-content: center; margin-top: 9px; }
.org-btn { flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; height: 32px; cursor: pointer; font-size: .95rem; transition: color .15s, border-color .15s; }
.org-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.org-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Split — clickable page-thumbnail picker */
.split-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 16px; }
.split-thumb-wrap { position: relative; cursor: pointer; background: #fff; border-radius: 8px; min-height: 90px;
  display: grid; place-items: center; overflow: hidden; border: 2px solid transparent; transition: border-color .15s, opacity .15s; }
.split-thumb-wrap:hover { border-color: var(--muted-2); }
.split-thumb-wrap.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.split-thumb-wrap img { max-width: 100%; height: auto; display: block; }
.split-thumb-num { position: absolute; left: 6px; top: 6px; background: rgba(15,18,34,.82); color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.split-thumb-check { position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #0b0e1c;
  display: none; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; }
.split-thumb-wrap.selected .split-thumb-check { display: flex; }

@media (max-width: 820px) { .use-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .edit-main { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .nav a { display: none; } .pdf-tabs { flex-wrap: wrap; } }
