/*
 * layout.css — Evidence-First System
 * Shell, Grid, Spacing, Layout-Architektur.
 * Keine Farbwerte — ausschließlich CSS-Variablen aus theme.css.
 *
 * =========================================================
 * LAYOUT.CSS STRUCTURE
 * =========================================================
 *
 *   01  FOUNDATIONS
 *       @font-face, reset, html/body/base
 *
 *   02  SHELL
 *       #app, #content-fade-bottom, #btn-back, #ui-controls
 *
 *   03  LAYOUT CONTAINERS
 *       .app-stage, .app-main, .phase-content
 *       .app-sidebar + Sidebar-Sub-Komponenten (Desktop)
 *
 *   04  RESPONSIVE ARCHITECTURE
 *       Mobile Responsive Shell, Desktop Restore, Print
 *       Mobile-first overrides (components.css)
 *       Mobile Korrekturen, Keyboard Fix, Glassmorphism
 *
 *   05  MIXED STRUCTURAL UI
 *       Blöcke mit gemischter Layout/Component-Verantwortung.
 *       Vor Extraktion prüfen.
 *
 *   06  FEATURE CLUSTERS LEFT IN LAYOUT
 *       Dashboard, AI Assistant Chat, Coaching
 *       Noch nicht nach components.css migriert.
 *
 *   07  LEGACY / VERIFY
 *       Alte Migrations-Platzhalter, leere Blöcke, orphaned Fragmente.
 *
 * =========================================================
 */

/* =========================================================
   01 — FOUNDATIONS
   @font-face, Reset, html/body/base.
   ========================================================= */

/* --- Font --- */
@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/Satoshi-Variable.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

/* --- Boska (Display Italic für Starke Aussage) --- */
@font-face {
  font-family: 'Boska';
  src: url('../fonts/Boska-Variable.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Boska';
  src: url('../fonts/Boska-VariableItalic.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--surface-page);
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button  { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family:     var(--input-font-family);
  font-size:       var(--input-font-size);
  font-weight:     var(--input-font-weight);
  letter-spacing:  var(--input-letter-spacing);
  line-height:     var(--input-line-height);
  color:           var(--input-text-color);
}
input::placeholder,
textarea::placeholder {
  color:       var(--input-placeholder-color);
  font-weight: var(--input-font-weight);
}
a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.hidden { display: none !important; }

/* =========================================================
   02 — SHELL
   Globale Shell-Ebenen: #app, #content-fade-bottom,
   #btn-back, #ui-controls.
   ========================================================= */

/* --- App Root --- */
#app {
  display: flex;
  flex-direction: row;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* --- Nav Footer Gradient Overlay --- */
#content-fade-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 15;
  display: flex;
  align-items: flex-end;
  padding-bottom: 5px;
}




/* --- UI Controls Layer (position: fixed, z-index 30) --- */
#ui-controls {
  display: none; /* Desktop: Controls nicht sichtbar */
  pointer-events: none; /* Container selbst nicht klickbar */
  z-index: 30;
}

@media (max-width: 600px) {
  #ui-controls {
    display: block;
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 30;
  }

  /* Buttons innerhalb ui-controls: pointer-events an */
  #ui-controls > button {
    pointer-events: auto;
  }
}

/* =========================================================
   03 — LAYOUT CONTAINERS
   .app-stage, .app-main, .phase-content.
   .app-sidebar als struktureller Desktop-Container.
   Sidebar-Sub-Komponenten (Nav-Items, Brand, Footer).
   ========================================================= */

/* --- App Stage (Desktop) --- */
.app-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--surface-page);
}

/* --- Ghost Layer --- */
#ghost-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  background: transparent;
  z-index: 5;
}
#ghost-num {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 56px);
  right: 2px;
  padding-right: 6px;
  font-size: 128px;
  font-weight: var(--fw-heavy);
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--text-faint);
  pointer-events: none;
  user-select: none;
}

/* --- App Main (Desktop) --- */
.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 0 48px 0;
}
@media (max-width: 960px) {
  .app-main { padding: 0 24px 0; }
}
@media (max-width: 600px) {
  .app-main { padding: 0 24px 0; }
}

