/**
 * Picture-Idea-Canvas — Tool-eigenes CSS (/app/canvas/).
 * Nutzt die Design-System-Tokens (design-system.css). Self-contained, nur unter /app/canvas/ geladen.
 */

:root {
  --g-yellow: #ffe488;
  --g-blue:   #bfe3ef;
  --g-pink:   #f6c8d8;
  --g-green:  #cfe8bf;
}

/* Gemeinsame Swatch-Farbregeln (`.s-COLOR` → Gruppenfarbe). Eine Quelle für ALLE Swatch-Basen
   (.cv-filter-sw, .ce-legend-sw, .sw, .cv-legend-sw, .cv-mini-sw) — die Basen geben nur Größe/Form. */
.s-yellow { background: var(--g-yellow); }
.s-blue   { background: var(--g-blue); }
.s-pink   { background: var(--g-pink); }
.s-green  { background: var(--g-green); }

/* ── Übersicht (index) ───────────────────────────────────────────────── */
.cv-index-head { margin: 18px 0 22px; }

/* Tabs: Meine PICs ⇄ Community (server-gerendert, reine Links) */
.cv-tabs {
  display: inline-flex; border: 1px solid var(--border); border-radius: 4px;
  overflow: hidden; margin: 0 0 22px;
}
.cv-tabs a {
  font-family: var(--font-heading); font-size: 14px; font-weight: 600;
  color: var(--night); text-decoration: none; padding: 8px 16px; line-height: 1;
}
.cv-tabs a:hover { background: var(--surface-hover); }
.cv-tabs a.on { background: var(--night); color: var(--cream); }
.cv-tabs a.on:hover { background: var(--night); }

.cv-flash {
  background: rgba(232, 85, 85, .10); color: #b53b3b;
  font-size: var(--text-small); padding: 10px 14px; border-radius: 4px; margin-bottom: 18px;
}
.cv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cv-card {
  border: 1px solid var(--border); border-radius: 6px; padding: 0;
  display: flex; flex-direction: column; background: var(--surface);
}
.cv-card-link { display: block; padding: 18px 18px 14px; text-decoration: none; color: var(--night); flex: 1; }
.cv-card-link:hover { background: var(--surface-hover); }
.cv-card-title { font-family: var(--font-heading); font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.cv-card-meta { font-family: var(--font-body); font-size: 12.5px; color: var(--color-text-muted); }
.cv-card-warn { display: block; margin-top: 4px; font-family: var(--font-body); font-size: 12px; font-weight: 600; color: var(--coral); }
.cv-card-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 2px;
  padding: 8px 10px; border-top: 1px solid var(--border-light);
}
.cv-card-actions form { margin: 0; }
.cv-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: none; background: transparent; color: var(--color-text-muted);
  border-radius: 4px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.cv-icon-btn:hover { background: var(--surface-hover); color: var(--night); }
.cv-icon-btn--danger:hover { background: rgba(232, 85, 85, .12); color: var(--coral); }
.cv-card--new { border-style: dashed; }

/* Community-Feed-Karte (read-only, anonym) */
.cv-card--feed .cv-card-link { padding-bottom: 18px; }
.cv-card-badge {
  display: inline-block; margin-bottom: 8px;
  font-family: var(--font-heading); font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--cyan); background: rgba(0, 153, 187, .10);
  padding: 2px 7px; border-radius: var(--radius-tag, 3px);
}
.cv-card-snippet {
  margin: 9px 0 0; font-family: var(--font-body); font-size: 13px; line-height: 1.5;
  color: rgba(11, 28, 38, .7);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cv-new-btn {
  width: 100%; height: 100%; min-height: 96px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: none; color: var(--color-text-muted);
  font-family: var(--font-heading); font-size: 14px; font-weight: 600;
}
.cv-new-btn:hover { color: var(--night); }
.cv-new-plus { font-size: 28px; line-height: 1; font-weight: 400; }

/* ── Editor-Toolbar ──────────────────────────────────────────────────── */
.cv-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 6px 0 6px; }
.ce-back { font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--night); opacity: .6; text-decoration: none; }
.ce-back:hover { opacity: 1; }
.ce-titlewrap { flex: 1; min-width: 220px; }
.ce-title {
  font-family: var(--font-heading); font-size: 26px; font-weight: 700; color: var(--night);
  border: none; background: transparent; width: 100%; padding: 2px 4px; border-radius: 3px;
}
.ce-title:hover, .ce-title:focus { background: rgba(11, 28, 38, .04); outline: none; }

