:root {
  --bg: #181818;
  --bg-stage: #202020;
  --panel: #202020;
  --panel-hover: #303030;
  --line: rgba(255,255,255,.11);
  --text: #f5f5f5;
  --muted: rgba(255,255,255,.62);
  --accent: #ed8008;

  --shadow:
    0 30px 80px rgba(0,0,0,.42),
    0 8px 24px rgba(0,0,0,.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

html {
  background: var(--bg);
}

body {
  min-height: 100dvh;
  overflow: hidden;

  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;

  background: var(--bg);
  color: var(--text);

  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}


/* =========================================================
   APP
   ========================================================= */

.app-shell {
  height: 100dvh;

  display: grid;
  grid-template-rows:
    64px
    minmax(0, 1fr)
    60px;

  background: var(--bg);
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  position: relative;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: space-between;

  min-width: 0;

  padding:
    0
    max(14px, env(safe-area-inset-right))
    0
    max(14px, env(safe-area-inset-left));

  background: rgba(25,25,25,.97);

  border-bottom: 1px solid var(--line);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  min-width: 0;

  display: flex;
  align-items: center;

  gap: 16px;
}

.brand__logo {
  display: block;

  width: auto;
  height: 33px;

  object-fit: contain;
}

.brand__divider {
  width: 1px;
  height: 28px;

  background: rgba(255,255,255,.17);
}

.brand__document {
  min-width: 0;

  display: flex;
  flex-direction: column;

  line-height: 1.05;
}

.brand__document span {
  margin-bottom: 3px;

  color: var(--accent);

  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;

  text-transform: uppercase;
}

.brand__document strong {
  overflow: hidden;

  font-size: 14px;
  font-weight: 650;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__right {
  display: flex;
  align-items: center;

  gap: 13px;
}

.page-indicator {
  min-width: 72px;

  padding: 8px 11px;

  border-radius: 8px;

  background: rgba(255,255,255,.055);

  color: var(--text);

  font-size: 13px;
  font-weight: 650;

  font-variant-numeric: tabular-nums;
  text-align: center;

  white-space: nowrap;
}

.page-indicator__separator {
  margin: 0 5px;

  color: var(--muted);
}

.topbar__actions {
  display: flex;
  align-items: center;

  gap: 7px;
}

.icon-btn {
  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  padding: 0;

  border: 1px solid rgba(255,255,255,.13);
  border-radius: 8px;

  background: rgba(255,255,255,.06);
  color: #fff;

  cursor: pointer;

  transition:
    background-color .2s ease,
    border-color .2s ease,
    transform .2s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  border-color: var(--accent);

  background: rgba(237,128,8,.11);

  outline: none;
}

.icon-btn:active {
  transform: scale(.96);
}

.icon-btn svg {
  width: 18px;
  height: 18px;

  fill: none;
  stroke: currentColor;

  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* =========================================================
   VIEWER
   ========================================================= */

.viewer-wrap {
  position: relative;

  min-width: 0;
  min-height: 0;

  overflow: hidden;

  display: grid;
  place-items: center;

  background:
    radial-gradient(
      circle at 50% 42%,
      #292929 0%,
      #222 42%,
      #1a1a1a 100%
    );
}

.book-stage {
  width: 100%;
  height: 100%;

  min-width: 0;
  min-height: 0;

  display: grid;
  place-items: center;

  overflow: auto;

  padding: 22px 74px;

  touch-action: none;

  scrollbar-width: thin;
  scrollbar-color:
    rgba(255,255,255,.18)
    transparent;
}

.book {
  position: relative;

  max-width: min(100%, 1220px);
  max-height: 100%;

  transform-origin: center center;

  will-change: transform;
}

.page-frame {
  position: relative;

  display: grid;
  place-items: center;

  transform-origin: center center;

  perspective: 2200px;

  will-change:
    transform,
    opacity,
    filter;
}

.page-frame img {
  display: block;

  width: auto;
  max-width: 100%;

  max-height:
    calc(
      100dvh
      - 64px
      - 60px
      - 44px
    );

  border-radius: 2px;

  background: #fff;

  box-shadow: var(--shadow);

  user-select: none;
  -webkit-user-drag: none;
}

.page-shade {
  position: absolute;

  inset: 0;

  border-radius: 2px;

  pointer-events: none;

  opacity: .12;

  box-shadow:
    inset 10px 0 18px rgba(0,0,0,.05),
    inset -10px 0 18px rgba(0,0,0,.06);

  transition: opacity .56s ease;
}


/* =========================================================
   RUHIGER SEITENWECHSEL
   ========================================================= */

.page-frame.is-leaving-next {
  animation:
    pageLeaveNext
    .28s
    cubic-bezier(.4,0,.6,1)
    both;
}

.page-frame.is-leaving-prev {
  animation:
    pageLeavePrev
    .28s
    cubic-bezier(.4,0,.6,1)
    both;
}

.page-frame.is-entering-next {
  animation:
    pageEnterNext
    .34s
    cubic-bezier(.16,1,.3,1)
    both;
}

.page-frame.is-entering-prev {
  animation:
    pageEnterPrev
    .34s
    cubic-bezier(.16,1,.3,1)
    both;
}

@keyframes pageLeaveNext {
  from {
    opacity: 1;

    transform:
      translate3d(0,0,0)
      rotateY(0deg)
      scale(1);

    filter: brightness(1);
  }

  to {
    opacity: .12;

    transform:
      translate3d(-18px,0,0)
      rotateY(-4deg)
      scale(.994);

    filter: brightness(.93);
  }
}

@keyframes pageEnterNext {
  from {
    opacity: .12;

    transform:
      translate3d(18px,0,0)
      rotateY(4deg)
      scale(.994);

    filter: brightness(.93);
  }

  to {
    opacity: 1;

    transform:
      translate3d(0,0,0)
      rotateY(0deg)
      scale(1);

    filter: brightness(1);
  }
}

@keyframes pageLeavePrev {
  from {
    opacity: 1;

    transform:
      translate3d(0,0,0)
      rotateY(0deg)
      scale(1);

    filter: brightness(1);
  }

  to {
    opacity: .12;

    transform:
      translate3d(18px,0,0)
      rotateY(4deg)
      scale(.994);

    filter: brightness(.93);
  }
}

@keyframes pageEnterPrev {
  from {
    opacity: .12;

    transform:
      translate3d(-18px,0,0)
      rotateY(-4deg)
      scale(.994);

    filter: brightness(.93);
  }

  to {
    opacity: 1;

    transform:
      translate3d(0,0,0)
      rotateY(0deg)
      scale(1);

    filter: brightness(1);
  }
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.nav-btn {
  position: absolute;

  top: 50%;
  z-index: 15;

  width: 44px;
  height: 72px;

  display: grid;
  place-items: center;

  padding: 0 0 5px;

  transform: translateY(-50%);

  border: 1px solid rgba(255,255,255,.11);
  border-radius: 10px;

  background: rgba(20,20,20,.52);
  color: rgba(255,255,255,.84);

  font-family: Arial, sans-serif;
  font-size: 39px;
  font-weight: 200;
  line-height: 1;

  cursor: pointer;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transition:
    background-color .2s ease,
    border-color .2s ease,
    opacity .2s ease,
    color .2s ease;
}

.nav-btn:hover:not(:disabled) {
  border-color: rgba(237,128,8,.6);

  background: rgba(237,128,8,.14);
  color: #fff;
}

.nav-btn:disabled {
  opacity: .18;

  cursor: default;
}

.nav-btn--left {
  left: 18px;
}

.nav-btn--right {
  right: 18px;
}


/* =========================================================
   THUMBNAILS
   ========================================================= */

.thumb-panel {
  position: absolute;

  top: 14px;
  right: 14px;
  bottom: 14px;

  z-index: 40;

  width: min(350px, calc(100vw - 28px));

  display: grid;
  grid-template-rows: auto minmax(0,1fr);

  overflow: hidden;

  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;

  background: rgba(25,25,25,.97);

  box-shadow:
    0 24px 70px rgba(0,0,0,.42);

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  opacity: 0;
  visibility: hidden;

  transform: translateX(18px);

  transition:
    opacity .28s ease,
    transform .28s ease,
    visibility .28s ease;
}

.thumb-panel.is-open {
  opacity: 1;
  visibility: visible;

  transform: translateX(0);
}

.thumb-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: 54px;

  padding: 0 12px 0 16px;

  border-bottom: 1px solid var(--line);
}

.thumb-panel__head strong {
  font-size: 14px;
}

.thumb-panel__close {
  width: 36px;
  height: 36px;

  display: grid;
  place-items: center;

  border: 0;
  border-radius: 7px;

  background: transparent;
  color: #fff;

  font-size: 25px;
  font-weight: 300;

  cursor: pointer;
}

.thumb-panel__close:hover {
  background: rgba(255,255,255,.07);
}

.thumbs {
  min-height: 0;

  display: grid;
  grid-template-columns:
    repeat(2, minmax(0,1fr));

  align-content: start;

  gap: 12px;

  overflow-y: auto;

  padding: 14px;
}

.thumb {
  position: relative;

  min-width: 0;

  padding: 5px;

  border: 2px solid transparent;
  border-radius: 7px;

  background: rgba(255,255,255,.05);
  color: #fff;

  cursor: pointer;

  transition:
    border-color .2s ease,
    background-color .2s ease;
}

.thumb:hover {
  background: rgba(255,255,255,.09);
}

.thumb.is-active {
  border-color: var(--accent);

  background: rgba(237,128,8,.08);
}

.thumb img {
  display: block;

  width: 100%;
  height: auto;

  border-radius: 3px;

  background: #fff;
}

.thumb span {
  display: block;

  padding: 6px 2px 1px;

  color: var(--muted);

  font-size: 11px;
  text-align: center;
}


/* =========================================================
   TOOLBAR
   ========================================================= */

.toolbar {
  position: relative;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 9px;

  padding:
    8px
    max(14px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));

  border-top: 1px solid var(--line);

  background: rgba(25,25,25,.97);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toolbar button {
  min-width: 38px;
  height: 38px;

  padding: 0 13px;

  border: 1px solid rgba(255,255,255,.12);
  border-radius: 7px;

  background: rgba(255,255,255,.055);
  color: var(--text);

  cursor: pointer;

  transition:
    border-color .2s ease,
    background-color .2s ease;
}

.toolbar button:hover,
.toolbar button:focus-visible {
  border-color: var(--accent);

  background: rgba(237,128,8,.1);

  outline: none;
}

#zoomRange {
  width: min(220px, 28vw);

  accent-color: var(--accent);
}

.zoom-display {
  min-width: 49px;

  color: var(--muted);

  font-size: 12px;

  font-variant-numeric: tabular-nums;
  text-align: center;
}

.toolbar__separator {
  width: 1px;
  height: 24px;

  margin: 0 2px;

  background: rgba(255,255,255,.12);
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

  .app-shell {
    grid-template-rows:
      56px
      minmax(0,1fr)
      56px;
  }

  .topbar {
    padding-left:
      max(9px, env(safe-area-inset-left));

    padding-right:
      max(9px, env(safe-area-inset-right));
  }

  .brand {
    gap: 10px;
  }

  .brand__logo {
    height: 27px;
  }

  .brand__divider,
  .brand__document {
    display: none;
  }

  .topbar__right {
    gap: 7px;
  }

  .page-indicator {
    min-width: 59px;

    padding: 7px;

    font-size: 12px;
  }

  .icon-btn {
    width: 37px;
    height: 37px;
  }

  #fitTopBtn {
    display: none;
  }

  .book-stage {
    padding: 10px 46px;
  }

  .page-frame img {
    max-height:
      calc(
        100dvh
        - 56px
        - 56px
        - 20px
      );
  }

  .nav-btn {
    width: 35px;
    height: 56px;

    border-radius: 8px;

    font-size: 32px;
  }

  .nav-btn--left {
    left: 5px;
  }

  .nav-btn--right {
    right: 5px;
  }

  .toolbar {
    gap: 6px;

    padding-left:
      max(8px, env(safe-area-inset-left));

    padding-right:
      max(8px, env(safe-area-inset-right));
  }

  .toolbar button {
    height: 36px;

    padding: 0 10px;
  }

  #fullscreenBtn,
  #fitBtn,
  .toolbar__separator {
    display: none;
  }

  #zoomRange {
    width: min(145px, 38vw);
  }

  .thumb-panel {
    top: 8px;
    right: 8px;
    bottom: 8px;

    width: calc(100vw - 16px);
  }

  .thumbs {
    grid-template-columns:
      repeat(3, minmax(0,1fr));

    gap: 9px;
  }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: .01ms !important;
  }

}


