/* ============================================================
   Edit PDF — visual editor UI  (LIGHT theme)
   Brand lime-yellow accent (soft) + pastel per-mode tints.
   Self-contained tokens so it stays light regardless of site theme.
   ============================================================ */
.ed-app { width: 100%; }
.hidden { display: none !important; }

.ed-app {
  --ed-bg:      #0a0b0e;          /* canvas stage backdrop      */
  --ed-panel:   #101218;          /* side panels                */
  --ed-bar:     #0c0e13;          /* top + sub toolbar          */
  --ed-tool:    #181b22;          /* tool button rest (dark)    */
  --ed-tool-h:  #1f232c;          /* tool button hover          */
  --ed-edge:    rgba(255,255,255,0.08);
  --ed-edge2:   rgba(255,255,255,0.14);
  --ed-txt:     #f4f6fb;          /* primary text (light on dark)*/
  --ed-txt2:    #9ba3b4;          /* secondary text             */
  --ed-txt3:    #5f6675;          /* muted / labels             */

  /* soft pastel highlights — shown ONLY on clicked/active buttons */
  --ed-acc:     #d4ed5a;          /* lime  (annotate / default) */
  --ed-acc-d:   #c2e040;
  --ed-acc-ink: #2b3410;          /* dark ink for text on pastel */
  --ed-acc-sft: rgba(212,237,90,0.16);
  --ed-glow:    rgba(190,224,64,0.35);

  --ed-rose:    #fbe3e3;  --ed-rose-ink:  #8d3b3b;
  --ed-blue:    #cfe1fb;  --ed-blue-ink:  #1e3c70;
  --ed-mint:    #cdeede;  --ed-mint-ink:  #1d5c40;
  --ed-amber:   #fae5c0;  --ed-amber-ink: #6e4d0c;
  --ed-lilac:   #e2d4fb;  --ed-lilac-ink: #432e78;
}

/* full-screen editor: hide site chrome so the workspace owns the viewport */
body.ed-fullscreen .nav,
body.ed-fullscreen .footer { display: none !important; }
body.ed-fullscreen { overflow: hidden; }

/* ===================== UPLOAD SCREEN ===================== */
.ed-upload { max-width: 640px; margin: 0 auto; padding: 60px 22px 90px; }
.ed-up-head { text-align: center; margin-bottom: 30px; }
.ed-up-head .eyebrow { margin-bottom: 16px; }
.ed-up-head h1 { font-size: clamp(2.2rem,6vw,3.3rem); letter-spacing: -0.02em; }
.ed-up-head p { color: var(--txt2); margin-top: 12px; font-weight: 400; }
.ed-drop { position: relative; display: block; text-align: center; cursor: pointer; padding: 54px 22px;
  border: 1.5px dashed var(--ed-edge2); border-radius: 20px; background: var(--ed-panel); transition: all .25s; }
.ed-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ed-drop:hover, .ed-drop.drag { border-color: var(--ed-acc-d); background: var(--ed-acc-sft); transform: translateY(-2px); }
.ed-drop-ic { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center;
  background: var(--ed-acc); color: var(--ed-acc-ink); transition: transform .25s; box-shadow: 0 10px 26px -8px var(--ed-glow); }
.ed-drop:hover .ed-drop-ic { transform: translateY(-4px) rotate(-4deg); }
.ed-drop .t { font-size: 1.25rem; font-weight: 700; color: var(--ed-txt); }
.ed-drop .s { font-family: 'JetBrains Mono', monospace; font-size: .76rem; color: var(--ed-txt3); margin-top: 7px; }
.ed-drop .s strong { color: var(--ed-acc); }
.ed-drop { background: var(--ed-panel); }
.ed-drop-ic { color: var(--ed-acc-ink); }

/* ===================== WORKSPACE ===================== */
.ed-workspace { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: var(--ed-bg); color: var(--ed-txt); }

/* ---------- top bar: brand · mode tabs · save ---------- */
.ed-topbar { display: flex; align-items: center; gap: 20px; padding: 11px 22px;
  background: var(--ed-bar); border-bottom: 1px solid var(--ed-edge); }
.ed-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.22rem;
  letter-spacing: -0.03em; color: var(--ed-txt); text-decoration: none; flex-shrink: 0; }
.ed-brand-logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ed-acc); color: #0a0b0d; flex-shrink: 0; }
.ed-brand:hover { color: var(--ed-txt); }
.ed-brand:hover .ed-brand-logo { filter: brightness(1.05); }

