/* NAVO – PDF-Editor (#/pdf-editor): Werkzeugleiste, Seitenleiste mit Miniaturen, Seiten auf Zeichenfläche, Eigenschaften rechts.
 * Farben aus den NAVO-Variablen (style.css), hell/dunkel; Papier bleibt immer weiß. Handy: Seiten und Eigenschaften als Schublade. */
.pe {
  --pe-canvas: #e7e8ec;
  --pe-dot: #d3d5dc;
  --pe-sel: #005cfb;
  --pe-shadow: rgba(16, 16, 24, 0.14);
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  height: var(--pe-h, calc(100dvh - 150px));
  min-height: 420px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .pe {
    --pe-canvas: #0b0b0e;
    --pe-dot: #1f1f25;
    --pe-sel: #4d8dff;
    --pe-shadow: rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme='dark'] .pe {
  --pe-canvas: #0b0b0e;
  --pe-dot: #1f1f25;
  --pe-sel: #4d8dff;
  --pe-shadow: rgba(0, 0, 0, 0.5);
}
.pe [hidden] {
  display: none !important;
}
.pe button,
.pe input,
.pe select,
.pe textarea {
  font: inherit;
  color: inherit;
}
.pe :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Kopfleiste ---------- */
.pe-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.pe-grp {
  display: flex;
  align-items: center;
  gap: 2px;
}
.pe-grp.end {
  margin-left: auto;
  gap: 6px;
}
.pe-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
  flex: none;
}
.pe-ib {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.pe-ib:hover {
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pe-ib:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
  box-shadow: none;
}
.pe-ib[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent);
}
.pe-ib.primary {
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 14px;
  font-weight: 600;
}
.pe-ib.primary:hover {
  background: var(--accent-2);
  box-shadow: none;
}
.pe-ib.ghost {
  box-shadow: inset 0 0 0 1px var(--line);
}
.pe-ib svg {
  flex: none;
}
.pe-tools {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.pe-tools::-webkit-scrollbar {
  display: none;
}
.pe-tools .pe-ib {
  min-width: 32px;
  padding: 0 6px;
}
.pe-zoom {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  height: 34px;
}
.pe-zoom .pe-ib {
  height: 32px;
  min-width: 30px;
  padding: 0 4px;
}
.pe-zoom select {
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  height: 32px;
  padding: 0 2px;
  cursor: pointer;
}
#peBPanel,
#peBPages {
  display: none;
}
@media (max-width: 1500px) {
  .pe-tools {
    order: 10;
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

/* ---------- Hauptbereich ---------- */
.pe-main {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 300px;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.pe-side,
.pe-panel {
  background: var(--panel);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pe-side {
  border-right: 1px solid var(--line);
}
.pe-panel {
  border-left: 1px solid var(--line);
}
.pe-sidehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
}
.pe-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.pe-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pe-sideops {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
}
.pe-sideops .pe-ib {
  height: 30px;
  min-width: 30px;
  padding: 0 6px;
}
.pe-thumbs {
  overflow: auto;
  padding: 12px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.pe-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  user-select: none;
}
.pe-thumb:hover {
  background: var(--panel-2);
}
.pe-thumb.picked {
  background: var(--accent-soft);
}
.pe-tpage {
  background: #fff;
  box-shadow:
    0 0 0 1px var(--line),
    0 2px 6px var(--pe-shadow);
  position: relative;
  max-width: 100%;
}
.pe-thumb.on .pe-tpage {
  box-shadow:
    0 0 0 2px var(--accent),
    0 2px 6px var(--pe-shadow);
}
.pe-tpage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pe-tmeta {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pe-thumb.on .pe-tn {
  color: var(--accent);
  font-weight: 600;
}
.pe-tact {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  box-shadow: 0 2px 8px var(--pe-shadow);
}
.pe-thumb:hover .pe-tact {
  display: flex;
}
.pe-tact button {
  border: 0;
  background: transparent;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text);
  cursor: pointer;
}
.pe-tact button:hover {
  background: var(--panel-2);
}
.pe-thumb.drop-b::before,
.pe-thumb.drop-a::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.pe-thumb.drop-b::before {
  top: -9px;
}
.pe-thumb.drop-a::after {
  bottom: -9px;
}
.pe-thumb.dragging {
  opacity: 0.4;
}

/* ---------- Zeichenfläche ---------- */
.pe-stage {
  position: relative;
  overflow: auto;
  background-color: var(--pe-canvas);
  background-image: radial-gradient(var(--pe-dot) 1px, transparent 1.3px);
  background-size: 22px 22px;
  overscroll-behavior: contain;
}
.pe-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 28px 28px 72px;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
}
.pe-page {
  position: relative;
  background: #fff;
  flex: none;
  color-scheme: light;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 10px 30px -10px rgba(15, 23, 42, 0.35);
}
.pe-page > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.pe-flayer,
.pe-alayer,
.pe-elayer,
.pe-dlayer,
.pe-slayer {
  position: absolute;
  inset: 0;
}
.pe-alayer,
.pe-elayer,
.pe-dlayer,
.pe-slayer {
  pointer-events: none;
}
.pe.drawmode .pe-alayer {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}
.pe.textmode .pe-alayer {
  cursor: text;
}
.pe.drawmode .pe-flayer,
.pe.editmode .pe-flayer {
  pointer-events: none;
}
.pe.placing .pe-page,
.pe.placing .pe-alayer {
  cursor: copy !important;
  pointer-events: auto;
}
.pe-anno {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  touch-action: none;
  cursor: move;
}
.pe.drawmode .pe-anno {
  cursor: crosshair;
}
.pe.textmode .pe-anno.k-text {
  cursor: text;
}
.pe-anno.k-ellipse {
  border-radius: 50%;
}
.pe-anno.k-hl {
  mix-blend-mode: multiply;
}
.pe-anno.k-white {
  background: #fff;
}
.pe-anno.k-redact {
  background: #000;
}
.pe-anno.k-image img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.pe-anno.k-text {
  white-space: pre;
  line-height: 1.2;
  min-width: 3px;
  min-height: 1em;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.pe-anno.k-text.editing {
  cursor: text;
  outline: 1.5px dashed var(--pe-sel);
  outline-offset: 3px;
  -webkit-user-select: text;
  user-select: text;
  min-width: 2ch;
}
.pe-anno.k-text.editing:empty::before {
  content: 'Text eingeben';
  color: #9aa3ae;
}
.pe-anno.k-note svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.3));
}
.pe-anno svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.pe-anno.sel {
  outline: 1.5px solid var(--pe-sel);
  outline-offset: 3px;
}
.pe-h {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1.5px solid var(--pe-sel);
  border-radius: 2px;
  pointer-events: auto;
  box-sizing: border-box;
}
.pe-h[data-h='nw'] {
  left: -9px;
  top: -9px;
  cursor: nwse-resize;
}
.pe-h[data-h='ne'] {
  right: -9px;
  top: -9px;
  cursor: nesw-resize;
}
.pe-h[data-h='sw'] {
  left: -9px;
  bottom: -9px;
  cursor: nesw-resize;
}
.pe-h[data-h='se'] {
  right: -9px;
  bottom: -9px;
  cursor: nwse-resize;
}
.pe.editmode .pe-elayer {
  pointer-events: auto;
}
.pe-eb {
  position: absolute;
  outline: 1px dashed rgba(0, 92, 251, 0.6);
  background: rgba(0, 92, 251, 0.05);
  cursor: text;
  border-radius: 1px;
}
.pe-eb:hover {
  background: rgba(0, 92, 251, 0.13);
  outline-style: solid;
}
.pe-dlayer > div {
  position: absolute;
  white-space: pre;
  line-height: 1.2;
  font-family: Helvetica, Arial, 'Liberation Sans', sans-serif;
}
.pe-dlayer .wm {
  left: 50%;
  top: 50%;
  font-weight: 700;
  transform-origin: center;
}
.pe-hit {
  position: absolute;
  background: rgba(255, 196, 0, 0.35);
  box-shadow: 0 0 0 1px rgba(200, 140, 0, 0.55);
  border-radius: 2px;
}
.pe-hit.cur {
  background: rgba(255, 110, 0, 0.42);
  box-shadow: 0 0 0 2px rgba(230, 90, 0, 0.9);
}
.pe-fld {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid rgba(0, 92, 251, 0.35);
  background: rgba(0, 92, 251, 0.07);
  color: #111 !important;
  font-family: Helvetica, Arial, sans-serif !important;
  padding: 0 3px;
  border-radius: 2px;
  outline: none;
  min-width: 0;
  min-height: 0;
  box-shadow: none;
}
.pe-fld:hover {
  border-color: rgba(0, 92, 251, 0.7);
}
.pe-fld:focus {
  border-color: #005cfb;
  background: rgba(0, 92, 251, 0.12);
  box-shadow: 0 0 0 2px rgba(0, 92, 251, 0.25);
}
textarea.pe-fld {
  resize: none;
  padding: 2px 3px;
  line-height: 1.25;
}
select.pe-fld {
  padding: 0 2px;
}
.pe-fld.f-check,
.pe-fld.f-radio {
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  cursor: pointer;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 80% 80%;
}
.pe-fld.f-radio {
  border-radius: 50%;
}
.pe-fld.f-check:checked {
  background-color: rgba(0, 92, 251, 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.5' fill='none' stroke='%23111' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.pe-fld.f-radio:checked {
  background-image: radial-gradient(#111 30%, transparent 34%);
  background-size: 100% 100%;
}
.pe-fld:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.pe-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}
.pe-emptycard {
  background: var(--panel);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  padding: 32px 28px;
  max-width: 440px;
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
  box-shadow: var(--shadow);
}
.pe-emptycard h2 {
  margin: 0;
  font-size: 19px;
  text-wrap: balance;
}
.pe-emptycard p {
  margin: 0;
  color: var(--muted);
}
.pe-emptycard > svg {
  color: var(--accent);
}
.pe-emptycard .btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.pe-link {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  font-size: 13px;
  cursor: pointer;
}
.pe-drop {
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
  z-index: 4;
}

/* ---------- Eigenschaften ---------- */
.pe-tabs {
  display: flex;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.pe-tab {
  border: 0;
  background: none;
  padding: 8px 9px 10px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
  font-size: 13.5px;
  cursor: pointer;
}
.pe-tab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.pe-tab .n {
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 6px;
  color: var(--muted);
}
.pe-tab .n:empty {
  display: none;
}
.pe-pane {
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}
.pe-ph {
  display: grid;
  gap: 2px;
}
.pe-ph h3 {
  margin: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.pe-sec {
  display: grid;
  gap: 8px;
}
.pe-sec > label,
.pe-sec > .lbl {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}
.pe-sec output {
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pe-sws {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pe-sw {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  padding: 0;
  position: relative;
  background: var(--c);
  cursor: pointer;
}
.pe-sw.on {
  box-shadow:
    0 0 0 2px var(--panel),
    0 0 0 4px var(--accent);
}
.pe-sw.none {
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.pe-cpick {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px dashed var(--muted);
  display: inline-grid;
  place-items: center;
  position: relative;
}
.pe-cpick input {
  position: absolute;
  inset: -6px;
  width: 40px;
  height: 40px;
  border: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.pe-cpick::after {
  content: '+';
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.pe input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  padding: 0;
  border: 0;
  background: none;
}
.pe-seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-wrap: wrap;
}
.pe-seg button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.pe-seg button + button {
  border-left: 1px solid var(--line);
}
.pe-seg button.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.pe-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.pe-num,
.pe-inp {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 6px 8px;
}
.pe-num {
  width: 76px;
  font-variant-numeric: tabular-nums;
}
.pe-inp {
  width: 100%;
  box-sizing: border-box;
}
textarea.pe-inp {
  min-height: 64px;
  resize: vertical;
}
.pe-stamps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pe-stamps button {
  border: 1.5px solid var(--c);
  color: var(--c);
  background: transparent;
  border-radius: 6px;
  padding: 5px 4px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.pe-stamps button.on {
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.pe-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pe-acts .pe-ib {
  justify-content: flex-start;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px;
}
.pe-acts .pe-ib.danger {
  color: var(--bad);
}
.pe-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 13px;
}
.pe-kv dt {
  color: var(--muted);
}
.pe-kv dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.pe-keys {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  margin: 0;
  font-size: 13px;
}
.pe-keys dd {
  margin: 0;
  text-align: right;
}
.pe kbd {
  font-size: 11.5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--panel-2);
}
.pe-hint-t {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.pe h4 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.pe-pf-row {
  display: grid;
  gap: 5px;
}
.pe-pf-row > span {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pe-pf {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
}
textarea.pe-pf {
  min-height: 64px;
  resize: vertical;
}
.pe-pf-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.pe-pf-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.pe-emptyp {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.pe-sbox {
  display: flex;
  gap: 6px;
}
.pe-sbox input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 7px 10px;
}
.pe-sbox .pe-ib {
  box-shadow: inset 0 0 0 1px var(--line);
}
.pe-results {
  display: grid;
  gap: 2px;
}
.pe-res {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  display: grid;
  gap: 2px;
  font-size: 13px;
  cursor: pointer;
}
.pe-res:hover {
  background: var(--panel-2);
}
.pe-res.cur {
  background: var(--accent-soft);
}
.pe-res small {
  font-size: 11px;
  color: var(--muted);
}
.pe-res mark {
  background: rgba(255, 196, 0, 0.45);
  color: inherit;
  border-radius: 2px;
}

/* KI */
.pe-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 12px;
  background: var(--panel);
}
.pe-card > h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 14px;
}
.pe-card > h4 svg {
  color: var(--accent);
}
.pe-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.pe-field > span {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}
.pe-field input[type='text'],
.pe-field input[type='number'],
.pe-field select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 7px 9px;
  min-width: 0;
}
.pe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pe-chips button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px;
  padding: 5px 10px;
  font-size: 12.5px;
  cursor: pointer;
}
.pe-chips button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pe-chat {
  display: grid;
  gap: 10px;
}
.pe-msg {
  font-size: 13.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.pe-msg p {
  margin: 0 0 6px;
}
.pe-msg ul {
  margin: 0 0 6px;
  padding-left: 18px;
}
.pe-msg.u {
  justify-self: end;
  background: var(--accent-soft);
  padding: 8px 11px;
  border-radius: 12px 12px 3px 12px;
  max-width: 90%;
  white-space: pre-wrap;
}
.pe-msg.a.wait {
  color: var(--muted);
}
.pe-msg .pg {
  border: 0;
  background: var(--panel-2);
  color: var(--accent);
  border-radius: 5px;
  padding: 0 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pe-msgacts {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.pe-msgacts button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}
.pe-msgacts button:hover {
  color: var(--accent);
}
.pe-ask {
  display: grid;
  gap: 6px;
}
.pe-ask textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 8px 10px;
  resize: none;
  min-height: 44px;
}
.pe-trout {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.55;
}
.pe-trout h5 {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}
.pe-trout p {
  margin: 0;
  white-space: pre-wrap;
}
.pe-prog {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-2);
  overflow: hidden;
}
.pe-prog i {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.3s;
}
.pe-note {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}
.pe-note.err {
  color: var(--bad);
}
.pe-note.ok {
  color: var(--ok);
}
.pe-lock {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
}

/* ---------- Fußleiste ---------- */
.pe-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}
.pe-status .nm {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.pe-status .nm b {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pe-chip {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1px 7px;
  white-space: nowrap;
}
.pe-chip.warn {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}
.pe-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.pe-pnav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.pe-pnav input {
  width: 3.2em;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 2px 4px;
}
.pe-pnav .pe-ib {
  height: 26px;
  min-width: 26px;
  padding: 0;
}
.pe-fmt {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pe-float {
  position: absolute;
  left: 50%;
  bottom: 52px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--panel);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
  z-index: 8;
  max-width: calc(100% - 32px);
}

/* ---------- Dialoge (NAVO-Fenster) ---------- */
.pe-dlg {
  display: grid;
  gap: 14px;
}
.pe-dlg .pe-radios {
  display: grid;
  gap: 8px;
  font-size: 14px;
}
.pe-dlg .pe-radios > label {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.pe-dlg .pe-radios > label.off {
  color: var(--muted);
}
.pe-dlg .pe-radios input[type='radio'],
.pe-chkl input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex: none;
}
.pe-dlg .pe-radios input[type='text'],
.pe-dlg .pe-radios input[type='number'] {
  width: 10em;
}
.pe-chkl {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
}
.pe-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pe-why {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--text);
  font-size: 13px;
}
.pe-why svg {
  color: var(--warn);
  flex: none;
  margin-top: 1px;
}
.pe-dest {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.pe-pad {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 200px;
  touch-action: none;
  color-scheme: light;
}
.pe-pad canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.pe-pad .base {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 46px;
  border-bottom: 1.5px solid #c9ced6;
  pointer-events: none;
}
.pe-pad .base span {
  position: absolute;
  left: 0;
  top: 8px;
  font-size: 11px;
  color: #8a929d;
  transform: translateY(100%);
}
.pe-sigsaved {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pe-sigsaved .sig {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  width: 120px;
  height: 52px;
  padding: 4px;
  box-sizing: border-box;
  cursor: pointer;
}
.pe-sigsaved .sig img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pe-sigsaved .sig button {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.pe-pick {
  display: grid;
  gap: 2px;
  max-height: 52vh;
  overflow: auto;
}
.pe-pick button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}
.pe-pick button:hover {
  background: var(--panel-2);
}
.pe-pick small {
  color: var(--muted);
}

/* ---------- Schmalere Fenster ---------- */
@media (max-width: 1240px) {
  .pe-main {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .pe-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 90%);
    z-index: 6;
    transform: translateX(105%);
    transition: transform 0.2s ease;
    box-shadow: -10px 0 30px -10px var(--pe-shadow);
  }
  .pe.panel-open .pe-panel {
    transform: none;
  }
  #peBPanel {
    display: inline-flex;
  }
}
@media (max-width: 760px) {
  .pe {
    --pe-h: calc(100dvh - 120px);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .pe-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .pe-side {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(220px, 80%);
    z-index: 6;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 10px 0 30px -10px var(--pe-shadow);
  }
  .pe.side-open .pe-side {
    transform: none;
  }
  #peBPages {
    display: inline-flex;
  }
  .pe-viewer {
    padding: 14px 12px 60px;
    gap: 14px;
  }
  .pe-bar {
    padding: 6px 8px;
    gap: 4px;
  }
  .pe-ib.txt span,
  .pe-zoom,
  .pe-bar .pe-sep,
  .pe-fmt,
  .pe-desk {
    display: none !important;
  }
  /* Handy: nur die wichtigsten Werkzeuge – Seiten ansehen, Text, Markieren, Zeichnen, Haken, Unterschrift */
  .pe-tools [data-tool]:not([data-m]),
  .pe-tools .pe-sep {
    display: none;
  }
  .pe-tools {
    justify-content: space-between;
  }
  .pe-tools .pe-ib {
    min-width: 40px;
    height: 40px;
  }
  .pe-status {
    gap: 8px;
    padding: 6px 8px;
  }
  .pe-grid2 {
    grid-template-columns: 1fr;
  }
  .pe-tact {
    display: flex;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pe-panel,
  .pe-side,
  .pe-prog i {
    transition: none;
  }
}
