  :root {
    --accent: #f6cd48;
    --border-outer: #000000;
    --border-inner: #555555;
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f3f4f7;
    color: #111827;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* ===== Header wie auf home.html (vereinfacht) ===== */
  header.chrome {
    position: sticky;
    top: 16px;
    z-index: 1000;
    margin: 16px auto;
    width: min(1280px, 100% - 48px);
    border-radius: 999px;
    padding: 14px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(240,240,240,.6));
    backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 18px 40px rgba(15,23,42,.12);
  }

  .logo{
  display:flex;
  align-items:center;
  text-decoration:none;
}

.logo .pv-logo{
  height:32px;
  width:auto;
  display:block;
}


  .appmenu {
    position: relative;
    z-index: 50;
  }

  .appmenu-btn {
    display: grid;
    grid-template-columns: repeat(2, 12px);
    grid-template-rows: repeat(2, 12px);
    gap: 3px;
    padding: 14px;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 14px;
    transition: transform 0.35s ease;
    transform-origin: center;
  }

  .appmenu-btn .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
  }

  .appmenu.open .appmenu-btn { transform: rotate(90deg); }

  .appmenu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 12px 10px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.85));
    backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 10px 30px rgba(15,23,42,.12);
    transform-origin: top right;
    transform: scale(.98) translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
  }

  .appmenu.open .appmenu-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
  }

  .appmenu-panel .menu-list {
    display: grid;
    gap: 6px;
  }

  .appmenu-panel .menu-item {
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
  }

  .appmenu-panel .menu-item:hover {
    background: rgba(0,0,0,.06);
    text-decoration: none;
  }

  /* ===== Layout für PDF-Designer ===== */
  main {
    flex: 1;
    padding: 20px 16px 40px;
    display: flex;
    justify-content: center;
  }

  .designer-shell {
    width: 100%;
    max-width: 1400px;                     /* genug Platz für beide Spalten */
    margin: 0 auto;
    display: grid;
    grid-template-columns: 420px 1fr;      /* links fix, rechts flexibel */
    gap: 48px;                             /* Abstand zwischen Panel & Blatt */
    align-items: flex-start;
  }

  @media (max-width: 960px) {
    .designer-shell {
      grid-template-columns: 1fr;
    }
  }

  .panel-card,
  .doc-card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15,23,42,.08);
    padding: 18px 18px 20px;
  }

  /* linkes Panel wird nie breiter als seine Spalte */
  .panel-card {
    width: 100%;
    max-width: 420px;
  }

  .doc-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .panel-title {
    font-weight: 600;
    margin-bottom: 8px;
  }

  .sub {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 14px;
  }

  .panel-section {
    margin-bottom: 16px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
  }

  .panel-section:first-of-type {
    border-top: 0;
    padding-top: 0;
  }

  label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #4b5563;
  }

  input[type="color"] {
    width: 40px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: transparent;
    cursor: pointer;
  }

  input[type="number"],
  select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
  }

  .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: center;
  }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;                    /* mehr Abstand zwischen Buttons */
    align-items: center;
    justify-content: flex-start;
    border-radius: 20px;        /* echte Pille */
    background: #f5f6f7;        /* etwas heller, schöner */
    padding: 10px 14px;         /* WICHTIG: mehr Innenabstand oben/unten */
    border: 1px solid #e5e7eb;
    font-size: 13px;
}

/* Buttons exakt mittig */
.tool-btn {
    border: 0;
    background: transparent;
    padding: 6px 10px;          /* mehr vertikaler Raum */
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.tool-btn:hover,
.tool-btn.active {
    background: #e5e7eb;
}

  .tool-btn {
    border: 0;
    background: transparent;
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
  }

  .tool-btn.active,
  .tool-btn:hover {
    background: #e5e7eb;
  }

  .toolbar select,
  .toolbar input[type="color"] {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 4px 8px;
    font-size: 12px;
  }

  /* ===== Die Seite (weißes Blatt) ===== */

  .page-wrapper {
    background: repeating-linear-gradient(
      45deg,
      #d1d5db22,
      #d1d5db22 10px,
      transparent 10px,
      transparent 20px
    );
    border-radius: 20px;
    padding: 20px;
    display: flex;
    justify-content: center;
    width: 100%;
  }



/* Innenlinie mit gleichmäßigem Abstand von allen Seiten */

/* ===== Download-Button ===== */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;

  background: #2F5FD7;                 /* ✅ gleiches Blau */
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;

  box-shadow: 0 10px 24px rgba(47,95,215,.28);
  text-decoration: none;               /* kein Unterstrich normal */
}

/* Hover */
.btn-download:hover{
  background: #244DBA;                 /* ✅ gleiches Hover-Blau */
  box-shadow: 0 12px 28px rgba(47,95,215,.38);
  transform: translateY(-1px);

  text-decoration: underline;          /* ✅ Unterstrich */
  text-decoration-color: #ffffff;      /* weiß */
  text-underline-offset: 4px;
}