/* =========================================================
   COMPETENZA ASBEST NAVIGATOR – CANONICAL TOOLBAR
   ========================================================= */

.topbar__actions.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 7px;

  padding: 0;

  border: 0;

  background: transparent;

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.topbar__actions.toolbar .btn {
  width: 40px;
  min-width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  padding: 0;

  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;

  background: rgba(255,255,255,.065);
  color: #fff;

  font-size: 17px;
  font-weight: 500;
  line-height: 1;

  cursor: pointer;

  transition:
    border-color .18s ease,
    background-color .18s ease,
    color .18s ease,
    transform .18s ease;
}

.topbar__actions.toolbar .btn:hover,
.topbar__actions.toolbar .btn:focus-visible {
  border-color: #ed8008;

  background: rgba(237,128,8,.10);

  outline: none;
}

.topbar__actions.toolbar .btn[aria-expanded="true"] {
  border-color: #ed8008;

  background: rgba(237,128,8,.08);
}

.topbar__actions.toolbar .btn:active {
  transform: scale(.96);
}


/* Untere Leiste ausschließlich für Zoom */

.zoom-toolbar {
  position: relative;
  z-index: 50;

  min-height: 60px;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 10px;

  padding:
    8px
    max(14px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));

  border-top: 1px solid rgba(255,255,255,.11);

  background: rgba(25,25,25,.97);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.zoom-toolbar button {
  width: 38px;
  min-width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  padding: 0;

  border: 1px solid rgba(255,255,255,.12);
  border-radius: 7px;

  background: rgba(255,255,255,.055);
  color: #fff;

  font-size: 18px;

  cursor: pointer;

  transition:
    border-color .18s ease,
    background-color .18s ease;
}