.ce-controls { display: flex; align-items: center; gap: 14px; }
.ce-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.ce-seg button { font-family: var(--font-heading); font-weight: 600; border: none; background: transparent; color: var(--night); cursor: pointer; padding: 7px 11px; line-height: 1; }
.ce-seg button.on { background: var(--night); color: var(--cream); }
.ce-vis {
  font-family: var(--font-heading); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--night); cursor: pointer;
  padding: 8px 14px; border-radius: 4px; display: inline-flex; align-items: center; gap: 7px;
}
.ce-vis .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(11, 28, 38, .35); }
.ce-vis.is-community .dot { background: var(--cyan); }
.ce-vis.is-public .dot { background: var(--yellow); }
.ce-copylink {
  font-family: var(--font-heading); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--night); cursor: pointer;
  padding: 8px 14px; border-radius: 4px;
}
.ce-copylink.is-hidden { display: none; }
.ce-status { font-family: var(--font-heading); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; color: var(--color-text-muted); min-width: 150px; }
.ce-status .tick { width: 15px; height: 15px; }
.ce-status.saving { color: var(--cyan); }
.ce-status.saving .tick { animation: cv-spin .8s linear infinite; }
.ce-status.error { color: var(--coral); cursor: pointer; }
@keyframes cv-spin { to { transform: rotate(360deg); } }

/* Edit/Ansicht-Umschalter — kleiner Icon-Button (Auge ↔ Stift) */
.cv-mode-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 4px;
  background: transparent; color: var(--night); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.cv-mode-toggle:hover { background: var(--surface-hover); border-color: rgba(11, 28, 38, .3); }
.cv-mode-toggle svg { display: block; }

/* ── Farb-Filter (in der Toolbar von Editor + Ansicht) ───────────────── */
.cv-filter {
  display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding-left: 14px; border-left: 1px solid var(--border);
}
.cv-filter-label {
  font-family: var(--font-heading); font-size: 12px; font-weight: 600;
  letter-spacing: .02em; color: var(--color-text-muted); margin-right: 1px;
}
.cv-filter-sw {
  width: 20px; height: 20px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid rgba(11, 28, 38, .15); opacity: .4;
  transition: opacity .15s, border-color .15s;
}
.cv-filter-sw:hover { opacity: .75; }
.cv-filter-sw.is-on { opacity: 1; border-color: var(--night); }
/* Farben via gemeinsamer .s-COLOR-Regel (oben) */

/* Filter-Sichten: ausgeschaltete Farbe verbirgt ihre Notes in allen Repräsentationen */
.f-off-yellow .note.g-yellow, .f-off-yellow .cl-note.g-yellow, .f-off-yellow .cv-list-note.g-yellow,
.f-off-blue   .note.g-blue,   .f-off-blue   .cl-note.g-blue,   .f-off-blue   .cv-list-note.g-blue,
.f-off-pink   .note.g-pink,   .f-off-pink   .cl-note.g-pink,   .f-off-pink   .cv-list-note.g-pink,
.f-off-green  .note.g-green,  .f-off-green  .cl-note.g-green,  .f-off-green  .cv-list-note.g-green {
  display: none !important;
}

.ce-descwrap { margin: 2px 0 10px; }
.ce-desc {
  font-family: var(--font-body); font-size: 14px; line-height: 1.55; color: var(--color-text);
  border: none; background: transparent; width: 100%; padding: 6px 8px; border-radius: 4px;
  resize: none; overflow: hidden; display: block;
}
.ce-desc::placeholder { color: rgba(11, 28, 38, .38); }
.ce-desc:hover { background: rgba(11, 28, 38, .03); }
.ce-desc:focus { background: rgba(11, 28, 38, .05); outline: none; }
.ce-hint { font-size: 12.5px; color: rgba(11, 28, 38, .45); margin: 0 0 14px; }

/* ── Farb-Legende (Editor) — erscheint ab 2 genutzten Farben, je Zeile eine Farbe ─ */
.ce-legend { margin: 0 0 14px; padding: 10px 12px; background: rgba(11, 28, 38, .025); border-radius: 6px; }
.ce-legend[hidden] { display: none; }
.ce-legend-title { font-family: var(--font-heading); font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--color-text-muted); margin: 0 0 8px; }
.ce-legend-hint { font-weight: 400; color: rgba(11, 28, 38, .42); }
.ce-legend-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 6px; }
.ce-legend-row.is-unused { display: none; }
.ce-legend-sw { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 7px; border-radius: 4px; border: 1px solid rgba(11, 28, 38, .15); }
.ce-legend-input {
  flex: 1 1 auto; min-width: 0; font-family: var(--font-body); font-size: 13.5px; line-height: 1.5; color: var(--color-text);
  border: none; background: transparent; padding: 5px 8px; border-radius: 4px; resize: none; overflow: hidden; display: block;
}
.ce-legend-input::placeholder { color: rgba(11, 28, 38, .38); }
.ce-legend-input:hover { background: rgba(11, 28, 38, .03); }
.ce-legend-input:focus { background: rgba(11, 28, 38, .06); outline: none; }

