/* ============================================================
   Avison Studios Dashboard — Notiz-Seiten: Editor, Blöcke, Moodboard, Storyboard, Lightbox
   Reihenfolge der <link>-Tags nicht ändern.

   Ruhiges Dokument: keine Rahmen, keine harten Schatten, Bedeutung
   durch Tonflächen. Das Gerüst (docs-shell, Seitenbaum) liegt in
   zeit-ziele.css – hier nur die Seite selbst.
   ============================================================ */

/* ~72 Zeichen Fließtext bei 16px */
.doc-page { max-width: 740px; margin: 0 auto; }
.doc-blank { max-width: 640px; margin: 40px auto; }
.doc-blank h2 { margin: 0 0 10px; font-family: var(--font-title); font-size: 26px; font-weight: 400; line-height: 1.1; }
.doc-blank p { line-height: 1.6; color: var(--ink-2); }
.doc-tpl-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.doc-tpl {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface-2);
    border: none;
    border-radius: 12px;
    box-shadow: none;
    padding: 9px 15px;
    cursor: pointer;
    transition: background 0.15s;
}
.doc-tpl:hover { background: var(--tone-almond); }
.doc-tpl:active { transform: translateY(1px); }
.doc-tpl span { font-size: 17px; }

.doc-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.doc-crumbs button { background: none; border: none; color: var(--ink-2); cursor: pointer; font-family: var(--font-display); font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.doc-crumbs button:hover { color: var(--orange); background: rgba(190,94,33,0.1); }
.doc-crumbs em { font-style: normal; color: var(--ink); }

.doc-title-row { display: flex; align-items: center; gap: 12px; }
.doc-icon-btn {
    font-size: 38px;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 12px;
}
.doc-icon-btn:hover { background: var(--surface-2); }
.doc-title-input {
    flex: 1;
    min-width: 0;
    font-family: var(--font-title);
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 0;
}
.doc-title-input:focus { outline: none; background: transparent; box-shadow: none; }
.doc-title-input::placeholder { color: rgba(var(--ink-rgb), 0.22); }
.doc-fav { font-size: 20px; }
.doc-icon-pop {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--surface);
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 8px;
    margin: 8px 0 0;
    max-width: 330px;
}
.doc-icon-pop button {
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    line-height: 1;
}
.doc-icon-pop button:hover { background: var(--surface-2); }

/* Verknüpfungen: Pillen, bei Kunden leicht in der Kundenfarbe mit Punkt */
.doc-relations { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 14px 0 4px; }
.doc-rel {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    border: none;
    border-radius: var(--r-pill);
    overflow: hidden;
    max-width: 100%;
}
.doc-rel[style*="--client-color"] { background: color-mix(in srgb, var(--client-color) 14%, var(--surface)); }
.doc-rel[style*="--client-color"]::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--client-color);
    margin-left: 10px;
    flex-shrink: 0;
}
.doc-rel.dead { opacity: 0.55; }
.doc-rel.dead .doc-rel-open { text-decoration: line-through; }
.doc-rel-open {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    color: var(--ink);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-rel[style*="--client-color"] .doc-rel-open { padding-left: 7px; }
.doc-rel-open:hover { color: var(--orange); }
.doc-rel-inline { font-size: 12px; color: var(--ink-2); padding: 0 10px 0 0; cursor: default; }
.doc-rel-x { background: none; border: none; cursor: pointer; color: var(--ink-2); font-size: 15px; padding: 0 9px 1px 2px; }
.doc-rel-x:hover { color: var(--danger); }
.doc-rel-add {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    background: none;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-pill);
    padding: 5px 12px;
    cursor: pointer;
    color: var(--ink-2);
    transition: color 0.15s, border-color 0.15s;
}
.doc-rel-add:hover { border-color: var(--orange); color: var(--orange); }