/* --- Phase Content --- */
.phase-content {
  position: relative;
  padding-top: var(--app-content-offset);
}

/* --- Sidebar (Desktop) --- */
.app-sidebar {
  width: 258px;
  background: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-top {
  padding: var(--space-4) 14px 10px;
  flex-shrink: 0;
}

.sidebar-top-label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 6px;
}

.sidebar-nav .nav-item:first-child {
  margin-bottom: var(--space-2);
}

.nav-section-label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px var(--space-1);
  opacity: .6;
}

/* Nav Item */
.nav-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active {
  background: var(--surface-accent);
  border-left-color: var(--border-accent);
}
.nav-item.locked { opacity: .5; cursor: default; }

.nav-item-num {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  min-width: 22px;
  padding-top: 1px;
  letter-spacing: var(--ls-wide);
}
.nav-item.active .nav-item-num { color: var(--text-on-accent); }

.nav-item-info { flex: 1; min-width: 0; }

.nav-item-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: var(--ls-tight);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item.active .nav-item-title { color: var(--text-on-accent); }

.nav-item-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.4;
}

.nav-item-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: var(--space-1);
  transition: background 0.12s, border-color 0.12s;
}
.nav-item.active .nav-item-check {
  border-color: rgba(0,0,0,0.25);
}
.nav-item-check.done {
  background: var(--text-on-accent);
  border-color: var(--text-on-accent);
}
.nav-item.active .nav-item-check.done {
  background: var(--text-on-accent);
  border-color: transparent;
}
.nav-item-check svg { width: 8px; height: 8px; color: var(--text-accent); }
.nav-item.active .nav-item-check svg { color: var(--text-accent); }

.nav-item-lock {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: var(--space-1);
}
.nav-item-lock svg { width: 10px; height: 10px; color: var(--text-muted); }

/* Sidebar Bottom */
.sidebar-bottom {
  padding: var(--space-3) 14px;
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  flex-shrink: 0;
}
.sidebar-bottom strong { color: var(--text-primary); font-weight: var(--fw-bold); }
.sidebar-bottom a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }

/* Sidebar Brand (top) */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: 15px;
  padding-bottom: 15px;
  padding-left: 14px;
  padding-right: 14px;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--surface-card);
}

.sidebar-brand-slot {
  flex-shrink: 0;
}

/* Sidebar Footer (bottom) */
.sidebar-footer {
  padding: var(--space-3) 49px;
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex-shrink: 0;
}
.sidebar-footer-name {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}
.sidebar-footer-version {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}
.sidebar-footer-version a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* =========================================================
   04 — RESPONSIVE ARCHITECTURE
   Mobile Shell, Desktop Restore, Print, Mobile-first overrides,
   Mobile Korrekturen, Keyboard Fix, Glassmorphism.
   ========================================================= */

