/* PDF Studio - Edit & sign (builder B) */
.work.ed { height: 100%; overflow: hidden; }
.work.ed .stagewrap { min-height: 0; }
.ed-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ed-tools { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.ed-tools .iconbtn { flex: 0 0 auto; }
.ed-tools .sep { flex: 0 0 1.5px; }
.ed-hint {
  flex: 0 0 auto; padding: 7px 12px; font-size: 13px; color: #2c3a4a;
  background: var(--t-gold); border-bottom: 2px solid var(--b-gold);
}
.ed-hint:empty { display: none; }
.ed-banner {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; background: #b3261e; color: #fff; font-weight: 700; border-bottom: 2px solid #6e1712;
}
.ed-banner[hidden] { display: none; }
.ed-banner .btn { background: #fff; color: #8a1c16; border-color: #6e1712; min-height: 32px; padding: 4px 12px; }

/* page layers */
.ed-stage .ps-layer { touch-action: auto; }
.ed-stage.drawing .ps-layer { touch-action: none; cursor: crosshair; }
.ed-stage.t-text .ps-layer, .ed-stage.t-edittext .ps-layer { cursor: text; }
.ed-stage.t-check .ps-layer, .ed-stage.t-xmark .ps-layer, .ed-stage.t-date .ps-layer, .ed-stage.t-place .ps-layer { cursor: copy; }
.ed-forms, .ed-anns { position: absolute; inset: 0; pointer-events: none; }
.ed-anns .ea { position: absolute; pointer-events: auto; transform-origin: 50% 50%; box-sizing: border-box; }
.ed-stage.t-select .ea { cursor: move; }
.ed-stage.t-form .ed-anns .ea, .ed-stage.drawing .ed-anns .ea { pointer-events: none; }
.ea .ea-box { position: absolute; inset: 0; box-sizing: border-box; }
.ea img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.ea svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ea .ea-ta {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; outline: 0; resize: none;
  background: transparent; overflow: hidden; white-space: pre; box-sizing: border-box; pointer-events: none;
  caret-color: #1d4f91;
}
.ea.editing .ea-ta { pointer-events: auto; cursor: text; }
.ea.sel { outline: 2px solid #1d4f91; outline-offset: 1px; }
.ea.editing { outline: 2px dashed #1d4f91; }
.ea .eh { display: none; position: absolute; right: -9px; bottom: -9px; width: 16px; height: 16px; border-radius: 50%; background: #1d4f91; border: 2px solid #fff; box-shadow: 0 0 0 1px #13294b; cursor: nwse-resize; touch-action: none; }
.ed-stage.t-select .ea.sel .eh { display: block; }
.ed-ghost { position: absolute; border: 2px dashed #1d4f91; background: rgba(29, 79, 145, .12); pointer-events: none; }
.ed-ghost.red { border-color: #b3261e; background: rgba(0, 0, 0, .45); }
.ed-ghost.line { border: 0; background: #1d4f91; transform-origin: 0 50%; }
.ed-ghost.ink { inset: 0; border: 0; background: none; }
.ed-ghost.ink svg { width: 100%; height: 100%; overflow: visible; }

/* form boxes laid over the page */
.ed-f {
  position: absolute; pointer-events: auto; box-sizing: border-box; margin: 0; padding: 0 3px;
  background: rgba(227, 236, 248, .85); border: 1.5px solid #1d4f91; border-radius: 2px; color: #0d1b2a;
  font-family: Arial, Helvetica, sans-serif; line-height: 1.15;
}
textarea.ed-f { resize: none; padding: 2px 3px; }
.ed-f.ed-fc { padding: 0; accent-color: #1d4f91; }
.ed-f:focus { background: #fff; outline: 2px solid #f0b400; }
.ed-stage:not(.t-form):not(.t-select) .ed-f { pointer-events: none; }

/* side panels: each its own tint + 2px border */
.ed-side .ed-p { border: 2px solid; border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; }
.ed-side .ed-p h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; }
.ed-side .ed-p p { margin: 0 0 8px; color: #1f2a37; }
.ed-side .ed-p .hint { color: #3d4a59; }
.ed-p.p-sel { background: var(--t-blue); border-color: var(--b-blue); } .ed-p.p-sel h3 { color: #1d4f91; }
.ed-p.p-style { background: var(--t-violet); border-color: var(--b-violet); } .ed-p.p-style h3 { color: #4f338a; }
.ed-p.p-sig { background: var(--t-gold); border-color: var(--b-gold); } .ed-p.p-sig h3 { color: #6b4e0a; }
.ed-p.p-form { background: var(--t-green); border-color: var(--b-green); } .ed-p.p-form h3 { color: #1f5c36; }
.ed-p.p-red { background: var(--t-rose); border-color: var(--b-rose); } .ed-p.p-red h3 { color: #8a1c26; }
.ed-selname { font-weight: 700; }
.ed-lbl { display: block; font-size: 13px; font-weight: 600; color: #3d4a59; margin: 0 0 4px; }
.ed-num { max-width: 160px; }
.ed-seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.ed-seg .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ed-bold { font-weight: 800; min-width: 40px; }
.ed-sws { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.ed-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #4a5868; cursor: pointer; padding: 0; }
.ed-sw[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #1d4f91; }
.ed-cc { width: 38px; height: 32px; padding: 0; border: 2px solid #4a5868; border-radius: 6px; background: #fff; cursor: pointer; }

/* signature dialog */
.ed-sigmodal { width: min(640px, 100%); }
.ed-sig .ed-sub { font-size: 14px; margin: 12px 0 6px; color: #1f2a37; }
.ed-sig .ed-tabs { margin-bottom: 8px; }
.ed-pens { margin: 0 0 8px; }
.ed-pad {
  display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; border-radius: 8px;
  background: #fff; border: 1.5px solid var(--line-strong);
  background-image: linear-gradient(to top, transparent 44px, #9aa7b6 44px, #9aa7b6 45.5px, transparent 45.5px);
}
.ed-pane .row { margin-top: 6px; justify-content: space-between; }
.ed-fontlist { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ed-fontlist button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: 8px; background: #fff; border: 2px solid var(--btnline); border-left: 6px solid var(--bar-gold);
}
.ed-fontlist button:nth-child(even) { background: #fdf8ec; border: 2px solid var(--btnline); border-left: 6px solid var(--bar-gold); }
.ed-fontlist button[aria-checked="true"] { border-color: #1d4f91; border-left-color: #1d4f91; background: var(--accent-soft); }
.ed-fontlist span { font-size: 30px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ed-fontlist small { font-size: 12px; color: #4a5868; }
.ed-upprev {
  margin: 8px 0; min-height: 90px; display: flex; align-items: center; justify-content: center; color: #4a5868;
  border-radius: 8px; border: 1.5px dashed var(--line-strong);
  background-color: #fff; background-image: conic-gradient(#eef1f5 25%, transparent 0 50%, #eef1f5 0 75%, transparent 0); background-size: 16px 16px;
}
.ed-upprev img { max-width: 100%; max-height: 160px; }
.ed-chk { margin: 8px 0 0; gap: 8px; font-size: 14px; cursor: pointer; }
.ed-chk input { width: 20px; height: 20px; }
.ed-saved .ed-tile {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; margin: 0 0 8px; border-radius: 8px;
  background: #fff; border: 1.5px solid var(--line-strong); border-left: 6px solid var(--bar-gold);
}
.ed-saved .ed-tile:nth-child(odd) { background: #fdf8ec; border: 1.5px solid var(--line-strong); border-left: 6px solid var(--bar-gold); }
.ed-saved .ed-tile img { max-height: 56px; max-width: 60%; }

@media (max-width: 760px) {
  .ed-tools { padding: 6px 8px; }
  .ed-tools .iconbtn { width: 44px; height: 44px; }
  .ed-hint { font-size: 12.5px; padding: 6px 10px; }
  .ed-pad { height: 160px; }
  .ed-fontlist { grid-template-columns: 1fr; }
}
