/* ============================================================
   LOKALE SCHRIFTEN (Offline) — Dateien im Ordner  fonts/
   Hanken Grotesk & Fraunces, SIL Open Font License 1.1
   Dateinamen folgen dem Fontsource-Schema (…-latin-<gewicht>-normal.woff)
   ============================================================ */
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/hanken-grotesk-latin-400-normal.woff") format("woff"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("fonts/hanken-grotesk-latin-500-normal.woff") format("woff"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("fonts/hanken-grotesk-latin-600-normal.woff") format("woff"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("fonts/hanken-grotesk-latin-700-normal.woff") format("woff"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/fraunces-latin-400-normal.woff") format("woff"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("fonts/fraunces-latin-500-normal.woff") format("woff"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("fonts/fraunces-latin-600-normal.woff") format("woff"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("fonts/fraunces-latin-700-normal.woff") format("woff"); }

/* =====================================================================
   VELUM — PDF Reader · Stylesheet
   Designsprache: refined / luxury · Signatur: Petrol + Messing-Gold
   ===================================================================== */

/* ---------- Design-Token: DUNKELMODUS (Standard) ---------- */
:root,
[data-theme="dark"] {
  --bg-deep:        #0c1116;
  --bg:             #10161d;
  --bg-stage:       #0a0e13;
  --surface:        #161e27;
  --surface-2:      #1b2530;
  --surface-glass:  rgba(22, 30, 39, 0.72);
  --topbar-glass:   rgba(12, 17, 22, 0.78);
  --line:           rgba(255, 255, 255, 0.07);
  --line-strong:    rgba(255, 255, 255, 0.12);
  --divider:        rgba(255, 255, 255, 0.045);

  --text:           #eef2f6;
  --text-soft:      #aab4c0;
  --text-mute:      #6d7a88;

  --accent:         #2bb3bd;   /* Petrol */
  --accent-deep:    #16808a;
  --accent-soft:    rgba(43, 179, 189, 0.16);
  --gold:           #d6b06a;   /* Messing-Gold */
  --gold-soft:      rgba(214, 176, 106, 0.18);

  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
  --shadow-md:  0 6px 20px rgba(0,0,0,.45);
  --shadow-lg:  0 18px 50px rgba(0,0,0,.55);
  --shadow-page: 0 14px 44px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);

  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 6px;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Hanken Grotesk", "Segoe UI", sans-serif;

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-soft: cubic-bezier(.4,0,.2,1);
}

/* ---------- Design-Token: HELLMODUS (warmes Papier) ---------- */
[data-theme="light"] {
  --bg-deep:        #ece7df;
  --bg:             #f4efe8;
  --bg-stage:       #e6ded2;
  --surface:        #fffdf9;
  --surface-2:      #f6f1e9;
  --surface-glass:  rgba(255, 253, 249, 0.78);
  --topbar-glass:   rgba(244, 239, 232, 0.82);
  --line:           rgba(40, 30, 20, 0.08);
  --line-strong:    rgba(40, 30, 20, 0.14);
  --divider:        rgba(40, 30, 20, 0.05);

  --text:           #211b14;
  --text-soft:      #5c5346;
  --text-mute:      #948a7b;

  --accent:         #0e7c85;
  --accent-deep:    #0a5b62;
  --accent-soft:    rgba(14, 124, 133, 0.12);
  --gold:           #a9802f;
  --gold-soft:      rgba(169, 128, 47, 0.16);

  --shadow-sm:  0 1px 2px rgba(60,45,25,.10);
  --shadow-md:  0 6px 22px rgba(60,45,25,.14);
  --shadow-lg:  0 18px 50px rgba(60,45,25,.18);
  --shadow-page: 0 16px 46px rgba(50,38,20,.22), 0 2px 6px rgba(50,38,20,.12);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Wichtig: [hidden] muss jede explizite display-Regel überstimmen,
   sonst bleiben Modal, Loader & Inline-Suche dauerhaft sichtbar. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .5s var(--ease), color .5s var(--ease);
}
button { font-family: inherit; cursor: pointer; color: inherit; border: none; background: none; }
input, select { font-family: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* Ruhiger, flächiger Hintergrund (kein Farbverlauf) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--bg-deep);
}

/* ============================ TITELLEISTE ============================ */
.topbar {
  position: relative; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 56px; padding: 0 16px;
  background: var(--topbar-glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 9px; padding-right: 6px; }
.brand-logo { display: inline-flex; line-height: 0; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.22); }
.brand-logo svg { display: block; border-radius: 8px; }
.brand-text {
  font-family: var(--font-display); font-weight: 600; font-size: 22px;
  letter-spacing: .5px; color: var(--text); cursor: pointer;
}

.quick-access { display: flex; align-items: center; gap: 2px; margin-left: 6px;
  padding: 4px; background: var(--surface-glass); border: 1px solid var(--line);
  border-radius: var(--radius-sm); }
.qa-divider { width: 1px; height: 20px; background: var(--line-strong); margin: 0 4px; }

.qa-btn, .icon-btn, .status-icon {
  display: grid; place-items: center; width: 34px; height: 32px;
  border-radius: var(--radius-xs); color: var(--text-soft);
  transition: background .18s, color .18s, transform .18s var(--ease);
}
.qa-btn:hover, .icon-btn:hover, .status-icon:hover { background: var(--surface-2); color: var(--text); }
.qa-btn:active, .icon-btn:active { transform: scale(.92); }
.qa-btn::before, .icon-btn::before, .status-icon::before {
  content: ""; width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon) center/contain no-repeat; mask: var(--icon) center/contain no-repeat;
}

.topbar-doc {
  flex: 1; text-align: center; font-size: 13.5px; color: var(--text-soft);
  font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 46vw;
}