/* ---- Blöcke ---- */
.doc-editor { margin-top: 14px; }
.blk {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding-left: calc(var(--level, 0) * 26px);
    border-radius: 6px;
}
.blk.dragging { opacity: 0.4; }
.blk.drop-here { box-shadow: inset 0 -2px 0 var(--orange); }
.blk-gutter {
    position: absolute;
    left: calc(var(--level, 0) * 26px - 52px);
    top: 3px;
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.12s;
}
.blk:hover .blk-gutter, .blk:focus-within .blk-gutter { opacity: 1; }
.blk-plus, .blk-handle {
    background: none;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 6px;
}
.blk-handle { cursor: grab; }
.blk-plus:hover, .blk-handle:hover { background: var(--surface-2); color: var(--ink); }
.blk-text {
    flex: 1;
    min-width: 0;
    outline: none;
    padding: 3px 2px;
    line-height: 1.62;
    font-size: 16px;
    font-family: var(--font-display);
    overflow-wrap: anywhere;
}
.blk-text:empty::before { content: attr(data-ph); color: rgba(var(--ink-rgb), 0.26); pointer-events: none; }
.blk-marker { flex-shrink: 0; padding: 3px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.62; user-select: none; }
.blk-marker.num { font-variant-numeric: tabular-nums; font-size: 15px; min-width: 20px; }
.blk-marker.callout { font-size: 17px; }

/* Überschriften im Dokument: H1 Gambarino, H2/H3 Chillax 600 */
.blk-h1 .blk-text { font-family: var(--font-title); font-size: 30px; font-weight: 400; line-height: 1.2; margin-top: 22px; letter-spacing: 0; }
.blk-h2 .blk-text { font-size: 22px; font-weight: 600; line-height: 1.3; margin-top: 16px; }
.blk-h3 .blk-text { font-size: 17px; font-weight: 600; line-height: 1.35; margin-top: 12px; }
/* Zitat: der einzige Block mit Akzentlinie */
.blk-quote { border-left: 2px solid var(--orange); margin-left: 1px; border-radius: 0; }
.blk-quote .blk-text { padding-left: 14px; font-style: italic; color: var(--ink-2); }
.blk-callout {
    background: var(--tone-blue);
    color: var(--ink);
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    margin: 8px 0;
}
.blk-code { background: var(--charcoal); border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
.blk-code .blk-text { font-family: 'Courier New', monospace; font-size: 14px; color: #e6e2da; white-space: pre-wrap; }
.blk-code .blk-text:empty::before { color: rgba(233,218,197,0.35); }
.blk-divider { flex: 1; padding: 12px 0; }
.blk-divider::after { content: ''; display: block; border-top: 1px solid var(--line-strong); }
.blk-check {
    flex-shrink: 0;
    width: 19px; height: 19px;
    margin-top: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-2);
    cursor: pointer;
    display: grid;
    place-content: center;
    font-size: 12px;
    color: var(--surface-2);
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}
.blk-check:hover { border-color: var(--moss); }
.blk-check.on { background: var(--moss); border-color: var(--moss); color: #fff; }
.blk.checked .blk-text { text-decoration: line-through; color: var(--ink-3); }
.blk-caret {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 12px;
    padding: 5px 3px 0;
}
.blk-toggle .blk-text { font-weight: 600; }
.blk a { color: var(--orange); text-decoration: underline; text-underline-offset: 2px; }
.blk code { background: var(--surface-2); border-radius: 5px; padding: 1px 5px; font-size: 0.92em; }

.mention {
    display: inline-block;
    background: var(--surface-2);
    color: var(--ink);
    border-radius: 6px;
    padding: 0 7px;
    font-size: 0.94em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: inset 0 -2px 0 var(--client-color, transparent);
}
.mention:hover { background: var(--tone-orange); color: var(--tone-orange-ink); }
.mention.dead { text-decoration: line-through; opacity: 0.6; }

.doc-after { margin-top: 6px; }
.doc-add-end {
    font-family: var(--font-display);
    font-size: 14px;
    background: none;
    border: none;
    color: rgba(var(--ink-rgb), 0.32);
    cursor: pointer;
    padding: 8px 2px;
    width: 100%;
    text-align: left;
    border-radius: 8px;
}
.doc-add-end:hover { background: var(--surface-2); color: var(--ink-2); }

.doc-subpages, .doc-backlinks { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 14px; }
.doc-subpages h4, .doc-backlinks h4 {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin: 0 0 8px;
}
.doc-subpage {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 7px 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--ink);
}
.doc-subpage:hover { background: var(--surface-2); }
.doc-meta { margin-top: 24px; }

/* ---- Schwebendes Menü („/", „@", Blockmenü) ---- */
.doc-menu {
    position: fixed;
    z-index: 300;
    width: 310px;
    max-height: 340px;
    overflow-y: auto;
    background: var(--surface);
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 6px;
}
.doc-menu-head {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin: 6px 0 4px 8px;
}
.doc-menu-empty { margin: 10px; font-size: 13px; color: var(--ink-2); }
.doc-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 7px 9px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--ink);
}
.doc-menu-item:hover, .doc-menu-item.on { background: var(--surface-2); color: var(--ink); }
.doc-menu-item.danger:hover { background: var(--tone-red); color: var(--tone-red-ink); }
.dmi-icon {
    flex-shrink: 0;
    width: 26px;
    text-align: center;
    font-size: 14px;
    font-family: var(--font-display);
    opacity: 0.85;
}
.dmi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmi-sub { flex-shrink: 0; font-size: 12px; color: var(--ink-2); }
.doc-menu-item:hover .dmi-sub, .doc-menu-item.on .dmi-sub { color: var(--ink-2); }

