/* ============ Edit PDF: landing upload + full-screen editor ============ */
.drop {
  position: relative; background: var(--card); border: 2.5px dashed var(--line); border-radius: 22px;
  padding: clamp(28px, 5vw, 54px) 22px; text-align: center; box-shadow: var(--shadow);
  transition: background .15s ease, transform .15s ease;
}
.drop.over { background: var(--sun-soft); transform: scale(1.01); }
.drop .drop-ico {
  width: 74px; height: 88px; margin: 0 auto 16px; border: 2.5px solid var(--line); border-radius: 10px 26px 10px 10px;
  background: var(--accent-soft); display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem; transform: rotate(-5deg); box-shadow: 3px 3px 0 var(--line);
}
.drop h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin-bottom: 6px; }
.drop p { color: var(--ink-soft); margin: 0 0 18px; }
.drop .btn { font-size: 1.08rem; padding: 14px 30px; }
.drop .fine { font-size: .84rem; color: var(--ink-faint); margin: 16px 0 0; }
.hero-edit { padding: 46px 0 30px; }
.hero-edit .grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 44px; align-items: center; }
.hero-edit h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); }
.hero-edit .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 34rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.feature { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .ico { width: 46px; height: 46px; border: 2px solid var(--line); border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--sun-soft); margin-bottom: 12px; box-shadow: 2px 2px 0 var(--line); }
.feature h3 { font-family: var(--font-body); font-weight: 800; font-size: 1.08rem; margin-bottom: 6px; }
.feature p { font-size: .93rem; color: var(--ink-soft); margin: 0; }
.compare { width: 100%; border-collapse: collapse; background: var(--card); font-size: .95rem; }
.compare th, .compare td { border: 2px solid var(--line); padding: 11px 14px; text-align: left; }
.compare th { background: var(--paper-2); font-family: var(--font-display); }
.compare td.yes { color: var(--green); font-weight: 700; }
.table-scroll { overflow-x: auto; }
@media (max-width: 900px) { .hero-edit .grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- editor shell ---------- */
#pe-app { display: none; }
body.pe-open { overflow: hidden; }
body.pe-open #pe-app {
  display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 500; background: var(--paper-2);
  font-family: var(--font-body); font-size: 14px; line-height: 1.4;
}
body.pe-open::before { display: none; }
#pe-app { -webkit-user-select: none; user-select: none; }
#pe-app input, #pe-app select, #pe-app textarea { -webkit-user-select: text; user-select: text; }
.pe-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--paper); border-bottom: 2px solid var(--line); flex-wrap: nowrap; }
.pe-top .logo { font-size: 1.15rem; }
.pe-top .logo-mark { width: 28px; height: 28px; font-size: .95rem; border-radius: 8px; }
.pe-file { min-width: 0; display: flex; flex-direction: column; margin-left: 6px; }
.pe-file b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26vw; }
.pe-file span { font-size: .75rem; color: var(--ink-faint); font-family: var(--font-mono); }
.pe-sp { flex: 1; }
.pe-ib {
  font: inherit; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 36px; padding: 0 10px; border: 2px solid transparent; border-radius: 10px;
  background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap;
}
.pe-ib:hover { background: var(--paper-2); }
.pe-ib:disabled { opacity: .35; cursor: default; background: transparent; }
.pe-ib.on { background: var(--ink); color: var(--paper); }
.pe-ib.bordered { border-color: var(--line); background: var(--card); box-shadow: 2px 2px 0 var(--line); }
.pe-zoom { display: flex; align-items: center; gap: 2px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); padding: 0 2px; }
.pe-zoom .pe-ib { height: 30px; min-width: 30px; padding: 0 6px; }
#pe-zoomval { font-family: var(--font-mono); font-size: .8rem; min-width: 44px; text-align: center; }
.pe-dl { position: relative; }
.pe-dl .btn { white-space: nowrap; padding: 8px 16px; font-size: .95rem; box-shadow: 2px 2px 0 var(--line); }
.pe-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--card); border: 2px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-s); width: 290px; padding: 6px; display: none; z-index: 20; }
.pe-menu.show { display: block; }
.pe-menu button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: 10px 12px; border-radius: 9px; cursor: pointer; color: var(--ink); }
.pe-menu button:hover { background: var(--sun-soft); }
.pe-menu button b { display: block; font-size: .95rem; }
.pe-menu button small { color: var(--ink-faint); font-size: .8rem; }