/* --- Mobile Responsive Shell (@media max-width: 600px) --- */
@media (max-width: 600px) {

  /* Step Forward Button — fixed unten */
  /* Visual base comes from .btn-step-forward in components.css */
  #btn-step-forward-fixed {
    display: none;
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    left: 44px;
    right: 44px;
    width: auto; /* override width:100% from .btn-step-forward */
    pointer-events: auto;
    z-index: 30;
  }

  [data-page-type="phase_step"] #btn-step-forward-fixed,
  [data-page-type="phase_result"] #btn-step-forward-fixed,
  [data-page-type="phase_handout"] #btn-step-forward-fixed,
  [data-page-type="phase_intro"] #btn-step-forward-fixed,
  [data-page-type="static"] #btn-step-forward-fixed,
  [data-page-type="tier15"] #btn-step-forward-fixed {
    display: flex;
  }

  /* CTA Smart Visibility */
  #btn-step-forward-fixed {
    opacity: 0;
    transition:
      background-color 100ms ease,
      color 100ms ease,
      outline-color 100ms ease,
      opacity 120ms ease;
  }
  #btn-step-forward-fixed[data-cta="visible"] {
    opacity: 1;
  }
  #btn-step-forward-fixed[data-cta="hidden"] {
    opacity: 0;
    pointer-events: none;
  }


  /* Nav-Footer — floating pill buttons on mobile, no gradient block */
  #content-fade-bottom,
  [data-theme="dark"] #content-fade-bottom {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    left: 0;
    right: 0;
    height: auto;
    background: none;
    padding-bottom: 0;
    align-items: center;
    pointer-events: none;
  }

  /* Sidebar: fixed, unter dem Header */
  html {
    position: static;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: none;
  }
  body {
    position: static;
    height: auto;
    overflow: visible;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
  }

  /* #app transparent — kein eigener Hintergrund */
  #app {
    display: block;
    height: auto;
    overflow: visible;
    position: relative;
    z-index: 1;
    background: transparent;
  }

  /* Stage — bewegende Vordergrundebene (PWA-Transforms in layout.pwa.css) */
  .app-stage {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 100dvh;
    background: var(--surface-page);
  }

  .app-main {
    position: relative;
    z-index: 10;
    overflow-y: visible;
    background: transparent;
  }

  /* Main takes full width */
  .app-main {
    padding: 0 24px 0;
    width: 100%;
  }

  /* Mobile: kein padding-top — kein offset mehr */
  .phase-content {
    position: static;
    padding-top: 0;
    background: transparent;
  }

  /* Hide some header items on very small screens */
  .header-progress { display: none !important; }

  /* Collapse label text on small screens */
  .btn-header span,
  .btn-user span {
    display: none;
  }
  .btn-header,
  .btn-user {
    padding: 5px var(--space-2);
  }

  /* Hide save text on mobile — dot is enough */
  #save-text { display: none; }

  /* Phase complete banner below hamburger area */
  #phase-complete-banner { top: 0; font-size: var(--fs-2xs); padding: 9px 14px; padding-top: calc(var(--safe-inset-top) + var(--space-4)); }

  /* Dashboard grid single column */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Desktop Restore — undo mobile fixed overrides --- */
@media (min-width: 769px) {
  #content-fade-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
  }

  /* Step Forward Button — auf Desktop sichtbar, positioniert im Content-Bereich */
  #ui-controls {
    display: block;
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 30;
  }

  #ui-controls > button {
    pointer-events: auto;
  }

  #btn-step-forward-fixed {
    display: none;
    position: fixed;
    bottom: 32px;
    left: calc(258px + 40px);
    right: 40px;
    width: auto;
    pointer-events: auto;
    z-index: 30;
  }

  [data-page-type="phase_step"] #btn-step-forward-fixed,
  [data-page-type="phase_result"] #btn-step-forward-fixed,
  [data-page-type="phase_handout"] #btn-step-forward-fixed,
  [data-page-type="phase_intro"] #btn-step-forward-fixed,
  [data-page-type="static"] #btn-step-forward-fixed,
  [data-page-type="tier15"] #btn-step-forward-fixed {
    display: flex;
  }

  #btn-step-forward-fixed {
    opacity: 0;
    transition:
      background-color 100ms ease,
      color 100ms ease,
      outline-color 100ms ease,
      opacity 120ms ease;
  }
  #btn-step-forward-fixed[data-cta="visible"] {
    opacity: 1;
  }
  #btn-step-forward-fixed[data-cta="hidden"] {
    opacity: 0;
    pointer-events: none;
  }
}

/* --- Print --- */
@media print {
  .app-sidebar,
  .modal-bg,
  #toast,
  #setup-banner,
  .header-actions,
  #readonly-banner { display: none !important; }

  html, body { overflow: visible; height: auto; }
  #app { height: auto; }
  .app-stage { display: block; }
  .app-main { padding: 0; overflow: visible; height: auto; }

  .content-block,
  .callout,
  .examples-block,
  .callout-info,
  .concept-card,
  .summary-card {
    break-inside: avoid;
  }
}

/* Mobile overrides live in components.css */

/* --- Keyboard Fix — iOS visualViewport --- */
@media (max-width: 600px) {
  /* Content-Fade + AI-Button: folgen visualViewport via JS */
  #content-fade-bottom,
  .ai-toggle-btn,
  .ai-chat-wrap {
    transition: bottom 0.15s ease;
  }

  /* Verhindert dass Input-Felder unter Tastatur verschwinden */
  textarea:focus,
  input:focus {
    scroll-margin-bottom: 0;
  }
}