/* ---- Verknüpfen-Dialog ---- */
.dp-list { max-height: 46vh; overflow-y: auto; margin-top: 12px; display: grid; gap: 2px; }
.dp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--ink);
}
.dp-item:hover { background: var(--surface-2); box-shadow: none; }
.dp-item.fresh { border: 1px dashed var(--line-strong); margin-bottom: 6px; }
.dp-item.fresh:hover { border-color: var(--orange); color: var(--orange); background: none; }
/* Suchfeld: Aussehen kommt aus basis.css, hier nur die Größe */
#dlgDocPicker input[type=search] { font-size: 15px; padding: 10px 14px; }

/* Der Notiz-Bereich fährt nur ein, statt hereinzugleiten.
   Grund: „rise-in" lässt einen transform-Wert auf dem Bereich stehen (fill: both),
   und ein transform macht den Bereich zum Bezugsrahmen für position:fixed – die
   ausklappbare Seitenleiste am Handy klebte dann am Bereich statt am Bildschirm.
   Derselbe Fallstrick wie beim backdrop-filter der Topbar (siehe Mobile-Block). */
#viewDocs:not([hidden]) { animation-name: fade-in; }

/* ---- Ziele & Notizen am Handy ---- */
@media (max-width: 900px) {
    .docs-shell { grid-template-columns: 1fr; min-height: 0; position: relative; }
    .docs-side {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 90;
        width: 82vw;
        max-width: 320px;
        height: 100%;
        transform: translateX(-102%);
        transition: transform 0.22s ease;
        box-shadow: 0 16px 48px -12px rgba(var(--ink-rgb), 0.35);
        padding-top: calc(18px + env(safe-area-inset-top));
    }
    .docs-shell.side-open .docs-side { transform: none; }
    .docs-side-toggle {
        display: inline-grid;
        place-content: center;
        /* Schwebt links über der Bottom-Bar – die alte Topbar, an der
           der Knopf klebte, gibt es nicht mehr. */
        position: fixed;
        left: 12px;
        bottom: calc(84px + env(safe-area-inset-bottom));
        z-index: 60;
        margin: 0;
        width: 38px;
        height: 38px;
        background: var(--surface);
        border: none;
        border-radius: 50%;
        box-shadow: var(--shadow-card);
        cursor: pointer;
        font-size: 16px;
    }
    .docs-main { padding: 6px 16px 80px; min-height: 0; }
    .blk-gutter { position: static; opacity: 1; margin-top: 2px; }
    .blk { gap: 4px; }
    .doc-title-input { font-size: 26px; }
}
@media (max-width: 720px) {
    #viewGoals .view-head { display: none; }
    .docs-shell { border-radius: 14px; margin-top: 8px; }
    .goal-grid { grid-template-columns: 1fr; }
    /* Ergebnis-Zeile darf umbrechen, sonst schiebt sie die Seite quer */
    .goal-kr-top { flex-wrap: wrap; row-gap: 2px; }
    .goal-kr-label { flex: 1 0 100%; }
    .goal-kr-nums { margin-left: auto; }
    .kr-del { opacity: 1; }
    .goal-focus { gap: 16px; }
    .goal-focus-stats { width: 100%; }
    .goal-stat { flex: 1; min-width: 68px; padding: 7px 9px; }
    .goal-stat b { font-size: 18px; }
    .card-goalfocus { padding: 16px 14px; }
    .roadmap { --rm-label: 148px; }
    .rm-name { font-size: 12px; }
    .goal-head-actions { width: 100%; justify-content: space-between; }
    .goal-tab { padding: 6px 12px; font-size: 13px; }
}