/* ── Canvas-Grid ─────────────────────────────────────────────────────── */
.ce-wrap { overflow-x: auto; }
.ce-canvas {
  display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: 1fr 1fr;
  aspect-ratio: 297 / 210; min-width: 920px;
  border: 2px solid var(--night); background: var(--night); gap: 2px;
}
.cf { background: #f6f5f1; padding: 12px 12px 14px; display: flex; flex-direction: column; position: relative; min-height: 0; overflow: hidden; }
.cf--playground   { grid-column: 1; grid-row: 1 / 3; }
.cf--activities   { grid-column: 2; grid-row: 1; }
.cf--resources    { grid-column: 2; grid-row: 2; }
.cf--pictures     { grid-column: 3; grid-row: 1 / 3; }
.cf--story        { grid-column: 4; grid-row: 1; }
.cf--presentation { grid-column: 4; grid-row: 2; }
.cf--customer     { grid-column: 5; grid-row: 1 / 3; }

.cf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; flex: 0 0 auto; }
.cf-name { font-family: var(--font-heading); font-size: 15px; font-weight: 700; color: var(--night); }
.cf-q { font-family: var(--font-body); font-size: 12px; line-height: 1.5; color: rgba(11, 28, 38, .4); font-style: italic; margin: 0 0 8px; pointer-events: none; flex: 0 0 auto; }
/* flex 0 1 auto: sizt am Inhalt (Button sitzt direkt unter der letzten Note, Leerraum bleibt unten);
   schrumpft NUR bei Überlauf — als einziges Geschwister → stabile Klemmung in overflow.js */
.cf-notes { display: flex; flex-direction: column; gap: 7px; flex: 0 1 auto; min-height: 0; overflow: hidden; }

/* „+N weitere"-Hinweis: erscheint, wenn nicht alle Notes ins Feld passen → Klick öffnet die Liste */
.cf-more {
  margin-top: 7px; flex: 0 0 auto; width: 100%;
  font-family: var(--font-heading); font-size: 11px; font-weight: 600; letter-spacing: .01em;
  color: var(--cyan); background: rgba(0, 153, 187, .08);
  border: none; border-radius: 3px; padding: 5px 8px; cursor: pointer; text-align: center;
}
.cf-more:hover { background: rgba(0, 153, 187, .16); }
.cf-more[hidden] { display: none; }