.pe-tools { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--card); border-bottom: 2px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.pe-tools::-webkit-scrollbar { display: none; }
.pe-tools .pe-ib { flex-direction: column; gap: 1px; height: 50px; min-width: 62px; font-size: .74rem; font-weight: 700; }
.pe-tools .pe-ib i { font-style: normal; font-size: 1.15rem; line-height: 1.1; }
.pe-tools .sep { width: 2px; height: 34px; background: var(--paper-3); margin: 0 4px; flex: none; }

.pe-props { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--paper); border-bottom: 2px solid var(--line); min-height: 44px; flex-wrap: wrap; }
.pe-props select, .pe-props input[type=number] { font: inherit; border: 2px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--card); height: 32px; }
.pe-props input[type=number] { width: 64px; }
.pe-props input[type=color] { width: 36px; height: 32px; border: 2px solid var(--line); border-radius: 8px; padding: 1px; background: var(--card); cursor: pointer; }
.pe-props .pe-ib { height: 32px; min-width: 32px; }
.pe-props .grp { display: flex; align-items: center; gap: 6px; }
.pe-props label { font-size: .78rem; color: var(--ink-faint); font-weight: 700; }
#pe-hint { font-size: .84rem; color: var(--ink-soft); margin-left: auto; }
.pe-props .g-text, .pe-props .g-stroke, .pe-props .g-del { display: none; }
.pe-props[data-kind=text] .g-text, .pe-props[data-kind=addtext] .g-text, .pe-props[data-kind=edittext] .g-text { display: flex; }
.pe-props[data-kind=rect] .g-stroke, .pe-props[data-kind=ellipse] .g-stroke, .pe-props[data-kind=line] .g-stroke, .pe-props[data-kind=draw] .g-stroke, .pe-props[data-kind=path] .g-stroke { display: flex; }
.pe-props.has-obj .g-del { display: flex; }
.pe-props[data-kind=whiteout] .g-color, .pe-props[data-kind=cover] .g-color, .pe-props[data-kind=image] .g-color, .pe-props[data-kind=select] .g-color { display: none; }
.pe-props.has-obj #pe-hint { display: none; }