/* ============================================================
   ZIELE — Reihenfolge-Ansicht („erst A, dann B")
   Spalte 1 kann sofort losgehen, jede weitere wartet auf die vorige.
   Die Karten sind normales HTML im Flex-Layout; die Pfeile liegen als
   SVG darüber und werden nach dem Zeichnen aus den echten Positionen
   berechnet (drawGoalTreeLinks) – dadurch passen sie immer.
   ============================================================ */
.goal-tree {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 62px;
    overflow-x: auto;
    padding: 6px 4px 14px;
}
.gt-links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.gt-link { fill: none; stroke-width: 2px; }
.gt-link.ready { stroke: var(--moss); }
.gt-link.waiting { stroke: rgba(var(--ink-rgb), 0.25); stroke-dasharray: 6 5; }
.gt-links marker path { fill: rgba(var(--ink-rgb), 0.35); }
.gt-col { display: flex; flex-direction: column; gap: 16px; min-width: 250px; flex: 0 0 250px; }
.gt-col-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin: 0 0 2px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
}
/* Zielkarte: die Zielfarbe liegt als Fläche darunter, nicht als Rand */
.gt-node {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 7px;
    background: color-mix(in srgb, var(--goal-color, var(--charcoal)) 12%, var(--surface));
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    padding: 12px 14px 13px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}
.gt-node:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.gt-node.locked { background: var(--surface-2); box-shadow: none; opacity: 0.9; }
.gt-node.done { opacity: 0.72; }
.gt-node.done .gt-title { text-decoration: line-through; }
.gt-node-head { display: flex; align-items: flex-start; gap: 7px; }
.gt-state { flex-shrink: 0; font-size: 13px; line-height: 1.35; }
.gt-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.gt-node .goal-track { height: 8px; }
.gt-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.gt-waits {
    margin: 0;
    font-size: 12px;
    color: var(--ink-2);
    border-top: 1px solid var(--line);
    padding-top: 6px;
}
.gt-legend { margin: 12px 2px 0; max-width: 70ch; }