.note {
  --note-fs: 13px; position: relative; background: var(--g-yellow); border-radius: 2px;
  padding: 8px 22px 8px 10px; cursor: grab;
  box-shadow: 0 1px 2px rgba(11, 28, 38, .12), 0 2px 6px rgba(11, 28, 38, .06);
  font-family: var(--font-heading); font-weight: 600; font-size: var(--note-fs); color: #2a2410; line-height: 1.25;
}
.note.g-blue  { background: var(--g-blue);  color: #0f2c36; }
.note.g-pink  { background: var(--g-pink);  color: #3a1320; }
.note.g-green { background: var(--g-green); color: #15290c; }
.note:active { cursor: grabbing; }
.note .ind { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; }

.note.is-img { padding: 5px; }
.note.is-img .note-img { display: block; width: 100%; max-height: 130px; object-fit: cover; border-radius: 1px; background: rgba(11, 28, 38, .06); }
.note.is-img .note-label { display: block; font-size: 11px; padding: 5px 4px 1px; }
.note.is-img .note-label:empty { display: none; }
.note.is-img.img-broken .note-img { display: none; }
.note.is-img.img-broken::after { content: "⚠ Bild nicht ladbar"; display: block; font-size: 11px; opacity: .6; padding: 14px 4px; text-align: center; }

/* ── Link-Notes (Website oder andere Canvas): Badge unten rechts ─────── */
a.note { display: block; text-decoration: none; }
.note-kind { position: absolute; right: 6px; bottom: 5px; width: 13px; height: 13px; opacity: .5; pointer-events: none; }
.note-kind svg { display: block; width: 100%; height: 100%; }
/* Defekter Link: Editor warnt (Cron-Befund / Ziel-Canvas weg), Ansicht entschärft nur */
.note.lnk-dead::after { content: "⚠ Link nicht erreichbar"; display: block; font-size: 10.5px; opacity: .6; padding-top: 3px; }
.note.lnk-dead .note-kind, .note.lnk-dead-view .note-kind { color: var(--coral); opacity: 1; }

.sortable-ghost { opacity: .35; }
.sortable-drag { box-shadow: 0 8px 24px rgba(11, 28, 38, .28) !important; }

.cf-add {
  flex: 0 0 auto;
  margin-top: 8px; font-family: var(--font-heading); font-size: 12px; font-weight: 600; color: rgba(11, 28, 38, .45);
  border: 1px dashed var(--border); background: transparent; border-radius: 3px; padding: 7px; cursor: pointer; text-align: center;
}
.cf-add:hover { color: var(--night); border-color: rgba(11, 28, 38, .3); }
.cf-add.full { opacity: .4; cursor: not-allowed; }

/* ── Popover-Editor ──────────────────────────────────────────────────── */
.pop-back { position: fixed; inset: 0; z-index: 40; display: none; }
.pop-back.on { display: block; }
.note-pop { position: fixed; z-index: 50; width: 280px; background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(11, 28, 38, .28); padding: 14px; display: none; }
.note-pop.on { display: block; }
.pop-title { font-family: var(--font-heading); font-weight: 700; font-size: 15px; border: none; background: rgba(255, 255, 255, .6); width: 100%; padding: 7px 9px; border-radius: 4px; }
.pop-title:focus { outline: 2px solid rgba(11, 28, 38, .15); }
.pop-cap { font-family: var(--font-body); font-size: 11px; color: rgba(11, 28, 38, .45); text-align: right; margin: 3px 2px 8px; }
.pop-comment { font-family: var(--font-body); font-size: 13px; line-height: 1.5; border: none; background: rgba(255, 255, 255, .6); width: 100%; padding: 8px 9px; border-radius: 4px; resize: none; max-height: 120px; min-height: 60px; overflow-y: auto; }
.pop-comment:focus { outline: 2px solid rgba(11, 28, 38, .15); }
.pop-imglabel { font-family: var(--font-heading); font-size: 11px; font-weight: 600; color: rgba(11, 28, 38, .45); margin-top: 10px; display: block; }
.pop-img { font-family: var(--font-body); font-size: 12px; border: none; background: rgba(255, 255, 255, .6); width: 100%; padding: 8px 9px; border-radius: 4px; margin-top: 6px; }
.pop-img:focus { outline: 2px solid rgba(11, 28, 38, .15); }
.pop-imgwarn { display: block; margin-top: 5px; font-family: var(--font-body); font-size: 11px; color: var(--coral); }
.pop-imgwarn[hidden] { display: none; }
/* Klassifizierungs-Hinweis unter dem URL-Feld (Website-Titel / verlinkte Canvas / Warnung) */
.pop-urlhint { display: block; margin-top: 5px; font-family: var(--font-body); font-size: 11px; color: rgba(11, 28, 38, .55); }
.pop-urlhint.is-warn { color: var(--coral); }
.pop-urlhint[hidden] { display: none; }
.pop-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.pop-swatches { display: flex; gap: 8px; }
.sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(11, 28, 38, .12); cursor: pointer; padding: 0; }
.sw.sel { border-color: var(--night); }
.pop-del { border: none; background: transparent; cursor: pointer; padding: 6px; border-radius: 4px; color: rgba(11, 28, 38, .5); }
.pop-del:hover { background: rgba(232, 85, 85, .12); color: var(--coral); }
.pop-del svg { width: 18px; height: 18px; display: block; }

/* ── Export-Dropdown ─────────────────────────────────────────────────── */
.cv-export { position: relative; }
.ce-export-btn {
  font-family: var(--font-heading); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--night);
  cursor: pointer; padding: 8px 14px; border-radius: 4px;
}
.ce-export-btn:hover { border-color: rgba(11, 28, 38, .3); }
.cv-export-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 170px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(11, 28, 38, .18); padding: 5px; display: flex; flex-direction: column;
}
.cv-export-menu[hidden] { display: none; }
.cv-export-item {
  font-family: var(--font-body); font-size: 13px; text-align: left; text-decoration: none;
  color: var(--night); background: transparent; border: none; cursor: pointer;
  padding: 8px 10px; border-radius: 4px;
}
.cv-export-item:hover { background: var(--surface-hover); }