/* mode tabs — segmented, centered; each mode carries a soft pastel cue when active */
.ed-modes { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap;
  padding: 4px; background: var(--ed-tool); border: 1px solid var(--ed-edge); border-radius: 100px;
  max-width: max-content; margin: 0 auto; }
.ed-modetab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 17px; border: none;
  background: none; cursor: pointer; border-radius: 100px; color: var(--ed-txt2);
  font-family: 'Plus Jakarta Sans',sans-serif; font-weight: 700; font-size: .86rem;
  white-space: nowrap; transition: color .15s, background .2s; }
.ed-modetab:hover:not(.sel) { background: var(--ed-tool-h); color: var(--ed-txt); }
.ed-modetab.sel { background: var(--ed-acc); color: var(--ed-acc-ink); box-shadow: 0 4px 12px -5px var(--ed-glow); }
/* per-mode pastel active colors */
.ed-modetab.sel[data-mode="annotate"] { background: var(--ed-acc);  color: var(--ed-acc-ink); }
.ed-modetab.sel[data-mode="shapes"]   { background: var(--ed-blue);  color: var(--ed-blue-ink);  box-shadow: none; }
.ed-modetab.sel[data-mode="insert"]   { background: var(--ed-mint);  color: var(--ed-mint-ink);  box-shadow: none; }
.ed-modetab.sel[data-mode="text"]     { background: var(--ed-amber); color: var(--ed-amber-ink); box-shadow: none; }
.ed-modetab.sel[data-mode="forms"]    { background: var(--ed-lilac); color: var(--ed-lilac-ink); box-shadow: none; }
.ed-crown { color: #d99a16; font-size: .9em; }
.ed-modetab.sel .ed-crown { color: inherit; opacity: .7; }

.ed-save { display: inline-flex; align-items: center; gap: 9px; padding: 12px 24px; border: none;
  border-radius: 100px; cursor: pointer; background: var(--ed-acc); color: var(--ed-acc-ink); flex-shrink: 0;
  font-family: 'Plus Jakarta Sans',sans-serif; font-weight: 800; font-size: .92rem;
  box-shadow: 0 8px 20px -8px var(--ed-glow); transition: background .15s, transform .1s; }
.ed-save:hover { background: var(--ed-acc-d); }
.ed-save:active { transform: scale(.97); }
.ed-save-ic { display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; border: 2px solid var(--ed-acc-ink); font-size: .7rem; }

/* ---------- sub-toolbar: icon tools for the active mode ---------- */
.ed-subbar { display: flex; align-items: center; gap: 6px; padding: 10px 22px;
  background: var(--ed-bar); border-bottom: 1px solid var(--ed-edge); justify-content: center; flex-wrap: wrap; }
.ed-subtool { display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 60px; padding: 8px 11px; border: 1px solid transparent; background: var(--ed-tool);
  border-radius: 11px; cursor: pointer; color: var(--ed-txt2); transition: all .15s; }
.ed-subtool:hover { background: var(--ed-tool-h); color: var(--ed-txt); border-color: var(--ed-edge2); }
.ed-subtool.sel { background: var(--ed-acc); color: var(--ed-acc-ink); border-color: var(--ed-acc-d);
  box-shadow: 0 4px 10px -5px var(--ed-glow); }
.ed-subtool .i { font-size: 1.15rem; line-height: 1; }
.ed-subtool .l { font-size: .58rem; font-family: 'JetBrains Mono',monospace; letter-spacing: .02em; }

/* each tool carries its own soft pastel cue (cycles across the row) */
.ed-subtool:nth-child(6n+1) .i { color: #d4ed5a; }   /* lime   */
.ed-subtool:nth-child(6n+2) .i { color: #8fc7ff; }   /* blue   */
.ed-subtool:nth-child(6n+3) .i { color: #7fe0b6; }   /* mint   */
.ed-subtool:nth-child(6n+4) .i { color: #ffcf7a; }   /* amber  */
.ed-subtool:nth-child(6n+5) .i { color: #c9aaff; }   /* lilac  */
.ed-subtool:nth-child(6n+6) .i { color: #ff9fb0; }   /* rose   */
/* selected: solid pastel fill, dark ink, icon back to ink */
.ed-subtool.sel { color: var(--ed-acc-ink); }
.ed-subtool.sel .i, .ed-subtool.sel .l { color: var(--ed-acc-ink); }
.ed-subtool.sel:nth-child(6n+1) { background:#d4ed5a; border-color:#d4ed5a; }
.ed-subtool.sel:nth-child(6n+2) { background:#8fc7ff; border-color:#8fc7ff; }
.ed-subtool.sel:nth-child(6n+3) { background:#7fe0b6; border-color:#7fe0b6; }
.ed-subtool.sel:nth-child(6n+4) { background:#ffcf7a; border-color:#ffcf7a; }
.ed-subtool.sel:nth-child(6n+5) { background:#c9aaff; border-color:#c9aaff; }
.ed-subtool.sel:nth-child(6n+6) { background:#ff9fb0; border-color:#ff9fb0; }
/* undo / redo never get the pastel cue */
.ed-subtool.ed-subundo .i { color: var(--ed-txt2) !important; }
.ed-subundo { background: var(--ed-tool); border: 1px solid var(--ed-edge); }
.ed-subundo:first-of-type { margin-left: 14px; }
.ed-subcolor { display: flex; align-items: center; padding: 0 6px; }
.ed-subcolor input[type=color] { width: 32px; height: 30px; border: 1.5px solid var(--ed-edge2);
  border-radius: 9px; background: var(--ed-tool); cursor: pointer; padding: 2px; }

/* ---------- body: thumbs · canvas · props ---------- */
.ed-body { flex: 1; display: flex; min-height: 0; }

/* left thumbnail rail */
.ed-thumbs { width: 160px; flex-shrink: 0; overflow-y: auto; padding: 16px 12px;
  background: var(--ed-panel); border-right: 1px solid var(--ed-edge); display: flex;
  flex-direction: column; gap: 12px; }
.ed-thumb { cursor: pointer; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 10px -4px rgba(60,70,40,0.2); transition: transform .12s, box-shadow .15s; }
.ed-thumb:hover { transform: translateY(-2px); }
.ed-thumb.sel { border-color: var(--ed-acc-d); box-shadow: 0 0 0 2px var(--ed-acc-d), 0 4px 12px -4px var(--ed-glow); }
.ed-thumb img { display: block; width: 100%; }
.ed-thumb-n { text-align: center; font-family: 'JetBrains Mono',monospace; font-size: .62rem;
  color: var(--ed-txt3); margin-top: 4px; }

/* canvas stage */
.ed-canvas-area { flex: 1; overflow: auto; padding: 40px 28px 110px; display: flex; flex-direction: column;
  align-items: center; gap: 28px; background: var(--ed-bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0);
  background-size: 22px 22px; }
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.ed-page-wrap { box-shadow: 0 14px 50px -12px rgba(0,0,0,0.7); border-radius: 3px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06); }
.ed-canvas { position: relative; background: #fff; cursor: crosshair; touch-action: none; }
.ed-canvas img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.ed-layer { position: absolute; inset: 0; }
.ed-fallback { color: var(--ed-txt2); font-family: 'JetBrains Mono',monospace; font-size: .8rem; text-align: center; margin-top: 40px; }
.ed-fallback .mono { color: var(--ed-acc-ink); }

/* elements placed on the page */
.ed-el { position: absolute; cursor: move; transform-origin: center center; }
.ed-el.text { font-family: Arial, sans-serif; line-height: 1; white-space: pre; }
.ed-el.text:hover { outline: 1px dashed rgba(170,217,47,0.7); outline-offset: 2px; }
.ed-el.sel-on { outline: 1.5px dashed var(--ed-acc-d); outline-offset: 2px; }
.ed-el .ed-del { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: #e2685a; color: #fff; font-size: .7rem; cursor: pointer; display: none;
  place-items: center; z-index: 5; }
.ed-el.sel-on .ed-del { display: grid; }
.ed-el .ed-rot { position: absolute; top: -32px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px;
  border-radius: 50%; border: 2px solid #fff; background: var(--ed-acc); color: var(--ed-acc-ink); font-size: .8rem;
  cursor: grab; display: none; place-items: center; z-index: 6; box-shadow: 0 2px 6px rgba(0,0,0,0.18); }
.ed-el.sel-on .ed-rot { display: grid; }
.ed-el .ed-rot:active { cursor: grabbing; }
.ed-el.imgel img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ed-prev { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.ed-el.ed-editing { outline: 2px solid var(--ed-acc-d); outline-offset: 2px; cursor: text;
  background: rgba(212,237,90,0.10); min-width: 20px; min-height: 1em; }

/* ---- resizable text box ---- */
.ed-el.textbox { display: flex; padding: 4px 6px; box-sizing: border-box; line-height: 1.25;
  border: 1.5px dashed transparent; border-radius: 4px; overflow: visible; }
/* a clean dashed frame only while editing or selected; otherwise just the text */
.ed-el.textbox.sel-on { border-color: #9bd23a; }
.ed-el.textbox.ed-editing { border-color: #9bd23a; background: rgba(155,210,58,0.06); }
.ed-tb-text { width: 100%; height: 100%; outline: none; overflow: hidden; word-break: break-word; cursor: text; }
.ed-tb-text:empty::before { content: attr(data-ph); color: #8a93a3; opacity: .8; }
/* corner resize handles — blue dots, shown only when selected/editing */
.ed-rz { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #fff;
  border: 2.5px solid #3b6fd4; display: none; z-index: 7; box-shadow: 0 1px 4px rgba(0,0,0,0.35); }
.ed-el.textbox.sel-on .ed-rz, .ed-el.textbox.ed-editing .ed-rz { display: block; }
.ed-el.textbox.sel-on .ed-del, .ed-el.textbox.ed-editing .ed-del { display: grid; }
.ed-rz-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.ed-rz-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.ed-rz-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.ed-rz-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.ed-el.stamp { border: 2px solid; border-radius: 6px; padding: 4px 14px; font-weight: 800;
  font-family: 'Plus Jakarta Sans',sans-serif; letter-spacing: .05em; font-size: 1rem;
  background: rgba(255,255,255,0.9); white-space: nowrap; }
.ed-el.field { border: 1.5px dashed var(--ed-blue-ink); background: var(--ed-blue); display: grid; place-items: center; }
.ed-fieldlbl { font-family: 'JetBrains Mono',monospace; font-size: .6rem; color: var(--ed-blue-ink); }

/* ---------- right properties panel ---------- */
.ed-props { width: 270px; flex-shrink: 0; overflow-y: auto; padding: 22px 20px;
  background: var(--ed-panel); border-left: 1px solid var(--ed-edge);
  transition: box-shadow .25s, border-color .25s; }
.ed-props.ed-props-active { box-shadow: inset 3px 0 0 var(--ed-acc-d); border-left-color: var(--ed-acc-d); }
.ed-props-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--ed-edge); color: var(--ed-txt); }
.ed-prop-block { margin-bottom: 20px; }
.ed-prop-block > label { display: block; font-family: 'JetBrains Mono',monospace; font-size: .62rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ed-txt3); margin-bottom: 9px; }
.ed-prop-block b { color: var(--ed-acc-ink); }
.ed-prop-block input[type=range] { width: 100%; accent-color: var(--ed-acc-d); }
.ed-prop-check { display: flex; align-items: center; gap: 9px; color: var(--ed-txt2); font-size: .86rem;
  cursor: pointer; margin-bottom: 18px; }
.ed-prop-check input { width: 17px; height: 17px; accent-color: var(--ed-acc-d); }
.ed-prop-hint { font-size: .78rem; line-height: 1.55; color: var(--ed-txt2); padding: 13px 14px;
  background: var(--ed-tool); border: 1px solid var(--ed-edge); border-radius: 11px; }
.ed-prop-hint b { color: var(--ed-txt); }

/* color swatches */
.ed-colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-sw { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px var(--ed-edge2); transition: transform .1s; }
.ed-sw:hover { transform: scale(1.1); }
.ed-sw.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--ed-acc-d); }
.ed-cpick { width: 30px; height: 28px; padding: 2px; border: 1.5px solid var(--ed-edge2); border-radius: 8px;
  background: var(--ed-tool); cursor: pointer; }

/* text inputs / textarea in the panel */
.ed-textin, .ed-txtarea { width: 100%; padding: 12px 14px; background: var(--ed-tool);
  border: 1.5px solid var(--ed-edge2); border-radius: 12px; color: var(--ed-txt);
  font-family: 'Plus Jakarta Sans',sans-serif; font-size: .92rem; outline: none; margin-bottom: 10px; }
.ed-textin:focus, .ed-txtarea:focus { border-color: var(--ed-acc-d); box-shadow: 0 0 0 3px var(--ed-acc-sft); }
.ed-txtarea { resize: vertical; min-height: 48px; line-height: 1.4; }
.ed-textin::placeholder, .ed-txtarea::placeholder { color: var(--ed-txt3); }

/* primary add button in the panel */
.ed-addbtn { width: 100%; padding: 13px; border: none; border-radius: 12px; background: var(--ed-acc);
  color: var(--ed-acc-ink); font-family: 'Plus Jakarta Sans',sans-serif; font-weight: 800; font-size: .9rem;
  cursor: pointer; transition: background .15s; }
.ed-addbtn:hover { background: var(--ed-acc-d); }

/* dropdowns (font / size) */
.ed-select, .ed-ts-sel { width: 100%; padding: 11px 28px 11px 13px; background: var(--ed-tool);
  border: 1.5px solid var(--ed-edge2); border-radius: 12px; color: var(--ed-txt);
  font-family: 'Plus Jakarta Sans',sans-serif; font-size: .9rem; cursor: pointer;
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis; }
.ed-select { margin-bottom: 9px; }
.ed-select:disabled, .ed-ts-sel:disabled { opacity: .55; cursor: not-allowed; }
.ed-ts-sel-wrap { position: relative; }
.ed-ts-sel-wrap::after { content: "⌄"; position: absolute; right: 13px; top: 50%; transform: translateY(-65%);
  color: var(--ed-txt3); pointer-events: none; font-size: .9rem; }
.ed-ts-row { display: flex; gap: 8px; margin-bottom: 12px; }

/* B / I / U · align · link grid (edit-text) */
.ed-ts-grp, .ed-ts-grp4 { display: flex; gap: 9px; margin-bottom: 12px; }
.ed-tsi, .ed-tsbtn { width: 44px; height: 44px; display: grid; place-items: center; background: var(--ed-tool);
  border: 1.5px solid var(--ed-edge2); border-radius: 11px; color: var(--ed-txt2); cursor: pointer;
  font-size: 1.1rem; transition: all .15s; }
.ed-tsi { border: none; background: none; color: var(--ed-txt3); }
.ed-tsi:hover:not(:disabled), .ed-tsbtn:hover:not(:disabled) { background: var(--ed-tool-h); color: var(--ed-txt); }
.ed-tsi.sel, .ed-tsbtn.sel { color: #1a1d12; background: var(--ed-acc); }
.ed-tsi.sel b, .ed-tsi.sel i, .ed-tsi.sel span, .ed-tsi.sel svg { color: #1a1d12 !important; stroke: #1a1d12; }
.ed-tsbtn.sel { border-color: var(--ed-acc); }
.ed-tsi:disabled, .ed-tsbtn:disabled { opacity: .4; cursor: not-allowed; }
.ed-ts-divider { height: 1px; background: var(--ed-edge); margin: 16px 0; }
.ed-ts-label { font-weight: 800; font-size: 1.02rem; margin-bottom: 14px; color: var(--ed-txt); }
.ed-ts-color { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ed-ts-circle { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ed-edge2); cursor: pointer;
  box-shadow: 0 0 0 3px var(--ed-panel), 0 0 0 4px var(--ed-edge2); }
.ed-ts-cpick { width: 34px; height: 34px; padding: 2px; border: 1.5px solid var(--ed-edge2); border-radius: 10px;
  background: var(--ed-tool); cursor: pointer; }
.ed-ts-color .ed-colors { gap: 7px; }

/* legacy fmt buttons */
.ed-rich-row { display: flex; gap: 6px; margin-bottom: 8px; }
.ed-fmt { flex: 1; padding: 9px; background: var(--ed-tool); border: 1.5px solid var(--ed-edge2);
  border-radius: 10px; color: var(--ed-txt2); cursor: pointer; font-size: .92rem; transition: all .15s; }
.ed-fmt:hover { border-color: var(--ed-acc-d); color: var(--ed-txt); }
.ed-fmt.sel { border-color: var(--ed-acc-d); color: var(--ed-acc-ink); background: var(--ed-acc-sft); }

/* signature builder */
.ed-sig-preview { min-height: 50px; display: grid; place-items: center; padding: 10px; margin-bottom: 10px;
  border: 1px dashed var(--ed-edge2); border-radius: 12px; background: #fff; color: #111;
  font-family: 'Brush Script MT','Segoe Script',cursive; font-style: italic; font-size: 1.6rem; overflow: hidden; }
.ed-sigstyles { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 10px; }
.ed-sigstyle { padding: 9px 14px; background: var(--ed-tool); border: 1.5px solid var(--ed-edge2);
  border-radius: 10px; color: var(--ed-txt); cursor: pointer; font-size: 1.05rem; transition: all .15s; }
.ed-sigstyle:hover { border-color: var(--ed-acc-d); background: var(--ed-tool-h); }
.ed-sigstyle.sel { border-color: var(--ed-acc); color: #1a1d12; background: var(--ed-acc); font-weight: 700; }

/* ---------- bottom floating nav ---------- */
.ed-navbar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 6px; padding: 9px 14px; background: rgba(16,18,24,0.94);
  border: 1px solid var(--ed-edge2); border-radius: 100px; box-shadow: 0 16px 40px -12px rgba(0,0,0,0.7);
  backdrop-filter: blur(10px); }
.ed-nav-btn { width: 36px; height: 36px; border: none; background: none; color: var(--ed-txt); border-radius: 9px;
  cursor: pointer; font-size: 1rem; display: grid; place-items: center; transition: all .15s; }
.ed-nav-btn:hover { background: var(--ed-tool); color: var(--ed-acc-ink); }
.ed-nav-page { color: var(--ed-txt); font-family: 'JetBrains Mono',monospace; font-size: .82rem; display: inline-flex; align-items: center; gap: 6px; }
.ed-nav-page input { width: 34px; height: 28px; text-align: center; background: rgba(255,255,255,0.08); border: 1px solid var(--ed-edge);
  border-radius: 7px; color: var(--ed-txt); padding: 0; font-family: inherit; font-size: .82rem; line-height: 28px; }
.ed-nav-page b { color: var(--ed-txt3); font-weight: 700; }
.ed-nav-zoom { color: var(--ed-txt); font-family: 'JetBrains Mono',monospace; font-size: .8rem; min-width: 50px; text-align: center; }
.ed-nav-sep { width: 1px; height: 22px; background: var(--ed-edge2); margin: 0 5px; }
.ed-shortcuts { font-size: .72rem; color: var(--ed-txt3); white-space: nowrap; }
.ed-shortcuts b { color: var(--ed-txt2); font-weight: 700; }

/* ---------- pop pickers (symbols / stamps) ---------- */
.ed-pop, .ed-symbox { position: fixed; bottom: 84px; right: 24px; left: auto; transform: none; z-index: 120;
  width: 330px; max-width: 92vw; background: #14171d; border: 1px solid var(--ed-edge2);
  border-radius: 16px; box-shadow: 0 24px 60px -16px rgba(0,0,0,0.85); padding: 14px; }
.ed-pop-h, .ed-symhead { display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: .92rem; margin-bottom: 12px; color: var(--ed-txt); }
.ed-pop-h button, .ed-symhead button { background: none; border: none; color: var(--ed-txt3); cursor: pointer; font-size: 1.1rem; }
.ed-pop-g, .ed-symgrid { display: grid; grid-template-columns: repeat(8,1fr); gap: 6px; }
.ed-gbtn, .ed-symbtn { aspect-ratio: 1; background: var(--ed-tool); border: 1px solid var(--ed-edge2);
  border-radius: 9px; color: var(--ed-txt); cursor: pointer; font-size: 1.05rem; display: grid; place-items: center; transition: all .12s; }
.ed-gbtn:hover, .ed-symbtn:hover { border-color: var(--ed-acc-d); color: var(--ed-acc-ink); }
.ed-pop-g .ed-stampbtn { grid-column: span 4; aspect-ratio: auto; padding: 11px; background: var(--ed-tool);
  border: 1px solid var(--ed-edge2); border-radius: 10px; color: var(--ed-txt); cursor: pointer;
  font-weight: 800; font-size: .8rem; letter-spacing: .04em; }
.ed-stampbtn:hover { border-color: var(--ed-acc-d); color: var(--ed-acc-ink); }

/* ---------- overlays (saving / result) ---------- */
.ed-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(60,65,40,0.4); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; }
.ed-scan-box, .ed-result-card { text-align: center; padding: 46px 32px; max-width: 420px; background: var(--ed-panel);
  border: 1px solid var(--ed-edge2); border-radius: 22px; box-shadow: 0 30px 64px -24px rgba(60,70,40,0.45); }
.ed-spin { width: 54px; height: 54px; margin: 0 auto 22px; border: 3px solid var(--ed-tool); border-top-color: var(--ed-acc-d);
  border-radius: 50%; animation: spin .8s linear infinite; }
.ed-scan-box h3, .ed-result-card h3 { font-size: 1.45rem; color: var(--ed-txt); }
.ed-scan-box p { color: var(--ed-txt3); margin-top: 10px; font-size: .8rem; }
.ed-check { width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ed-acc); color: var(--ed-acc-ink); box-shadow: 0 0 32px -8px var(--ed-glow); }
.ed-result-card > p { color: var(--ed-txt2); margin-top: 8px; font-weight: 400; }

#toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%); z-index: 400; background: #1b1e26;
  color: #fff; padding: 12px 22px; border-radius: 100px; font-size: .85rem; font-weight: 600;
  box-shadow: 0 14px 34px -12px rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.12); display: none; }

/* ============================================================
   MOBILE: properties become a slide-up sheet
   ============================================================ */
.ed-mobtoggle { display: none; position: fixed; right: 16px; bottom: 80px; z-index: 75; align-items: center;
  gap: 8px; padding: 12px 18px; border: none; border-radius: 100px; background: var(--ed-acc); color: var(--ed-acc-ink);
  font-family: 'Plus Jakarta Sans',sans-serif; font-weight: 800; font-size: .85rem; cursor: pointer;
  box-shadow: 0 12px 26px -8px var(--ed-glow); }
.ed-mobtoggle .ic { font-size: 1rem; line-height: 1; }
.ed-sheet-backdrop { display: none; position: fixed; inset: 0; z-index: 69; background: rgba(60,65,40,0.35); backdrop-filter: blur(2px); }
.ed-sheet-backdrop.show { display: block; }
.ed-sheet-handle { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px){
  .ed-thumbs { width: 124px; padding: 13px 9px; }
  .ed-props  { width: 230px; padding: 18px 15px; }
  .ed-canvas-area { padding: 30px 16px 100px; }
}

@media (max-width: 860px){
  .ed-thumbs { display: none; }
  .ed-props  { width: 210px; }
  .ed-topbar { gap: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ed-topbar::-webkit-scrollbar { height: 0; }
  .ed-modes  { flex: 0 0 auto; flex-wrap: nowrap; margin: 0; }
  .ed-modetab { white-space: nowrap; padding: 8px 12px; font-size: .82rem; }
  .ed-subbar { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ed-subbar::-webkit-scrollbar { height: 0; }
  .ed-subtool { flex-shrink: 0; }
  .ed-subundo:first-of-type { margin-left: 8px; }
}

@media (max-width: 620px){
  .ed-props { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 64vh; z-index: 70;
    padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); border-left: none; border-top: 1px solid var(--ed-edge2);
    border-radius: 20px 20px 0 0; box-shadow: 0 -12px 36px -12px rgba(60,70,40,0.28); transform: translateY(110%);
    transition: transform .28s cubic-bezier(.4,0,.2,1); }
  .ed-props.open { transform: translateY(0); }
  .ed-props.ed-props-active { box-shadow: 0 -12px 36px -12px rgba(60,70,40,0.28); }
  .ed-sheet-handle { display: block; width: 44px; height: 4px; margin: 4px auto 12px; background: var(--ed-edge2); border-radius: 100px; }
  .ed-props-title { font-size: 1rem; margin-bottom: 14px; }
  .ed-mobtoggle { display: inline-flex; }
  .ed-topbar { gap: 8px; padding: 9px 12px; }
  .ed-save { padding: 10px 14px; font-size: .82rem; }
  .ed-save-ic { display: none; }
  .ed-subtool .l { display: none; }
  .ed-subtool { min-width: 42px; padding: 9px; }
  .ed-canvas-area { padding: 20px 10px 130px; }
  .ed-page-wrap, .ed-canvas, .ed-canvas img { max-width: 100%; }
  .ed-navbar { bottom: 16px; gap: 4px; padding: 8px 11px; }
  .ed-nav-btn { width: 33px; height: 33px; }
}

@media (max-width: 380px){
  .ed-modetab { padding: 7px 9px; font-size: .76rem; }
  .ed-mobtoggle { right: 12px; bottom: 72px; padding: 11px 15px; }
}

@media (max-width: 720px){ .ed-shortcuts { display: none; } }

/* pop pickers: center on small screens, never overflow */
@media (max-width: 620px){
  .ed-pop, .ed-symbox { right: 50%; transform: translateX(50%); width: min(330px, 92vw); }
}
