/* =============================================================
   PROZESSDOKUMENTATION — Finder
   Optik 1:1 vom Motion Tool: Farben des "create"-Modus (fast schwarz),
   ABC Favorit Variable durchgehend, scharfkantig, keine Versalien/Tracking
   ============================================================= */

/* ABC Favorit Variable — einzige Schrift der Seite */
@font-face {
  font-family: 'ABCFavoritVariable';
  src: url('fonts/ABC Favorit Variable/ABCFavoritVariableEdu-Regular.woff2') format('woff2'),
       url('fonts/ABC Favorit Variable/ABCFavoritVariableEdu-Regular.woff') format('woff');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Grundfarben 1:1 vom Motion Tool — "create"-Modus: fast schwarz, scharfkantig */
  --bg:        #050505;
  --bg-2:      #050505;
  --panel:     #050505;
  --panel-2:   #1e1e1e;
  --hover:     #1c1c1c;
  --sel:       #f5f5f5;
  --line:      #555555;

  /* Oberflächen gestaffelt (dunklere Töne oben/aussen, heller innen) */
  --s-titlebar: #1e1e1e;
  --s-toolbar:  #131313;
  --s-status:   #1e1e1e;
  --s-columns:  #050505;
  --s-preview:  #1e1e1e;
  --s-desc:     #131313;
  --line-soft: #1e1e1e;
  --text:      #f5f5f5;
  --text-soft: #a5a5a5;
  --muted:     #555555;
  --accent:    #f5f5f5;
  --good:      #71d99e;
  --danger:    #ff5050;
  --blue:      #3a6ea5;

  --sans: 'ABCFavoritVariable', ui-sans-serif, system-ui, sans-serif;

  --tb-h: 40px;
}

/* ===================== ICONS (SVG-Masken, folgen der Textfarbe) ===================== */
.icn {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center;  mask-position: center;
  -webkit-mask-size: contain;     mask-size: contain;
}
.icn-folder   { -webkit-mask-image: url(icons/1_Folder_Icon.svg);   mask-image: url(icons/1_Folder_Icon.svg); }
.icn-square   { -webkit-mask-image: url(icons/1_Square_Icon.svg);   mask-image: url(icons/1_Square_Icon.svg); }
.icn-triangle { -webkit-mask-image: url(icons/1_Triangle_Icon.svg); mask-image: url(icons/1_Triangle_Icon.svg); }
.icn-plus     { -webkit-mask-image: url(icons/1_Plus_Icon.svg);     mask-image: url(icons/1_Plus_Icon.svg); }
.icn-arrow    { -webkit-mask-image: url(icons/1_Arrow_Icon.svg);    mask-image: url(icons/1_Arrow_Icon.svg); }
.icn-close    { -webkit-mask-image: url(icons/1_Close_Icon.svg);    mask-image: url(icons/1_Close_Icon.svg); }
.icn-import   { -webkit-mask-image: url(icons/1_Import_Form_Icon.svg); mask-image: url(icons/1_Import_Form_Icon.svg); }
.icn-youtube  { -webkit-mask-image: url(icons/1_YouTube_Icon.svg); mask-image: url(icons/1_YouTube_Icon.svg); }
/* Arrow zeigt im Original nach unten — Rotation für Richtung */
.ar-right { transform: rotate(-90deg); }
.ar-left  { transform: rotate(90deg); }
/* Import-Pfeil zeigt im Original nach oben — 45° für "extern öffnen" (↗) */
.ar-ne    { transform: rotate(45deg); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; }

/* ===================== FENSTER ===================== */
.finder {
  display: grid;
  grid-template-rows: var(--tb-h) var(--tb-h) 1fr 26px;
  grid-template-areas: "title" "toolbar" "body" "status";
  height: 100vh;
  background: var(--bg);
}