/* ── Listen-Editier-Modus ────────────────────────────────────────────── */
.cl-list { max-width: 820px; }
.cl-field { padding: 14px 0 6px; border-bottom: 1px solid var(--border-light); }
.cl-field-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.cl-field-name { font-family: var(--font-heading); font-size: 16px; font-weight: 700; color: var(--night); }
.cl-notes { display: flex; flex-direction: column; gap: 6px; }
.cl-note {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-left: 4px solid var(--g-yellow); border-radius: 0 4px 4px 0;
  padding: 5px 8px;
}
.cl-note.g-blue { border-left-color: var(--g-blue); } .cl-note.g-pink { border-left-color: var(--g-pink); } .cl-note.g-green { border-left-color: var(--g-green); }
.cl-handle { cursor: grab; color: rgba(11, 28, 38, .3); font-size: 14px; line-height: 1; user-select: none; }
.cl-handle:active { cursor: grabbing; }
.cl-sw { width: 16px; height: 16px; flex-shrink: 0; border-radius: 3px; border: 1px solid rgba(11, 28, 38, .15); cursor: pointer; background: var(--g-yellow); padding: 0; }
.cl-note.g-blue .cl-sw { background: var(--g-blue); } .cl-note.g-pink .cl-sw { background: var(--g-pink); } .cl-note.g-green .cl-sw { background: var(--g-green); }
.cl-title { flex: 1; font-family: var(--font-heading); font-weight: 600; font-size: 14px; color: var(--night); border: none; background: transparent; padding: 4px 4px; border-radius: 3px; min-width: 0; }
.cl-title:focus { outline: none; background: rgba(11, 28, 38, .05); }
.cl-iconbtn { border: none; background: transparent; cursor: pointer; color: rgba(11, 28, 38, .4); padding: 4px 6px; border-radius: 3px; font-size: 13px; line-height: 1; }
.cl-iconbtn:hover { color: var(--night); background: rgba(11, 28, 38, .06); }
.cl-del:hover { color: var(--coral); background: rgba(232, 85, 85, .12); }
.cl-note.has-detail .cl-expand { color: var(--cyan); }
.cl-detail { display: none; flex-basis: 100%; padding: 6px 2px 2px; }
.cl-note.show-detail { flex-wrap: wrap; }
.cl-note.show-detail .cl-detail { display: block; }
.cl-comment { width: 100%; font-family: var(--font-body); font-size: 13px; line-height: 1.5; border: 1px solid var(--border-light); background: #fff; border-radius: 4px; padding: 6px 8px; resize: vertical; min-height: 48px; }
.cl-img { width: 100%; font-family: var(--font-body); font-size: 12px; border: 1px solid var(--border-light); background: #fff; border-radius: 4px; padding: 6px 8px; margin-top: 6px; }
.cl-comment:focus, .cl-img:focus { outline: none; border-color: rgba(11, 28, 38, .3); }
.cl-add {
  width: 100%; margin-top: 8px; font-family: var(--font-body); font-size: 13px;
  border: 1px dashed var(--border); background: transparent; border-radius: 4px; padding: 8px 10px; color: var(--night);
}
.cl-add::placeholder { color: rgba(11, 28, 38, .4); }
.cl-add:focus { outline: none; border-color: rgba(11, 28, 38, .35); border-style: solid; }
.cl-add:disabled { opacity: .4; }

/* ── Ansicht (read-only) ─────────────────────────────────────────────── */
.cv-view-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 16px; }
.cv-view-titles { display: flex; flex-direction: column; }
.cv-view-titles .page-hero-label { margin-bottom: 8px; }
.cv-view-titles .page-hero-title { margin: 0; }
.cv-view-actions { display: flex; gap: 8px; }
.cv-view-head { margin-bottom: 18px; }
.cv-view-desc { font-family: var(--font-body); font-size: 15px; line-height: 1.6; color: var(--color-text); max-width: 70ch; margin: 8px 0 var(--space-10); }
/* Farb-Legende (Ansicht/Druck): Swatch + Erläuterung, nur genutzte Farben */
.cv-legend { max-width: 70ch; margin: 0 0 var(--space-10); display: flex; flex-direction: column; gap: 7px; }
.cv-legend-row { display: flex; align-items: flex-start; gap: 10px; }
.cv-legend-sw { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 3px; border-radius: 4px; border: 1px solid rgba(11, 28, 38, .15); }
.cv-legend-text { font-family: var(--font-body); font-size: 14px; line-height: 1.55; color: var(--color-text); margin: 0; }
.ce-canvas.is-readonly { position: relative; }
.ce-canvas.is-readonly .note { cursor: default; }
.cf-empty { color: rgba(11, 28, 38, .25); }
/* Fußnoten-Nummer auf der Note (nur Notes mit Kommentar) */
.note-num { font-size: .68em; font-weight: 700; vertical-align: super; line-height: 0; margin-left: 2px; color: var(--cyan); }

/* Kommentar-Fußnoten unter der Canvas */
.cv-comments { margin-top: var(--space-10); max-width: 70ch; }
.cv-comments-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.cv-comments-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cv-comments-item { display: flex; gap: 10px; align-items: baseline; }
.cv-cnum { flex: 0 0 auto; min-width: 1.6em; text-align: right; font-family: var(--font-heading); font-weight: 700; font-size: 13px; color: var(--cyan); }
.cv-ctext { font-family: var(--font-body); font-size: 14px; line-height: 1.55; color: var(--color-text); }
/* Quellenzeile einer Fußnote/Listen-Note: URL bzw. verlinkte Canvas in Klarschrift */
.cv-src { display: block; font-family: var(--font-body); font-size: 12.5px; color: rgba(11, 28, 38, .55); margin-top: 2px; word-break: break-all; }
.cv-src a { color: var(--cyan); text-decoration: none; }
.cv-src a:hover { text-decoration: underline; }

/* Backlinks: welche anderen PICs verlinken hierher */
.cv-backlinks { margin-top: var(--space-10); max-width: 70ch; }
.cv-backlinks-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.cv-backlinks-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-family: var(--font-body); font-size: 14px; }
.cv-backlinks-list a { color: var(--cyan); text-decoration: none; }
.cv-backlinks-list a:hover { text-decoration: underline; }
.cv-print-head { display: none; }   /* nur im Druck sichtbar (siehe @media print) */
.cv-you { position: absolute; left: 40%; top: 50%; transform: translate(-50%, -50%); width: 60px; height: 58px; z-index: 4; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .22)); pointer-events: none; }
.cv-you svg { width: 100%; height: 100%; }

