/**
 * Produktdesigner – zentrales Stylesheet
 * Farbschema angelehnt an iptv.fauss.eu
 */
:root {
    --primary: #E50914;
    --primary-hover: #c40812;
    --bg-dark: #000000;
    --bg-card: #1a1a1a;
    --bg-sidebar: #0a0a0a;
    --bg-input: #111111;
    --text-light: #eeeeee;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --navbar-h: 58px;
    --sidebar-w: 300px;

    --bs-body-bg: var(--bg-dark);
    --bs-body-color: var(--text-light);
    --bs-border-color: var(--border-color);
    --bs-secondary-color: var(--text-muted);
    --bs-link-color: var(--primary);
    --bs-link-hover-color: #ff4d55;
    --bs-link-color-rgb: 229, 9, 20;
    --bs-primary: var(--primary);
    --bs-primary-rgb: 229, 9, 20;
    --bs-tertiary-bg: var(--bg-card);
    --bs-secondary-bg: var(--bg-card);
}

html, body { height: 100%; }
body {
    background: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}
.text-muted { color: var(--text-muted) !important; }
.text-primary-dg { color: var(--primary) !important; }
a { color: var(--primary); }
a:hover { color: #ff4d55; }

/* ---------- Buttons ---------- */
.btn-primary {
    --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-disabled-bg: #6b0a0f; --bs-btn-disabled-border-color: #6b0a0f;
    --bs-btn-color: var(--text-light); --bs-btn-hover-color: #fff;
}
.btn-dg-ghost {
    color: var(--text-muted); background: transparent; border: 1px solid var(--border-color);
}
.btn-dg-ghost:hover, .btn-dg-ghost.active { color: var(--text-light); background: #1f1f1f; border-color: #555; }
.form-control, .form-select, .input-group-text {
    background-color: var(--bg-input); border-color: var(--border-color); color: var(--text-light);
}
.form-control:focus, .form-select:focus {
    background-color: var(--bg-input); color: var(--text-light);
    border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(229, 9, 20, .25);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(229, 9, 20, .25); border-color: var(--primary); }
.form-range::-webkit-slider-thumb { background: var(--primary); }
.form-range::-moz-range-thumb { background: var(--primary); }
.form-range::-webkit-slider-runnable-track { background: #3a3a3a; }
.form-range::-moz-range-track { background: #3a3a3a; }
.nav-pills .nav-link.active { background: var(--primary); }
.nav-pills .nav-link { color: var(--text-muted); text-align: left; }
.nav-pills .nav-link:hover { color: var(--text-light); background: #141414; }
.dropdown-menu { --bs-dropdown-bg: var(--bg-card); --bs-dropdown-border-color: var(--border-color); --bs-dropdown-link-active-bg: var(--primary); }
.list-group { --bs-list-group-bg: var(--bg-card); --bs-list-group-border-color: var(--border-color); --bs-list-group-color: var(--text-light); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text-light); --bs-table-border-color: var(--border-color); }
.modal-content.dg-modal { background: var(--bg-card); border: 1px solid var(--border-color); }
.dg-modal .modal-header, .dg-modal .modal-footer { border-color: var(--border-color); }

/* ---------- Navigationsleiste ---------- */
.dg-navbar {
    background: var(--bg-dark);
    border-bottom: 2px solid var(--primary);
    min-height: var(--navbar-h);
    padding-top: .35rem; padding-bottom: .35rem;
    z-index: 1030;
}
.dg-navbar .navbar-brand { color: var(--text-light); }
.dg-navbar .nav-link { color: var(--text-muted); border-radius: 6px; padding: .45rem .8rem !important; }
.dg-navbar .nav-link:hover { color: var(--text-light); background: #141414; }
.dg-navbar .nav-link.active { color: var(--text-light); background: #1a1a1a; box-shadow: inset 0 -2px 0 var(--primary); }
.dg-navbar .navbar-toggler { color: var(--text-light); border-color: var(--border-color); }
.dg-logo { width: 34px; height: 34px; }

/* ---------- Karten / Startseite ---------- */
.dg-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}
.dg-module-tile {
    display: flex; flex-direction: column; padding: 1.4rem;
    color: var(--text-light); text-decoration: none;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.dg-module-tile:hover {
    color: var(--text-light); transform: translateY(-3px);
    border-color: var(--primary); box-shadow: 0 8px 24px rgba(229, 9, 20, .15);
}
.dg-module-icon {
    width: 52px; height: 52px; border-radius: 12px; margin-bottom: 1rem;
    display: flex; align-items: center; justify-content: center;
    background: rgba(229, 9, 20, .12); color: var(--primary); font-size: 1.5rem;
}
.dg-tile-go { color: var(--primary); font-weight: 600; }

/* ---------- Login ---------- */
.page-bare .dg-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.dg-auth-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px;
    padding: 2.5rem 2rem; width: 100%; max-width: 380px; text-align: center;
}
.dg-auth-logo { width: 72px; height: 72px; margin-bottom: 1rem; }

/* ---------- Meldungen ---------- */
.dg-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.dg-toast {
    background: var(--bg-card); border: 1px solid var(--border-color); border-left: 4px solid var(--text-muted);
    border-radius: 8px; padding: .7rem 1rem; box-shadow: 0 6px 20px rgba(0,0,0,.6);
    animation: dgIn .2s ease-out;
}
.dg-toast-success { border-left-color: #28a745; }
.dg-toast-danger, .dg-toast-error { border-left-color: var(--primary); }
.dg-toast-warning { border-left-color: #ffc107; }
.dg-toast-info { border-left-color: #0dcaf0; }
@keyframes dgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Seitenleisten (gemeinsam) ---------- */
.dg-sidebar {
    background: var(--bg-sidebar);
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    display: flex; flex-direction: column; min-height: 0;
    transition: margin .2s ease, transform .2s ease;
}
.dg-sidebar-left { border-right: 1px solid var(--border-color); }
.dg-sidebar-right { border-left: 1px solid var(--border-color); }
.dg-sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem; border-bottom: 1px solid var(--border-color);
    font-weight: 600; font-size: .9rem;
}
.dg-sidebar-body { padding: 1rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dg-workspace.hide-left .dg-sidebar-left { margin-left: calc(-1 * var(--sidebar-w)); }
.dg-workspace.hide-right .dg-sidebar-right { margin-right: calc(-1 * var(--sidebar-w)); }
.dg-panel-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: .5rem; }

/* ---------- Arbeitsfläche ---------- */
.page-module .dg-main, .page-files .dg-main { height: calc(100vh - var(--navbar-h)); overflow: hidden; }
.dg-workspace { display: flex; height: 100%; overflow: hidden; }
.dg-stage-wrap { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.dg-stage-toolbar {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .5rem .75rem; border-bottom: 1px solid var(--border-color); background: var(--bg-dark);
}
.dg-stage {
    position: relative; flex: 1 1 auto; overflow: hidden; cursor: grab;
    background-color: #0d0d0d;
    background-image: radial-gradient(#262626 1px, transparent 1px);
    background-size: 16px 16px;
}
.dg-stage.dragging { cursor: grabbing; }
.dg-stage { touch-action: none; }

/* Zeichnen: Pinsel & Radierer */
.dg-stage.ed-drawing, .dg-stage.ed-drawing * { cursor: crosshair !important; }
.dg-stage.ed-drop { outline: 2px dashed var(--primary); outline-offset: -6px; }
[data-pt].active { border-color: var(--primary) !important; background: rgba(229, 9, 20, .15); }
.ed-drawbar {
    position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); z-index: 15;
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 1rem); width: max-content;
    background: rgba(20, 20, 20, .95); border: 1px solid var(--border-color); border-radius: 10px; padding: .4rem .6rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5); cursor: default !important;
}
.ed-drawbar * { cursor: default !important; }
.ed-drawbar input[type=range] { cursor: pointer !important; width: 110px; accent-color: var(--primary); }
.ed-drawbar-kinds { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.ed-drawbar-title { font-size: .8rem; color: var(--text-muted); max-width: 320px; }
.ed-drawbar-title.warn { color: #ffc107; }
.ed-swatch { display: flex; align-items: center; gap: .3rem; background: #1c1c1c; border: 1px solid #333; color: var(--text-light); border-radius: 6px; padding: .15rem .4rem; font-size: .75rem; cursor: pointer !important; }
.ed-swatch span { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-sizing: border-box; }
.ed-swatch.active { border-color: var(--primary); background: rgba(229, 9, 20, .15); }
.ed-swatch-static { width: 20px; height: 20px; border-radius: 50%; display: inline-block; border: 1px solid #555; }
.ed-cmyk { display: flex; align-items: center; gap: .2rem; font-size: .75rem; color: var(--text-muted); }
.ed-cmyk input { width: 52px; background: #1c1c1c; border: 1px solid #333; color: var(--text-light); border-radius: 4px; padding: 0 .25rem; }
.ed-colorpick input { width: 34px; height: 26px; border: 0; background: none; padding: 0; cursor: pointer !important; }
.ed-drawbar-size { display: flex; align-items: center; gap: .4rem; }
.ed-drawbar-size .form-control { width: 64px; }
.ed-size-dot { display: inline-block; border-radius: 50%; border: 1px solid #888; flex: 0 0 auto; }
.dg-overlay .ed-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .75; pointer-events: none; }
.dg-overlay .ed-stroke-erase { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; opacity: .55; pointer-events: none; }
.dg-overlay .ed-brush-cursor { fill: none; stroke: var(--c, #e63946); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.dg-overlay .ed-brush-cursor.eraser { stroke: #fff; stroke-dasharray: 3 2; fill: rgba(255, 255, 255, .12); }
.dg-stage-canvas [data-dg-drag] { cursor: move; pointer-events: all; }
.dg-stage-canvas [data-dg-handle] { fill: transparent; stroke: transparent; vector-effect: non-scaling-stroke; }
.dg-stage-canvas [data-dg-handle]:hover, .dg-stage.dragging-el [data-dg-handle] { stroke: var(--primary); stroke-width: 1.5px; stroke-dasharray: 5 4; fill: rgba(229, 9, 20, .06); }
.dg-stage.dragging-el { cursor: move; }
.dg-field-btns { display: inline-flex; gap: .35rem; }
.dg-field-btn { background: none; border: 0; padding: 0 .15rem; color: var(--text-muted); font-size: .8rem; line-height: 1; }
.dg-field-btn:hover { color: var(--primary); }
.dg-field label { align-items: center; }
.dg-stage-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.dg-stage-canvas svg {
    display: block; background: #f4efe6; /* Holzfarbener Hintergrund für bessere Lesbarkeit */
    box-shadow: 0 10px 40px rgba(0,0,0,.7); overflow: visible;
}
.dg-stage.grid .dg-stage-canvas svg {
    background-image:
        linear-gradient(rgba(0,0,0,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.08) 1px, transparent 1px);
}
.dg-stage-error {
    position: absolute; left: 50%; top: 1rem; transform: translateX(-50%);
    background: rgba(229, 9, 20, .15); border: 1px solid var(--primary); color: var(--text-light);
    border-radius: 8px; padding: .5rem 1rem; max-width: 80%;
}
.dg-stage-status.busy { color: var(--primary); }
.dg-source { background: #141414; border: 1px solid var(--border-color); border-radius: 8px; padding: .5rem .75rem; }
.dg-info-table td { padding: .25rem .4rem; font-size: .85rem; }
.dg-info-table td:first-child { color: var(--text-muted); }
.dg-warning { background: rgba(255, 193, 7, .1); border: 1px solid rgba(255, 193, 7, .5); border-radius: 8px; padding: .4rem .7rem; font-size: .85rem; margin-bottom: .5rem; }
.dg-warning-mark { position: relative; cursor: pointer; padding-right: 2rem; user-select: none; }
.dg-warning-mark:hover { background: rgba(255, 193, 7, .18); }
.dg-warning-mark.on { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.dg-warning-mark .dg-mark-eye { position: absolute; right: .65rem; top: .55rem; color: var(--text-muted); font-size: .8rem; }
.dg-warning-mark.on .dg-mark-eye { color: var(--primary); }

/* Parameterformular */
.dg-param-group { margin-bottom: 1rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); }
.dg-param-group > summary {
    list-style: none; cursor: pointer; padding: .6rem .8rem; font-weight: 600; font-size: .9rem;
    display: flex; align-items: center; justify-content: space-between;
}
.dg-param-group > summary::-webkit-details-marker { display: none; }
.dg-param-group > summary::after { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .7rem; color: var(--text-muted); transition: transform .15s; }
.dg-param-group[open] > summary::after { transform: rotate(180deg); }
.dg-param-group .dg-param-fields { padding: 0 .8rem .6rem; }
.dg-field { margin-bottom: .75rem; }
.dg-field label { font-size: .82rem; color: var(--text-muted); margin-bottom: .2rem; display: flex; justify-content: space-between; }
.dg-field .form-text { font-size: .75rem; }
.dg-field-number { display: flex; gap: .5rem; align-items: center; }
.dg-field-number .form-range { flex: 1 1 auto; }
.dg-field-number .form-control { width: 82px; flex: 0 0 82px; text-align: right; }
.dg-unit { font-size: .75rem; color: var(--text-muted); min-width: 22px; }

.dg-ai-btn { color: var(--primary) !important; }
.dg-ai-btn:hover { color: #ff4d55 !important; }

/* ---------- Objekt-Editor ---------- */
.dg-overlay { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.dg-stage-canvas svg.dg-overlay, .dg-stage.grid .dg-stage-canvas svg.dg-overlay { background: none !important; box-shadow: none; }
.dg-overlay [data-h] { pointer-events: all; }
.dg-overlay .ed-sel { fill: none; stroke: var(--primary); stroke-width: 1.2px; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; }
.dg-overlay .ed-sel-item { fill: rgba(229, 9, 20, .05); stroke: var(--primary); stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
.dg-overlay .ed-hover { fill: rgba(58, 134, 255, .06); stroke: #3a86ff; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.dg-overlay .ed-h { fill: #fff; stroke: var(--primary); stroke-width: 1.2px; vector-effect: non-scaling-stroke; cursor: ew-resize; }
.dg-overlay [data-h="n"], .dg-overlay [data-h="s"] { cursor: ns-resize; }
.dg-overlay [data-h="nw"], .dg-overlay [data-h="se"] { cursor: nwse-resize; }
.dg-overlay [data-h="ne"], .dg-overlay [data-h="sw"] { cursor: nesw-resize; }
.dg-overlay .ed-hc { fill: var(--primary); stroke: #fff; }
.dg-overlay .ed-rot { fill: #fff; stroke: var(--primary); stroke-width: 1.2px; vector-effect: non-scaling-stroke; cursor: grab; }
.dg-overlay .ed-rotline { stroke: var(--primary); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.dg-overlay .ed-conn { stroke: #3a86ff; stroke-width: 1px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.dg-overlay .ed-ch { fill: #3a86ff; stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: move; }
.dg-overlay .ed-cm { fill: #fff; stroke: #3a86ff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: move; }
.dg-overlay .ed-guide { stroke: #00c2ff; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.dg-overlay .ed-marquee { fill: rgba(58, 134, 255, .08); stroke: #3a86ff; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.ed-on .dg-stage { cursor: default; }
.dg-stage.ed-connecting { cursor: crosshair; }
.dg-tool-sep { width: 1px; height: 22px; background: var(--border-color); margin: 0 .25rem; }
.ed-add { display: flex; flex-wrap: wrap; gap: .3rem; }
.ed-add .btn { font-size: .78rem; padding: .2rem .45rem; }
.ed-list { border: 1px solid var(--border-color); border-radius: 8px; max-height: 260px; overflow-y: auto; background: var(--bg-card); }
.ed-item { display: flex; align-items: center; gap: .35rem; padding: .3rem .45rem; font-size: .84rem; cursor: pointer; border-bottom: 1px solid #222; user-select: none; }
.ed-item:last-child { border-bottom: 0; }
.ed-item:hover { background: #1f1f1f; }
.ed-item.active { background: rgba(229, 9, 20, .18); }
.ed-item.hidden-obj .ed-name { opacity: .45; }
.ed-item .ed-name { flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ed-item .ed-eff { color: var(--text-muted); font-size: .75rem; }
.ed-item .ed-colordot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid #555; flex: 0 0 auto; }
.ed-item .ed-badge { font-size: .65rem; background: #2a2a2a; border-radius: 4px; padding: 0 .3rem; color: var(--text-muted); }
.ed-ib { background: none; border: 0; color: var(--text-muted); padding: 0 .15rem; font-size: .75rem; }
.ed-ib:hover { color: var(--text-light); }
.ed-group-row .ed-name { font-weight: 500; }
.ed-group-row .ed-tog { width: 14px; font-size: .62rem; }
.ed-iso-head { display: flex; align-items: center; padding: .35rem .45rem; font-size: .8rem; background: rgba(229, 9, 20, .12); border-bottom: 1px solid rgba(229, 9, 20, .35); color: var(--text-light); }
.dg-overlay .ed-iso { fill: rgba(18, 18, 18, .55); pointer-events: none; }
.dg-overlay .ed-iso-frame { fill: none; stroke: #ffb703; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; pointer-events: none; }
.dg-overlay .ed-sel-group { fill: rgba(229, 9, 20, .03); stroke-dasharray: 6 3; }
.ed-ctx { position: fixed; z-index: 2000; min-width: 230px; font-size: .85rem; padding: .25rem 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.ed-ctx .dropdown-item { display: flex; align-items: center; padding: .3rem .8rem; }
.ed-ctx .ed-ctx-key { margin-left: auto; padding-left: 1.2rem; font-size: .72rem; color: var(--text-muted); }
.ed-props, .ed-right-default { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.ed-props.d-none, .ed-right-default.d-none { display: none !important; }
kbd { background: #2a2a2a; border: 1px solid #444; color: var(--text-light); font-size: .75rem; }

/* Motivauswahl (Feldtyp "motif") */
.dg-motif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .4rem; max-height: 230px; overflow-y: auto; padding: 2px; }
.dg-motif { background: #141414; border: 1px solid var(--border-color); border-radius: 8px; padding: .3rem; color: var(--text-light); text-align: center; }
.dg-motif:hover { border-color: #666; }
.dg-motif.active { border-color: var(--primary); background: rgba(229, 9, 20, .12); }
.dg-motif-img { height: 44px; display: flex; align-items: center; justify-content: center; color: #d8b98e; }
.dg-motif-img svg { max-width: 100%; max-height: 44px; }
.dg-motif-name { font-size: .65rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Presets */
.dg-presets { max-height: 240px; overflow-y: auto; }
.dg-preset {
    display: flex; align-items: center; gap: .25rem; padding: .3rem .5rem;
    border-radius: 6px; font-size: .88rem; cursor: pointer;
}
.dg-preset:hover { background: #1a1a1a; }
.dg-preset .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-preset .btn { padding: 0 .3rem; color: var(--text-muted); }
.dg-preset .btn:hover { color: var(--text-light); }

/* ---------- Dateiverwaltung ---------- */
.dg-files { display: flex; height: 100%; overflow: hidden; }
.dg-files-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; position: relative; }
.dg-files-toolbar, .dg-files-selbar, .dg-trashbar {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .6rem .9rem; border-bottom: 1px solid var(--border-color);
}
.dg-files-selbar {
    /* schwebt unten über der Liste – verschiebt beim Auswählen nichts (Doppelklick trifft dieselbe Zeile) */
    position: absolute; left: .75rem; right: .75rem; bottom: .75rem; z-index: 20;
    background: #1a0b0c; border: 1px solid rgba(229, 9, 20, .45); border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .6);
}
.dg-files-list { padding-bottom: 5rem !important; }


.dg-trashbar { background: #141414; }
.dg-search { width: 200px; }
.dg-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; font-size: .95rem; }
.dg-breadcrumb a { color: var(--text-muted); text-decoration: none; padding: .15rem .35rem; border-radius: 4px; }
.dg-breadcrumb a:hover, .dg-breadcrumb a.drop-over { color: var(--text-light); background: #1f1f1f; }
.dg-breadcrumb .sep { color: #555; }
.dg-files-list { flex: 1 1 auto; overflow: auto; padding: .5rem; outline: none; }
.dg-tree-item {
    display: flex; align-items: center; padding: .3rem .4rem; border-radius: 6px; cursor: pointer;
    white-space: nowrap; color: var(--text-muted); font-size: .9rem; user-select: none;
}
.dg-tree-item:hover { background: #161616; color: var(--text-light); }
.dg-tree-item.active { background: #1f1f1f; color: var(--text-light); box-shadow: inset 2px 0 0 var(--primary); }
.dg-tree-item .toggle { width: 16px; text-align: center; font-size: .7rem; flex: 0 0 16px; }
.dg-tree-children { padding-left: 14px; }
.dg-tree-children.collapsed { display: none; }
.drop-over { background: rgba(229, 9, 20, .25) !important; color: var(--text-light) !important; outline: 1px dashed var(--primary); }

.fm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.fm-table th { color: var(--text-muted); font-weight: 500; font-size: .8rem; padding: .4rem .6rem; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; background: var(--bg-dark); z-index: 1; cursor: pointer; }
.fm-table td { padding: .45rem .6rem; border-bottom: 1px solid #1a1a1a; }
.fm-row { cursor: default; user-select: none; }
.fm-row:hover td { background: #121212; }
.fm-row.selected td { background: rgba(229, 9, 20, .14); }
.fm-row .fm-icon { width: 22px; text-align: center; color: var(--text-muted); }
.fm-row.is-dir .fm-icon { color: #e0b030; }
.fm-row .fm-name { word-break: break-all; }
.fm-thumb { width: 32px; height: 32px; object-fit: contain; background: #f4efe6; border-radius: 4px; }
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.fm-tile {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: .6rem;
    text-align: center; user-select: none; position: relative;
}
.fm-tile:hover { border-color: #555; }
.fm-tile.selected { border-color: var(--primary); background: rgba(229, 9, 20, .1); }
.fm-tile .fm-tile-img { height: 100px; display: flex; align-items: center; justify-content: center; margin-bottom: .4rem; border-radius: 6px; overflow: hidden; }
.fm-tile .fm-tile-img img { max-width: 100%; max-height: 100px; background: #f4efe6; }
.fm-tile .fm-tile-img i { font-size: 2.6rem; color: var(--text-muted); }
.fm-tile.is-dir .fm-tile-img i { color: #e0b030; }
.fm-tile .fm-tile-name { font-size: .8rem; word-break: break-all; line-height: 1.2; }
.fm-tile .form-check-input { position: absolute; top: .4rem; left: .4rem; }
.fm-module-badge { font-size: .7rem; background: #222; border: 1px solid var(--border-color); border-radius: 4px; padding: 0 .3rem; color: var(--text-muted); }
.dg-dropzone-hint {
    display: none; position: absolute; inset: 0; z-index: 5;
    background: rgba(0,0,0,.75); border: 2px dashed var(--primary); border-radius: 12px; margin: .5rem;
    align-items: center; justify-content: center; flex-direction: column; color: var(--text-light); pointer-events: none;
}
.dg-files-main.drag-upload .dg-dropzone-hint { display: flex; }
.dg-empty { color: var(--text-muted); text-align: center; padding: 3rem 1rem; }
.dg-preview-body { min-height: 300px; display: flex; align-items: center; justify-content: center; background: #0d0d0d; }
.dg-preview-body img { max-width: 100%; max-height: 70vh; background: #f4efe6; }
.dg-preview-body iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.dg-picker { max-height: 50vh; overflow-y: auto; }

/* ---------- Einstellungen ---------- */
.dg-settings-nav .nav-link { margin-bottom: .25rem; }
.dg-module-list .list-group-item.dragging { opacity: .4; }
.dg-drag-handle { cursor: grab; }
.form-control-color { width: 3rem; padding: .2rem; }

/* ---------- Responsiv ---------- */
@media (max-width: 991.98px) {
    .page-module .dg-main, .page-files .dg-main { height: auto; min-height: calc(100vh - var(--navbar-h)); overflow: visible; }
    .dg-workspace, .dg-files { flex-direction: column; height: auto; overflow: visible; }
    .dg-sidebar { width: 100%; flex: 0 0 auto; border: 0; border-bottom: 1px solid var(--border-color); }
    .dg-workspace.hide-left .dg-sidebar-left, .dg-workspace.hide-right .dg-sidebar-right { display: none; margin: 0; }
    .dg-stage { height: 60vh; flex: 0 0 auto; }
    .dg-sidebar-body { max-height: none; }
    .dg-files-tree-wrap .dg-sidebar-body { max-height: 30vh; }
    .dg-files-list { min-height: 50vh; }
    .dg-search { width: 100%; }
}

/* Datei-Explorer verkleinert (Speichern-/Exportdialog) – steht am Ende, damit er die Seiten-Regeln überstimmt */
.dg-files.dg-files-compact {
    flex-direction: row; height: 360px; overflow: hidden;
    border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-dark);
}
.dg-files.dg-files-compact .dg-sidebar.dg-files-tree-wrap { width: 180px; flex: 0 0 180px; border: 0; border-right: 1px solid var(--border-color); }
.dg-files-compact .dg-sidebar-head { padding: .4rem .6rem; font-size: .8rem; }
.dg-files.dg-files-compact .dg-files-tree-wrap .dg-sidebar-body { max-height: none; overflow-y: auto; }
.dg-files-compact .dg-tree-item { font-size: .8rem; padding: .2rem .3rem; }
.dg-files-compact .dg-files-toolbar, .dg-files-compact .dg-trashbar { padding: .35rem .5rem; gap: .35rem; }
.dg-files-compact .dg-files-selbar { padding: .35rem .5rem; left: .4rem; right: .4rem; bottom: .4rem; font-size: .8rem; }
.dg-files-compact .dg-breadcrumb { font-size: .82rem; }
.dg-files.dg-files-compact .dg-search { width: 130px; }
.dg-files-compact .form-select-sm, .dg-files-compact .form-control { font-size: .78rem; }
.dg-files.dg-files-compact .dg-files-list { min-height: 0; padding: .25rem; padding-bottom: 3.5rem !important; }
.dg-files-compact .fm-table { font-size: .8rem; }
.dg-files-compact .fm-table th { padding: .25rem .4rem; font-size: .72rem; }
.dg-files-compact .fm-table td { padding: .25rem .4rem; }
.dg-files-compact .fm-thumb { width: 22px; height: 22px; }
.dg-files-compact .fm-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .4rem; }
.dg-files-compact .fm-tile .fm-tile-img { height: 60px; }
.dg-files-compact .fm-tile .fm-tile-img img { max-height: 60px; }
.dg-files-compact .fm-tile .fm-tile-img i { font-size: 1.8rem; }
.dg-files-compact .dg-empty { padding: 1.5rem .5rem; font-size: .85rem; }
@media (max-width: 575.98px) {
    .dg-files.dg-files-compact { flex-direction: column; height: auto; }
    .dg-files.dg-files-compact .dg-sidebar.dg-files-tree-wrap { width: 100%; flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--border-color); }
    .dg-files.dg-files-compact .dg-files-tree-wrap .dg-sidebar-body { max-height: 110px; }
    .dg-files.dg-files-compact .dg-files-list { min-height: 200px; max-height: 280px; }
}