.pe-body { flex: 1; display: flex; min-height: 0; }
.pe-side { width: 168px; background: var(--paper); border-right: 2px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.pe-side-head { padding: 10px 12px 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--ink-faint); }
#pe-thumbs { flex: 1; overflow-y: auto; padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.pe-thumb { cursor: pointer; border-radius: 10px; padding: 6px; border: 2px solid transparent; }
.pe-thumb:hover { background: var(--paper-2); }
.pe-thumb.over { border-color: var(--accent); border-style: dashed; }
.pe-thumb.dragging { opacity: .4; }
.pe-tcanvas { display: grid; place-items: center; min-height: 60px; }
.pe-thumb canvas { width: 100%; max-width: 120px; border: 2px solid var(--line); border-radius: 4px; background: #fff; transition: transform .2s; }
.pe-thumb.deleted canvas { opacity: .3; filter: grayscale(1); }
.pe-tbar { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; font-size: .78rem; font-family: var(--font-mono); }
.pe-tops { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.pe-thumb:hover .pe-tops, .pe-thumb.deleted .pe-tops { opacity: 1; }
.pe-tops button { font: inherit; border: 1.5px solid var(--line); background: var(--card); border-radius: 6px; width: 24px; height: 22px; cursor: pointer; padding: 0; line-height: 1; }
.pe-tops button:hover { background: var(--sun); }
.pe-side-foot { padding: 10px; border-top: 2px solid var(--paper-3); display: grid; gap: 6px; }
.pe-side-foot .btn { justify-content: center; font-size: .82rem; padding: 7px 8px; box-shadow: 2px 2px 0 var(--line); }

#pe-main { flex: 1; overflow: auto; padding: 26px 20px 80px; position: relative; }
#pe-pages { display: flex; flex-direction: column; align-items: center; gap: 26px; min-width: min-content; }
.pe-page { position: relative; background: #fff; box-shadow: 0 0 0 2px var(--line), 5px 5px 0 2px rgba(30,24,17,.9); flex: none; }
.pe-base { position: absolute; left: 0; top: 0; }
.pe-fab { position: absolute; left: 0; top: 0; }
.pe-textlayer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
body[data-tool=edittext] .pe-textlayer { pointer-events: none; }
.pe-tb { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; position: absolute; display: none; border-radius: 2px; cursor: text; }
body[data-tool=edittext] .pe-tb { display: block; pointer-events: auto; outline: 1.5px dashed rgba(228,87,46,.55); background: rgba(228,87,46,.04); }
body[data-tool=edittext] .pe-tb:hover { outline: 2px solid var(--accent); background: rgba(255,197,61,.18); }
.pe-plabel { position: absolute; left: 0; bottom: -22px; font-size: .74rem; font-family: var(--font-mono); color: var(--ink-faint); white-space: nowrap; }

#pe-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(10px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 12px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 900; max-width: 88vw; }
#pe-toast.show { opacity: 1; transform: translateX(-50%); }
#pe-busy { position: fixed; inset: 0; background: rgba(30,24,17,.45); display: none; place-items: center; z-index: 800; }
#pe-busy.show { display: grid; }
#pe-busy > div { background: var(--card); border: 2.5px solid var(--line); border-radius: 16px; padding: 20px 26px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; font-weight: 700; }
.pe-spin { width: 24px; height: 24px; border: 3px solid var(--paper-3); border-top-color: var(--accent); border-radius: 50%; animation: pespin .8s linear infinite; }
@keyframes pespin { to { transform: rotate(360deg); } }

.pe-modal-bg { position: fixed; inset: 0; background: rgba(30,24,17,.55); display: none; align-items: center; justify-content: center; z-index: 700; padding: 16px; }
.pe-modal-bg.show { display: flex; }
.pe-modal { background: var(--card); border: 2.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); width: min(480px, 100%); padding: 20px; }
.pe-modal h3 { font-size: 1.3rem; margin-bottom: 12px; }
.pe-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.pe-tabs .pe-ib { border: 2px solid var(--line); height: 32px; }
#pe-sigpad { width: 100%; height: 160px; border: 2px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
#pe-sigtext { width: 100%; font-size: 2rem; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; }
.pe-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pe-row .btn { padding: 9px 16px; font-size: .92rem; }
#pe-sigprev { max-width: 100%; max-height: 140px; margin-top: 10px; display: none; border: 2px dashed var(--paper-3); border-radius: 10px; }

@media (max-width: 820px) {
  .pe-side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .pe-body { position: relative; }
  body.pe-side-open .pe-side { transform: none; box-shadow: 6px 0 0 rgba(30,24,17,.15); }
  .pe-top .logo span.txt, .pe-hide-sm { display: none; }
  #pe-main { padding: 16px 8px 80px; }
  #pe-hint { display: none; }
}
@media (max-width: 480px) { .pe-file { display: none; } .pe-dl .btn { padding: 7px 12px; font-size: .88rem; } .pe-top { gap: 4px; padding: 6px 8px; } }
@media (min-width: 821px) { #pe-sidetoggle { display: none; } }