.zoom-toolbar button:hover,
.zoom-toolbar button:focus-visible {
  border-color: #ed8008;

  background: rgba(237,128,8,.10);

  outline: none;
}

.zoom-toolbar #zoomRange {
  width: min(240px, 30vw);

  accent-color: #ed8008;
}

.zoom-toolbar .zoom-display {
  min-width: 48px;

  color: rgba(255,255,255,.65);

  font-size: 12px;

  font-variant-numeric: tabular-nums;
  text-align: center;
}


/* Mobile */

@media (max-width: 700px) {

  .topbar__actions.toolbar {
    gap: 5px;
  }

  .topbar__actions.toolbar .btn {
    width: 37px;
    min-width: 37px;
    height: 37px;

    font-size: 16px;
  }

  .zoom-toolbar {
    min-height: 56px;

    gap: 7px;
  }

  .zoom-toolbar #zoomRange {
    width: min(150px, 40vw);
  }

}


/* =========================================================
   COMPETENZA ASBEST NAVIGATOR
   CANONICAL CONTROLBAR V2
   ========================================================= */

/*
 * Explizite feste Höhe:
 * verhindert Abschneiden der Controls am unteren Viewportrand.
 */

.app-shell {
  height: 100vh !important;
  height: 100dvh !important;

  min-height: 0 !important;

  grid-template-rows:
    64px
    minmax(0, 1fr)
    64px !important;
}