/* --- Nav Controls --- */
@media (max-width: 600px) {
  .nav-ctrl-btn {
    pointer-events: auto;
    position: relative;
    z-index: 30;
    width: 136px;
    flex-shrink: 0;
    border-radius: 20px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
  }
  .nav-ctrl-btn:active {
    transform: scale(0.96);
  }

}

/* --- Glassmorphism — Section Nav, Nav Controls --- */
@media (max-width: 600px) {
  .nav-ctrl-btn {
    background: var(--glass-bg-fallback);
  }

  @supports (backdrop-filter: blur(1px)) {
    .nav-ctrl-btn {
      background: var(--glass-bg);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }
  }

  .nav-ctrl-btn:hover {
    background: rgba(120,120,128,0.32);
  }

  .nav-ctrl-btn--left  { background: var(--glass-bg-fallback); border: 1px solid var(--glass-border); }
  .nav-ctrl-btn--right { background: var(--glass-bg-fallback); border: 1px solid var(--glass-border); }

  @supports (backdrop-filter: blur(1px)) {
    .nav-ctrl-btn--left,
    .nav-ctrl-btn--right {
      background: var(--glass-bg);
    }
  }
}

/* TOP BAR — moved to top-bar.css */
/* Shell-Hide: Desktop — Pill ist nur auf Mobile sichtbar */
#section-nav-trigger { display: none; }
#section-nav-dot     { display: none; }

/* =========================================================
   05 — MIXED STRUCTURAL UI
   Blöcke mit gemischter Layout/Component-Verantwortung.
   Vor Extraktion sorgfältig prüfen.
   ========================================================= */


/* MIXED BLOCK — VERIFY BEFORE EXTRACTION
   .examples-details: Wurde nicht nach components.css migriert.
   Gehört zum Content-Block-System von Tier 1.
   Kandidat für components.css Sektion 05 CONTENT BLOCKS. */
.examples-details {
  margin: var(--space-4) 0 var(--space-3);
}
.examples-summary {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.examples-summary::before {
  content: '›';
  font-size: var(--fs-sm);
  transition: transform 0.15s;
  display: inline-block;
  opacity: 0.8;
}
[data-theme="dark"] .examples-summary {
  color: rgba(255,255,255,0.75);
}
[data-theme="light"] .examples-summary {
  color: rgba(0,0,0,0.65);
}
details[open] .examples-summary::before {
  transform: rotate(90deg);
}
.examples-details .examples-list {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.examples-details .examples-list span {
  font-size: var(--fs-base);
  color: var(--text-muted);
  padding: 6px 10px;
  border-left: 2px solid var(--border-subtle);
  line-height: var(--lh-normal);
}

/* =========================================================
   06 — FEATURE CLUSTERS LEFT IN LAYOUT
   Dashboard, AI Assistant Chat, Coaching.
   Noch nicht nach components.css migriert.
   Bewusst hier belassen bis eigene Migrationssession.
   ========================================================= */

/* --- Dashboard --- */
/* Mission Panel */
.mission-principle {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  color: var(--text-accent);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  margin-top: var(--space-3);
}

/* Grid-Ansicht: 3 Spalten (default) oder 4 Spalten */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-4);
  padding: 0 10px;
}
.dashboard-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-grid--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1300px) {
  .dashboard-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dashboard-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .dashboard-grid,
  .dashboard-grid--4 { grid-template-columns: 1fr; }
}