/* Schnellzugriff-Icons */
.qa-btn[data-action="open"]  { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E"); }
.qa-btn[data-action="save"]  { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h12l4 4v14H5z'/%3E%3Cpath d='M8 3v6h7M8 21v-6h8v6'/%3E%3C/svg%3E"); }
.qa-btn[data-action="print"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3h10v6M7 17H4v-6h16v6h-3M7 14h10v7H7z'/%3E%3C/svg%3E"); }
.qa-btn[data-action="undo"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7 4 12l5 5'/%3E%3Cpath d='M4 12h11a5 5 0 0 1 0 10h-1'/%3E%3C/svg%3E"); }
.qa-btn[data-action="redo"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 7 5 5-5 5'/%3E%3Cpath d='M20 12H9a5 5 0 0 0 0 10h1'/%3E%3C/svg%3E"); }
#toggleLeft  { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M9 4v16'/%3E%3C/svg%3E"); }
#toggleRight { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M15 4v16'/%3E%3C/svg%3E"); }
#themeToggle { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z'/%3E%3C/svg%3E"); }
[data-theme="light"] #themeToggle { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M19 5l-2 2M7 17l-2 2'/%3E%3C/svg%3E"); }
#modalClose { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6 18 18M18 6 6 18'/%3E%3C/svg%3E"); }
#previewClose { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6 18 18M18 6 6 18'/%3E%3C/svg%3E"); }

/* ============================== RIBBON ============================== */
.ribbon {
  position: relative; z-index: 30;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-bottom: 1px solid var(--line);
}
.ribbon-tabs { position: relative; display: flex; align-items: center; gap: 2px;
  padding: 8px 14px 0; }
.ribbon-tab {
  position: relative; padding: 8px 18px 12px; font-size: 13.5px; font-weight: 600;
  color: var(--text-mute); border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: color .2s var(--ease);
}
.ribbon-tab:hover { color: var(--text-soft); }
.ribbon-tab.active { color: var(--text); }
.tab-indicator {
  position: absolute; bottom: 0; height: 2.5px; border-radius: 3px;
  background: var(--accent);
  transition: left .35s var(--ease), width .35s var(--ease);
}
.ribbon-collapse { margin-left: auto; align-self: flex-start; margin-top: 2px;
  width: 30px; height: 28px; border-radius: var(--radius-xs); color: var(--text-mute);
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E"); }
.ribbon-collapse::before { content:""; width:16px;height:16px;background:currentColor;
  -webkit-mask:var(--icon) center/contain no-repeat; mask:var(--icon) center/contain no-repeat; display:block; margin:auto; }
.ribbon-collapse:hover { background: var(--surface-2); color: var(--text); }

.ribbon-panels { position: relative; }
.ribbon-panel {
  display: none; align-items: stretch; gap: 8px;
  padding: 12px 16px 14px; min-height: 96px;
  animation: panelIn .32s var(--ease);
}
.ribbon-panel.active { display: flex; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ribbon.collapsed .ribbon-panels { display: none; }
.ribbon.collapsed .ribbon-collapse { transform: rotate(180deg); }

/* Ribbon-Gruppen */
.rgroup { position: relative; display: flex; flex-direction: column;
  padding: 0 14px 2px; }
.rgroup + .rgroup::before { content: ""; position: absolute; left: -1px; top: 6px; bottom: 22px;
  width: 1px; background: var(--line); }
.rgroup.grow { flex: 1; min-width: 0; }
.rgroup-body { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rgroup-body.nav-body, .rgroup-body.search-body { flex-wrap: nowrap; }
.rgroup-label { text-align: center; font-size: 10px; font-weight: 600;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-mute);
  margin-top: 6px; }
.rcol { display: flex; flex-direction: column; gap: 3px; }

/* Ribbon-Buttons */
.rbtn {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500;
  color: var(--text-soft); border: 1px solid transparent; white-space: nowrap;
  transition: background .16s, color .16s, border-color .16s, transform .12s var(--ease);
}
.rbtn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.rbtn:active { transform: translateY(1px); }
.rbtn.icononly { padding: 8px; }
.rbtn.large { flex-direction: column; gap: 7px; padding: 10px 16px; min-width: 74px;
  font-size: 12px; }
.rbtn.large .ic { width: 22px; height: 22px; }
.rbtn .ic { width: 17px; height: 17px; flex-shrink: 0; }

/* aktiver Werkzeug-Zustand */
.rbtn.tool.active, .layout-btn.active {
  background: var(--accent-soft); color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent),
              0 0 12px var(--accent-soft);
}

/* Icon-Maske */
.ic { display: inline-block; background: currentColor;
  -webkit-mask: var(--i) center/contain no-repeat; mask: var(--i) center/contain no-repeat; }

/* ---- Icon-Definitionen (data-ic) ---- */
[data-ic="open"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E");}
[data-ic="save"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h12l4 4v14H5z'/%3E%3Cpath d='M8 3v6h7M8 21v-6h8v6'/%3E%3C/svg%3E");}
[data-ic="save-as"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h10l4 4v8M8 3v6h7'/%3E%3Cpath d='M16 17h6M19 14v6'/%3E%3C/svg%3E");}
[data-ic="close"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6 18 18M18 6 6 18'/%3E%3C/svg%3E");}
[data-ic="print"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3h10v6M7 17H4v-6h16v6h-3M7 14h10v7H7z'/%3E%3C/svg%3E");}
[data-ic="image"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='m3 17 5-4 4 3 3-3 6 5'/%3E%3C/svg%3E");}
[data-ic="download"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m-4-4 4 4 4-4M5 21h14'/%3E%3C/svg%3E");}
[data-ic="paste"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='3' width='8' height='4' rx='1'/%3E%3Cpath d='M9 5H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-3'/%3E%3C/svg%3E");}
[data-ic="copy"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5 15V5a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E");}
[data-ic="first"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 12 12l6 6M7 6v12'/%3E%3C/svg%3E");}
[data-ic="last"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 6 6 6-6 6M17 6v12'/%3E%3C/svg%3E");}
[data-ic="prev"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 6-6 6 6 6'/%3E%3C/svg%3E");}
[data-ic="next"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E");}
[data-ic="zoom-in"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4-4M11 8v6M8 11h6'/%3E%3C/svg%3E");}
[data-ic="zoom-out"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4-4M8 11h6'/%3E%3C/svg%3E");}
[data-ic="actual"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M9 9h6v6H9z'/%3E%3C/svg%3E");}
[data-ic="search"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");}
[data-ic="continuous"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='6' y='3' width='12' height='8' rx='1'/%3E%3Crect x='6' y='13' width='12' height='8' rx='1'/%3E%3C/svg%3E");}
[data-ic="single"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='6' y='4' width='12' height='16' rx='1'/%3E%3C/svg%3E");}
[data-ic="facing"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='3' y='4' width='8' height='16' rx='1'/%3E%3Crect x='13' y='4' width='8' height='16' rx='1'/%3E%3C/svg%3E");}
[data-ic="rotate-cw"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E");}
[data-ic="rotate-ccw"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E");}
[data-ic="book"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5C9 3 5 3 3 4v15c2-1 6-1 9 1 3-2 7-2 9-1V4c-2-1-6-1-9 1z'/%3E%3Cpath d='M12 5v15'/%3E%3C/svg%3E");}
[data-ic="fullscreen"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4'/%3E%3C/svg%3E");}
[data-ic="highlight"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 11 4 4 7-7-4-4z'/%3E%3Cpath d='M5 19l3-1 1-3-4-4-3 3z'/%3E%3Cpath d='M4 21h6'/%3E%3C/svg%3E");}
[data-ic="underline"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M7 4v6a5 5 0 0 0 10 0V4'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E");}
[data-ic="strike"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 12h16'/%3E%3Cpath d='M7 7a4 3 0 0 1 8-1M9 17a4 3 0 0 0 8 1'/%3E%3C/svg%3E");}
[data-ic="pen"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19l7-7-4-4-7 7-1 5z'/%3E%3Cpath d='m15 8 1-1 4 4-1 1'/%3E%3C/svg%3E");}
[data-ic="line"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M5 19 19 5'/%3E%3C/svg%3E");}
[data-ic="arrow"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 19 19 5M11 5h8v8'/%3E%3C/svg%3E");}
[data-ic="rect"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Crect x='4' y='6' width='16' height='12' rx='1'/%3E%3C/svg%3E");}
[data-ic="ellipse"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Cellipse cx='12' cy='12' rx='8' ry='6'/%3E%3C/svg%3E");}
[data-ic="eraser"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15 13 6l5 5-8 8H7z'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E");}
[data-ic="note"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16v11l-5 5H4z'/%3E%3Cpath d='M15 20v-5h5'/%3E%3C/svg%3E");}
[data-ic="textbox"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M5 5h14M12 5v14M9 19h6'/%3E%3C/svg%3E");}
[data-ic="stamp"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11V7a3 3 0 0 1 6 0v4l2 3H7z'/%3E%3Cpath d='M5 18h14v3H5z'/%3E%3C/svg%3E");}
[data-ic="list"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");}
[data-ic="trash"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V5h6v2M6 7l1 13h10l1-13'/%3E%3C/svg%3E");}
[data-ic="extract"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3h8l4 4v14H8z'/%3E%3Cpath d='M16 3v4h4'/%3E%3Cpath d='M4 9v10a2 2 0 0 0 2 2'/%3E%3C/svg%3E");}
[data-ic="grid"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");}
[data-ic="snapshot"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8V5h3M21 8V5h-3M3 16v3h3M21 16v3h-3'/%3E%3Crect x='8' y='9' width='8' height='6' rx='1'/%3E%3C/svg%3E");}
[data-ic="info"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");}
[data-ic="bookmark"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-6-4-6 4z'/%3E%3C/svg%3E");}
[data-ic="clip"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 9 12 18a4 4 0 0 1-6-6l8-8a3 3 0 0 1 4 4l-8 8'/%3E%3C/svg%3E");}

/* Seitensprung + Zoom-Select */
.page-jump { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
#pageInput { width: 46px; text-align: center; padding: 6px 4px; border-radius: var(--radius-xs);
  background: var(--surface); border: 1px solid var(--line-strong); font-weight: 600; }
#pageInput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.page-total { font-size: 12.5px; color: var(--text-mute); white-space: nowrap; }
.zoom-select { padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 500; }
.zoom-select:focus { outline: none; border-color: var(--accent); }

/* Inline-Suche */
.search-inline { display: flex; align-items: center; gap: 4px; padding: 4px 6px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  animation: panelIn .25s var(--ease); }
#searchInput { padding: 6px 8px; min-width: 180px; background: transparent; border: none; }
#searchInput:focus { outline: none; }
.search-count { font-size: 12px; color: var(--text-mute); white-space: nowrap; padding: 0 4px; }

/* Stiloptionen */
.markup-options { flex-direction: column; align-items: stretch !important; gap: 8px; min-width: 200px; }
.opt-row { display: flex; align-items: center; gap: 10px; }
.opt-label { font-size: 11px; color: var(--text-mute); width: 44px; }
.swatches { display: flex; gap: 5px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s var(--ease), border-color .15s; box-shadow: var(--shadow-sm); }
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--text); transform: scale(1.15); }
#strokeRange { flex: 1; accent-color: var(--accent); }
#strokeVal { font-size: 12px; width: 18px; text-align: right; color: var(--text-soft); }

/* zuletzt geöffnet */
.recent-body { gap: 6px; overflow-x: auto; }
.recent-item { display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-soft); white-space: nowrap; }
.recent-empty { font-size: 12px; color: var(--text-mute); align-self: center; }

/* ============================ WORKSPACE ============================ */
.workspace { position: relative; z-index: 10; flex: 1; display: flex; min-height: 0; }

.sidebar { background: var(--surface-glass); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column;
  transition: width .3s var(--ease), opacity .25s, transform .3s var(--ease); overflow: hidden; }
.sidebar.left { width: 230px; border-right: 1px solid var(--line); }
.sidebar.right { width: 290px; border-left: 1px solid var(--line); }
.sidebar.collapsed { width: 0; opacity: 0; }

.sidebar-tabs { display: flex; padding: 8px; gap: 4px; border-bottom: 1px solid var(--line); }
.sb-tab { flex: 1; display: grid; place-items: center; height: 34px; border-radius: var(--radius-xs);
  color: var(--text-mute); transition: background .16s, color .16s; }
.sb-tab .ic { width: 17px; height: 17px; }
.sb-tab:hover { background: var(--surface-2); color: var(--text); }
.sb-tab.active { background: var(--accent-soft); color: var(--text); }
.sidebar-content { flex: 1; overflow-y: auto; padding: 10px; }
.sb-panel { display: none; }
.sb-panel.active { display: block; }
.sb-empty { font-size: 12.5px; color: var(--text-mute); text-align: center; padding: 24px 12px; line-height: 1.6; }

/* Thumbnails */
.thumb { position: relative; margin-bottom: 12px; cursor: pointer; border-radius: var(--radius-sm);
  overflow: hidden; border: 2px solid transparent; transition: border-color .18s, transform .18s var(--ease); }
.thumb:hover { transform: translateY(-2px); }
.thumb canvas { display: block; width: 100%; background: #fff; }
.thumb.active { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-soft); }
.thumb-num { position: absolute; bottom: 4px; right: 6px; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 8px; background: rgba(0,0,0,.6); color: #fff; }

/* Lesezeichen / Anhänge */
.bm-item, .att-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: var(--radius-xs); font-size: 12.5px; color: var(--text-soft); cursor: pointer;
  transition: background .15s, color .15s; }
.bm-item:hover, .att-item:hover { background: var(--surface-2); color: var(--text); }
.bm-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }

/* ============================== VIEWER ============================== */
.viewer { position: relative; flex: 1; min-width: 0; background: var(--bg-stage); overflow: hidden; }
.viewer-scroll { position: absolute; inset: 0; overflow: auto; scroll-behavior: smooth; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 28px 20px 60px; min-height: 100%; }
.pages.layout-facing { display: grid; grid-template-columns: repeat(2, max-content);
  justify-content: center; gap: 16px 14px; align-content: start; }
.pages.layout-single .page-wrap:not(.is-current) { display: none; }

.page-wrap { position: relative; background: #fff; border-radius: 3px;
  box-shadow: var(--shadow-page); transition: box-shadow .3s; }
.page-wrap .pdf-canvas { display: block; border-radius: 3px; }
.page-wrap .annot-canvas { position: absolute; inset: 0; }
.page-wrap .text-layer { position: absolute; inset: 0; overflow: hidden; opacity: 0;
  line-height: 1; }
.page-wrap .placeholder { display: grid; place-items: center; color: var(--text-mute);
  font-size: 12px; background: var(--surface); }
.page-num-badge { position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-mute); font-weight: 500; }

/* Suchtreffer / Annotationen-DOM */
.search-hit { position: absolute; background: var(--gold-soft); border-radius: 2px; pointer-events: none; }
.search-hit.current { background: color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: 0 0 0 1px var(--gold); }

.dom-annot { position: absolute; cursor: move; }
.sticky-note { width: 190px; background: #ffd866;
  color: #3a2e08; padding: 10px 12px; border-radius: 4px 4px 10px 4px;
  box-shadow: var(--shadow-md); font-size: 12.5px; }
.sticky-note textarea { width: 100%; min-height: 56px; border: none; background: transparent;
  resize: vertical; font-family: inherit; font-size: 12.5px; color: inherit; }
.sticky-note textarea:focus { outline: none; }
.text-annot { min-width: 80px; color: var(--accent-deep); font-weight: 600; }
.text-annot [contenteditable] { outline: none; padding: 2px 4px; }
.annot-del { position: absolute; top: -9px; right: -9px; width: 20px; height: 20px;
  border-radius: 50%; background: #c0392b; color: #fff; display: grid; place-items: center;
  font-size: 13px; box-shadow: var(--shadow-sm); opacity: 0; transition: opacity .15s; }
.dom-annot:hover .annot-del { opacity: 1; }
.stamp-annot { font-family: var(--font-display); font-weight: 700; font-size: 22px;
  border: 3px solid currentColor; border-radius: 6px; padding: 4px 12px; transform: rotate(-8deg);
  letter-spacing: 1px; opacity: .85; }

/* Cursor je Werkzeug */
.viewer.tool-active .viewer-scroll { cursor: crosshair; }
.viewer.tool-text .viewer-scroll, .viewer.tool-note .viewer-scroll { cursor: copy; }

/* Empty State */
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  transition: opacity .4s; }
.empty-state.hidden { opacity: 0; pointer-events: none; }
.empty-card { position: relative; text-align: center; max-width: 420px; padding: 46px 40px;
  background: var(--surface-glass); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(14px); overflow: hidden; }
.empty-glow { display: none; }
.empty-icon { color: var(--accent); margin-bottom: 10px; display: flex; justify-content: center;
  filter: drop-shadow(0 4px 14px var(--accent-soft)); }
.empty-card h1 { font-family: var(--font-display); font-weight: 500; font-size: 27px; margin-bottom: 8px; }
.empty-card h1 span { color: var(--gold); }
.empty-card p { color: var(--text-soft); font-size: 14px; margin-bottom: 22px; line-height: 1.6; }
.primary-btn { display: inline-flex; align-items: center; gap: 9px; padding: 12px 24px;
  border-radius: 999px; font-weight: 600; font-size: 14px; color: #fff;
  background: var(--accent-deep);
  box-shadow: var(--shadow-md);
  transition: transform .18s var(--ease), box-shadow .2s, background .2s; }
.primary-btn .ic { width: 18px; height: 18px; }
.primary-btn:hover { transform: translateY(-2px); background: var(--accent); box-shadow: var(--shadow-lg); }
.primary-btn:active { transform: translateY(0); }
.empty-hint { margin-top: 18px; font-size: 11.5px; color: var(--text-mute); letter-spacing: .3px; }

/* Drop-Overlay */
.drop-overlay { position: absolute; inset: 0; z-index: 50; display: none; place-items: center;
  background: color-mix(in srgb, var(--accent-deep) 30%, rgba(0,0,0,.6));
  backdrop-filter: blur(4px); }
.drop-overlay.show { display: grid; animation: panelIn .2s var(--ease); }
.drop-inner { text-align: center; color: #fff; padding: 50px 70px; border-radius: 22px;
  border: 2.5px dashed rgba(255,255,255,.6); }
.drop-inner .ic { width: 48px; height: 48px; margin-bottom: 12px; }
.drop-inner p { font-size: 18px; font-weight: 600; }

/* Loader */
.loader { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; background: color-mix(in srgb, var(--bg-deep) 70%, transparent);
  backdrop-filter: blur(3px); color: var(--text-soft); font-size: 13px; }
.spinner { width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Kommentare rechts */
.sidebar-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13.5px; }
.sidebar-head .ic { width: 16px; height: 16px; color: var(--accent); }
.comment-count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 9px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.comments-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.comment-card { padding: 11px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; transition: border-color .16s, transform .16s var(--ease); }
.comment-card:hover { border-color: var(--accent); transform: translateX(2px); }
.comment-card .cc-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.comment-card .cc-swatch { width: 11px; height: 11px; border-radius: 3px; }
.comment-card .cc-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); }
.comment-card .cc-page { margin-left: auto; font-size: 11px; color: var(--text-mute); }
.comment-card .cc-text { font-size: 12.5px; color: var(--text-soft); line-height: 1.5; }
.comment-card .cc-del { float: right; color: var(--text-mute); font-size: 14px; }
.comment-card .cc-del:hover { color: #c0392b; }

/* ============================ STATUSLEISTE ============================ */
.statusbar { position: relative; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; height: 40px; padding: 0 16px;
  background: var(--topbar-glass); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-soft); }
.status-center { display: flex; gap: 2px; padding: 3px; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.status-icon { width: 30px; height: 26px; }
.status-icon::before { width: 15px; height: 15px; }
.status-icon.active { background: var(--accent-soft); color: var(--accent); }
.status-right { display: flex; align-items: center; gap: 8px; }
#zoomRange { width: 130px; accent-color: var(--accent); }
#zoomLabel { width: 44px; text-align: right; font-weight: 600; }

/* status-icon Maske (eigene Icons über --icon) */
.status-icon[data-layout="single"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='6' y='4' width='12' height='16' rx='1'/%3E%3C/svg%3E");}
.status-icon[data-layout="continuous"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='6' y='3' width='12' height='8' rx='1'/%3E%3Crect x='6' y='13' width='12' height='8' rx='1'/%3E%3C/svg%3E");}
.status-icon[data-layout="facing"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='3' y='4' width='8' height='16' rx='1'/%3E%3Crect x='13' y='4' width='8' height='16' rx='1'/%3E%3C/svg%3E");}
.status-icon[data-action="zoom-in"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4-4M11 8v6M8 11h6'/%3E%3C/svg%3E");}
.status-icon[data-action="zoom-out"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4-4M8 11h6'/%3E%3C/svg%3E");}

/* Toasts */
.toast-container { position: fixed; bottom: 56px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 11px 20px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 9px; animation: toastIn .3s var(--ease); }
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.toast.warn::before { background: var(--gold); }
.toast.error::before { background: #c0392b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(5px); animation: panelIn .25s var(--ease); }
.modal { width: min(440px, 92vw); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 1px solid var(--line); font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.modal-body { padding: 18px 20px 22px; font-size: 13.5px; color: var(--text-soft); line-height: 1.7; }
.modal-body .prop-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.modal-body .prop-row span:first-child { color: var(--text-mute); }
.modal-body .prop-row span:last-child { color: var(--text); font-weight: 500; text-align: right; word-break: break-word; }

/* Lesemodus */
body.read-mode .menubar, body.read-mode .tools-ribbon, body.read-mode .sidebar { display: none; }
body.read-mode .topbar { opacity: .35; transition: opacity .3s; }
body.read-mode .topbar:hover { opacity: 1; }

/* Scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid transparent;
  background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Responsiv */
@media (max-width: 1100px) {
  .sidebar.right { width: 240px; }
  .rbtn span:not(.ic) { font-size: 11.5px; }
}
@media (max-width: 860px) {
  .sidebar.left { position: absolute; z-index: 60; height: 100%; box-shadow: var(--shadow-lg); }
  .sidebar.right { position: absolute; right: 0; z-index: 60; height: 100%; box-shadow: var(--shadow-lg); }
  .ribbon-panel { overflow-x: auto; }
  .topbar-doc { display: none; }
}

/* Druck */
@media print {
  /* (alte Druckregel entfernt – gedruckt wird ausschließlich die flache Fassung in #printStage) */
}

/* =====================================================================
   ERWEITERUNG v2 — Multi-PDF, Suche, Werkzeuge, Abgabe
   ===================================================================== */

/* ---- neue Icons ---- */
[data-ic="select"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 3l7 17 2.5-6.5L20 11z'/%3E%3C/svg%3E");}
[data-ic="fill"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='8' rx='2'/%3E%3Cpath d='M7 12h.01'/%3E%3C/svg%3E");}
[data-ic="shape"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Crect x='3' y='4' width='10' height='10' rx='1'/%3E%3Ccircle cx='16' cy='15' r='5'/%3E%3C/svg%3E");}
[data-ic="symbol"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");}
[data-ic="docs"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3' width='12' height='16' rx='2'/%3E%3Cpath d='M8 21h12V7'/%3E%3C/svg%3E");}
[data-ic="profile"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h11l3 3v13H5z'/%3E%3Cpath d='M9 9h6M9 13h6M9 17h3'/%3E%3C/svg%3E");}
[data-ic="help"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.8.4-1 .9-1 1.7M12 17h.01'/%3E%3C/svg%3E");}
[data-ic="export"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m-4 4 4-4 4 4'/%3E%3Cpath d='M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E");}
[data-ic="import"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v12m-4-4 4 4 4-4'/%3E%3Cpath d='M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E");}
[data-ic="eye"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");}
[data-ic="star"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9 6.8 19.2l1-5.8L3.5 9.2l5.9-.9z'/%3E%3C/svg%3E");}
[data-ic="add"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");}
[data-ic="bin"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V5h6v2M6 7l1 13h10l1-13'/%3E%3C/svg%3E");}
[data-ic="bold"]{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 5h6a3.5 3.5 0 0 1 0 7H7zM7 12h7a3.5 3.5 0 0 1 0 7H7z'/%3E%3C/svg%3E");}

/* ---- Ribbon: viele Tabs ggf. scrollbar ---- */
.ribbon-tabs { overflow-x: auto; scrollbar-width: none; }
.ribbon-tabs::-webkit-scrollbar { display: none; }
.ribbon-panel { overflow-x: auto; }

/* ---- Zentrales Suchfeld (Tab Suche) ---- */
.central-search { display: flex; flex-direction: column; gap: 8px; min-width: 340px; flex: 1; }
.cs-bar { display: flex; gap: 6px; }
.cs-input { flex: 1; padding: 9px 14px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; font-size: 13.5px; }
.cs-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-scope { padding: 0 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 26px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px;
  background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px; font-size: 12px; cursor: pointer; transition: transform .12s var(--ease); }
.chip:hover { transform: translateY(-1px); }
.chip.global { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.chip .x { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.15); font-size: 12px; line-height: 1; }
.chip .x:hover { background: #c0392b; color: #fff; }
.chip-add { font-size: 11px; color: var(--text-mute); }

/* ---- Listen (Dokumente / Profile / Treffer) ---- */
.doc-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); margin-bottom: 7px; background: var(--surface); cursor: pointer;
  transition: border-color .15s, transform .15s var(--ease); }
.doc-item:hover { border-color: var(--accent); transform: translateX(2px); }
.doc-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.doc-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.doc-item .di-body { flex: 1; min-width: 0; }
.doc-item .di-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item .di-meta { font-size: 11px; color: var(--text-mute); }
.doc-item .di-del { color: var(--text-mute); width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; }
.doc-item .di-del:hover { color: #c0392b; background: var(--surface-2); }
.doc-item .di-del::before { content: ""; width: 15px; height: 15px; background: currentColor;
  -webkit-mask: var(--bin-i) center/contain no-repeat; mask: var(--bin-i) center/contain no-repeat; }
:root { --bin-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V5h6v2M6 7l1 13h10l1-13'/%3E%3C/svg%3E"); }

.hit-item { padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  margin-bottom: 7px; cursor: pointer; transition: border-color .15s, transform .15s var(--ease); }
.hit-item:hover { border-color: var(--accent); transform: translateX(2px); }
.hit-item .hi-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.hit-item .hi-file { font-size: 11.5px; font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit-item .hi-page { font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.hit-item .hi-snippet { font-size: 12px; color: var(--text-soft); line-height: 1.5; }
.hit-item .hi-snippet mark { background: var(--gold-soft); color: var(--text); padding: 0 2px; border-radius: 2px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.list-head .lh-title { font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-mute); }

/* ---- Suchprofile-Panel ---- */
.term-group { margin-bottom: 14px; }
.term-group .tg-label { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.profile-item { padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  margin-bottom: 7px; cursor: pointer; background: var(--surface); transition: border-color .15s; }
.profile-item:hover { border-color: var(--accent); }
.profile-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.profile-item .pi-name { font-size: 12.5px; font-weight: 600; display: flex; justify-content: space-between; }
.profile-item .pi-meta { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* ---- Format-Inspektor (rechte Sidebar) ---- */
.inspector { padding: 4px 2px; }
.insp-empty { font-size: 12.5px; color: var(--text-mute); text-align: center; padding: 30px 12px; line-height: 1.6; }
.insp-section { margin-bottom: 16px; }
.insp-section h4 { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 9px; }
.insp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.insp-row label { font-size: 12px; color: var(--text-soft); width: 86px; flex-shrink: 0; }
.insp-row select, .insp-row input[type=text], .insp-row input[type=number] {
  flex: 1; min-width: 0; padding: 6px 9px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs); font-size: 12.5px; }
.insp-row input[type=color] { width: 34px; height: 28px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs); background: none; cursor: pointer; }
.insp-row input[type=range] { flex: 1; accent-color: var(--accent); }
.insp-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.fmt-btns { display: flex; gap: 5px; }
.fmt-btn { width: 32px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; font-size: 13px; }
.fmt-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fmt-btn .ic { width: 15px; height: 15px; }
.insp-del { width: 100%; padding: 9px; border-radius: var(--radius-sm); margin-top: 6px;
  background: color-mix(in srgb, #c0392b 14%, transparent); color: #e06b5e;
  border: 1px solid color-mix(in srgb, #c0392b 30%, transparent); font-weight: 600; font-size: 12.5px; }
.insp-del:hover { background: color-mix(in srgb, #c0392b 24%, transparent); }

/* ---- Edit-Overlay-Elemente auf der Seite ---- */
.edit-layer { position: absolute; inset: 0; }
.edit-layer.passive { pointer-events: none; }
.edit { position: absolute; box-sizing: border-box; cursor: move; }
.edit.passive { pointer-events: none; }
.edit.selected { outline: 1.5px dashed var(--accent); outline-offset: 2px; }
.edit-text, .edit-fill { padding: 3px 5px; overflow: hidden; }
.edit-text [contenteditable], .edit-fill [contenteditable] { outline: none; width: 100%; height: 100%; overflow: hidden; word-break: break-word; }
.edit-fill { display: flex; align-items: center; }
.edit-markup { border-radius: 1px; }
.edit-shape svg, .edit-symbol svg { width: 100%; height: 100%; display: block; overflow: visible; }
.edit-symbol { display: grid; place-items: center; line-height: 1; }
.edit-image img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.resize-handle { position: absolute; width: 12px; height: 12px; background: var(--accent);
  border: 2px solid #fff; border-radius: 50%; box-shadow: var(--shadow-sm); z-index: 3; }
.resize-handle.br { right: -7px; bottom: -7px; cursor: nwse-resize; }
.resize-handle.bl { left: -7px; bottom: -7px; cursor: nesw-resize; }
.resize-handle.tr { right: -7px; top: -7px; cursor: nesw-resize; }
.resize-handle.tl { left: -7px; top: -7px; cursor: nwse-resize; }

/* ---- Abgabevorschau-Modal ---- */
.modal.wide { width: min(960px, 94vw); max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide .modal-body { overflow: auto; }
.preview-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); }
.preview-toolbar label { font-size: 12.5px; color: var(--text-soft); }
.preview-toolbar select { padding: 6px 10px; border-radius: var(--radius-xs); background: var(--surface);
  border: 1px solid var(--line-strong); font-size: 12.5px; }
.preview-toolbar .spacer { flex: 1; }
.preview-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 20px;
  background: var(--bg-stage); }
.preview-page { background: #fff; box-shadow: var(--shadow-page); }
.preview-page canvas { display: block; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.btn:hover { background: var(--surface-2); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { color: #fff; border-color: transparent;
  background: var(--accent-deep); box-shadow: var(--shadow-sm); }
.btn.primary:hover { transform: translateY(-1px); background: var(--accent); }

/* ---- Hilfe-Modal ---- */
.help-tabs { display: flex; gap: 4px; padding: 12px 20px 0; border-bottom: 1px solid var(--line); }
.help-tab { padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-mute); border-radius: var(--radius-xs) var(--radius-xs) 0 0; }
.help-tab.active { color: var(--text); background: var(--surface-2); }
.help-pane { display: none; }
.help-pane.active { display: block; }
.help-pane h3 { font-family: var(--font-display); font-size: 16px; margin: 4px 0 10px; }
.help-pane kbd { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--surface-2);
  border: 1px solid var(--line-strong); font-family: var(--font-body); font-size: 11.5px; font-weight: 600; }
.kbd-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }

/* Druck-Container für flache Abgabe */
#printStage { position: fixed; left: -99999px; top: 0; }
@media print {
  html, body { height: auto !important; overflow: visible !important; }
  body > *:not(#printStage) { display: none !important; }
  #printStage { position: static !important; left: 0 !important; display: block !important; }
  #printStage img { display: block; max-width: 100%; max-height: 100vh; margin: 0 auto;
    break-after: page; page-break-after: always; }
  #printStage img:last-child { break-after: auto; page-break-after: auto; }
  @page { margin: 8mm; }
}

/* ============================================================
   MENÜLEISTE MIT DROPDOWNS  (ersetzt das alte Tab-Menüband)
   ============================================================ */
.menubar {
  position: relative; z-index: 40; display: flex; align-items: center; gap: 2px;
  padding: 4px 12px; min-height: 40px;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(130%); -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-bottom: 1px solid var(--line);
}
.menu { position: relative; }
.menu-btn { padding: 7px 13px; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  border-radius: var(--radius-xs); transition: background .15s, color .15s; }
.menu-btn:hover { background: var(--surface-2); color: var(--text); }
.menu.open .menu-btn { background: var(--accent-soft); color: var(--text); }
.menu-list {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 240px;
  display: none; flex-direction: column; gap: 1px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.25); z-index: 60;
}
.menu-list.wide { min-width: 320px; }
.menu.open .menu-list { display: flex; animation: panelIn .2s var(--ease); }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 8px 11px; border-radius: var(--radius-xs); font-size: 13px; font-weight: 500;
  color: var(--text-soft); white-space: nowrap; }
.menu-item:hover { background: var(--accent-soft); color: var(--text); }
.menu-item.active { color: var(--accent); }
.menu-item .ic { width: 16px; height: 16px; flex-shrink: 0; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-section { font-size: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--text-mute); padding: 8px 11px 3px; }
.menubar-spacer { flex: 1; }
.tools-toggle { display: flex; align-items: center; gap: 8px; padding: 7px 13px;
  font-size: 13px; font-weight: 600; color: var(--text-soft); border-radius: var(--radius-xs);
  border: 1px solid transparent; }
.tools-toggle .ic { width: 16px; height: 16px; }
.tools-toggle:hover { background: var(--surface-2); color: var(--text); }
.tools-toggle.active { background: var(--accent-soft); color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
/* Chips & Zuletzt-geöffnet innerhalb der Dropdowns */
.menu-list .chip-row { padding: 4px 6px; max-width: 320px; }
.menu-list .recent-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; }

/* ============================================================
   WERKZEUGE-MENÜBAND (ein-/ausklappbar)
   ============================================================ */
.tools-ribbon {
  position: relative; z-index: 30;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(130%); -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-bottom: 1px solid var(--line);
  height: 46px;            /* minimal höher als die Menüleiste (40px) */
}
.tools-ribbon.collapsed { display: none; }
.tools-row { display: flex; align-items: center; gap: 3px; height: 100%;
  padding: 0 12px; overflow-x: auto; overflow-y: hidden; }
.tools-row::-webkit-scrollbar { height: 6px; }
.tools-row .rbtn { height: 32px; padding: 0 9px; gap: 6px; font-size: 11.5px; font-weight: 500;
  border-radius: var(--radius-xs); flex-shrink: 0; }
.tools-row .rbtn .ic { width: 15px; height: 15px; }
.tools-row .rbtn.icononly { padding: 0 7px; }
.tool-sep { flex-shrink: 0; width: 1px; height: 20px; margin: 0 5px;
  background: var(--divider); }

/* ============================================================
   SCHMALES SYMBOL-BAND ÜBER DEM PDF
   ============================================================ */
.viewbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30; height: 44px;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  border-bottom: 1px solid var(--line);
}
.viewer-scroll { padding-top: 44px; }
.vb-group { display: flex; align-items: center; gap: 4px; }
.vb-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-xs);
  color: var(--text-soft); transition: background .15s, color .15s; }
.vb-btn:hover { background: var(--surface-2); color: var(--text); }
.vb-btn .ic { width: 16px; height: 16px; }
.vb-sep { width: 1px; height: 22px; background: var(--line); }
.vb-page { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-mute); }
.vb-page input { width: 44px; height: 28px; text-align: center; border-radius: var(--radius-xs);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 12.5px; }
.vb-zoom, .vb-scope { height: 28px; border-radius: var(--radius-xs); background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text); font-size: 12px; padding: 0 6px; }
.vb-search { flex: 1; max-width: 380px; display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 9px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); }
.vb-search:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.vb-ic { width: 15px; height: 15px; color: var(--text-mute); flex-shrink: 0; }
.vb-search-input { flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  font-size: 13px; color: var(--text); }
.vb-search .vb-scope { height: 24px; border: none; background: transparent; color: var(--text-mute); }
.vb-search .vb-btn { width: 26px; height: 26px; }

/* Eigene, SICHTBARE Ebene für Suchtreffer (Textlayer ist bewusst unsichtbar) */
.page-wrap .search-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* Suchtreffer im PDF deutlich GELB hervorheben (Aufgabe 4) */
.search-hit { position: absolute; background: rgba(255, 221, 0, .55); border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(214,160,30,.45); }
.search-hit.current { background: rgba(255, 150, 0, .8); box-shadow: 0 0 0 1.5px rgba(180,110,0,.7); }

/* Trefferzahl + Vor/Zurück im Symbol-Band */
.vb-search-group { flex: 1; max-width: 480px; display: flex; align-items: center; gap: 6px; }
.vb-search-group .vb-search { flex: 1; max-width: none; }
.vb-search-go { display: grid; place-items: center; width: 18px; height: 18px; flex-shrink: 0; color: var(--text-mute); }
.vb-search-go:hover { color: var(--text); }
.vb-count { font-size: 12px; color: var(--text-mute); min-width: 50px; text-align: center;
  white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ============================================================
   DIALOGE: SEITEN VERWALTEN & ZUSAMMENFÜHREN
   ============================================================ */
.pm-hint { color: var(--text-mute); font-size: 12.5px; margin-bottom: 14px; }
.pm-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pm-actions .ic { width: 15px; height: 15px; }

/* Seiten-Raster */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 12px; max-height: 56vh; overflow: auto; padding: 4px; }
.pm-item { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 8px; display: flex; flex-direction: column; align-items: center;
  gap: 6px; cursor: grab; transition: border-color .15s, transform .12s, opacity .15s; }
.pm-item:hover { border-color: var(--accent); }
.pm-item.dragging { opacity: .5; cursor: grabbing; }
.pm-item.removed { opacity: .4; }
.pm-item.removed .pm-num { text-decoration: line-through; color: #c0392b; }
.pm-item .pm-canvas { width: 100%; min-height: 60px; display: grid; place-items: center; }
.pm-item .pm-canvas canvas { max-width: 100%; height: auto; border-radius: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.pm-item .pm-num { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.pm-item .pm-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--line);
  color: var(--text-soft); display: grid; place-items: center; font-size: 14px; line-height: 1; }
.pm-item .pm-del:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* Zusammenführen-Liste */
.merge-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; }
.merge-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: grab; transition: border-color .15s, opacity .12s; }
.merge-row:hover { border-color: var(--accent); }
.merge-row.dragging { opacity: .5; cursor: grabbing; }
.merge-row .mr-grip { color: var(--text-mute); font-size: 16px; line-height: 1; cursor: grab; }
.merge-row .mr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; color: var(--text); }
.merge-row .mr-pages { font-size: 12px; color: var(--text-mute); white-space: nowrap; }
.merge-row .mr-del { width: 24px; height: 24px; border-radius: 6px; color: var(--text-mute);
  display: grid; place-items: center; font-size: 16px; line-height: 1; }
.merge-row .mr-del:hover { background: #c0392b; color: #fff; }

/* ============================================================
   HILFSRASTER-OVERLAY (über jeder Seite, kein Farbverlauf)
   ============================================================ */
.grid-overlay { position: absolute; inset: 0; pointer-events: none;
  display: none; background-repeat: repeat; background-position: 0 0; opacity: .7; }
.pages.grid-on .grid-overlay { display: block; }

/* Raster-Steuerung im Band */
.vb-grid { gap: 8px; }
.vb-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--text-soft); white-space: nowrap; cursor: pointer; }
.vb-check input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }
.vb-size { gap: 5px; }
.vb-num { width: 48px; height: 26px; text-align: center; border-radius: var(--radius-xs);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 12px;
  accent-color: var(--accent); }
.vb-num:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* feinere Trennstriche im Band */
.vb-sep { background: var(--divider); }

/* Inspektor: Standardstil-Hinweis & Werte */
.insp-hint { font-size: 12px; color: var(--text-mute); line-height: 1.55; margin: 2px 0 12px; }
.insp-hint b { color: var(--text-soft); font-weight: 600; }
.insp-val { font-size: 12px; color: var(--text-mute); min-width: 18px; text-align: right; }
#defSwatches.swatches { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============================================================
   DRUCK: Seiten ohne Hintergrund, so wie sie gedruckt werden
   ============================================================ */
@media print {
  html, body, #printStage { background: #fff !important; }
}

/* ============================================================
   HILFE: LIZENZEN-LISTE
   ============================================================ */
.lic-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.lic-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.lic-item > b { color: var(--text); font-size: 13.5px; }
.lic-item > span { color: var(--text-soft); font-size: 12.5px; }
.lic-item .lic-links { margin-top: 2px; font-size: 12px; }
.lic-item .lic-links a { color: var(--accent); text-decoration: none; }
.lic-item .lic-links a:hover { text-decoration: underline; }