/* ── Bild-Consent (Leseansicht): externe Bilder erst nach Zustimmung ──── */
.cv-consent {
  position: fixed; inset: 0; z-index: 60; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 28, 38, .45);
}
.cv-consent[hidden] { display: none; }
.cv-consent-box {
  background: #fff; border-radius: 8px; width: 100%; max-width: 460px;
  padding: 24px 24px 18px; box-shadow: 0 20px 60px rgba(11, 28, 38, .3);
}
.cv-consent-title { font-family: var(--font-heading); font-size: 20px; font-weight: 700; margin: 0 0 10px; }
.cv-consent-text { font-family: var(--font-body); font-size: 14px; line-height: 1.55; color: var(--color-text); margin: 0 0 12px; }
.cv-consent-domains {
  font-family: var(--font-body); font-size: 13px; line-height: 1.5; color: rgba(11, 28, 38, .72);
  background: var(--bg-alt); padding: 8px 12px; border-radius: 4px; margin: 0 0 18px; word-break: break-word;
}
.cv-consent-domains-label { font-family: var(--font-heading); font-weight: 600; color: var(--night); }
.cv-consent-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.cv-consent-note { font-family: var(--font-body); font-size: 11.5px; color: rgba(11, 28, 38, .45); margin: 12px 0 0; text-align: right; }

/* Platzhalter für noch nicht geladene Bild-Notes (Klick öffnet den Consent-Dialog erneut) */
.note.img-pending { cursor: pointer; }
.note.img-pending .note-img { display: none; }
.note-imgph { display: none; }
.note.img-pending .note-imgph {
  display: flex; align-items: center; justify-content: center; height: 64px;
  background: rgba(11, 28, 38, .06); border-radius: 1px;
  font-family: var(--font-heading); font-size: 10.5px; font-weight: 600;
  letter-spacing: .02em; color: rgba(11, 28, 38, .45); text-align: center;
}
.cv-list-imgph { display: none; }
.cv-list-note.img-pending { cursor: pointer; }
.cv-list-note.img-pending .cv-list-img { display: none; }
.cv-list-note.img-pending .cv-list-imgph {
  display: inline-block; margin-bottom: 6px;
  font-family: var(--font-heading); font-size: 11px; font-weight: 600; color: var(--cyan);
  background: rgba(0, 153, 187, .08); padding: 3px 8px; border-radius: 3px;
}