/* Scroll-Ansicht: horizontaler Scroll */
.dashboard-scroll {
  display: flex;
  flex-direction: row;
  gap: var(--space-4);
  overflow-x: auto;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.dashboard-scroll::-webkit-scrollbar { height: 3px; }
.dashboard-scroll::-webkit-scrollbar-track { background: var(--border-subtle); }
.dashboard-scroll::-webkit-scrollbar-thumb { background: var(--surface-accent); }

.tier-card {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color 0.15s;
  cursor: pointer;
  position: relative;
}

/* Scroll-Variante: feste Breite, snap */
.tier-card--scroll {
  min-width: 260px;
  max-width: 280px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

/* Wide-Variante: Coaching — volle Breite, horizontal */
.tier-card--wide {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}
.tier-card--wide .tier-card-desc { flex: 1; }
.tier-card--wide .tier-card-features { flex: 1; }
@media (max-width: 700px) {
  .tier-card--wide {
    flex-direction: column;
    gap: var(--space-3);
  }
}

/* Coaching Modal */
.modal--coaching { max-width: 480px; }
.tier-card:hover:not(.locked) { border-color: var(--border-accent); }
.tier-card.locked { cursor: default; opacity: .7; }
.tier-card.locked:hover { border-color: var(--border-subtle); }

/* ─────────────────────────────────────────────
   Dashboard-Cards: Snap-Card-Active-Stil
   (transparent + 2-layer gelber Halo)
   Scoped auf .dashboard-grid → Tier 2 Method-Grid bleibt unveraendert.
───────────────────────────────────────────── */
.dashboard-grid .tier-card {
  min-width: 0;
  background: transparent;
  border: 1px solid rgba(255,199,0,0.28);
  border-radius: var(--radius-lg, 12px);
  padding: 18px 20px;
  box-shadow:
    0 0 0 3px rgba(255,199,0,0.05),
    0 0 16px rgba(255,199,0,0.08);
}

html:not([data-theme="dark"]) .dashboard-grid .tier-card {
  border-color: rgba(180,140,0,0.30);
  box-shadow:
    0 0 0 3px rgba(180,140,0,0.06),
    0 0 16px rgba(180,140,0,0.10);
}

/* Hover entfernen — Border bleibt Default-Wert */
.dashboard-grid .tier-card:hover:not(.locked),
.dashboard-grid .tier-card.locked:hover {
  border-color: rgba(255,199,0,0.28);
}
html:not([data-theme="dark"]) .dashboard-grid .tier-card:hover:not(.locked),
html:not([data-theme="dark"]) .dashboard-grid .tier-card.locked:hover {
  border-color: rgba(180,140,0,0.30);
}

/* Locked: Halo bleibt, zusaetzliche Opacity-Dimmung */
.dashboard-grid .tier-card.locked {
  opacity: .5;
}

.tier-card-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-accent);
  border: 1px solid var(--border-accent);
  padding: 3px var(--space-2);
  width: fit-content;
}

.tier-card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
  line-height: var(--lh-tight);
}

.tier-card-desc {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  flex: 1;
}

.tier-card-meta {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.tier-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tier-card-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.tier-card-progress-bar {
  width: 60px;
  height: 2px;
  background: var(--border-subtle);
  overflow: hidden;
}
.tier-card-progress-fill {
  height: 100%;
  background: var(--surface-accent);
}

.tier-card-lock {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--text-muted);
}
.tier-card-lock svg { width: 14px; height: 14px; }

.upgrade-cta {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.upgrade-cta:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Tier card locked state */
.tier-card.locked .tier-card-title { color: var(--text-muted); }

/* Feature list inside tier card */
.tier-card-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-1) 0 var(--space-2);
}
.tier-card-features li {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  padding-left: 15px;
  position: relative;
  line-height: var(--lh-normal);
}
.tier-card-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--surface-accent);
}
.tier-card.locked .tier-card-features li { opacity: .6; }