/* ---------------------------------------------------------
   Untere Bedienleiste
   --------------------------------------------------------- */

.controlbar {
  position: relative !important;
  z-index: 100 !important;

  width: 100% !important;
  height: 64px !important;
  min-height: 64px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  overflow: visible !important;

  padding:
    8px
    max(14px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left)) !important;

  border-top:
    1px solid
    rgba(255,255,255,.11) !important;

  background:
    rgba(22,22,22,.985) !important;

  box-shadow:
    0 -8px 30px rgba(0,0,0,.18) !important;

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}


.controlbar__inner {
  width: min(520px, 100%) !important;

  display: grid !important;

  grid-template-columns:
    40px
    54px
    minmax(120px, 1fr)
    40px !important;

  align-items: center !important;

  gap: 12px !important;

  margin: 0 auto !important;
}


.controlbar__btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;

  display: grid !important;
  place-items: center !important;

  padding: 0 !important;

  border:
    1px solid
    rgba(255,255,255,.15) !important;

  border-radius: 8px !important;

  background:
    rgba(255,255,255,.065) !important;

  color: #fff !important;

  font-size: 19px !important;
  font-weight: 400 !important;
  line-height: 1 !important;

  cursor: pointer !important;

  transition:
    border-color .18s ease,
    background-color .18s ease,
    transform .18s ease !important;
}


.controlbar__btn:hover,
.controlbar__btn:focus-visible {
  border-color: #ed8008 !important;

  background:
    rgba(237,128,8,.11) !important;

  outline: none !important;
}


.controlbar__btn:active {
  transform: scale(.96);
}


.controlbar__label {
  width: 54px !important;

  color:
    rgba(255,255,255,.72) !important;

  font-size: 12px !important;
  font-weight: 600 !important;

  font-variant-numeric:
    tabular-nums !important;

  text-align: center !important;

  white-space: nowrap !important;
}


.controlbar__range {
  width: 100% !important;
  min-width: 0 !important;

  margin: 0 !important;

  accent-color: #ed8008 !important;

  cursor: pointer !important;
}