/* „Wartet auf …" auf der normalen Zielkarte */
.goal-waits {
    margin: 0;
    font-size: 12.5px;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.goal-wait-chip {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    border: none;
    border-radius: var(--r-pill);
    padding: 3px 10px;
    cursor: pointer;
    color: var(--ink);
    transition: background 0.15s, color 0.15s;
}
.goal-wait-chip:hover { background: var(--tone-orange); color: var(--tone-orange-ink); }
.pace-locked { background: var(--surface-2); color: var(--ink-2); }

/* Voraussetzungen im Ziel-Dialog */
.gl-deps { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 6px 0 8px; }
.gl-dep {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    background: var(--surface-2);
    border: none;
    border-radius: var(--r-pill);
    padding: 4px 6px 4px 12px;
    max-width: 100%;
}
.gl-dep button { background: none; border: none; cursor: pointer; color: var(--ink-2); font-size: 16px; padding: 0 5px; line-height: 1; }
.gl-dep button:hover { color: var(--danger); }

@media (max-width: 720px) {
    /* Am Handy untereinander statt quer – die Pfeile verschwinden dabei,
       die Stufen-Überschriften tragen die Reihenfolge allein. */
    .goal-tree { flex-direction: column; gap: 22px; overflow-x: visible; }
    .gt-col { flex: 1 1 auto; min-width: 0; width: 100%; }
    .gt-links { display: none; }
}

/* ============================================================
   NOTIZEN — Moodboard & Storyboard
   Zwei Blöcke mit eigener Oberfläche statt einer Textzeile. Bilder
   liegen wie alle Anhänge auf dem Server, im Dokument steht nur der
   Schlüssel; die Vorschau wird nach dem Zeichnen nachgeladen.
   ============================================================ */
.blk-moodboard, .blk-storyboard { display: block; margin: 14px 0; }
.blk-moodboard .blk-gutter, .blk-storyboard .blk-gutter { top: 8px; }
.blk-kind {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
}

/* ---- Moodboard ---- */
.mb {
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 12px 14px 14px;
}
.mb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mb-count { margin-right: auto; }
.mb-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mb-cols select {
    width: auto;
    padding: 4px 28px 4px 8px;
    font-size: 12px;
    background-color: var(--surface);
    border-radius: 8px;
}
.mb-grid {
    display: grid;
    /* minmax(0,1fr) statt 1fr: sonst drückt der Text der „+"-Kachel
       ihre Spalte breiter als die anderen und das Raster steht schief */
    grid-template-columns: repeat(var(--mb-cols, 4), minmax(0, 1fr));
    gap: 10px;
    border-radius: 12px;
}
.mb-grid.over { outline: 1px dashed var(--orange); outline-offset: 4px; }
.mb-tile {
    position: relative;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: grab;
}
.mb-tile.dragging { opacity: 0.4; }
.mb-tile.over { outline: 1px solid var(--orange); outline-offset: 3px; border-radius: 10px; }
.mb-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--surface);
    border: none;
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
    display: grid;
    place-content: center;
    transition: box-shadow 0.15s;
}
.mb-tile:hover .mb-thumb { box-shadow: var(--shadow-hover); }
.mb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mb-thumb.missing::after { content: 'Bild fehlt'; font-size: 12px; color: var(--ink-2); }
.mb-swatch {
    position: relative;
    aspect-ratio: 1 / 1;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.mb-tile:hover .mb-swatch { box-shadow: var(--shadow-hover); }
.mb-swatch input[type=color] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: none;
    padding: 0;
    cursor: pointer;
}
.mb-hex {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    background: none;
    border: none;
    color: var(--ink-2);
    cursor: copy;
    padding: 0 2px;
    text-align: left;
}
.mb-hex:hover { color: var(--orange); }
.mb-cap {
    font-family: var(--font-display);
    font-size: 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 2px 1px;
    width: 100%;
}
.mb-cap:focus { outline: none; background: transparent; box-shadow: none; border-bottom-color: var(--orange); }
.mb-x {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    display: grid;
    place-content: center;
    background: rgba(var(--ink-rgb), 0.72);
    color: var(--almond-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s;
}
.mb-tile:hover .mb-x { opacity: 1; }
.mb-x:hover { background: var(--danger); }
/* Leerzone zum Hinzufügen: darf gestrichelt bleiben */
.mb-add {
    aspect-ratio: 1 / 1;
    display: grid;
    place-content: center;
    gap: 2px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--ink-2);
    background: transparent;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    cursor: pointer;
    padding: 6px;
    transition: color 0.15s, border-color 0.15s;
}
.mb-add span { font-size: 22px; line-height: 1; }
.mb-add:hover { border-color: var(--orange); color: var(--orange); }