/* Active */
.btn-download:active{
  transform: translateY(0);
  box-shadow: none;
}

  /* ===== Footer minimal ===== */
  footer {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
  }

  .footer-copy {
  margin-top: 20px;
  font-size: 11.5px;
  color: rgba(0,0,0,0.55);
  text-align: center;
}

    .footer-copy {
  letter-spacing: 0.2px;
}

    .panel-title-with-icon{
  display:flex;
  align-items:center;
  gap:12px;
}

.panel-title-icon{
  width:54px;
  height:auto;
  flex-shrink:0;
  border-radius:8px;
}







.row-top-space { margin-top: 8px; }
.toolbar-top-space { margin-top: 8px; }
.label-inline { margin-left: 4px; }
.export-sub { margin-top: 4px; }

.page-nav{
  width:210mm;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0;
}

.btn-nav{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid #e5e7eb;
  background:#ffffff;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
}

.btn-nav:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.page-indicator{
  display:flex;
  gap:8px;
  align-items:center;
  font-size:13px;
  color:#4b5563;
}

#pagesContainer{
  width:100%;
  display:block; /* wichtig: nicht flex, sonst nebeneinander beim Export/Debug */
}

.pdf-page{
  position:relative;
  width:210mm;
  height:296.8mm;
  margin:0 auto;
  background:#ffffff;
  box-shadow:0 18px 40px rgba(15,23,42,.18);
  border-radius:0;
  padding:0;
  overflow:hidden;
  border:1.5mm solid var(--border-outer);

  page-break-after:always;
  break-after:page;
}

.pdf-page:last-child{
  page-break-after:auto;
  break-after:auto;
}

.pdf-inner-border{
  position:absolute;
  top:6mm;
  bottom:6mm;
  left:6mm;
  right:6mm;
  border:0.6mm solid var(--border-inner);
  pointer-events:none;
  box-sizing:border-box;
}

.pdf-content{
  position:absolute;
  top:12mm;
  left:12mm;
  right:12mm;
  bottom:12mm;
  overflow:hidden;
  outline:none;
  line-height:1.5;
}

.page-nav-wrapper{
  width:100%;
  display:flex;
  justify-content:center;
  margin-bottom:12px;
}

.page-delete-btn{
   position: static;
   margin-left: 12px;

  width:32px;
  height:32px;
  border-radius:999px;

  border:2px solid #ef4444;
  background:#fee2e2;   /* sofort rot hinterlegt */
  color:#b91c1c;        /* dunkles Rot fürs ✕ */

  cursor:pointer;
  font-weight:800;
  font-size:18px;
  line-height:1;

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

  z-index:10;
  transition: all .15s ease;
}

.page-delete-btn:hover{
  background:#ef4444;
  color:#ffffff;
  transform:scale(1.05);
}





/* =======================
   PRINT FINAL (STABIL & KORREKT)
   ======================= */
@media print {

  /* UI ausblenden */
  header.chrome,
  .panel-card,
  footer,
  .page-nav-wrapper,
  .btn-download {
    display: none !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    caret-color: transparent !important; /* Cursor NIE drucken */
  }

  main { padding: 0 !important; }
  .designer-shell { display: block !important; max-width: none !important; }
  .doc-card { box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
  .page-wrapper { background: none !important; padding: 0 !important; }

  /* ===== Seite ===== */
  .pdf-page{
    position: relative !important;
    box-sizing: border-box !important;
    width: 210mm !important;
    height: 296.8mm !important;
    margin: 0 auto !important;

    /* BORDER BLEIBT für Geometrie, aber unsichtbar */
    border: var(--outerW, 2px) solid transparent !important;
    box-shadow: none !important;

    page-break-after: always !important;
    break-after: page !important;

    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .pdf-page:last-child{
    page-break-after: auto !important;
    break-after: auto !important;
  }

  /* Sichtbarer Außenrahmen – überall exakt gleich dick */
  .pdf-page::before{
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 var(--outerW, 2px) var(--border-outer, #000);
    pointer-events: none;
  }

  /* ===== Innenrahmen ===== */
  .pdf-inner-border{
    position: absolute !important;
    top: 6mm;
    right: 6mm;
    bottom: 6mm;
    left: 6mm;

    /* Border bleibt für Layout, aber unsichtbar */
    border: var(--innerW, 1px) solid transparent !important;
    box-shadow: none !important;
  }

  /* Sichtbarer Innenrahmen */
  .pdf-inner-border::before{
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 var(--innerW, 1px) var(--border-inner, #555);
    pointer-events: none;
  }

  /* Content darf im Print nicht clippen */
  .pdf-content{
    overflow: visible !important;
    caret-color: transparent !important;
  }

  /* verhindert hässliche Seitensplits */
  .pdf-content *{
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* A4 – leichter Sicherheitsrand (Druckerfreundlich) */
@page{
  size: A4;
  margin: 2mm;
}

/* 📱 Mobile Header – Logo näher an den Rand */
@media (max-width: 640px){

  header.chrome{
    padding: 12px 12px;     /* vorher ~14px 16–40px → weniger Innenrand */
  }

  /* Logo minimal optisch ausbalancieren */
  .logo{
    margin-left: 0;         /* falls irgendwo Margin sitzt → weg */
  }

  .logo .pv-logo{
    margin-left: -2px;      /* Optical alignment (Logo wirkt mittiger) */
  }
}