/* ---------------------------------------------------------
   Topbar Buttons
   --------------------------------------------------------- */

.topbar__actions.toolbar {
  display: flex !important;
  align-items: center !important;

  gap: 7px !important;

  padding: 0 !important;

  border: 0 !important;

  background: transparent !important;

  box-shadow: none !important;

  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}


.topbar__actions.toolbar .btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;

  display: grid !important;
  place-items: center !important;

  padding: 0 !important;

  border:
    1px solid
    rgba(255,255,255,.14) !important;

  border-radius: 8px !important;

  background:
    rgba(255,255,255,.065) !important;

  color: #fff !important;

  cursor: pointer !important;
}


.topbar__actions.toolbar .btn:hover,
.topbar__actions.toolbar .btn:focus-visible {
  border-color: #ed8008 !important;

  background:
    rgba(237,128,8,.11) !important;

  outline: none !important;
}


.topbar__actions.toolbar
.btn[aria-expanded="true"] {
  border-color: #ed8008 !important;

  background:
    rgba(237,128,8,.11) !important;
}


/* ---------------------------------------------------------
   Vollbild
   --------------------------------------------------------- */

html.is-flipbook-fullscreen,
html.is-flipbook-fullscreen body,
html.is-flipbook-fullscreen .app-shell {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
}


/* ---------------------------------------------------------
   Mobile
   --------------------------------------------------------- */

@media (max-width: 700px) {

  .app-shell {
    grid-template-rows:
      56px
      minmax(0, 1fr)
      58px !important;
  }


  .controlbar {
    height: 58px !important;
    min-height: 58px !important;

    padding:
      7px
      max(8px, env(safe-area-inset-right))
      max(7px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left)) !important;
  }


  .controlbar__inner {
    width: min(430px, 100%) !important;

    grid-template-columns:
      36px
      48px
      minmax(90px, 1fr)
      36px !important;

    gap: 7px !important;
  }


  .controlbar__btn {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
  }


  .controlbar__label {
    width: 48px !important;

    font-size: 11px !important;
  }


  .topbar__actions.toolbar .btn {
    width: 37px !important;
    min-width: 37px !important;
    height: 37px !important;
  }

}


/* =========================================================
   COMPETENZA ASBEST NAVIGATOR
   PDF.JS VIEWER V1
   ========================================================= */

.pdf-page {
  position: relative;

  display: block;

  overflow: hidden;

  border-radius: 2px;

  background: #fff;

  box-shadow:
    0 30px 80px rgba(0,0,0,.42),
    0 8px 24px rgba(0,0,0,.26);
}


#pageCanvas {
  position: relative;
  z-index: 1;

  display: block;

  width: 100%;
  height: 100%;

  background: #fff;
}


.pdf-link-layer {
  position: absolute;

  inset: 0;

  z-index: 5;

  pointer-events: none;
}


.pdf-link {
  position: absolute;

  display: block;

  pointer-events: auto;

  cursor: pointer;

  background:
    rgba(237,128,8,0);

  outline: none;

  transition:
    background-color .15s ease,
    box-shadow .15s ease;
}


.pdf-link:hover,
.pdf-link:focus-visible {
  background:
    rgba(237,128,8,.08);

  box-shadow:
    inset 0 0 0 1px
    rgba(237,128,8,.34);
}


.page-frame .page-shade {
  z-index: 6;
}


/* Bestehende IMG-Regeln neutralisieren */

.page-frame img,
.book img {
  max-width: none;
  max-height: none;
}


/* ---------------------------------------------------------
   Dynamische PDF-Thumbnails
   --------------------------------------------------------- */

.thumb canvas {
  display: block;

  width: 100% !important;
  height: auto !important;

  background: #fff;

  border-radius: 3px;
}


/* ---------------------------------------------------------
   Ladezustand
   --------------------------------------------------------- */

.app-shell::after {
  content: "";

  position: fixed;

  left: 50%;
  top: 50%;

  z-index: 200;

  width: 30px;
  height: 30px;

  margin:
    -15px
    0
    0
    -15px;

  border:
    3px solid
    rgba(255,255,255,.16);

  border-top-color:
    #ed8008;

  border-radius: 50%;

  opacity: 0;
  visibility: hidden;

  pointer-events: none;

  animation:
    competenzaPdfSpin
    .8s
    linear
    infinite;

  transition:
    opacity .15s ease,
    visibility .15s ease;
}


.app-shell.is-loading::after {
  opacity: 1;
  visibility: visible;
}


