:root{
  --brand-1:#6D5BFF;
  --brand-2:#9B5BFF;
  --brand-grad:linear-gradient(135deg,var(--brand-1),var(--brand-2));
  --ink:#1A1A2E;
  --ink-soft:#52526b;
  --muted:#8787a0;
  --bg:#ffffff;
  --bg-soft:#f6f5ff;
  --border:#e7e5f5;
  --danger:#ef4444;
  --success:#22c55e;
  --radius:14px;
  --shadow:0 10px 30px rgba(45,30,110,0.08);
  --shadow-lg:0 20px 60px rgba(45,30,110,0.14);
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  color:var(--ink);
  background:var(--bg);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none;}
img{max-width:100%;display:block;}
.container{max-width:1160px;margin:0 auto;padding:0 24px;}
button{font-family:inherit;}

.alert{padding:12px 14px;border-radius:10px;font-size:14px;font-weight:600;}
.alert-error{background:#fef2f2;color:var(--danger);border:1px solid #fecaca;}
.alert-success{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0;}

/* ---------- Announcement banner ---------- */
.site-announcement{text-align:center;padding:11px 16px;font-size:14px;font-weight:600;}
.site-announcement-info{background:#eef2ff;color:#4338ca;}
.site-announcement-warning{background:#fffbeb;color:#92400e;}

/* ---------- Header ---------- */
.site-header{position:sticky;top:0;z-index:100;background:rgba(255,255,255,0.85);backdrop-filter:saturate(180%) blur(10px);border-bottom:1px solid var(--border);}
.header-inner{display:flex;align-items:center;justify-content:space-between;height:68px;}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:20px;color:var(--ink);}
.main-nav{display:flex;align-items:center;gap:8px;}
.main-nav a{padding:9px 14px;border-radius:10px;font-weight:600;font-size:14.5px;color:var(--ink-soft);transition:all .15s ease;}
.main-nav a:hover{background:var(--bg-soft);color:var(--ink);}
.main-nav a.active{background:var(--bg-soft);color:var(--brand-1);}
.nav-toggle{display:none;flex-direction:column;justify-content:center;gap:5px;width:36px;height:36px;background:none;border:none;cursor:pointer;}
.nav-toggle span{display:block;height:2px;background:var(--ink);border-radius:2px;}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:13px 24px;border-radius:12px;font-weight:700;font-size:15px;cursor:pointer;border:none;transition:transform .12s ease, box-shadow .12s ease, background .15s ease;white-space:nowrap;}
.btn:active{transform:scale(0.97);}
.btn-primary{background:var(--brand-grad);color:#fff;box-shadow:0 8px 20px rgba(109,91,255,0.35);}
.btn-primary:hover{box-shadow:0 10px 26px rgba(109,91,255,0.45);}
.btn-secondary{background:var(--bg-soft);color:var(--ink);border:1px solid var(--border);}
.btn-secondary:hover{background:#efedff;}
.btn-ghost{background:transparent;color:var(--ink-soft);}
.btn-ghost:hover{color:var(--ink);}
.btn-sm{padding:8px 14px;font-size:13.5px;border-radius:9px;}
.btn-danger{background:#fef2f2;color:var(--danger);}
.btn-danger:hover{background:#fee2e2;}
.btn:disabled{opacity:.5;cursor:not-allowed;}
.btn-block{width:100%;}
.btn-icon{padding:9px;width:38px;height:38px;}

/* ---------- Hero ---------- */
.hero{padding:76px 0 60px;text-align:center;background:
  radial-gradient(ellipse 70% 60% at 50% -10%, rgba(109,91,255,0.12), transparent),
  var(--bg);}
.hero .eyebrow{display:inline-flex;align-items:center;gap:8px;background:var(--bg-soft);color:var(--brand-1);font-weight:700;font-size:13px;padding:7px 14px;border-radius:999px;margin-bottom:22px;border:1px solid var(--border);}
.hero h1{font-size:52px;line-height:1.08;font-weight:800;letter-spacing:-1.2px;margin:0 0 18px;}
.hero h1 span{background:var(--brand-grad);-webkit-background-clip:text;background-clip:text;color:transparent;}
.hero p.lead{font-size:19px;color:var(--ink-soft);max-width:600px;margin:0 auto 34px;}
.hero-actions{display:flex;gap:14px;justify-content:center;flex-wrap:wrap;}
.trust-row{display:flex;gap:28px;justify-content:center;margin-top:44px;flex-wrap:wrap;color:var(--muted);font-size:13.5px;font-weight:600;}
.trust-row .item{display:flex;align-items:center;gap:7px;}

/* ---------- Tool grid ---------- */
.section{padding:70px 0;}
.section-head{text-align:center;max-width:620px;margin:0 auto 48px;}
.section-head h2{font-size:34px;font-weight:800;letter-spacing:-0.6px;margin:0 0 12px;}
.section-head p{color:var(--ink-soft);font-size:16.5px;margin:0;}
.category-label{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:var(--brand-1);margin:40px 0 18px;}
.category-label:first-of-type{margin-top:8px;}
.tool-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:20px;margin-bottom:12px;}
.tool-card{background:var(--bg);border:1px solid var(--border);border-radius:var(--radius);padding:28px 22px;transition:all .18s ease;}
.tool-card:hover{box-shadow:var(--shadow-lg);transform:translateY(-4px);border-color:transparent;}
.tool-card .icon{width:50px;height:50px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-bottom:18px;background:var(--bg-soft);color:var(--brand-1);}
.tool-card h3{font-size:17px;margin:0 0 8px;font-weight:700;}
.tool-card p{font-size:14px;color:var(--ink-soft);margin:0 0 16px;}
.tool-card .go{font-size:13.5px;font-weight:700;color:var(--brand-1);display:inline-flex;align-items:center;gap:5px;}

/* ---------- How it works ---------- */
.steps{display:grid;grid-template-columns:repeat(3,1fr);gap:28px;}
.step{text-align:center;padding:10px;}
.step .num{width:40px;height:40px;border-radius:50%;background:var(--brand-grad);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;margin:0 auto 18px;}
.step h3{font-size:17px;margin:0 0 8px;}
.step p{color:var(--ink-soft);font-size:14.5px;margin:0;}

/* ---------- FAQ ---------- */
.faq{max-width:760px;margin:0 auto;}
.faq-item{border-bottom:1px solid var(--border);padding:20px 0;}
.faq-item summary{font-weight:700;cursor:pointer;list-style:none;display:flex;justify-content:space-between;align-items:center;font-size:15.5px;}
.faq-item summary::-webkit-details-marker{display:none;}
.faq-item summary:after{content:'+';font-size:22px;color:var(--brand-1);font-weight:400;}
.faq-item[open] summary:after{content:'\2212';}
.faq-item p{color:var(--ink-soft);margin:14px 0 0;font-size:14.5px;}

.cta-band{background:var(--brand-grad);border-radius:24px;padding:56px 40px;text-align:center;color:#fff;margin:0 24px;}
.cta-band h2{font-size:32px;margin:0 0 12px;font-weight:800;}
.cta-band p{opacity:.9;margin:0 0 28px;}
.cta-band .btn-primary{background:#fff;color:var(--brand-1);box-shadow:none;}

/* ---------- Footer ---------- */
.site-footer{background:var(--ink);color:#c7c7d9;padding:56px 0 0;margin-top:40px;}
.footer-inner{display:grid;grid-template-columns:2fr 1fr 1fr;gap:40px;padding-bottom:40px;}
.footer-brand .brand-mark{font-weight:800;font-size:20px;color:#fff;}
.footer-brand p{font-size:13.5px;max-width:280px;margin-top:12px;color:#9494ab;}
.footer-links h4{color:#fff;font-size:13px;text-transform:uppercase;letter-spacing:.6px;margin:0 0 14px;}
.footer-links a{display:block;font-size:14px;margin-bottom:10px;color:#b4b4c8;}
.footer-links a:hover{color:#fff;}
.footer-bottom{border-top:1px solid rgba(255,255,255,0.1);padding:20px 24px;font-size:13px;color:#8585a0;}

/* ---------- Tool page shell ---------- */
.tool-page-header{padding:40px 0 18px;text-align:center;}
.tool-page-header h1{font-size:30px;font-weight:800;margin:0 0 8px;letter-spacing:-0.5px;}
.tool-page-header p{color:var(--ink-soft);margin:0;}
.workspace{max-width:1160px;margin:0 auto;padding:0 24px 80px;}
/* The editor tool benefits from using the full browser width rather than being
   capped like the marketing pages — more room for the page thumbnails, toolbar
   and canvas, especially on wide monitors. */
.workspace-wide{max-width:none;padding:0 32px 80px;}

.dropzone{border:2px dashed var(--border);border-radius:18px;background:var(--bg-soft);padding:64px 24px;text-align:center;cursor:pointer;transition:all .15s ease;}
.dropzone.dragover{border-color:var(--brand-1);background:#efecff;}
.dropzone .icon{width:60px;height:60px;margin:0 auto 18px;color:var(--brand-1);}
.dropzone h3{margin:0 0 6px;font-size:18px;}
.dropzone p{color:var(--muted);margin:0 0 20px;font-size:14px;}
.dropzone input[type=file]{display:none;}

.file-list{display:flex;flex-direction:column;gap:10px;margin:24px 0;}
.file-row{display:flex;align-items:center;gap:14px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:12px 16px;}
.file-row .fi-icon{width:36px;height:36px;border-radius:8px;background:var(--bg-soft);color:var(--brand-1);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.file-row .fi-name{font-weight:600;font-size:14px;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.file-row .fi-size{color:var(--muted);font-size:12.5px;flex-shrink:0;}
.file-row .fi-actions{display:flex;gap:6px;flex-shrink:0;}
.file-row .fi-drag{cursor:grab;color:var(--muted);flex-shrink:0;}
.file-row.dragging{opacity:.4;}

.icon-btn{width:32px;height:32px;border-radius:8px;border:none;background:transparent;color:var(--muted);display:flex;align-items:center;justify-content:center;cursor:pointer;}
.icon-btn:hover{background:var(--bg-soft);color:var(--ink);}
.icon-btn.danger:hover{background:#fef2f2;color:var(--danger);}

.actions-bar{display:flex;justify-content:center;gap:12px;margin-top:28px;flex-wrap:wrap;}

/* page thumbnail grid (split/organize) */
.page-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:18px;margin:24px 0;}
.page-thumb{position:relative;border:2px solid var(--border);border-radius:12px;overflow:hidden;background:#fff;cursor:grab;transition:border-color .12s ease;}
.page-thumb.selected{border-color:var(--brand-1);}
.page-thumb.dragging{opacity:.4;}
.page-thumb canvas{width:100%;display:block;}
.page-thumb .pt-label{position:absolute;bottom:0;left:0;right:0;background:rgba(26,26,46,0.75);color:#fff;font-size:11.5px;padding:5px 0;text-align:center;font-weight:600;}
.page-thumb .pt-check{position:absolute;top:8px;left:8px;width:20px;height:20px;border-radius:5px;border:2px solid #fff;background:rgba(0,0,0,0.25);}
.page-thumb.selected .pt-check{background:var(--brand-1);border-color:var(--brand-1);}
.page-thumb .pt-controls{position:absolute;top:6px;right:6px;display:flex;gap:4px;opacity:0;transition:opacity .12s ease;}
.page-thumb:hover .pt-controls{opacity:1;}
.page-thumb .pt-controls button{width:24px;height:24px;border-radius:6px;border:none;background:rgba(0,0,0,0.5);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;}
.page-thumb.removed{display:none;}

/* Editor workspace */
.editor-layout{display:grid;grid-template-columns:230px 1fr;gap:24px;align-items:start;}
.editor-toolbar{position:sticky;top:84px;background:#fff;border:1px solid var(--border);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:6px;}
.editor-toolbar .tool-btn{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;border:none;background:transparent;color:var(--ink-soft);font-weight:600;font-size:14px;cursor:pointer;text-align:left;width:100%;}
.editor-toolbar .tool-btn:hover{background:var(--bg-soft);color:var(--ink);}
.editor-toolbar .tool-btn.active{background:var(--bg-soft);color:var(--brand-1);}
.editor-toolbar hr{border:none;border-top:1px solid var(--border);margin:8px 0;}
.editor-toolbar label.opt-label{font-size:11.5px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);font-weight:700;margin:4px 0 2px;}
.editor-toolbar input[type=color]{width:100%;height:32px;border:1px solid var(--border);border-radius:8px;cursor:pointer;}
.editor-toolbar input[type=range]{width:100%;}
.editor-canvas-wrap{background:#f1f0fb;border-radius:14px;padding:28px;overflow:auto;max-height:80vh;}
.page-canvas-block{position:relative;margin:0 auto;box-shadow:0 6px 24px rgba(45,30,110,0.15);background:#fff;}
.page-canvas-block canvas.pdf-render{display:block;}
.page-canvas-block canvas.fabric-layer{position:absolute;top:0;left:0;}
/* Separates adjacent pages with an unambiguous label, so a click can never land on
   the wrong page without the user immediately seeing which page they're on —
   especially important for mixed page-size documents (e.g. Letter + A4 mixed). */
.page-wrap{margin-bottom:38px;}
.page-wrap:last-child{margin-bottom:0;}
.page-number-label{text-align:center;font-size:12px;font-weight:700;color:var(--muted);background:var(--bg-soft);border:1px solid var(--border);border-radius:999px;display:inline-block;padding:4px 14px;margin:0 auto 10px;position:relative;left:50%;transform:translateX(-50%);}

.upper-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;flex-wrap:wrap;gap:12px;}
.zoom-controls{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid var(--border);border-radius:10px;padding:4px;}
.zoom-controls span{font-size:13px;font-weight:700;min-width:44px;text-align:center;}

.badge{display:inline-flex;align-items:center;gap:6px;background:var(--bg-soft);color:var(--brand-1);font-size:12.5px;font-weight:700;padding:4px 10px;border-radius:999px;}

.field-highlight{position:absolute;border:2px solid var(--brand-1);background:rgba(109,91,255,0.08);border-radius:3px;}
.field-highlight input[type=text], .field-highlight input[type=checkbox]{width:100%;height:100%;border:none;background:transparent;font-size:13px;padding:2px 4px;outline:none;}

.sig-pad-wrap{background:#fff;border:1px solid var(--border);border-radius:12px;padding:16px;}
.sig-pad-wrap canvas{width:100%;height:180px;border:1px dashed var(--border);border-radius:10px;touch-action:none;}
.sig-tabs{display:flex;gap:8px;margin-bottom:14px;}
.sig-tabs button{flex:1;}
.sig-type-input{width:100%;font-size:32px;padding:20px;text-align:center;border:1px dashed var(--border);border-radius:10px;font-family:'Segoe Script','Brush Script MT',cursive;}

.modal-overlay{position:fixed;inset:0;background:rgba(26,26,46,0.55);display:flex;align-items:center;justify-content:center;z-index:1000;padding:20px;}
.modal{background:#fff;border-radius:16px;padding:28px;max-width:440px;width:100%;box-shadow:var(--shadow-lg);}
.modal h3{margin:0 0 16px;font-size:19px;}
.modal-actions{display:flex;gap:10px;margin-top:22px;justify-content:flex-end;}

.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--ink);color:#fff;padding:13px 22px;border-radius:12px;font-size:14px;font-weight:600;box-shadow:var(--shadow-lg);z-index:2000;display:flex;align-items:center;gap:10px;}
.toast.error{background:var(--danger);}
.toast.success{background:var(--success);}

.spinner{width:18px;height:18px;border:2.5px solid rgba(255,255,255,0.35);border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite;}
.spinner.dark{border-color:rgba(109,91,255,0.25);border-top-color:var(--brand-1);}
@keyframes spin{to{transform:rotate(360deg);}}

.empty-state{text-align:center;padding:60px 20px;color:var(--muted);}

/* ---------- Unified app editor ---------- */
.app-toolbar{display:flex;align-items:center;gap:4px;flex-wrap:wrap;background:#fff;border:1px solid var(--border);border-radius:14px;padding:8px;margin-bottom:16px;}
.app-tool-btn{display:flex;flex-direction:column;align-items:center;gap:3px;width:60px;padding:7px 4px;border:none;background:transparent;border-radius:9px;cursor:pointer;color:var(--ink-soft);font-size:10.5px;font-weight:600;}
.app-tool-btn span{white-space:nowrap;}
.app-tool-btn:hover{background:var(--bg-soft);color:var(--ink);}
.app-tool-btn.active{background:var(--brand-grad);color:#fff;}
.app-tool-btn:disabled{opacity:.35;cursor:not-allowed;}
.app-tool-btn:disabled:hover{background:transparent;color:var(--ink-soft);}
.app-divider{width:1px;align-self:stretch;background:var(--border);margin:4px 2px;}
.app-toolbar-spacer{flex:1;}
.app-toolbar input[type=color]{width:34px;height:34px;padding:0;border:1px solid var(--border);border-radius:8px;cursor:pointer;}
.app-toolbar input[type=range]{width:90px;}
.app-body{display:grid;grid-template-columns:220px 1fr;gap:16px;align-items:start;}
.app-body.thumbs-collapsed{grid-template-columns:1fr;}
.app-body.thumbs-collapsed .thumbs-panel{display:none;}
.thumbs-panel{background:#fff;border:1px solid var(--border);border-radius:14px;padding:14px;position:sticky;top:84px;max-height:80vh;overflow-y:auto;}
.thumbs-list{display:flex;flex-direction:column;gap:12px;margin-top:12px;}
.thumb-item{position:relative;border:2px solid var(--border);border-radius:10px;overflow:hidden;cursor:grab;background:#fff;}
.thumb-item.active{border-color:var(--brand-1);}
.thumb-item.dragging{opacity:.4;}
.thumb-item canvas{width:100%;display:block;}
.thumb-item .thumb-label{position:absolute;bottom:0;left:0;right:0;background:rgba(26,26,46,0.75);color:#fff;font-size:10.5px;padding:4px 0;text-align:center;font-weight:600;}
.thumb-item .thumb-controls{position:absolute;top:4px;right:4px;display:flex;gap:3px;opacity:0;transition:opacity .12s ease;}
.thumb-item:hover .thumb-controls{opacity:1;}
.thumb-item .thumb-controls button{width:20px;height:20px;border-radius:5px;border:none;background:rgba(0,0,0,0.5);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;}
.thumb-item.removed{display:none;}

.stamp-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.stamp-preset{padding:18px 10px;border-radius:10px;border:3px solid currentColor;background:#fff;font-weight:800;letter-spacing:1px;cursor:pointer;font-size:14px;}
.stamp-preset[data-color="#16a34a"]{color:#16a34a;}
.stamp-preset[data-color="#dc2626"]{color:#dc2626;}
.stamp-preset[data-color="#6b7280"]{color:#6b7280;}
.stamp-preset[data-color="#2563eb"]{color:#2563eb;}
.stamp-preset:hover{background:var(--bg-soft);}

.link-region{position:absolute;border:2px dashed #2563eb;background:rgba(37,99,235,0.08);border-radius:3px;pointer-events:none;}
.note-icon{position:absolute;width:26px;height:26px;background:#facc15;border:2px solid #ca8a04;border-radius:5px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;box-shadow:0 2px 6px rgba(0,0,0,0.2);}

@media (max-width:900px){
  .app-body{grid-template-columns:1fr;}
  /* Below the two-column breakpoint the thumbnails panel stacks above the canvas.
     Rendered full-width it could be mistaken for the real page, so force it into
     a compact, clearly-labeled horizontal filmstrip instead. */
  .thumbs-panel{position:static;max-height:none;padding:10px;}
  .thumbs-panel:before{content:'Pages';display:block;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin-bottom:8px;}
  .thumbs-panel #addFileBtn{width:auto;display:inline-flex;margin-bottom:0;}
  .thumbs-list{flex-direction:row;overflow-x:auto;gap:10px;margin-top:10px;padding-bottom:4px;}
  .thumb-item{flex:0 0 90px;width:90px;}
  .tool-grid{grid-template-columns:repeat(2,1fr);}
  .steps{grid-template-columns:1fr;}
  .footer-inner{grid-template-columns:1fr;}
  .editor-layout{grid-template-columns:1fr;}
  .editor-toolbar{position:static;flex-direction:row;flex-wrap:wrap;}
  .editor-toolbar .tool-btn{width:auto;}
}
@media (max-width:640px){
  .main-nav{position:fixed;top:68px;left:0;right:0;background:#fff;flex-direction:column;align-items:stretch;padding:12px;border-bottom:1px solid var(--border);display:none;gap:4px;}
  .main-nav.open{display:flex;}
  .nav-toggle{display:flex;}
  .hero h1{font-size:36px;}
  .hero p.lead{font-size:16px;}
  .tool-grid{grid-template-columns:1fr;}
  .cta-band{margin:0 16px;padding:40px 22px;}
  .cta-band h2{font-size:24px;}
}
