/* ============================================================
   WELCOME-SEITE mit Gewerk-Auswahl (Handwerk-Style)
   Fonts: Instrument Sans (Body) + Cabinet Grotesk (Headlines)
   ============================================================ */

body.welcome-body {
  margin: 0;
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  color: #1a1a1a;
  background: #FAF8F5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.welcome-page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.25rem;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(255, 138, 76, 0.08), transparent 55%),
    radial-gradient(800px 500px at 100% 100%, rgba(74, 127, 167, 0.06), transparent 60%),
    #FAF8F5;
}

.welcome-card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 20px;
  padding: 3rem 2.5rem 2.5rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08),
              0 4px 12px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.04);
}

.welcome-logo {
  display: block;
  margin: 0 auto 1.5rem;
  height: 44px;
  width: auto;
}

.welcome-logo-text {
  text-align: center;
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 auto 1.5rem;
}

.welcome-live-pill {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  background: rgba(58, 143, 92, 0.12);
  border: 1px solid rgba(63, 217, 127, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #2d7a4f;
  margin: 0 auto 0.875rem;
}

.welcome-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3FD97F;
  box-shadow: 0 0 6px #3FD97F;
  animation: blink 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

.welcome-kicker {
  text-align: center;
  color: #FF5C1A;
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.875rem;
}

.welcome-title {
  text-align: center;
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 1rem;
}

.welcome-brand {
  background: linear-gradient(135deg, #FF8A4C 0%, #FF5C1A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  text-align: center;
  color: #475569;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 520px;
  margin: 0 auto 2.25rem;
}

/* ============================================================
   GEWERK-BUTTON-GRID
   ============================================================ */
.gewerk-section {
  margin: 0 0 2rem;
}

.gewerk-label {
  text-align: center;
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.gewerk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.gewerk-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1.25rem 0.75rem;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(.4, 0, .2, 1);
  font-family: 'Instrument Sans', sans-serif;
  color: #0f172a;
  text-align: center;
  min-height: 110px;
}

.gewerk-btn:hover {
  border-color: #FF8A4C;
  background: #FFF8F1;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 92, 26, 0.15);
}

.gewerk-btn:active {
  transform: translateY(0);
}

.gewerk-icon {
  font-size: 1.625rem;
  line-height: 1;
}

.gewerk-name {
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.1;
}

.gewerk-sub {
  font-size: 0.7rem;
  color: #64748B;
  line-height: 1.3;
  font-weight: 500;
}

.gewerk-other {
  background: linear-gradient(135deg, #FFF4EA 0%, #FFFBF5 100%);
  border-color: #FFE4CC;
  border-style: dashed;
}

.gewerk-other:hover {
  background: linear-gradient(135deg, #FFE4CC 0%, #FFF4EA 100%);
  border-style: solid;
}

.gewerk-other-hint {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #FFF4EA 0%, #FFFBF5 100%);
  border: 1px solid #FFE4CC;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #5C3B1E;
  animation: hint-in 0.3s ease-out;
}

.gewerk-other-hint a {
  color: #FF5C1A;
  font-weight: 600;
  text-decoration: none;
}

.gewerk-other-hint a:hover {
  text-decoration: underline;
}

@keyframes hint-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-footer {
  text-align: center;
  color: #94A3B8;
  font-size: 0.8125rem;
  padding-top: 1.5rem;
  border-top: 1px solid #F1F5F9;
}

.welcome-footer a {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
}

.welcome-footer a:hover {
  color: #FF5C1A;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .welcome-card {
    padding: 2rem 1.5rem 1.5rem;
    border-radius: 16px;
  }
  .welcome-title {
    font-size: 2rem;
  }
  .gewerk-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gewerk-btn {
    min-height: 100px;
    padding: 1rem 0.5rem;
  }
  .gewerk-name {
    font-size: 0.9375rem;
  }
  .gewerk-sub {
    font-size: 0.65rem;
  }
}


/* ============================================================
   GEWERK-BADGE im App-Header (wird statt mode-switch angezeigt)
   ============================================================ */
.gewerk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: linear-gradient(135deg, #FFF4EA 0%, #FFFBF5 100%);
  border: 1px solid #FFE4CC;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
  color: #5C3B1E;
  margin-left: 0.5rem;
}

.gewerk-badge-icon {
  font-size: 1.05rem;
}

.gewerk-badge-text {
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
}

.gewerk-change {
  color: #C9531C;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1;
  margin-left: 0.25rem;
  padding: 0 0.25rem;
  border-radius: 50%;
  transition: background 0.15s;
}

.gewerk-change:hover {
  background: rgba(201, 83, 28, 0.12);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (min-width: 768px) {
  .welcome-page {
    padding-top: 6rem;
  }
}


/* ============================================================
   UPLOAD-KARTE STATES (Analyse, Learning) — Orange-Branding
   ============================================================ */
.upload-card.is-analyzing {
  background: linear-gradient(135deg, #FFEADA 0%, #FFF7EE 100%) !important;
  border-color: #FF8A4C !important;
  border-style: solid !important;
  cursor: wait;
}

.upload-card.is-learned {
  background: linear-gradient(135deg, #E8F3E8 0%, #F5FBF5 100%) !important;
  border-color: #3BA55D !important;
  border-style: solid !important;
  cursor: default;
}

.upload-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.up-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 92, 26, 0.18);
  border-top-color: #FF5C1A;
  border-radius: 50%;
  animation: up-spin 0.8s linear infinite;
}

@keyframes up-spin {
  to { transform: rotate(360deg); }
}

.up-stage {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #FF5C1A;
  text-align: center;
}

.up-detail {
  font-size: 0.7rem;
  color: #6A5F5F;
  text-align: center;
  min-height: 1em;
}

.learned-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.learned-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3BA55D;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.learned-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #2B4E35;
  line-height: 1.2;
  margin-bottom: 2px;
}

.learned-sub {
  font-size: 0.7rem;
  color: #4A5A4E;
  line-height: 1.4;
}


/* ============================================================
   HEADER-BRAND (Ersatz für altes SVG-Logo)
   Normale Schrift, fett, verlinkt zu /handwerk
   ============================================================ */
.header-brand {
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 1.375rem;
  font-style: normal;
  letter-spacing: -0.01em;
  color: #1A1F2E;
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  padding: 6px 4px;
  transition: opacity 0.15s;
}

.header-brand:hover {
  opacity: 0.7;
}

.header-brand .brand-accent {
  color: #FF5C1A;
  margin-left: 2px;
}

/* ============================================================
   MOBILE-OPTIMIERUNG App-Header
   ============================================================ */
@media (max-width: 720px) {
  /* Logout-Button ausblenden auf Mobile */
  .logout-btn {
    display: none !important;
  }

  /* Mode-Switch im Header ausblenden auf Mobile
     (wird bei Schreiner via JS als Buttons in Schnellvorlagen injected) */
  .mode-switch {
    display: none !important;
  }

  /* Header kompakter: flex-wrap + kleinere Abstände */
  .app-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem !important;
  }

  .header-left, .header-right {
    gap: 0.5rem !important;
  }

  .header-brand {
    font-size: 1.125rem;
    padding: 4px 2px;
  }

  .gewerk-badge {
    padding: 0.3rem 0.7rem;
    font-size: 0.8125rem;
    margin-left: 0;
  }

  .gewerk-badge-text {
    font-size: 0.8125rem;
  }

  /* Kundenname: max-width + ellipsis, kein Logo */
  .kunde-info {
    max-width: 60vw;
  }
  .kunde-info .kunde-logo {
    display: none;
  }
  .kunde-name {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .kunde-status {
    font-size: 0.7rem;
  }
}

/* ============================================================
   MODE-SWITCH als Template-Buttons (Mobile Schreiner)
   wird via JS mit Klasse .qt-mode-btn eingefügt
   ============================================================ */
.qt-button.qt-mode-btn {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  color: #1A1F2E;
  font-weight: 600;
  position: relative;
}

.qt-button.qt-mode-btn.active {
  background: #FF5C1A !important;
  border-color: #FF5C1A !important;
  color: #fff !important;
}

.qt-button.qt-mode-btn .mode-icon {
  margin-right: 4px;
}


/* ============================================================
   MOBILE VIEWPORT-LOCK
   Verhindert horizontalen Scroll auf iPhone/Android
   (irgendein Element ragt sonst minimal über die Viewport-Breite)
   ============================================================ */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-text-size-adjust: 100%;
}

/* Sicherheits-Box: alle Top-Level Container respektieren Viewport */
.welcome-page,
.welcome-card,
.app-header,
.phase-1,
.phase-2,
main {
  max-width: 100vw;
  box-sizing: border-box;
}

/* Bilder, iframes, tables nie breiter als Container */
img, iframe, table, video {
  max-width: 100%;
  height: auto;
}

/* Mobile-spezifisch: Touch-Target & Scroll-Hardening */
@media (max-width: 720px) {
  html, body {
    width: 100%;
    overflow-x: hidden !important;
    position: relative;
  }

  /* Padding-Reduktion damit nichts überquillt */
  .phase-1-grid,
  .phase-2-grid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Form-Inputs nie breiter als Viewport */
  input, textarea, select, button {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Position-Cards & Top-Cards mobile-tight */
  .position-card,
  .top-cards,
  .form-block,
  .form-row,
  .pdf-toolbar,
  .chat-input-wrapper {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Chat-Bubbles dürfen den Container nicht sprengen */
  .msg-bubble {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Preview-PDF: scrollbar im Container, nicht ganzer Page */
  .preview-pdf,
  .pdf-viewer {
    max-width: 100%;
    overflow-x: auto;
  }
}


/* ============================================================
   "ANGEBOT AN KUNDEN SENDEN" Button (grün)
   ============================================================ */
.cta-send {
  background: linear-gradient(135deg, #3BA55D 0%, #2D8049 100%);
  color: #fff;
  border: 1px solid #2D8049;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 12px rgba(59, 165, 93, 0.25);
  white-space: nowrap;
}

.cta-send:hover {
  background: linear-gradient(135deg, #2D8049 0%, #1F5D34 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 165, 93, 0.35);
}

.cta-send:active {
  transform: translateY(0);
}

/* ============================================================
   DEMO-MODAL — Oasis-Welcome-Style
   ============================================================ */
.demo-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: modal-fade-in 0.2s ease-out;
}

.demo-modal[hidden] {
  display: none !important;
}

.demo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.demo-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem 2.25rem 2rem;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25),
              0 8px 20px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.04);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  text-align: center;
  animation: modal-slide-up 0.28s cubic-bezier(.4, 0, .2, 1);
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.demo-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.875rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-modal-close:hover {
  background: #F1F5F9;
  color: #0f172a;
}

.demo-modal-icon {
  font-size: 2.75rem;
  line-height: 1;
  margin-bottom: 0.875rem;
}

.demo-modal-title {
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-weight: 800;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 1rem;
}

.demo-modal-text {
  color: #475569;
  font-size: 0.9375rem;
  line-height: 1.65;
  margin: 0 0 1.5rem;
}

.demo-modal-text strong {
  color: #0f172a;
  font-weight: 700;
}

.demo-modal-cta {
  width: 100%;
  margin-bottom: 1rem;
}

.demo-modal-footer {
  font-size: 0.8125rem;
  color: #94A3B8;
  padding-top: 1rem;
  border-top: 1px solid #F1F5F9;
}

.demo-modal-footer a {
  color: #FF5C1A;
  font-weight: 600;
  text-decoration: none;
}

.demo-modal-footer a:hover {
  text-decoration: underline;
}

/* Mobile-Anpassungen */
@media (max-width: 640px) {
  .demo-modal-card {
    padding: 2rem 1.5rem 1.5rem;
    border-radius: 16px;
  }
  .demo-modal-title {
    font-size: 1.375rem;
  }
  .demo-modal-icon {
    font-size: 2.25rem;
  }
  .cta-send {
    font-size: 0.875rem;
    padding: 0.55rem 0.9rem;
  }
}


/* ============================================================
   WELCOME-TOP-NAV (im Stil der /handwerk-Navigation)
   Glassmorphism Pill-Bar, fixed top
   ============================================================ */
.welcome-nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 1180px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(10, 22, 40, 0.08);
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(10, 22, 40, 0.08),
              0 1px 0 rgba(255, 255, 255, 0.6) inset;
  z-index: 1000;
}

.welcome-nav .nav-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 58px;
  padding: 0 10px 0 22px;
}

.welcome-nav .nav-logo-wrap {
  display: flex;
  align-items: center;
}

.welcome-nav .nav-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  line-height: 1;
}

.welcome-nav .nav-favicon {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

.welcome-nav .nav-brand {
  font-family: 'Cabinet Grotesk', 'Instrument Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  color: #0A1628;
  letter-spacing: -0.02em;
  line-height: 1;
}

.welcome-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.welcome-nav .nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(10, 22, 40, 0.06);
  border: 1px solid rgba(10, 22, 40, 0.12);
  border-radius: 999px;
  color: rgba(10, 22, 40, 0.78);
  text-decoration: none;
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.18s ease;
}

.welcome-nav .nav-back-btn:hover {
  background: rgba(10, 22, 40, 0.12);
  border-color: rgba(10, 22, 40, 0.2);
  color: #0A1628;
}

.welcome-nav .nav-back-label-short { display: none; }

/* Welcome-Page bekommt Top-Padding wegen fixer Nav */
.welcome-page {
  padding-top: 7rem !important;
}

/* Mobile-Anpassungen */
@media (max-width: 720px) {
  .welcome-nav {
    top: 12px;
    width: calc(100% - 20px);
  }
  .welcome-nav .nav-in {
    height: 50px;
    padding: 0 8px 0 16px;
  }
  .welcome-nav .nav-brand { font-size: 1.2rem; }
  .welcome-nav .nav-favicon { width: 20px; height: 20px; }
  .welcome-nav .nav-back-btn {
    padding: 7px 12px;
    font-size: 0.8rem;
  }
  .welcome-nav .nav-back-label { display: none; }
  .welcome-nav .nav-back-label-short { display: inline; }
  .welcome-page { padding-top: 5.5rem !important; }
}


/* ============================================================
   MOBILE FLOATING CTA (Oasis-Demo only)
   Sticky Button am unteren Bildschirmrand für "Angebot erstellen"
   - User muss nicht ans Ende scrollen
   - Verschwindet wenn Phase 2 aktiv ist (kein Generate mehr nötig)
   ============================================================ */
@media (max-width: 720px) {
  .mobile-floating-cta {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 90px;   /* lässt Platz für Paul-Bubble rechts (56px + 16px margin + 18px gap) */
    z-index: 9000;
    padding: 14px 18px;
    background: linear-gradient(135deg, #FF8A4C 0%, #FF5C1A 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: 'Instrument Sans', system-ui, sans-serif;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 92, 26, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    animation: cta-float-in 0.4s cubic-bezier(.4, 0, .2, 1);
  }

  .mobile-floating-cta:hover,
  .mobile-floating-cta:active {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(255, 92, 26, 0.5),
                0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .mobile-floating-cta[hidden],
  .mobile-floating-cta.hidden {
    display: none !important;
  }

  /* Etwas zusätzlicher Bottom-Padding am Form-Ende, damit sticky Button keine Inhalte verdeckt */
  .phase-1 .form-column {
    padding-bottom: 90px !important;
  }
}

@keyframes cta-float-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MOBILE PDF-VIEWER FIX (Phase 2, Oasis-Demo only)
   Verhindert dass die generierte Vorschau rechts abgeschnitten wird
   ============================================================ */
@media (max-width: 720px) {
  .phase-2-grid {
    display: flex !important;
    flex-direction: column !important;
    padding: 0.75rem !important;
    gap: 0.75rem;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .pdf-column,
  .chat-column {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
  }

  .pdf-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    max-width: 100%;
  }

  .pdf-toolbar button {
    font-size: 0.85rem;
    padding: 8px 12px;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* WICHTIGSTER FIX: PDF-Viewer Container voll responsiv */
  .pdf-viewer {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding: 8px !important;
  }

  /* Inner-Content im PDF-Viewer (das renderPDFTemplate-Output) skaliert sauber runter */
  .pdf-viewer > div,
  .pdf-viewer table,
  .pdf-viewer .pdf-document {
    max-width: 100% !important;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .pdf-viewer table {
    table-layout: auto;
    font-size: 0.78rem !important;
  }

  /* Chat im Phase 2 unter PDF auf Mobile */
  .chat-column {
    height: 65vh;
    max-height: 600px;
  }

  .pdf-versions select {
    max-width: 100%;
    box-sizing: border-box;
  }
}