@keyframes competenzaPdfSpin {
  to {
    transform:
      rotate(360deg);
  }
}


/* ---------------------------------------------------------
   Fehlerzustand
   --------------------------------------------------------- */

.app-shell.has-error .viewer-wrap::after {
  content:
    "Das Dokument konnte nicht geladen werden.";

  position: absolute;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%);

  padding:
    14px 18px;

  border:
    1px solid
    rgba(255,255,255,.14);

  border-radius: 8px;

  background:
    rgba(20,20,20,.94);

  color: #fff;

  font-size: 14px;
}


/* =========================================================
   COMPETENZA ASBEST NAVIGATOR
   PDF.JS RUNTIME DIAGNOSE
   ========================================================= */

.pdf-runtime-error {
  position: fixed;

  left: 50%;
  top: 50%;

  z-index: 500;

  width:
    min(
      640px,
      calc(100vw - 40px)
    );

  transform:
    translate(-50%, -50%);

  display: grid;

  gap: 9px;

  padding: 18px 20px;

  border:
    1px solid
    rgba(237,128,8,.45);

  border-radius: 10px;

  background:
    rgba(20,20,20,.97);

  box-shadow:
    0 24px 70px
    rgba(0,0,0,.48);

  color: #fff;

  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}


.pdf-runtime-error strong {
  color: #ed8008;

  font-size: 14px;
}


.pdf-runtime-error span {
  color: #fff;

  font-size: 13px;
  line-height: 1.45;

  word-break: break-word;
}


.pdf-runtime-error small {
  color:
    rgba(255,255,255,.63);

  font-size: 11px;
  line-height: 1.4;

  word-break: break-word;
}


/*
 * Alte generische Meldung ausblenden,
 * sobald unsere genaue Runtime-Meldung existiert.
 */

body:has(.pdf-runtime-error)
.app-shell.has-error
.viewer-wrap::after {
  display: none;
}


/* =========================================================
   COMPETENZA ASBEST NAVIGATOR
   VIEWPORT FIT V1
   ========================================================= */

.viewer-wrap {
  min-width: 0 !important;
  min-height: 0 !important;

  overflow: hidden !important;
}

.book-stage {
  position: relative !important;

  width: 100% !important;
  height: 100% !important;

  min-width: 0 !important;
  min-height: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  overflow: auto !important;

  padding: 28px 72px !important;

  box-sizing: border-box !important;
}

.book {
  position: relative !important;

  flex: 0 0 auto !important;

  max-width: none !important;
  max-height: none !important;

  transform-origin: center center !important;
}

.page-frame {
  position: relative !important;

  display: block !important;

  max-width: none !important;
  max-height: none !important;

  transform-origin: center center !important;
}

.pdf-page {
  position: relative !important;

  display: block !important;

  max-width: none !important;
  max-height: none !important;
}

#pageCanvas {
  display: block !important;

  max-width: none !important;
  max-height: none !important;
}


/*
 * Kein künstlicher horizontaler Überstand in Grundansicht.
 * Erst bei Zoom > 100 % darf gescrollt werden.
 */

.book-stage:not(.is-zoomed) {
  overflow: hidden !important;
}


/* Mobile */

@media (max-width: 700px) {

  .book-stage {
    padding: 14px 42px !important;
  }

}

/* COMPETENZA_FLIPBOOK_HEADER_CANONICAL_START */

/*
 * Einheitliches Branding für
 * Asbest-Navigator,
 * Schimmel-Navigator und Schadstoff-Fibel.
 */

.topbar {
    min-height: 72px;
}


/*
 * Logo größer als bisher.
 */

.topbar .brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.topbar .brand img,
.topbar .brand__logo img,
.topbar img.brand__logo {
    width: auto !important;
    height: 40px !important;
    max-width: 180px !important;
    object-fit: contain;
}


/*
 * Neuer Titelbereich:
 *
 * NAVIGATOR | ASBEST & KMF
 * NAVIGATOR | SCHIMMEL
 * FIBEL      | SCHADSTOFF
 */

.topbar .brand__identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;

    margin-left: 16px;
    padding-left: 16px;

    border-left: 1px solid rgba(255,255,255,.20);

    white-space: nowrap;
}


/*
 * Kategorie weiterhin im Academy-Orange.
 */

.topbar .brand__category {
    color: #ed8008;

    font-size: 11px;
    line-height: 1;

    font-weight: 700;
    letter-spacing: .10em;

    text-transform: uppercase;
}