/* ── Lineare Liste (Mobile / Listenansicht / Druck-Reflow) ───────────── */
.cv-list { display: none; }
/* In der Leseansicht per „+N weitere"-Chip eingeblendet (Desktop) */
.cv-view.show-list .cv-list { display: block; margin-top: var(--space-10); border-top: 1px solid var(--border); }
.cv-list-field { padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.cv-list-name { font-family: var(--font-heading); font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.cv-list-notes { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cv-list-note { padding: 8px 12px; border-left: 4px solid var(--g-yellow); background: var(--surface); border-radius: 0 4px 4px 0; }
.cv-list-note.g-blue { border-left-color: var(--g-blue); } .cv-list-note.g-pink { border-left-color: var(--g-pink); } .cv-list-note.g-green { border-left-color: var(--g-green); }
.cv-list-img { display: block; max-width: 200px; max-height: 130px; object-fit: cover; border-radius: 2px; margin-bottom: 6px; }
.cv-list-t { font-family: var(--font-heading); font-weight: 700; font-size: 14px; }
.cv-list-comment { display: block; font-family: var(--font-body); font-size: 13px; line-height: 1.5; color: rgba(11, 28, 38, .72); margin-top: 3px; }
.cv-list-empty { color: rgba(11, 28, 38, .3); }

/* ── Mobile: in der Ansicht Grid + Fußnoten weg, lineare Liste her ───── */
@media screen and (max-width: 860px) {
  .cv-view-canvas, .cv-comments { display: none; }
  .cv-list { display: block; }
}

/* ── Mobil: Toolbar stapeln (Editor + Ansicht) ───────────────────────── */
@media (max-width: 760px) {
  .cv-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .ce-titlewrap { min-width: 0; }
  .ce-title { font-size: 22px; }
  .ce-controls { flex-wrap: wrap; gap: 8px; }
  .ce-status { min-width: 0; margin-left: auto; }
  .cv-view-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .cv-view-actions { flex-wrap: wrap; }
}

/* ── Druck: Seite 1 = farbige Canvas (A4 quer, eine Seite); danach Text ─ */
@media print {
  @page { size: A4 landscape; margin: 6mm; }
  html, body { margin: 0 !important; padding: 0 !important; }

  /* Bedien-Chrome raus */
  nav, footer, .ce-hint, .cv-bar, .cl-list, .note-pop, .pop-back,
  .cv-view-bar, .tool-back, .cv-list { display: none !important; }

  /* Wrapper-Abstände hart auf 0 (sonst entsteht Platz über der Canvas) */
  .app-tool.cv-view { padding: 0 !important; margin: 0 !important; max-width: none;
                      display: flex; flex-direction: column; }

  /* Reihenfolge umdrehen: Canvas zuerst, dann Titel → Beschreibung → Kommentare */
  .cv-view-canvas { order: 1; margin: 0 !important; display: block !important; overflow: visible;
                    break-after: page; page-break-after: always; break-inside: avoid; }
  .cv-print-head  { order: 2; display: block !important; font-family: var(--font-heading); font-size: 26px; font-weight: 800; margin: 0 0 10px; }
  .cv-view-desc   { order: 3; margin: 0 0 14px; }
  .cv-legend      { order: 4; margin: 0 0 18px; }
  .cv-comments    { order: 5; display: block !important; margin-top: 0; }
  .cv-backlinks   { order: 6; margin-top: 12px; }

  .ce-wrap { overflow: visible !important; margin: 0 !important; }

  /* Canvas HÖHEN-begrenzt → passt sicher auf eine Querformat-Seite (Puffer für Browserzeile) */
  .ce-canvas { min-width: 0 !important; width: auto !important; max-width: 100% !important;
               height: 182mm !important; aspect-ratio: 297 / 210 !important; margin: 0 auto !important; }
  .cf { overflow: visible; }

  /* Farben erzwingen (Notes, Canvas-Linien, You-Herz, Bilder, Legenden-Swatches) */
  .ce-canvas, .cf, .note, .cv-you, .note-img, .cv-legend-sw {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

/* ─────────────────────────────────────────────────────────────
   Slideshow-Generator — Builder-Overlay (nur Editor)
   ───────────────────────────────────────────────────────────── */
.cv-slides-ov {
  position: fixed; inset: 0; z-index: 100; background: rgba(11, 28, 38, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cv-slides-panel {
  background: #fff; border-radius: 10px; width: min(860px, 100%); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 60px rgba(11, 28, 38, .35);
}
.cv-slides-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.cv-slides-head h2 { font-family: var(--font-heading); font-size: 20px; font-weight: 700; margin: 0; color: var(--night); }
.cv-slides-x { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--night); opacity: .6; padding: 4px 8px; border-radius: 6px; }
.cv-slides-x:hover { opacity: 1; background: var(--surface); }

.cv-slides-bar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border-light); font-size: 14px;
}
.cv-slides-fmt, .cv-slides-coverlb { display: inline-flex; align-items: center; gap: 8px; color: var(--night); }
.cv-slides-ratio { font-family: var(--font-body); font-size: 14px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.cv-slides-count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: rgba(11, 28, 38, .55); }

.cv-slides-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: 0; flex: 1; }
.cv-slides-col { padding: 14px 20px; overflow-y: auto; min-height: 0; }
.cv-slides-col + .cv-slides-col { border-left: 1px solid var(--border-light); }
.cv-slides-sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: rgba(11, 28, 38, .5); margin: 0 0 10px; }
.cv-slides-empty { font-size: 13px; color: rgba(11, 28, 38, .5); }

/* Picker = field-gruppierte Liste (Anlehnung an den Listen-Modus) */
.cv-slides-pick { display: flex; flex-direction: column; gap: 14px; }
.cv-pick-field > .cl-field-name { margin: 0 0 5px; }   /* Feld-Überschrift = bestehende Listen-Klasse */
.cv-pick-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 9px; margin-bottom: 4px; border: 1px solid transparent; border-radius: 7px;
  background: var(--surface); cursor: pointer; font-size: 13px; color: var(--night);
}
.cv-pick-row:hover { background: var(--surface-hover); }
.cv-pick-row.on { background: rgba(201, 168, 0, .12); border-color: var(--yellow); }
.cv-pick-num {
  flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; color: transparent;
}
.cv-pick-row.on .cv-pick-num { background: var(--yellow); border-color: var(--yellow); color: #2a2410; font-weight: 600; }
.cv-pick-t { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-pick-marks { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; color: rgba(11, 28, 38, .4); }
.cv-mk { display: inline-flex; }
.cv-mk svg { width: 14px; height: 14px; }
.cv-mk-c { font-size: 9px; color: var(--cyan); }

/* Swatch: bestehende .ce-legend-sw.s-* wiederverwenden, nur Größe/Abstand modifizieren */
.ce-legend-sw.cv-mini-sw { width: 11px; height: 11px; margin: 0; border-radius: 3px; flex: 0 0 auto; }

/* Reihenfolge = Inhalts-Karte je Slide (zeigt den ganzen Note-Inhalt + Zusatztext) */
.cv-slides-order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cv-ord { display: flex; flex-direction: column; gap: 6px; padding: 9px 11px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); }
.cv-ord-top { display: flex; align-items: center; gap: 8px; }
.cv-ord-h { cursor: grab; color: rgba(11, 28, 38, .4); font-size: 14px; line-height: 1; flex: 0 0 auto; }
.cv-ord-field { flex: 1; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: rgba(11, 28, 38, .5); }
.cv-ord-x { border: none; background: none; cursor: pointer; color: rgba(11, 28, 38, .4); font-size: 13px; padding: 2px 5px; border-radius: 5px; flex: 0 0 auto; }
.cv-ord-x:hover { color: var(--coral); background: rgba(232, 85, 85, .12); }
.cv-ord-title { font-family: var(--font-heading); font-size: 15px; font-weight: 700; color: var(--night); line-height: 1.2; margin: 0; }
.cv-ord-thumb { display: block; max-width: 100%; max-height: 90px; border-radius: 4px; }
.cv-ord-c { font-family: var(--font-body); font-size: 12.5px; line-height: 1.5; color: rgba(11, 28, 38, .72); margin: 0; white-space: pre-wrap; }
.cv-ord-link { font-family: var(--font-mono); font-size: 11px; color: var(--yellow); margin: 0; word-break: break-word; }
.cv-ord-extra { width: 100%; font-family: var(--font-body); font-size: 12px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: #fff; margin-top: 2px; }

.cv-slides-foot { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); }
.cv-slides-progress { font-size: 13px; color: rgba(11, 28, 38, .6); margin-right: auto; }
.cv-slides-go { background: var(--night); color: var(--cream); border-color: var(--night); }
.cv-slides-go:disabled { opacity: .55; cursor: default; }

@media (max-width: 680px) {
  .cv-slides-body { grid-template-columns: 1fr; }
  .cv-slides-col + .cv-slides-col { border-left: none; border-top: 1px solid var(--border-light); }
}