/* ---- Storyboard ---- */
.sb {
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 12px 14px 14px;
}
.sb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sb-head .muted { margin-right: auto; }
.sb-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 4px 10px;
    align-items: flex-start;
}
.sb-card {
    flex: 0 0 218px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface);
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    padding: 8px;
    transition: box-shadow 0.15s;
}
.sb-card:hover { box-shadow: var(--shadow-hover); }
.sb-card.dragging { opacity: 0.4; }
.sb-card.over { outline: 1px solid var(--orange); outline-offset: 2px; }
.sb-card-head { display: flex; align-items: center; gap: 5px; }
.sb-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: grid;
    place-content: center;
    background: var(--charcoal);
    color: var(--almond-light);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: grab;
}
/* Kleine Felder in der Szene: Aussehen aus basis.css, hier nur kompakter */
.sb-shot, .sb-dur, .sb-vo, .sb-text {
    font-family: var(--font-display);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 12px;
    width: 100%;
}
.sb-shot { min-width: 0; }
.sb-dur { width: 56px; flex-shrink: 0; text-align: right; }
.sb-text { resize: vertical; line-height: 1.4; }
.sb-x {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 16px;
    padding: 0 3px;
    line-height: 1;
}
.sb-x:hover { color: var(--danger); }
/* Bildrahmen: leer gestrichelt (Ablagezone), mit Bild rahmenlos */
.sb-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    display: grid;
    place-content: center;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
}
.sb-frame.has-img { border: none; cursor: zoom-in; }
.sb-frame.over { border-color: var(--orange); background: var(--tone-orange); }
.sb-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-frame.missing::after { content: 'Bild fehlt'; font-size: 12px; color: var(--ink-2); }
.sb-frame-hint { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.sb-frame-x {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    display: grid;
    place-content: center;
    background: rgba(var(--ink-rgb), 0.72);
    color: var(--almond-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s;
}
.sb-frame:hover .sb-frame-x { opacity: 1; }
.sb-frame-x:hover { background: var(--danger); }
.sb-add {
    flex: 0 0 56px;
    align-self: stretch;
    min-height: 170px;
    background: transparent;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    color: var(--ink-2);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.sb-add:hover { border-color: var(--orange); color: var(--orange); }

/* ---- Großansicht (bleibt dunkel) ---- */
.doc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    justify-items: center;
    gap: 10px;
    padding: 40px 16px 70px;
    background: rgba(var(--ink-rgb), 0.94);
    animation: fade-in 0.18s;
}
.doc-lightbox img {
    grid-column: 2;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    background: var(--charcoal-soft);
}
.dlb-nav {
    background: rgba(233,218,197,0.12);
    border: none;
    color: var(--almond);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.dlb-nav:hover { background: var(--orange); color: #FFF6EC; }
.dlb-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(233,218,197,0.12);
    border: none;
    color: var(--almond);
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
}
.dlb-close:hover { background: var(--danger); color: #fff; }
.dlb-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    color: var(--almond);
    font-size: 14px;
    text-align: center;
}
.dlb-count { font-family: var(--font-display); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; color: rgba(233,218,197,0.6); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
    .mb-grid { grid-template-columns: repeat(min(var(--mb-cols, 4), 3), minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .mb { padding: 10px; }
    .mb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .mb-x, .sb-frame-x { opacity: 1; }
    .sb { padding: 10px; }
    .sb-card { flex-basis: 78vw; max-width: 300px; }
    .sb-add { flex-basis: 46px; }
    .dlb-nav { width: 40px; height: 40px; font-size: 20px; }
}

/* Unterseite direkt von der Seite aus anlegen – der Weg über die
   Seitenleiste war ein Umweg, wenn man ohnehin schon in der Seite steht. */
.doc-subpage.neu { color: var(--ink-2); }
.doc-subpage.neu span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
}
.doc-subpage.neu:hover { color: var(--orange); }
.doc-subpage.neu:hover span { border-color: var(--orange); border-style: solid; }