/*
 * Dezenter Inline-Trenner.
 */

.topbar .brand__separator {
    color: rgba(255,255,255,.34);

    font-size: 16px;
    line-height: 1;

    font-weight: 300;
}


/*
 * Eigentliche Bezeichnung immer weiß.
 */

.topbar .brand__document-title {
    color: #fff;

    font-size: 15px;
    line-height: 1;

    font-weight: 600;
    letter-spacing: .01em;

    text-transform: uppercase;
}


/*
 * Alte zweizeilige Titelgestaltung,
 * falls einzelne Reste noch vorhanden sind,
 * nicht mehr anzeigen.
 */

.topbar .brand__kicker,
.topbar .brand__copy > strong:not(.brand__document-title),
.topbar .brand__text > strong:not(.brand__document-title) {
    display: none;
}


/*
 * Tablet / Mobile:
 * Logo etwas kleiner, Titel bleibt inline,
 * darf bei engem Viewport aber kompakter werden.
 */

@media (max-width: 767px) {

    .topbar {
        min-height: 64px;
    }

    .topbar .brand img,
    .topbar .brand__logo img,
    .topbar img.brand__logo {
        height: 32px !important;
        max-width: 145px !important;
    }

    .topbar .brand__identity {
        gap: 7px;

        margin-left: 10px;
        padding-left: 10px;
    }

    .topbar .brand__category {
        font-size: 9px;
    }

    .topbar .brand__separator {
        font-size: 13px;
    }

    .topbar .brand__document-title {
        font-size: 12px;
    }

}


/*
 * Sehr kleine Viewports:
 * weiterhin eine Zeile, aber kompakter.
 */

@media (max-width: 480px) {

    .topbar .brand img,
    .topbar .brand__logo img,
    .topbar img.brand__logo {
        height: 28px !important;
        max-width: 126px !important;
    }

    .topbar .brand__identity {
        gap: 5px;

        margin-left: 8px;
        padding-left: 8px;
    }

    .topbar .brand__category {
        font-size: 8px;
        letter-spacing: .07em;
    }

    .topbar .brand__document-title {
        font-size: 10px;
    }

}

/* COMPETENZA_FLIPBOOK_HEADER_CANONICAL_END */

/* COMPETENZA_FLIPBOOK_HEADER_REPLACE_FIX_START */

/*
 * Nur noch der neue Inline-Titel.
 * Alte Header-Texte werden vollständig ausgeblendet.
 */

.topbar .brand__kicker,
.topbar .brand__copy,
.topbar .brand__text,
.topbar .brand__meta {
    display: none !important;
}

.topbar .brand__identity {
    display: flex !important;
    align-items: center;
    gap: 10px;

    margin-left: 16px;
    padding-left: 16px;

    border-left: 1px solid rgba(255,255,255,.22);

    white-space: nowrap;
}

.topbar .brand__category {
    color: #ed8008 !important;

    font-size: 11px;
    line-height: 1;

    font-weight: 700;
    letter-spacing: .10em;

    text-transform: uppercase;
}

.topbar .brand__separator {
    color: rgba(255,255,255,.38);

    font-size: 15px;
    line-height: 1;
}

.topbar .brand__document-title {
    display: inline !important;

    color: #fff !important;

    font-size: 14px;
    line-height: 1;

    font-weight: 600;
    letter-spacing: .025em;

    text-transform: uppercase;
}

/*
 * Logo größer.
 */

.topbar .brand img {
    height: 42px !important;
    width: auto !important;
    max-width: 190px !important;
}

/* COMPETENZA_FLIPBOOK_HEADER_REPLACE_FIX_END */


/* =========================================================
   COMPETENZA MOBILE TOPBAR V2
   ========================================================= */