/* Price tag */
.tier-card-price {
  font-size: var(--fs-md);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.tier-card.locked .tier-card-price { color: var(--text-muted); }
.tier-card-price-note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.tier-card-coming-soon {
  margin-top: var(--space-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Coaching Info-Tooltip */
.tier-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tier-info-icon {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s;
}
.tier-info-icon svg { width: 13px; height: 13px; }
.tier-info-icon:hover { color: var(--text-accent); }

.tier-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 100;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  padding: 14px var(--space-4);
  min-width: 240px;
  box-shadow: var(--shadow-overlay);
  border-radius: var(--radius-md);
}
.tier-tooltip-wrap:hover .tier-tooltip,
.tier-tooltip-wrap:focus-within .tier-tooltip { display: block; }
.tier-tooltip-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.tier-tooltip-item { margin-bottom: var(--space-2); }
.tier-tooltip-item:last-child { margin-bottom: 0; }
.tier-tooltip-label {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin-bottom: 3px;
}
.tier-tooltip-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

/* --- AI Assistant Chat --- */
.ai-chat-wrap {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  right: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  pointer-events: none;
}
.ai-chat-wrap > * {
  pointer-events: auto;
}

/* Toggle Button */
.ai-toggle-btn {
  width: 46px;
  height: 46px;
  background: var(--surface-accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}
.ai-toggle-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}
.ai-toggle-btn svg { width: 20px; height: 20px; }

/* AI Page — Messages + Input (identisch mit bisherigem Panel-Inhalt) */
.ai-messages {
  margin-top: 32px;
  min-height: 300px;
  max-height: 480px;
  overflow-y: auto;
  padding: var(--space-4);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}
.ai-msg {
  max-width: 88%;
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  padding: 9px var(--space-3);
  word-break: break-word;
  white-space: pre-wrap;
}
.ai-msg.user {
  align-self: flex-end;
  background: var(--surface-accent);
  color: var(--text-on-accent);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-md);
}
.ai-msg.assistant {
  align-self: flex-start;
  background: var(--surface-page);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
}
.ai-msg.thinking {
  align-self: flex-start;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: 6px 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ai-thinking-dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ai-blink 1.2s infinite;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Input */
.ai-input-row {
  display: flex;
  gap: var(--space-2);
  padding: 10px var(--space-3);
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.ai-input {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  padding: 7px 10px;
  resize: none;
  height: 36px;
  max-height: 100px;
  outline: none;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-input:hover { border-color: var(--ghost-border-hover); }
.ai-input:focus {
  border-color: #FFC700;
  box-shadow: 0 0 0 1px var(--ghost-ring-focus);
  /* No bg change — .ai-input-row provides the surface */
}
.ai-send-btn {
  background: var(--surface-accent);
  color: var(--text-on-accent);
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.ai-send-btn:hover { opacity: 0.85; }
.ai-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-send-btn svg { width: 15px; height: 15px; }

/* AI-Seite: page-content-wrap als flex container damit ai-messages flex:1 greift */
[data-page-type="ai"] .page-content-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Context bar — oben auf der AI-Seite */
.ai-page-context-bar {
  padding: var(--space-2) 14px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin-bottom: 0;
}
.ai-page-context-bar span { color: var(--text-accent); }

/* AI button: only visible on phases (data-page-type="phase") */
.ai-chat-wrap { display: none !important; }
[data-page-type="phase"] .ai-chat-wrap { display: flex !important; }

@media (max-width: 600px) {
  .ai-chat-wrap { left: auto; right: 16px; }
  /* .ai-messages max-height entfernt — flex:1 übernimmt */
}

/* --- Coaching Chat --- */
.coaching-chat-wrap {
  max-width: 620px;
}

.coaching-msg-ai,
.coaching-msg-user {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.coaching-msg-ai  { align-items: flex-start; }
.coaching-msg-user { align-items: flex-end; align-self: flex-end; }

.coaching-bubble {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  background: var(--surface-card);
  border-radius: var(--radius-md);
}

.coaching-msg-user .coaching-bubble {
  background: var(--surface-accent);
  border-color: var(--border-accent);
  color: var(--text-on-accent);
}

.coaching-loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.coaching-loading-dots {
  display: flex;
  gap: var(--space-1);
}

.coaching-loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--surface-accent);
  animation: coachingDot 1.2s infinite;
}
.coaching-loading-dots span:nth-child(2) { animation-delay: .2s; }
.coaching-loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes coachingDot {
  0%, 80%, 100% { opacity: .2; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}

.coaching-book-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.coaching-book-cta button {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  padding: 13px var(--space-7);
  background: var(--surface-accent);
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-on-accent);
  align-self: flex-start;
}

.coaching-book-cta span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Coaching Component Classes */
.coaching-type-badge {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-accent);
  border: 1px solid var(--border-accent);
  padding: 2px var(--space-2);
  flex-shrink: 0;
}

.coaching-header-row {
  display: flex;
  align-items: center;
}

.coaching-field-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.coaching-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px var(--space-3) var(--space-2);
  transition: border-color 0.15s, background 0.18s, box-shadow 0.15s;
}
.coaching-input:hover { border-color: var(--ghost-border-hover); }
.coaching-input:focus {
  background:   var(--ghost-bg-focus);
  border-color: #FFC700;
  box-shadow:   0 0 0 1px var(--ghost-ring-focus);
  outline: none;
}

.coaching-chat-textarea {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 10px var(--space-3);
  resize: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.coaching-chat-textarea:hover {
  border-color: var(--ghost-border-hover);
  border-right: none;
}
.coaching-chat-textarea:focus {
  border-color: #FFC700;
  border-right: none;
  box-shadow: 0 0 0 1px var(--ghost-ring-focus);
  outline: none;
  /* No bg change — compound control with send button */
}

.coaching-send-btn {
  width: 52px;
  background: var(--surface-accent);
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.coaching-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.coaching-type-btn {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-align: left;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: 20px var(--space-5);
  cursor: pointer;
  transition: border-color .15s;
  width: 100%;
}
.coaching-type-btn:hover {
  border-color: var(--border-accent);
}

.coaching-ghost-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}
.coaching-ghost-btn:hover {
  color: var(--text-primary);
}

.coaching-locked-card {
  max-width: 520px;
  padding: 0 var(--space-8) var(--space-8);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border-radius: var(--radius-md);
}

.coaching-type-label {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-snug);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.coaching-type-desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}


.coaching-input-row {
  display: flex;
  gap: 0;
}

/* =========================================================
   07 — LEGACY / VERIFY
   Alte Migrations-Platzhalter und Überreste.
   Können nach Verifikation entfernt werden.
   ========================================================= */

/* LEGACY BLOCK — VERIFY BEFORE REMOVAL
   Alle folgenden Kommentare sind Migrations-Platzhalter
   aus der CSS-Architekturtrennung. Sie enthalten keinen CSS-Code
   und können entfernt werden sobald verifiziert ist, dass
   die referenzierten Blöcke korrekt in den Zieldateien angekommen sind. */

/* Loading Screen — verschoben nach css/components.css */
/* Nav Controls + Header Components — verschoben nach css/components.css */
/* Auth Screen — verschoben nach css/components.css */
/* Form Elements — verschoben nach css/components.css */
/* Buttons, Messages, Section Labels — verschoben nach css/components.css */
/* Callout System — verschoben nach css/components.css */
/* Content Blocks — verschoben nach css/components.css */
/* Input Table, Phase 05, Radio, Checklist, Clarity, Decision Tree — verschoben nach css/components.css */
/* Settings Page — verschoben nach css/components.css */
/* Modals — verschoben nach css/components.css */
/* Summary / Deliverables + Progress + Phase Sections + Next Step + Prompt — verschoben nach css/components.css */
/* Toast, Phase Complete Banner, Setup Banner — verschoben nach css/components.css */
/* Duration Chips, Intro Components, Phase Overview Grid, Readonly Banner — verschoben nach css/components.css */
/* Info Table — verschoben nach css/components.css */
/* Next Steps, Export Options, Settings Zurück, Nav Context Back — verschoben nach css/components.css */
/* Hero Block + Textarea Popup Modal — verschoben nach css/components.css */
/* Phase Header Meta, Phase Nav Inline, Settings Back Bottom, Context Intro+Accordion, Persona — verschoben nach css/components.css */
/* Install Hint, Update Banner, Landscape Block, Error Fallback — verschoben nach css/components.css */
/* Section Nav Trigger + Dropdown + Goal Card — verschoben nach css/components.css */
/* Block 9 — verschoben nach layout.pwa.css */
/* Block 19 — verschoben nach layout.pwa.css */
/* Block 21 Teil 1 — verschoben nach layout.pwa.css */
/* Block 22 — verschoben nach layout.pwa.css */
/* Block 21 Teil 2 — verschoben nach layout.pwa.css */
/* Block 44 — Browser Menu Card — verschoben nach layout.browser.css */

/* LEGACY BLOCK — VERIFY BEFORE REMOVAL
   Orphaned comment fragment ohne zugehörige Regel.
   War ursprünglich Ende eines Kommentarblocks aus der Coaching-Sektion. */