.titlebar {
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: #131313;
  user-select: none;
}
.mode-btn {
  width: 22px; height: 22px;
  background: var(--bg);
  border: none;
  border-radius: 100px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mode-btn:hover { background: var(--hover); }
.impressum-btn {
  width: auto;
  height: auto;
  background: none;
  padding: 3px 6px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0;
  color: var(--text-soft);
}
.impressum-btn:hover { background: none; color: var(--text); }
.lights { display: flex; gap: 8px; align-items: center; }
.light {
  width: 12px; height: 12px; border-radius: 50%;
  background: #3a3a3a; display: inline-block;
}
.light.close { background: #ff5f57; }
.light.min   { background: #febc2e; }
.light.max   { background: #28c840; }
.title {
  flex: 0 1 auto;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  color: #ffffff;
  cursor: pointer;
  margin-top: 4px;
}
.titlebar-spacer { flex: 1; }

/* ===================== WERKZEUGLEISTE ===================== */
.toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--s-toolbar);
}
.nav-buttons { display: flex; gap: 4px; }
.tb-btn {
  width: 28px; height: 28px;
  background: var(--bg);
  border: none;
  border-radius: 100px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background .1s, color .1s;
}
.tb-btn:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.tb-btn:disabled { opacity: .3; cursor: default; }
.tb-btn { display: flex; align-items: center; justify-content: center; }
.tb-btn .icn { width: 12px; height: 12px; }

.view-switch { display: flex; border: 1px solid var(--line); }
.vs-btn {
  width: 30px; height: 28px;
  background: var(--bg);
  border: none;
  border-right: 1px solid var(--line);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
}
.vs-btn:last-child { border-right: none; }
.vs-btn:hover { color: var(--text); }
.vs-btn.active { background: var(--text); color: var(--bg); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-top: -4px;
}
.crumb {
  background: none; border: none;
  border-radius: 100px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  padding: 3px 6px;
  letter-spacing: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb:hover { color: var(--text); }
.crumb.current { color: var(--text); }
/* Die drei Hauptordner-Crumbs immer in ihrer Zonen-Farbe (siehe zoneOf()). */
.crumb.zone-input, .crumb.zone-input:hover, .crumb.zone-input.current { color: rgb(6, 214, 160); }
.crumb.zone-improvisation, .crumb.zone-improvisation:hover, .crumb.zone-improvisation.current { color: rgb(17, 138, 178); }
.crumb.zone-output, .crumb.zone-output:hover, .crumb.zone-output.current { color: rgb(239, 71, 111); }
.crumb-sep { color: var(--muted); font-size: 11px; }
.crumb-sep-ic { width: 8px; height: 8px; opacity: 0.5; margin: 0 3px; color: var(--text-soft); }

.toolbar-spacer { flex: 1; }

/* ===================== KÖRPER ===================== */
.body {
  grid-area: body;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 12px 0;
}
.sb-group-label {
  font-size: 9.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  padding: 12px 16px 6px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0;
  border-left: 2px solid transparent;
}
.sb-item:hover { background: var(--hover); color: var(--text); }
.sb-item.active {
  color: var(--text);
  border-left-color: var(--text);
  background: var(--panel);
}
.sb-item .ic { width: 15px; text-align: center; flex-shrink: 0; opacity: .8; }

.content {
  grid-area: body;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

/* ===================== SYMBOLANSICHT ===================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 6px;
  padding: 20px;
  align-content: start;
}
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  text-align: center;
}
.item:hover { background: var(--hover); }
.item.selected { background: var(--panel-2); border-color: var(--line); }
.item .thumb {
  width: 92px; height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.item .thumb img,
.item .thumb video {
  max-width: 100%; max-height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #000;
}
.item .thumb svg { width: 56px; height: 56px; }
.item .label {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
  max-width: 124px;
  letter-spacing: 0;
}
.item .sublabel {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

/* Datei-Icon (generisch) */
.fileicon {
  width: 58px; height: 72px;
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.fileicon::after {
  content: "";
  position: absolute; top: 0; right: 0;
  border-width: 0 14px 14px 0;
  border-style: solid;
  border-color: var(--bg) var(--bg) transparent transparent;
}
.fileicon .badge {
  position: absolute;
  bottom: 8px; left: 0; right: 0;
  text-align: center;
  font-size: 9px;
  letter-spacing: 0;
  color: var(--text);
  text-transform: none;
}
.fileicon .catname {
  position: absolute;
  top: 12px; left: 0; right: 0;
  text-align: center;
  font-size: 18px;
  color: var(--text-soft);
}
/* Ordner-Icon */
.foldericon { width: 66px; height: 52px; position: relative; }
.foldericon svg { width: 100%; height: 100%; }

/* externer Link Marker */
.ext-pill {
  position: absolute;
  bottom: -4px; right: -4px;
  background: var(--blue);
  color: #fff;
  font-size: 8px;
  letter-spacing: 0;
  padding: 1px 4px;
  text-transform: none;
}
.dur-pill {
  position: absolute;
  bottom: 2px; right: 2px;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 9px;
  padding: 1px 4px;
}

/* Ordner mit eigener index.html: direkt als Webapp in neuem Tab öffnen */
.run-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgb(239, 71, 111);
  color: var(--bg);
  border: none;
  border-radius: 100px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 2px 8px;
  margin-left: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.run-pill:hover { background: rgb(244, 125, 154); }
.run-pill .icn { width: 12px; height: 12px; color: var(--bg); }
.item .run-pill { margin: 2px 0 0; }

/* ===================== LISTENANSICHT ===================== */
.list { width: 100%; border-collapse: collapse; }
.list th {
  position: sticky; top: 0;
  background: var(--bg-2);
  color: var(--text-soft);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  padding: 8px 14px;
}
.list td {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-soft);
}
.list tr { cursor: pointer; }
.list tr:hover td { background: var(--hover); color: var(--text); }
.list tr.selected td { background: var(--panel-2); color: var(--text); }
.list .nm { color: var(--text); display: flex; align-items: center; gap: 9px; }
.list .nm .ic { width: 16px; text-align: center; }
.list .col-size, .list .col-kind, .list .col-date { white-space: nowrap; }

/* ===================== SPALTENANSICHT ===================== */
/* Links: scrollbarer Spaltenbereich (2/3 der Breite, exakt 3 Spalten sichtbar).
   Rechts: feste Datei-Vorschau (mind. 1/3 der Breite). */
.columns {
  display: flex;
  height: 100%;
}
.col-scroll {
  flex: 0 0 60%;
  max-width: 60%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--s-columns);
}
.column {
  flex: 0 0 33.333%;   /* drei Spalten füllen den scrollbaren Bereich */
  max-width: 33.333%;
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* Passt alles (Dateien + Beschreibung) hinein: kein Scroll, Beschreibung unten.
     Ist es zu viel: die ganze Spalte scrollt als eine Einheit, Dateien inklusive. */
  overflow-y: auto;
}
.col-rows {
  flex: 1 0 auto;
}
.col-desc {
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
}
.col-desc p { margin: 0 0 10px; }
.col-desc p:last-child { margin-bottom: 0; }
.col-desc h1, .col-desc h2, .col-desc h3,
.col-desc h4, .col-desc h5, .col-desc h6 {
  margin: 0 0 8px; font-size: 1em; font-weight: 700; color: var(--text);
}
.col-desc a { color: inherit; text-decoration: none; }
.col-desc a:hover { color: var(--text); }
.col-desc ul { margin: 0 0 10px; padding-left: 18px; }
.col-desc li { margin: 0 0 4px; }
.col-tool {
  flex: 0 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-tool-date {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-soft);
}
.col-tool .run-pill { font-size: 13px; padding: 4px 10px; margin-left: auto; }
.col-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-row:hover { background: var(--hover); color: var(--text); }
/* Hover-/Auswahlfarbe je Hauptordner (egal auf welcher Tiefe) — Ordner volle
   Deckkraft (bleibt auch nach dem Anklicken/Auswählen in Farbe), Dateien nur
   abgeschwächt beim Hover, damit man Input/Improvisation/Output unterscheidet. */
.col-row.zone-input.is-dir:hover,
.col-row.zone-input.active.is-dir        { background: rgb(6, 214, 160); color: var(--bg); }
.col-row.zone-input:not(.is-dir):hover   { background: rgba(6, 214, 160, .16); color: var(--text); }
.col-row.zone-improvisation.is-dir:hover,
.col-row.zone-improvisation.active.is-dir      { background: rgb(17, 138, 178); color: var(--bg); }
.col-row.zone-improvisation:not(.is-dir):hover { background: rgba(17, 138, 178, .16); color: var(--text); }
.col-row.zone-output.is-dir:hover,
.col-row.zone-output.active.is-dir       { background: rgb(239, 71, 111); color: var(--bg); }
.col-row.zone-output:not(.is-dir):hover  { background: rgba(239, 71, 111, .16); color: var(--text); }
.col-row.active { background: var(--panel); color: var(--text); }
.col-row.active.is-dir { background: var(--text); color: var(--bg); }
.col-row.kbfocus { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--text); }
.col-row .chev { margin-left: auto; width: 9px; height: 9px; opacity: 0.6; }
.col-row .icn-import.chev,
.col-row .icn-youtube.chev { width: 13px; height: 13px; opacity: 0.6; }
.col-preview {
  flex: 1 1 40%;
  min-width: 40%;
  position: relative;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: var(--s-preview);
}
/* Medien immer vollständig in den freien Platz einpassen (Höhe ODER Breite) */
.col-preview img,
.col-preview video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  /* Bild/Video oben in der Vorschau ausrichten statt vertikal zu zentrieren */
  align-self: flex-start;
}
.col-preview svg { max-width: 100%; max-height: 100%; }
.col-preview > .ql-code,
.col-preview > .ql-md,
.col-preview > .ql-tabtree { align-self: stretch; width: 100%; height: 100%; }
.col-preview embed,
.col-preview iframe { width: 100%; height: 100%; border: 0; }
.col-preview .ql-placeholder { padding: 10px; }
.col-preview .ql-placeholder .big { font-size: 34px; }

/* Hinweis, wenn noch keine Datei gewählt ist */
.col-preview-hint {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 12px;
  font-weight: 350;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  line-height: 1.7;
}

/* ===================== GALERIE (Blatt-Ordner — Justified Layout) ===================== */
/* .col-preview zentriert seinen Inhalt standardmässig — die Galerie soll
   stattdessen immer oben anfangen, auch wenn sie die Vorschau nicht ausfüllt. */
.col-preview.gallery-pane { padding: 0; overflow-y: auto; overflow-x: hidden; align-items: flex-start; justify-content: flex-start; }

/* Einzelne Datei: füllt gesamte Vorschau */
.col-preview.gallery-single-pane { overflow: hidden; display: flex; flex-direction: column; }
.col-preview.gallery-single-pane .gallery { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.col-preview.gallery-single-pane .gal-cell { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.col-preview.gallery-single-pane .gallery-item { flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.col-preview.gallery-single-pane .gallery-item img,
.col-preview.gallery-single-pane .gallery-item video { width: auto; height: auto; max-width: 100%; max-height: 100%; }

/* Justified-Galerie: JS berechnet Zeilen und Breiten */
.gallery { padding: 3px; }
.gal-row { display: flex; gap: 3px; margin-bottom: 3px; }

.gal-cell {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  cursor: pointer;
}
.gal-cell:hover .gallery-item,
.gal-cell.gal-focus .gallery-item { outline: 2px solid var(--text); outline-offset: -2px; }

.gallery-item {
  overflow: hidden;
  background: var(--panel);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.gallery-item img,
.gallery-item video { width: 100%; height: 100%; object-fit: contain; display: block; }
/* TabTree direkt in der Galerie-Zelle: füllt die Zelle, scrollt selbst (siehe
   .ql-tabtree weiter unten) statt vom Layout zentriert/zugeschnitten zu werden. */
.gallery-item .ql-tabtree,
.col-preview.gallery-single-pane .gallery-item .ql-tabtree { width: 100%; height: 100%; max-width: none; max-height: none; }

/* Reiner Icon-Ordner (nur SVGs): festes 7er-Raster, Klick/Doppelklick ohne
   Wirkung (keine Quick-Look-Vorschau). Grundfarbe Weiss auf Schwarz, Hover
   invertiert (Schwarz auf Weiss). Icon liegt immer zentriert im Quadrat. */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 3px;
}
.icon-grid-cell {
  aspect-ratio: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.icon-grid-cell img { width: 55%; height: 55%; object-fit: contain; filter: invert(1); display: block; margin: auto; }
.icon-grid-cell:hover,
.icon-grid-cell.hovered { background: var(--text); }
.icon-grid-cell:hover img,
.icon-grid-cell.hovered img { filter: none; }

.gallery-filecard {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; text-align: center;
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 10px;
  word-break: break-all;
  padding: 16px;
}

/* ===================== HAUFEN / PILE ===================== */
/* Ordner mit nur Dateien: alle Dateien als unordentlicher Stapel */
.col-preview.pile-pane { padding: 0; overflow: hidden; }
.pile { position: absolute; inset: 0; }
.pile-card {
  position: absolute;
  left: 50%; top: 50%;
  transform-origin: center center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  will-change: transform;
}
.pile-card:hover { box-shadow: 0 18px 46px rgba(0, 0, 0, 0.75); }
.pile-card img,
.pile-card video {
  width: 100%; height: 100%;
  object-fit: contain;        /* Originalformat, kein Beschnitt */
  display: block;
}
.pile-filecard {
  width: 100%; height: 100%;
  background: var(--panel-2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 16px; text-align: center;
  color: var(--text-soft);
}
.pile-filecard .icn { width: 34px; height: 34px; }
.pile-filecard .nm { font-size: 10.5px; line-height: 1.4; word-break: break-word; }

/* ===================== STATUSLEISTE ===================== */
.statusbar {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: #131313;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
  text-transform: none;
}

/* leerer Ordner */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  gap: 10px;
  letter-spacing: 0;
  text-transform: none;
  font-size: 11px;
}

/* ===================== QUICK LOOK ===================== */
.ql-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: qlIn .14s ease-out;
}
.ql-overlay[hidden] { display: none; }
/* Echter Vollbild-Modus: Fenster füllt den ganzen Bildschirm */
.ql-overlay:fullscreen { padding: 0; }
.ql-overlay:fullscreen .ql-window { width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
.ql-overlay:-webkit-full-screen { padding: 0; }
.ql-overlay:-webkit-full-screen .ql-window { width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
@keyframes qlIn { from { opacity: 0; } to { opacity: 1; } }
.ql-window {
  /* Fallback-Grösse für Inhalte ohne festes Seitenverhältnis (PDF, Code, Tabelle, …).
     Für Bild/Video/SVG setzt JS eine exakte Breite/Höhe passend zum Format. */
  width: min(1100px, 94vw);
  height: min(82vh, 90vh);
  max-width: 94vw;
  max-height: 90vh;
  min-width: 280px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  transition: width .12s ease, height .12s ease;
}
.ql-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  height: 38px;
  flex-shrink: 0;
}
.ql-close {
  width: 26px; height: 26px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .1s, color .1s;
}
.ql-close:hover { background: rgba(255, 80, 80, 0.18); color: var(--danger); }
.ql-close { display: flex; align-items: center; justify-content: center; }
.ql-close .icn { width: 11px; height: 11px; }
.ql-title {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ql-actions { margin-left: auto; display: flex; gap: 8px; }
.ql-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 100px;
  text-decoration: none;
  cursor: pointer;
  font-size: 10.5px;
  letter-spacing: 0;
  text-transform: none;
  transition: background .1s, color .1s;
}
.ql-action:hover { background: var(--text); color: var(--bg); }
.ql-action.ghost:hover { background: var(--hover); color: var(--text); }
.ql-action[hidden] { display: none; }

.ql-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: var(--s-preview);
  position: relative;
  /* Native Scrollbar ausblenden — sonst manchmal eine dünne Linie direkt
     über der .ql-nav-Leiste sichtbar. Scrollen per Wheel/Trackpad bleibt möglich. */
  scrollbar-width: none;
}
.ql-body::-webkit-scrollbar { display: none; }
.ql-body img,
.ql-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.ql-body svg { max-width: 80%; max-height: 80%; }
.ql-body embed, .ql-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.ql-body audio { width: 70%; }

.ql-code {
  width: 100%; height: 100%;
  margin: 0; overflow: auto;
  text-align: left;
  background: #0d1117;
}
.ql-code pre { margin: 0; }
.ql-code code {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.55;
  display: block;
  padding: 18px;
  tab-size: 4;
}
.ql-md {
  max-width: 760px;
  text-align: left;
  padding: 36px 44px;
  color: var(--text);
  line-height: 1.6;
  overflow: auto;
  height: 100%;
}
.ql-md h1, .ql-md h2, .ql-md h3 { letter-spacing: 0; }
.ql-md code { background: var(--panel-2); padding: 1px 5px; font-size: 12px; }
.ql-md pre { background: #0d1117; padding: 14px; overflow: auto; }
.ql-md pre code { background: none; }
.ql-md table { border-collapse: collapse; }
.ql-md td, .ql-md th { border: 1px solid var(--line); padding: 5px 10px; }

/* ===================== TABTREE (tab-eingerückte .txt-Mindmaps) =====================
   Horizontales Knoten-Baumdiagramm, angelehnt an ffd8.github.io/tabtree:
   Kreise als Knoten, gebogene Verbindungslinien, Labels mit Halo zur Lesbarkeit. */
.ql-tabtree {
  overflow: auto;
  padding: 4px;
}
/* Immer native Grösse (gleiche Abstände/Schrift bei jeder Datei) — die generische
   ".col-preview svg { max-width/height:100% }"-Regel würde sie sonst zusammendrücken.
   Bei zu grossem Baum wird stattdessen horizontal+vertikal gescrollt (overflow:auto). */
.col-preview .tt-svg,
.tt-svg { display: block; max-width: none; max-height: none; width: auto; height: auto; }
.tt-link {
  fill: none;
  stroke: var(--line);
  stroke-width: 1px;
}
.tt-node {
  fill: var(--text-soft);
  stroke: none;
}
.tt-label {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  fill: var(--text);
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* ===================== FLOW-CHART (vertikales Ablaufdiagramm aus "_flow*.txt")
   Gleiche Optik wie TabTree, aber von oben nach unten: senkrechte Spalte aus
   Hauptschritten mit Pfeilen, eingerückte Unterpunkte, gestrichelte Rückführungen. */
.flow-link, .flow-edge, .flow-subdash {
  fill: none;
  stroke: var(--line);
  stroke-width: 1px;
  stroke-linejoin: round;
}
.flow-subdash { stroke: var(--muted); }
.flow-arrow {
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 1.4px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.flow-node { fill: var(--text); stroke: none; }
.flow-step {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  fill: var(--text);
  dominant-baseline: middle;
}
.flow-sub {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  fill: var(--text-soft);
  dominant-baseline: middle;
}

.ql-placeholder {
  text-align: center;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 40px;
}
.ql-placeholder .big { font-size: 46px; color: var(--muted); }
.ql-placeholder .msg { letter-spacing: 0; line-height: 1.6; }
.ql-placeholder .sub { font-size: 11px; color: var(--muted); }

.ql-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 40px;
  flex-shrink: 0;
}
.ql-navbtn {
  width: 34px; height: 26px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 15px;
  transition: background .1s, color .1s;
}
.ql-navbtn:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.ql-navbtn:disabled { opacity: .3; cursor: default; }
.ql-meta {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
  text-transform: none;
  min-width: 240px;
  text-align: center;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); background-clip: padding-box; }

@media (max-width: 720px) {
  /* Auf schmalen Bildschirmen: scrollbarer Bereich breiter, Vorschau bleibt 1/3 */
  .col-scroll { flex-basis: 60%; max-width: 60%; }
  .column { flex-basis: 50%; max-width: 50%; }
  .col-preview { min-width: 40%; }
}

/* ===================== ONBOARDING-OVERLAY ===================== */
.onboarding-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: qlIn .14s ease-out;
}
.onboarding-overlay[hidden] { display: none; }
.onboarding-card {
  width: min(800px, 100%);
  height: 700px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 26px 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.onboarding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.onboarding-head h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  color: #ffffff;
}
.onboarding-lead {
  margin: 0;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-soft);
}
.onboarding-lead span { display: block; }
.onboarding-lead span + span { margin-top: 0.9em; }
.onboarding-lead strong { color: var(--text); font-weight: 700; }
.onboarding-lead strong.hl-white { color: #ffffff; }
.onboarding-lead a { color: inherit; text-decoration: none; }
.onboarding-lead a:hover { color: var(--text); }
.onboarding-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; flex-shrink: 0; }
.onboarding-btns { display: flex; gap: 8px; }
.onboarding-btns .ql-action { font-size: 14px; }
.onboarding-dots { display: flex; gap: 6px; }
.onboarding-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.onboarding-dots .dot.active { background: var(--text); }