@media (max-width: 700px) {

  /*
   * Eine einzige kompakte Bedienzeile.
   * Kein Umbruch und kein gegenseitiges Überlagern.
   */

  .topbar {
    height: 58px !important;
    min-height: 58px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    gap: 8px !important;

    padding:
      0
      max(8px, env(safe-area-inset-right))
      0
      max(8px, env(safe-area-inset-left)) !important;

    overflow: hidden !important;
  }


  /*
   * Logo-Bereich darf nur den wirklich
   * benötigten Platz beanspruchen.
   */

  .brand {
    flex:
      0
      1
      122px !important;

    width: 122px !important;
    min-width: 0 !important;
    max-width: 122px !important;

    gap: 0 !important;

    overflow: hidden !important;
  }


  .brand__logo {
    display: block !important;

    width: 118px !important;
    max-width: 118px !important;
    height: auto !important;
    max-height: 34px !important;

    object-fit: contain !important;
    object-position: left center !important;

    flex: 0 0 auto !important;
  }


  /*
   * Dokumenttitel mobil ausblenden.
   * Auf 393 px bringt er keinen Mehrwert
   * gegenüber dem sichtbaren Dokument selbst.
   */

  .brand__divider,
  .brand__document {
    display: none !important;
  }


  /*
   * Rechte Bediengruppe kompakt halten.
   */

  .topbar__right {
    flex:
      0
      0
      auto !important;

    min-width: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;

    gap: 5px !important;
  }


  /*
   * Seitenzähler
   */

  .page-indicator {
    width: auto !important;
    min-width: 54px !important;
    height: 40px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 0 8px !important;

    border-radius: 8px !important;

    font-size: 12px !important;
    line-height: 1 !important;

    white-space: nowrap !important;

    flex: 0 0 auto !important;
  }


  .page-indicator__separator {
    margin:
      0
      4px !important;
  }


  /*
   * Aktionsbuttons:
   * 40 × 40 px = mobil gut bedienbare Touchfläche.
   */

  .topbar__actions.toolbar {
    flex:
      0
      0
      auto !important;

    display: flex !important;
    align-items: center !important;

    gap: 4px !important;

    min-width: 0 !important;

    padding: 0 !important;
  }


  .topbar__actions.toolbar .btn {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;

    height: 40px !important;
    min-height: 40px !important;

    padding: 0 !important;

    display: grid !important;
    place-items: center !important;

    flex: 0 0 40px !important;

    font-size: 16px !important;
    line-height: 1 !important;

    border-radius: 8px !important;
  }

}


/*
 * Besonders schmale Smartphones.
 */

@media (max-width: 380px) {

  .brand {
    flex-basis: 105px !important;

    width: 105px !important;
    max-width: 105px !important;
  }


  .brand__logo {
    width: 102px !important;
    max-width: 102px !important;
  }


  .page-indicator {
    min-width: 50px !important;

    padding:
      0
      6px !important;
  }


  .topbar__right {
    gap: 4px !important;
  }


  .topbar__actions.toolbar {
    gap: 3px !important;
  }


  .topbar__actions.toolbar .btn {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;

    height: 38px !important;
    min-height: 38px !important;

    flex-basis: 38px !important;
  }

}


/* =========================================================
   COMPETENZA LANDSCAPE VIEWER V1
   Mehr Fläche für die PDF im Querformat
   ========================================================= */

@media (orientation: landscape) and (max-height: 720px) {

  /*
   * Top- und Bottom-Bar etwas kompakter.
   * Dadurch gewinnt der eigentliche Viewer spürbar Höhe.
   */

  .app-shell {
    grid-template-rows:
      54px
      minmax(0, 1fr)
      54px !important;
  }


  .topbar {
    height: 54px !important;
    min-height: 54px !important;

    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }


  /*
   * Logo im Landscape etwas kompakter,
   * ohne das Desktop-Branding grundsätzlich zu verändern.
   */

  .brand__logo {
    max-height: 34px !important;
  }


  /*
   * Rechte Topbar-Controls etwas flacher.
   */

  .page-indicator {
    height: 38px !important;
    min-height: 38px !important;
  }


  .topbar__actions.toolbar .btn {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
  }


  /*
   * Entscheidend:
   * deutlich weniger vertikaler Innenabstand im Viewer.
   *
   * Die vorhandene JS-Fit-Berechnung misst stage.clientHeight
   * und rendert die PDF anschließend automatisch größer.
   */

  .book-stage {
    padding:
      10px
      64px !important;
  }


  /*
   * Zoomleiste ebenfalls kompakter.
   */

  .controlbar {
    height: 54px !important;
    min-height: 54px !important;

    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }


  .controlbar__inner {
    min-height: 0 !important;
  }


  .controlbar__btn {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
  }

}


/*
 * Sehr flache Landscape-Displays,
 * z. B. Smartphones quer.
 */

@media (orientation: landscape) and (max-height: 500px) {

  .app-shell {
    grid-template-rows:
      48px
      minmax(0, 1fr)
      48px !important;
  }


  .topbar {
    height: 48px !important;
    min-height: 48px !important;
  }


  .book-stage {
    padding:
      6px
      54px !important;
  }


  .controlbar {
    height: 48px !important;
    min-height: 48px !important;

    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }


  .controlbar__btn {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
  }

}
