/**
 * KundenKarte Module Styles
 * Dark Mode Theme
 */

/* ========================================
   TREE STRUCTURE - Multiple parallel cable lines
   ======================================== */

.kundenkarte-tree {
    font-family: inherit !important;
    padding: 10px 0 !important;
}

/* Row container - holds cable lines + content */
.kundenkarte-tree-row {
    display: flex !important;
    align-items: stretch !important;
    min-height: 36px !important;
}

/* Spacer row between cable groups */
.kundenkarte-tree-row.spacer-row {
    min-height: 12px !important;
}

/* Cable line column - vertical line placeholder */
.cable-line {
    width: 15px !important;
    min-width: 15px !important;
    position: relative !important;
    flex-shrink: 0 !important;
}

/* Active vertical line (passes through this row to children below) */
.cable-line.active::before {
    content: '' !important;
    position: absolute !important;
    left: 6px !important;
    top: 0 !important;
    width: 2px !important;
    height: 100% !important;
    background: #555 !important;
}

/* My cable line on connection row - vertical line + continues down */
.cable-line.my-line.conn-line::before {
    content: '' !important;
    position: absolute !important;
    left: 6px !important;
    top: 0 !important;
    width: 2px !important;
    height: 100% !important;
    background: #8bc34a !important;
}

/* Horizontal connector from line - width set via CSS variable */
.cable-line.my-line.conn-line::after {
    content: '' !important;
    position: absolute !important;
    left: 6px !important;
    top: 50% !important;
    width: var(--h-width, 8px) !important;
    height: 2px !important;
    background: #8bc34a !important;
    z-index: 0 !important;
}

/* My cable line on node row - vertical line ends at center */
.cable-line.my-line.node-line::before {
    content: '' !important;
    position: absolute !important;
    left: 6px !important;
    top: 0 !important;
    width: 2px !important;
    height: 50% !important;
    background: #8bc34a !important;
}

/* Horizontal connector to node - width set via CSS variable */
.cable-line.my-line.node-line::after {
    content: '' !important;
    position: absolute !important;
    left: 6px !important;
    top: 50% !important;
    width: var(--h-width, 8px) !important;
    height: 2px !important;
    background: #8bc34a !important;
    z-index: 0 !important;
}

/* Node content container - above horizontal lines */
.kundenkarte-tree-node-content {
    flex: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Connection content - above horizontal lines */
.kundenkarte-tree-conn-content {
    position: relative !important;
    z-index: 1 !important;
}

/* Legacy node styles (for root level) */
.kundenkarte-tree-node {
    position: relative !important;
    margin: 2px 0 !important;
    padding-left: 30px !important;
}

/* Horizontaler Strich zum Element */
.kundenkarte-tree-node::after {
    content: '' !important;
    position: absolute !important;
    left: 8px !important;
    top: 18px !important;
    width: 22px !important;
    height: 2px !important;
    background: #555 !important;
}

/* Senkrechter Strich (durchgehend für alle Geschwister) */
.kundenkarte-tree-node::before {
    content: '' !important;
    position: absolute !important;
    left: 8px !important;
    top: 0 !important;
    width: 2px !important;
    height: 100% !important;
    background: #555 !important;
}

/* Letztes Kind: senkrechter Strich nur bis zur Mitte */
.kundenkarte-tree-node:last-child::before {
    height: 20px !important;
}

/* Root-Ebene: keine Linien */
.kundenkarte-tree > .kundenkarte-tree-node::after,
.kundenkarte-tree > .kundenkarte-tree-node::before {
    display: none !important;
}

.kundenkarte-tree > .kundenkarte-tree-node {
    padding-left: 0 !important;
}

/* Abstand zwischen Root-Elementen (nicht beim ersten) */
.kundenkarte-tree > .kundenkarte-tree-node + .kundenkarte-tree-node {
    margin-top: 12px !important;
}

/* Tree-row at root level - no lines */
.kundenkarte-tree > .kundenkarte-tree-row .cable-line {
    display: none !important;
}

/* Durchgeschleifte Elemente (kein eigenes Kabel) - am gleichen senkrechten Strich */
.kundenkarte-tree-node.no-cable {
    /* Kein eigener Strich - nutzt den vorherigen */
}

/* Elemente mit eigenem Kabel - eigener senkrechter Strich, eingerückt */
.kundenkarte-tree-node:not(.no-cable) {
    /* Standard-Darstellung mit eigenem Strich */
}

.kundenkarte-tree-item {
    display: flex !important;
    align-items: center !important;
    padding: 8px 12px !important;
    border-radius: 4px !important;
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
    cursor: pointer !important;
    color: #e0e0e0 !important;
    position: relative !important;
    z-index: 1 !important;
}

.kundenkarte-tree-item:hover {
    background: #3a3a3a !important;
    border-color: #555 !important;
}

.kundenkarte-tree-toggle {
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 5px !important;
    cursor: pointer !important;
    color: #aaa !important;
}

.kundenkarte-tree-toggle .fa-chevron-down {
    transition: transform 0.2s ease !important;
}

.kundenkarte-tree-toggle.collapsed .fa-chevron-down {
    transform: rotate(-90deg) !important;
}

.kundenkarte-tree-icon {
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 8px !important;
    font-size: 14px !important;
    color: #aaa !important;
}

.kundenkarte-tree-label {
    flex: 1 !important;
    font-weight: 500 !important;
    color: #e0e0e0 !important;
}

.kundenkarte-tree-label-info {
    font-weight: normal !important;
    color: #888 !important;
    font-size: 0.85em !important;
    margin-left: 4px !important;
}

/* Spacer to push badges to the right */
.kundenkarte-tree-spacer {
    flex: 1 !important;
    min-width: 10px !important;
}

/* Tree info badges */
.kundenkarte-tree-badges {
    display: inline-flex !important;
    gap: 6px !important;
    margin-left: 0 !important;
    margin-right: 8px !important;
    flex-wrap: wrap !important;
}

.kundenkarte-tree-badge {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    gap: 4px !important;
    padding: 2px 8px !important;
    background: linear-gradient(135deg, #2a4a5e 0%, #1e3a4a 100%) !important;
    border: 1px solid #3a6a8e !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    color: #8cc4e8 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.kundenkarte-tree-badge i {
    font-size: 10px !important;
    color: #5aa8d4 !important;
}

.kundenkarte-tree-badge:hover {
    background: linear-gradient(135deg, #3a5a6e 0%, #2a4a5a 100%) !important;
    border-color: #4a7a9e !important;
}

.kundenkarte-tree-actions {
    display: flex !important;
    gap: 5px !important;
    margin-left: 10px !important;
    opacity: 0.6 !important;
    transition: opacity 0.15s !important;
}

.kundenkarte-tree-item:hover .kundenkarte-tree-actions {
    opacity: 1 !important;
}

.kundenkarte-tree-actions a {
    padding: 2px 6px !important;
    border-radius: 3px !important;
    color: #ccc !important;
}

.kundenkarte-tree-actions a:hover {
    background: #555 !important;
    color: #fff !important;
}

.kundenkarte-tree-children {
    position: relative !important;
    margin-left: 20px !important;
    padding-left: 0 !important;
}

.kundenkarte-tree-children.collapsed {
    display: none !important;
}

/* Drag & Drop Sortierung */
.kundenkarte-dragging {
    opacity: 0.4 !important;
}

.kundenkarte-dragging > .kundenkarte-tree-item {
    border: 1px dashed #666 !important;
}

body.kundenkarte-drag-active {
    cursor: grabbing !important;
    user-select: none !important;
}

body.kundenkarte-drag-active * {
    cursor: grabbing !important;
}

.kundenkarte-drag-above > .kundenkarte-tree-item {
    border-top: 3px solid #4a9eff !important;
}

.kundenkarte-drag-below > .kundenkarte-tree-item {
    border-bottom: 3px solid #4a9eff !important;
}

.kundenkarte-tree-type {
    font-size: 0.75em !important;
    padding: 2px 8px !important;
    border-radius: 10px !important;
    background: #444 !important;
    color: #ccc !important;
    margin-left: 8px !important;
    font-weight: normal !important;
}

/* Tree - File Indicators */
.kundenkarte-tree-files {
    display: inline-flex !important;
    vertical-align: middle !important;
    gap: 3px !important;
    margin-left: 6px !important;
}

.kundenkarte-tree-file-badge {
    font-size: 0.8em !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    gap: 3px !important;
    text-decoration: none !important;
}

.kundenkarte-tree-file-images {
    background: #2a5a8a !important;
    color: #ddd !important;
}

.kundenkarte-tree-file-docs {
    background: #8a5a2a !important;
    color: #ddd !important;
}

.kundenkarte-tree-file-all {
    background: #4a5a6a !important;
    color: #ddd !important;
}

/* ========================================
   TOOLTIP
   ======================================== */

.kundenkarte-tooltip {
    position: absolute !important;
    z-index: 1000 !important;
    background: #1e1e1e !important;
    border: 1px solid #555 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    padding: 15px !important;
    min-width: 300px !important;
    max-width: 450px !important;
    display: none !important;
}

.kundenkarte-tooltip.visible {
    display: block !important;
}

.kundenkarte-tooltip-header {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 10px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid #444 !important;
}

.kundenkarte-tooltip-icon {
    font-size: 24px !important;
    margin-right: 12px !important;
    color: #aaa !important;
}

.kundenkarte-tooltip-title {
    font-weight: 600 !important;
    font-size: 1.1em !important;
    color: #e0e0e0 !important;
}

.kundenkarte-tooltip-type {
    color: #999 !important;
    font-size: 0.9em !important;
}

.kundenkarte-tooltip-fields {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    gap: 6px 12px !important;
    font-size: 0.95em !important;
}

.kundenkarte-tooltip-field-label {
    color: #aaa !important;
    font-weight: 500 !important;
}

.kundenkarte-tooltip-field-value {
    color: #e0e0e0 !important;
}

.kundenkarte-tooltip-field-header {
    grid-column: 1 / -1 !important;
    font-weight: bold !important;
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid #444 !important;
    color: #aaa !important;
}

/* ========================================
   FILE PREVIEW TOOLTIP
   ======================================== */

.kundenkarte-file-preview {
    min-width: 280px !important;
    max-width: 400px !important;
}

.kundenkarte-file-preview-section {
    margin-bottom: 12px !important;
}

.kundenkarte-file-preview-section:last-child {
    margin-bottom: 0 !important;
}

.kundenkarte-file-preview-title {
    font-weight: bold !important;
    color: #8cc4e8 !important;
    margin-bottom: 8px !important;
    font-size: 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.kundenkarte-file-preview-thumbs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.kundenkarte-file-preview-thumb {
    position: relative !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    border: 2px solid #444 !important;
    transition: border-color 0.2s !important;
}

.kundenkarte-file-preview-thumb:hover {
    border-color: #8cc4e8 !important;
}

.kundenkarte-file-preview-thumb.is-cover {
    border-color: #f39c12 !important;
}

.kundenkarte-file-preview-thumb.is-pinned {
    border-color: #27ae60 !important;
}

.kundenkarte-file-preview-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.kundenkarte-file-preview-pin {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    background: rgba(39, 174, 96, 0.9) !important;
    color: #fff !important;
    font-size: 9px !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

.kundenkarte-file-preview-more {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 60px !important;
    height: 60px !important;
    background: #333 !important;
    border-radius: 4px !important;
    color: #888 !important;
    font-size: 14px !important;
    font-weight: bold !important;
}

.kundenkarte-file-preview-docs {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.kundenkarte-file-preview-doc {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 8px !important;
    background: #2a2a2a !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    color: #ddd !important;
    transition: background-color 0.2s !important;
}

.kundenkarte-file-preview-doc:hover {
    background: #3a3a3a !important;
    color: #fff !important;
}

.kundenkarte-file-preview-doc.is-pinned {
    background: #2a3a2a !important;
}

.kundenkarte-file-preview-doc i:first-child {
    font-size: 16px !important;
    width: 20px !important;
    text-align: center !important;
}

.kundenkarte-file-preview-doc-name {
    flex: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 12px !important;
}

.kundenkarte-file-preview-doc-pin {
    color: #27ae60 !important;
    font-size: 10px !important;
}

.kundenkarte-file-preview-more-docs {
    padding: 4px 8px !important;
    color: #888 !important;
    font-size: 11px !important;
    text-align: center !important;
}

/* ========================================
   SYSTEM TABS
   ======================================== */

.kundenkarte-system-tabs-wrapper {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #444 !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
}

.kundenkarte-system-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    flex: 1 !important;
    align-items: center !important;
}

.kundenkarte-tree-controls {
    display: flex !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}

/* Button in system tabs row */
.kundenkarte-system-tabs > button.button,
.kundenkarte-system-tabs > .button {
    align-self: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    vertical-align: middle !important;
}

/* System hinzufügen Button - kleiner, knapp über der Linie */
.kundenkarte-add-system-btn {
    font-size: 11px !important;
    padding: 4px 10px !important;
    margin-left: auto !important;
    align-self: flex-end !important;
    margin-bottom: -1px !important;
    height: auto !important;
    line-height: 1.3 !important;
}

.kundenkarte-add-system-btn i {
    font-size: 9px !important;
}

.kundenkarte-system-tab {
    padding: 8px 16px !important;
    border: 1px solid #555 !important;
    border-radius: 4px 4px 0 0 !important;
    background: #333 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #ccc !important;
}

.kundenkarte-system-tab:hover {
    background: #3a3a3a !important;
}

.kundenkarte-system-tab.active {
    background: #2d2d2d !important;
    border-bottom-color: #2d2d2d !important;
    margin-bottom: -2px !important;
    padding-bottom: 10px !important;
    color: #fff !important;
}

.kundenkarte-system-tab-icon {
    font-size: 14px !important;
}

/* ========================================
   BUTTONS - Dark Mode style
   ======================================== */

.kundenkarte-tree-controls .button,
.kundenkarte-tree-controls .button.small,
.kundenkarte-tree-controls a.button,
.kundenkarte-system-tabs .button,
.kundenkarte-system-tabs .button.small,
.kundenkarte-system-tabs button.button,
.kundenkarte-add-system-form .button,
.kundenkarte-add-system-form .button.small,
.kundenkarte-add-system-form button.button {
    background: #444 !important;
    background-image: linear-gradient(to bottom, #555 0%, #333 100%) !important;
    border: 1px solid #666 !important;
    border-radius: 3px !important;
    color: #e0e0e0 !important;
    cursor: pointer !important;
    padding: 6px 12px !important;
    font-size: 0.85em !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    height: auto !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
}

.kundenkarte-tree-controls .button:hover,
.kundenkarte-tree-controls a.button:hover,
.kundenkarte-system-tabs .button:hover,
.kundenkarte-system-tabs button.button:hover,
.kundenkarte-add-system-form .button:hover,
.kundenkarte-add-system-form button.button:hover {
    background: #555 !important;
    background-image: linear-gradient(to bottom, #666 0%, #444 100%) !important;
    border-color: #777 !important;
}

/* Add system form */
.kundenkarte-add-system-form {
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
    padding: 12px 15px !important;
    border-radius: 6px !important;
    color: #e0e0e0 !important;
}

.kundenkarte-add-system-form select.flat {
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #e0e0e0 !important;
    padding: 5px 10px !important;
    border-radius: 3px !important;
}


/* ========================================
   FAVORITES
   ======================================== */

.kundenkarte-favorites-add {
    display: flex !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
    border-radius: 6px !important;
}

.kundenkarte-favorites-table th {
    text-align: left !important;
    padding: 10px !important;
    background: #333 !important;
    color: #e0e0e0 !important;
    border-bottom: 2px solid #555 !important;
}

.kundenkarte-favorites-table td {
    padding: 10px !important;
    border-bottom: 1px solid #444 !important;
    vertical-align: middle !important;
}

.kundenkarte-favorites-actions {
    margin-top: 20px !important;
    padding-top: 15px !important;
    border-top: 1px solid #444 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.kundenkarte-favorites-add .button {
    background: #444 !important;
    background-image: linear-gradient(to bottom, #555 0%, #333 100%) !important;
    border: 1px solid #666 !important;
    border-radius: 3px !important;
    color: #e0e0e0 !important;
    padding: 6px 12px !important;
}

/* ========================================
   FILE GALLERY
   ======================================== */

/* ========================================
   FILE DROPZONE
   ======================================== */

.kundenkarte-dropzone {
    border: 2px dashed #555 !important;
    border-radius: 8px !important;
    padding: 30px !important;
    text-align: center !important;
    background: #1e1e1e !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
}

.kundenkarte-dropzone:hover,
.kundenkarte-dropzone.dragover {
    border-color: #3498db !important;
    background: #252530 !important;
}

.kundenkarte-dropzone.dragover {
    transform: scale(1.02) !important;
}

.kundenkarte-dropzone-content {
    pointer-events: none !important;
}

.kundenkarte-dropzone-files {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin-top: 15px !important;
    justify-content: center !important;
}

.kundenkarte-dropzone-file {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    background: #333 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    color: #e0e0e0 !important;
}

.kundenkarte-dropzone-file i {
    color: #3498db !important;
}

.kundenkarte-dropzone-file .remove-file {
    color: #e74c3c !important;
    cursor: pointer !important;
    margin-left: 5px !important;
}

.kundenkarte-dropzone-file .remove-file:hover {
    color: #ff6b6b !important;
}

/* ========================================
   FILE GRID - LARGER BOXES
   ======================================== */

.kundenkarte-files-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 15px !important;
}

.kundenkarte-file-item {
    border: 1px solid #444 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #2d2d2d !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    position: relative !important;
}

.kundenkarte-file-item:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3) !important;
}

/* Pinned files */
.kundenkarte-file-pinned {
    border-color: #e6a500 !important;
    box-shadow: 0 0 0 1px #e6a500 inset !important;
}

.kundenkarte-pin-indicator {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: #e6a500 !important;
    color: #000 !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    z-index: 10 !important;
}

.kundenkarte-file-btn-pinned {
    color: #e6a500 !important;
}

.kundenkarte-file-preview {
    height: 180px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #1e1e1e !important;
    overflow: hidden !important;
    cursor: pointer !important;
}

.kundenkarte-file-preview img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    transition: transform 0.3s !important;
}

.kundenkarte-file-item:hover .kundenkarte-file-preview img {
    transform: scale(1.05) !important;
}

.kundenkarte-file-info {
    padding: 12px 15px !important;
    font-size: 0.95em !important;
}

.kundenkarte-file-name {
    font-weight: 500 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: #e0e0e0 !important;
    font-size: 13px !important;
    margin-bottom: 4px !important;
}

.kundenkarte-file-size {
    color: #888 !important;
    font-size: 11px !important;
}

.kundenkarte-file-actions {
    display: flex !important;
    gap: 8px !important;
    margin-top: 10px !important;
    justify-content: center !important;
}

.kundenkarte-file-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    background: #444 !important;
    color: #e0e0e0 !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
}

.kundenkarte-file-btn:hover {
    background: #555 !important;
    color: #fff !important;
    transform: scale(1.1) !important;
}

.kundenkarte-file-btn-delete:hover {
    background: #c0392b !important;
}

/* ========================================
   ICON PICKER MODAL
   ======================================== */

.kundenkarte-modal {
    display: none !important;
    position: fixed !important;
    z-index: 10000 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0,0,0,0.7) !important;
    align-items: center !important;
    justify-content: center !important;
}

.kundenkarte-modal.visible {
    display: flex !important;
}

.kundenkarte-modal-content {
    background-color: #1e1e1e !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
    max-width: 600px !important;
    width: 90% !important;
    max-height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.kundenkarte-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 20px !important;
    border-bottom: 2px solid #444 !important;
    background: #2d2d2d !important;
}

.kundenkarte-modal-header h3 {
    margin: 0 !important;
    color: #e0e0e0 !important;
}

.kundenkarte-modal-close {
    font-size: 28px !important;
    color: #aaa !important;
    cursor: pointer !important;
}

.kundenkarte-modal-body {
    padding: 20px !important;
    overflow-y: auto !important;
}

.kundenkarte-icon-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)) !important;
    gap: 8px !important;
    max-height: 400px !important;
    overflow-y: auto !important;
}

.kundenkarte-icon-item {
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #444 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 20px !important;
    color: #aaa !important;
    background: #2d2d2d !important;
}

.kundenkarte-icon-item:hover {
    background: #444 !important;
    border-color: #666 !important;
    color: #fff !important;
}

/* ========================================
   PDF PREVIEW
   ======================================== */

.kundenkarte-pdf-preview-wrapper {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: relative !important;
}

.kundenkarte-pdf-preview-frame {
    width: 200% !important;
    height: 200% !important;
    border: none !important;
    transform: scale(0.5) !important;
    transform-origin: top left !important;
    pointer-events: none !important;
}

/* ========================================
   IMAGES/DOCS POPUP
   ======================================== */

.kundenkarte-images-grid,
.kundenkarte-docs-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
    gap: 8px !important;
    max-width: 350px !important;
}

.kundenkarte-images-thumb {
    display: block !important;
    width: 80px !important;
    height: 80px !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    border: 2px solid #444 !important;
}

.kundenkarte-images-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.kundenkarte-docs-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 10px 5px !important;
    border-radius: 6px !important;
    border: 1px solid #444 !important;
    background: #2d2d2d !important;
    text-decoration: none !important;
    width: 80px !important;
}

.kundenkarte-docs-card-icon {
    font-size: 36px !important;
    margin-bottom: 6px !important;
    color: #aaa !important;
}

.kundenkarte-docs-card-name {
    font-size: 0.75em !important;
    color: #e0e0e0 !important;
    text-align: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 70px !important;
}

/* ========================================
   EQUIPMENT / HUTSCHIENEN
   ======================================== */

.kundenkarte-equipment-container {
    margin-top: 15px !important;
    padding: 15px !important;
    background: #252525 !important;
    border: 1px solid #444 !important;
    border-radius: 6px !important;
    overflow: visible !important;
}

.kundenkarte-equipment-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid #444 !important;
}

.kundenkarte-equipment-header h4 {
    margin: 0 !important;
    color: #e0e0e0 !important;
    font-size: 1em !important;
}

.kundenkarte-add-carrier {
    background: #2d6a4f !important;
    color: #fff !important;
    border: 1px solid #40916c !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 0.85em !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    text-decoration: none !important;
}

.kundenkarte-add-carrier:hover {
    background: #40916c !important;
}

/* Panels Container */
.kundenkarte-panels-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    padding: 10px 5px !important;
}

/* Individual Panel (Feld) */
.kundenkarte-panel {
    flex: 0 0 auto !important;
    background: #1e1e1e !important;
    border: 2px solid #555 !important;
    border-radius: 8px !important;
    padding: 10px !important;
    display: inline-block !important;
}

.kundenkarte-panel-direct {
    border-style: dashed !important;
    border-color: #666 !important;
}

/* Quick-add panel button (duplicate last panel) */
.kundenkarte-panel-quickadd {
    flex: 0 0 auto !important;
    min-width: 60px !important;
    max-width: 80px !important;
    background: transparent !important;
    border: 2px dashed #555 !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-height: 100px !important;
}

.kundenkarte-panel-quickadd:hover {
    border-color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.1) !important;
}

.kundenkarte-panel-quickadd i {
    font-size: 24px !important;
    color: #555 !important;
    transition: color 0.2s ease !important;
}

.kundenkarte-panel-quickadd:hover i {
    color: #27ae60 !important;
}

/* Quick-add carrier button (duplicate last carrier) */
.kundenkarte-carrier-quickadd {
    background: transparent !important;
    border: 2px dashed #555 !important;
    border-radius: 6px !important;
    padding: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin-top: 10px !important;
}

.kundenkarte-carrier-quickadd:hover {
    border-color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.1) !important;
}

.kundenkarte-carrier-quickadd i {
    font-size: 18px !important;
    color: #555 !important;
    transition: color 0.2s ease !important;
}

.kundenkarte-carrier-quickadd:hover i {
    color: #27ae60 !important;
}

.kundenkarte-panel-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 12px !important;
    background: #333 !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
}

.kundenkarte-panel-label {
    font-weight: bold !important;
    color: #e0e0e0 !important;
    font-size: 0.95em !important;
}

.kundenkarte-panel-actions {
    display: flex !important;
    gap: 8px !important;
}

.kundenkarte-panel-actions a {
    color: #aaa !important;
    text-decoration: none !important;
    padding: 4px !important;
}

.kundenkarte-panel-actions a:hover {
    color: #fff !important;
}

/* Add Panel Button */
.kundenkarte-add-panel {
    background: #1e5f74 !important;
    color: #fff !important;
    border: 1px solid #2c8ba0 !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 0.85em !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    text-decoration: none !important;
}

.kundenkarte-add-panel:hover {
    background: #2c8ba0 !important;
}

.kundenkarte-carriers-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    overflow: visible !important;
}

/* Individual Carrier (Hutschiene) */
.kundenkarte-carrier {
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
    border-radius: 6px !important;
    overflow: visible !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.kundenkarte-carrier-header {
    display: flex !important;
    align-items: center !important;
    padding: 10px 15px !important;
    background: #333 !important;
    border-bottom: 1px solid #444 !important;
}

.kundenkarte-carrier-label {
    font-weight: 600 !important;
    color: #e0e0e0 !important;
    flex: 1 !important;
}

.kundenkarte-carrier-info {
    color: #888 !important;
    font-size: 0.85em !important;
    margin-right: 15px !important;
}

.kundenkarte-carrier-actions {
    display: flex !important;
    gap: 8px !important;
}

.kundenkarte-carrier-actions a {
    color: #888 !important;
    padding: 4px 8px !important;
    border-radius: 3px !important;
    text-decoration: none !important;
}

.kundenkarte-carrier-actions a:hover {
    background: #444 !important;
    color: #fff !important;
}

.kundenkarte-carrier-add-equipment {
    color: #27ae60 !important;
}

.kundenkarte-carrier-add-equipment:hover {
    background: #27ae60 !important;
    color: #fff !important;
}

/* SVG Container */
.kundenkarte-carrier-svg-container {
    position: relative !important;
    padding: 15px !important;
    background: #1e1e1e !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    border-radius: 0 0 6px 6px !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.kundenkarte-carrier-svg {
    display: block !important;
    background: linear-gradient(to bottom, #3a3a3a 0%, #2a2a2a 100%) !important;
    border-radius: 4px !important;
    border: 1px solid #555 !important;
    min-width: max-content !important;
    flex-shrink: 0 !important;
}

/* Clickable slot overlay */
.kundenkarte-carrier-slots {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    pointer-events: none !important;
}

.kundenkarte-slot-empty {
    position: absolute !important;
    top: 0 !important;
    height: 100% !important;
    pointer-events: all !important;
    cursor: pointer !important;
    opacity: 0 !important;
    transition: opacity 0.15s, background 0.15s !important;
}

.kundenkarte-slot-empty:hover {
    opacity: 1 !important;
    background: rgba(39, 174, 96, 0.3) !important;
    border: 1px dashed #27ae60 !important;
    border-radius: 3px !important;
}

.kundenkarte-slot-drop-target {
    opacity: 1 !important;
    background: rgba(52, 152, 219, 0.4) !important;
    border: 2px dashed #3498db !important;
    border-radius: 3px !important;
}

/* Quick-add slot (duplicate last equipment) */
.kundenkarte-slot-quickadd {
    position: absolute !important;
    top: 2px !important;
    height: calc(100% - 4px) !important;
    pointer-events: all !important;
    cursor: pointer !important;
    background: rgba(39, 174, 96, 0.15) !important;
    border: 2px dashed #27ae60 !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.kundenkarte-slot-quickadd i {
    color: #27ae60 !important;
    font-size: 24px !important;
}

.kundenkarte-slot-quickadd:hover {
    background: rgba(39, 174, 96, 0.4) !important;
    border-color: #1e8449 !important;
}

.kundenkarte-slot-quickadd:hover i {
    color: #fff !important;
}

/* Equipment Block (SVG elements styled via CSS) */
.kundenkarte-equipment-block {
    cursor: pointer !important;
    transition: filter 0.15s !important;
}

.kundenkarte-equipment-block:hover {
    filter: brightness(1.15) !important;
}

.kundenkarte-equipment-block.dragging {
    opacity: 0.5 !important;
}

/* Duplicate button on blocks */
.kundenkarte-equipment-duplicate {
    cursor: pointer !important;
    opacity: 0 !important;
    transition: opacity 0.15s !important;
}

.kundenkarte-equipment-block:hover .kundenkarte-equipment-duplicate {
    opacity: 1 !important;
}

/* Equipment Tooltip */
.kundenkarte-equipment-tooltip {
    position: absolute !important;
    z-index: 10001 !important;
    background: #1e1e1e !important;
    border: 1px solid #555 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    padding: 12px !important;
    min-width: 180px !important;
    max-width: 280px !important;
    display: none !important;
    pointer-events: none !important;
}

.kundenkarte-equipment-tooltip.visible {
    display: block !important;
}

.kundenkarte-equipment-tooltip-header {
    margin-bottom: 8px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #444 !important;
    color: #e0e0e0 !important;
}

.kundenkarte-equipment-tooltip-fields {
    font-size: 0.9em !important;
}

.kundenkarte-equipment-tooltip-fields .field-label {
    color: #888 !important;
}

.kundenkarte-equipment-tooltip-fields .field-value {
    color: #e0e0e0 !important;
}

/* Modal Footer */
.kundenkarte-modal-footer {
    padding: 15px 20px !important;
    border-top: 1px solid #444 !important;
    background: #2d2d2d !important;
    text-align: right !important;
    border-radius: 0 0 8px 8px !important;
}

.kundenkarte-modal-footer .button {
    margin-left: 10px !important;
}

/* Equipment color swatches in admin */
.kundenkarte-color-swatch {
    display: inline-block !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 4px !important;
    border: 1px solid #666 !important;
    vertical-align: middle !important;
    margin-right: 8px !important;
}

/* Equipment Type Badge */
.kundenkarte-equipment-type-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    font-size: 0.85em !important;
    background: #333 !important;
    border: 1px solid #444 !important;
    color: #e0e0e0 !important;
}

.kundenkarte-equipment-type-badge .te-width {
    color: #888 !important;
    font-size: 0.9em !important;
}

/* Responsive: scroll on small screens */
@media (max-width: 768px) {
    .kundenkarte-carrier-svg-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ========================================
   CONNECTIONS (Stromverbindungen)
   ======================================== */

.kundenkarte-connections-container {
    margin-top: 5px !important;
    padding: 8px 15px !important;
    background: #252525 !important;
    border-top: 1px solid #333 !important;
}

.kundenkarte-connections-svg {
    display: block !important;
    width: 100% !important;
}

/* Connection lines */
.kundenkarte-connection-line {
    fill: none !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
}

.kundenkarte-connection-line.phase-L1 { stroke: #8B4513 !important; }
.kundenkarte-connection-line.phase-L2 { stroke: #000000 !important; }
.kundenkarte-connection-line.phase-L3 { stroke: #808080 !important; }
.kundenkarte-connection-line.phase-N { stroke: #0000FF !important; }
.kundenkarte-connection-line.phase-PE { stroke: #9ACD32 !important; }
.kundenkarte-connection-line.phase-L1N { stroke: #8B4513 !important; stroke-width: 3 !important; }
.kundenkarte-connection-line.phase-L1L2L3 { stroke: #8B4513 !important; stroke-width: 4 !important; }
.kundenkarte-connection-line.phase-L1L2L3N { stroke: #8B4513 !important; stroke-width: 5 !important; }
.kundenkarte-connection-line.phase-L1L2L3NPE { stroke: #8B4513 !important; stroke-width: 6 !important; }

/* Rail/Sammelschiene (generic for all systems) */
.kundenkarte-rail {
    cursor: pointer !important;
    transition: opacity 0.2s !important;
}

.kundenkarte-rail-line {
    stroke-width: 4 !important;
    stroke-linecap: round !important;
    transition: stroke-width 0.2s, filter 0.2s !important;
}

.kundenkarte-rail:hover .kundenkarte-rail-line {
    filter: brightness(1.3) drop-shadow(0 0 3px rgba(255,255,255,0.3)) !important;
    stroke-width: 6 !important;
}

.kundenkarte-rail:hover text {
    fill: #fff !important;
}

.kundenkarte-rail text {
    font-weight: bold !important;
    transition: fill 0.2s !important;
}

/* Consumer output (Abgang) */
.kundenkarte-output {
    cursor: pointer !important;
    transition: opacity 0.2s !important;
}

.kundenkarte-output-line {
    fill: none !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-dasharray: 5, 3 !important;
    transition: stroke-width 0.2s !important;
}

.kundenkarte-output-label {
    font-size: 10px !important;
    fill: #aaa !important;
    transition: fill 0.2s, font-weight 0.2s !important;
}

.kundenkarte-output:hover .kundenkarte-output-label {
    fill: #fff !important;
    font-weight: bold !important;
}

.kundenkarte-output:hover .kundenkarte-output-line {
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.3)) !important;
}

/* Add connection button */
.kundenkarte-add-connection {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 10px !important;
    margin-top: 8px !important;
    background: #333 !important;
    border: 1px dashed #555 !important;
    border-radius: 4px !important;
    color: #888 !important;
    font-size: 0.8em !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.kundenkarte-add-connection:hover {
    background: #444 !important;
    border-color: #27ae60 !important;
    color: #27ae60 !important;
}

/* Connection legend */
.kundenkarte-connection-legend {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid #333 !important;
    font-size: 0.75em !important;
}

.kundenkarte-legend-item {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    color: #888 !important;
}

.kundenkarte-legend-color {
    width: 20px !important;
    height: 4px !important;
    border-radius: 2px !important;
}

.kundenkarte-legend-color.phase-L1 { background: #8B4513 !important; }
.kundenkarte-legend-color.phase-L2 { background: #000000 !important; border: 1px solid #444 !important; }
.kundenkarte-legend-color.phase-L3 { background: #808080 !important; }
.kundenkarte-legend-color.phase-N { background: #0000FF !important; }
.kundenkarte-legend-color.phase-PE { background: #9ACD32 !important; }

/* Connection dialog form */
.kundenkarte-connection-form .form-row {
    display: flex !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
}

.kundenkarte-connection-form .form-group {
    flex: 1 !important;
}

.kundenkarte-connection-form label {
    display: block !important;
    margin-bottom: 4px !important;
    color: #aaa !important;
    font-size: 0.85em !important;
}

.kundenkarte-connection-form select,
.kundenkarte-connection-form input {
    width: 100% !important;
    padding: 8px 10px !important;
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
    border-radius: 4px !important;
    color: #e0e0e0 !important;
}

.kundenkarte-connection-form select:focus,
.kundenkarte-connection-form input:focus {
    border-color: #3498db !important;
    outline: none !important;
}

/* Phase selection buttons */
.kundenkarte-phase-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
}

.kundenkarte-phase-btn {
    padding: 6px 12px !important;
    border: 1px solid #444 !important;
    border-radius: 4px !important;
    background: #2d2d2d !important;
    color: #aaa !important;
    cursor: pointer !important;
    font-size: 0.85em !important;
}

.kundenkarte-phase-btn:hover {
    border-color: #666 !important;
    color: #fff !important;
}

.kundenkarte-phase-btn.active {
    border-color: #3498db !important;
    background: #3498db !important;
    color: #fff !important;
}

.kundenkarte-phase-btn.phase-L1 { border-left: 3px solid #8B4513 !important; }
.kundenkarte-phase-btn.phase-L2 { border-left: 3px solid #333 !important; }
.kundenkarte-phase-btn.phase-L3 { border-left: 3px solid #808080 !important; }
.kundenkarte-phase-btn.phase-N { border-left: 3px solid #0000FF !important; }
.kundenkarte-phase-btn.phase-PE { border-left: 3px solid #9ACD32 !important; }

/* ========================================
   jsPlumb Interactive Editor (Prototype)
   ======================================== */

.kundenkarte-jsplumb-prototype {
    margin-top: 20px !important;
}

.kundenkarte-jsplumb-prototype .titre {
    background: #2d2d2d !important;
    padding: 10px 15px !important;
    border-radius: 6px !important;
    color: #ddd !important;
}

.kundenkarte-jsplumb-prototype .titre:hover {
    background: #3d3d3d !important;
}

#jsplumb-canvas {
    position: relative !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 100%) !important;
}

.jsplumb-node {
    transition: box-shadow 0.2s ease !important;
    z-index: 10 !important;
}

.jsplumb-node:hover {
    z-index: 20 !important;
    transform: scale(1.02);
}

.jsplumb-node.jsplumb-external {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%) !important;
}

/* jsPlumb endpoint styling */
.jtk-endpoint {
    z-index: 30 !important;
}

.jtk-connector {
    z-index: 5 !important;
}

/* Connection hover effect */
.jtk-connector:hover path {
    stroke-width: 3px !important;
}

/* ========================================
   CONNECTION EDITOR (Interactive SVG)
   ======================================== */

.kundenkarte-connection-editor-wrapper {
    border-top: 1px solid #333 !important;
    background: #1a1a1a !important;
}

.kundenkarte-connection-editor-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 15px !important;
    background: #252525 !important;
    border-bottom: 1px solid #333 !important;
}

.kundenkarte-connection-editor-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #888 !important;
    text-decoration: none !important;
    font-size: 0.85em !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.kundenkarte-connection-editor-toggle:hover {
    color: #fff !important;
    background: #333 !important;
}

.kundenkarte-connection-editor-toggle i {
    transition: transform 0.3s ease !important;
}

.kundenkarte-connection-editor-actions {
    display: flex !important;
    gap: 8px !important;
}

.kundenkarte-connection-editor-actions button {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 10px !important;
    background: #333 !important;
    border: 1px solid #444 !important;
    border-radius: 4px !important;
    color: #aaa !important;
    font-size: 0.8em !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.kundenkarte-connection-editor-actions button:hover {
    background: #444 !important;
    border-color: #555 !important;
    color: #fff !important;
}

.kundenkarte-add-busbar-btn:hover {
    border-color: #3498db !important;
    color: #3498db !important;
}

.kundenkarte-add-conn-btn:hover {
    border-color: #27ae60 !important;
    color: #27ae60 !important;
}

.kundenkarte-connection-editor {
    display: none !important;
    padding: 15px !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #202020 100%) !important;
    overflow-x: auto !important;
}

.kundenkarte-connection-editor.expanded {
    display: block !important;
}

.kundenkarte-connection-svg {
    display: block !important;
    max-width: 100% !important;
    border-radius: 4px !important;
}

/* Endpoints (connection points) */
.kundenkarte-endpoint {
    cursor: crosshair !important;
    transition: all 0.2s ease !important;
}

.kundenkarte-endpoint:hover,
.kundenkarte-endpoint.hover {
    r: 8 !important;
    filter: drop-shadow(0 0 4px rgba(52, 152, 219, 0.8)) !important;
}

.kundenkarte-endpoint.dragging {
    fill: #3498db !important;
    r: 10 !important;
    filter: drop-shadow(0 0 6px rgba(52, 152, 219, 1)) !important;
}

/* Busbar elements */
.kundenkarte-busbar-element {
    cursor: pointer !important;
}

.kundenkarte-busbar-element:hover .kundenkarte-busbar-line {
    filter: brightness(1.2) !important;
}

.kundenkarte-busbar-line {
    transition: filter 0.2s ease !important;
}

.kundenkarte-busbar-endpoint {
    opacity: 0.6 !important;
    transition: opacity 0.2s ease, r 0.2s ease !important;
}

.kundenkarte-busbar-element:hover .kundenkarte-busbar-endpoint,
.kundenkarte-busbar-endpoint:hover {
    opacity: 1 !important;
}

/* Equipment endpoints in editor */
.kundenkarte-equipment-endpoints rect {
    transition: filter 0.2s ease !important;
}

.kundenkarte-equipment-endpoints:hover rect {
    filter: brightness(1.15) !important;
}

.kundenkarte-equipment-input,
.kundenkarte-equipment-output {
    opacity: 0.7 !important;
    transition: all 0.2s ease !important;
}

.kundenkarte-equipment-endpoints:hover .kundenkarte-equipment-input,
.kundenkarte-equipment-endpoints:hover .kundenkarte-equipment-output,
.kundenkarte-equipment-input:hover,
.kundenkarte-equipment-output:hover {
    opacity: 1 !important;
}

/* Connection paths */
.kundenkarte-connection-path {
    cursor: pointer !important;
    transition: stroke-width 0.2s ease, filter 0.2s ease !important;
}

.kundenkarte-connection-path:hover {
    stroke-width: 4 !important;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5)) !important;
}

.kundenkarte-connection-path-shadow {
    pointer-events: none !important;
}

.kundenkarte-connection-group text {
    pointer-events: none !important;
    transition: fill 0.2s ease !important;
}

.kundenkarte-connection-group:hover text {
    fill: #fff !important;
}

/* Connection layer ordering - SVG elements rendered in order */
.kundenkarte-connections-layer {
    pointer-events: auto !important;
}

.kundenkarte-equipment-layer {
    pointer-events: auto !important;
}

/* Make connection paths clickable with wider hit area */
.kundenkarte-connection-group {
    cursor: pointer !important;
}

.kundenkarte-connection-group:hover .kundenkarte-connection-path {
    stroke-width: 4 !important;
}

.kundenkarte-connection-group:hover .kundenkarte-connection-path-shadow {
    stroke-width: 7 !important;
}

/* Drag preview line */
.kundenkarte-drag-preview {
    pointer-events: none !important;
    animation: dashOffset 0.5s linear infinite !important;
}

@keyframes dashOffset {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 10; }
}

/* Phase-specific colors for endpoints */
.kundenkarte-endpoint[data-phase="L1"] { stroke: #8B4513 !important; }
.kundenkarte-endpoint[data-phase="L2"] { stroke: #000000 !important; }
.kundenkarte-endpoint[data-phase="L3"] { stroke: #808080 !important; }
.kundenkarte-endpoint[data-phase="N"] { stroke: #0066cc !important; }
.kundenkarte-endpoint[data-phase="PE"] { stroke: #27ae60 !important; }

/* Busbar preset buttons */
.busbar-preset-btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.busbar-preset-btn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.busbar-preset-btn:active {
    transform: scale(0.98) !important;
}

/* Connection editor scrollbar */
.kundenkarte-connection-editor::-webkit-scrollbar {
    height: 8px !important;
}

.kundenkarte-connection-editor::-webkit-scrollbar-track {
    background: #1a1a1a !important;
    border-radius: 4px !important;
}

.kundenkarte-connection-editor::-webkit-scrollbar-thumb {
    background: #444 !important;
    border-radius: 4px !important;
}

.kundenkarte-connection-editor::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .kundenkarte-connection-editor-header {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }

    .kundenkarte-connection-editor-actions {
        flex-wrap: wrap !important;
    }

    .kundenkarte-connection-editor-actions button {
        flex: 1 !important;
        justify-content: center !important;
    }
}

/* ========================================
   SCHEMATIC EDITOR v2 (Interactive SVG)
   ======================================== */

.schematic-editor-wrapper {
    margin-top: 20px !important;
    max-width: 100% !important;
    overflow-x: auto !important;
}

/* Prevent Schematic Editor from breaking Dolibarr layout */
.kundenkarte-equipment-container {
    max-width: 100% !important;
    overflow-x: auto !important;
}

.schematic-editor-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 15px !important;
    background: #252525 !important;
    border: 1px solid #333 !important;
    border-radius: 4px 4px 0 0 !important;
}

.schematic-editor-toggle {
    color: #3498db !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.schematic-editor-toggle:hover {
    color: #5dade2 !important;
}

.schematic-editor-toggle i {
    transition: transform 0.3s ease !important;
    margin-right: 8px !important;
}

.schematic-editor-canvas {
    display: none !important;
    background: #1a1a1a !important;
    border: 1px solid #333 !important;
    border-top: none !important;
    border-radius: 0 0 4px 4px !important;
    padding: 15px !important;
    overflow: auto !important;
    min-height: 300px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.schematic-editor-canvas.expanded {
    display: block !important;
}

/* SVG Canvas */
.schematic-svg {
    background: #1e1e1e !important;
    border-radius: 4px !important;
}

/* Rails (Hutschienen) */
.schematic-rail {
    cursor: pointer !important;
    transition: filter 0.2s ease !important;
}

.schematic-rail:hover {
    filter: brightness(1.3) !important;
}

.schematic-rail.drop-target {
    filter: brightness(1.5) !important;
    stroke: #27ae60 !important;
    stroke-width: 3px !important;
}

.schematic-rail-bg {
    opacity: 0.8 !important;
}

/* Equipment Blocks */
.schematic-block {
    cursor: grab !important;
    transition: filter 0.2s ease !important;
}

.schematic-block:hover {
    filter: brightness(1.1) !important;
}

.schematic-block.dragging {
    cursor: grabbing !important;
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(52, 152, 219, 0.6)) !important;
}

.schematic-block-bg {
    transition: filter 0.2s ease !important;
}

/* Terminals */
.schematic-terminal {
    cursor: crosshair !important;
}

.schematic-terminal-circle {
    transition: all 0.2s ease !important;
}

.schematic-terminal:hover .schematic-terminal-circle {
    r: 8 !important;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5)) !important;
}

/* Connections */
.schematic-connection {
    cursor: pointer !important;
    transition: stroke-width 0.2s ease !important;
}

.schematic-connection:hover {
    stroke-width: 4 !important;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.4)) !important;
}

.schematic-connection-shadow {
    pointer-events: none !important;
}

.schematic-connection-group:hover .schematic-connection {
    stroke-width: 4 !important;
}

.schematic-connection-group:hover .schematic-connection-shadow {
    stroke-width: 7 !important;
}

/* Connection Preview */
.schematic-connection-preview {
    pointer-events: none !important;
    animation: dashOffset 0.5s linear infinite !important;
}

/* Messages */
.schematic-message {
    padding: 8px 15px !important;
    margin-bottom: 10px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
}

.schematic-message.info {
    background: #2d4a5e !important;
    color: #7ec8e3 !important;
    border: 1px solid #3498db !important;
}

.schematic-message.success {
    background: #2d5a3d !important;
    color: #7ee8a0 !important;
    border: 1px solid #27ae60 !important;
}

.schematic-message.warning {
    background: #5a5a2d !important;
    color: #e8e87e !important;
    border: 1px solid #f1c40f !important;
}

.schematic-message.error {
    background: #5a2d2d !important;
    color: #e87e7e !important;
    border: 1px solid #e74c3c !important;
}

/* Terminal color by phase */
.schematic-terminal[data-phase="L1"] .schematic-terminal-circle,
.schematic-terminal-circle[data-phase="L1"] {
    fill: #8B4513 !important;
}

.schematic-terminal[data-phase="L2"] .schematic-terminal-circle,
.schematic-terminal-circle[data-phase="L2"] {
    fill: #1a1a1a !important;
    stroke: #666 !important;
}

.schematic-terminal[data-phase="L3"] .schematic-terminal-circle,
.schematic-terminal-circle[data-phase="L3"] {
    fill: #666666 !important;
}

.schematic-terminal[data-phase="N"] .schematic-terminal-circle,
.schematic-terminal-circle[data-phase="N"] {
    fill: #0066cc !important;
}

.schematic-terminal[data-phase="PE"] .schematic-terminal-circle,
.schematic-terminal-circle[data-phase="PE"] {
    fill: #27ae60 !important;
}

/* Scrollbar for canvas */
.schematic-editor-canvas::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

.schematic-editor-canvas::-webkit-scrollbar-track {
    background: #1a1a1a !important;
    border-radius: 5px !important;
}

.schematic-editor-canvas::-webkit-scrollbar-thumb {
    background: #444 !important;
    border-radius: 5px !important;
}

.schematic-editor-canvas::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

/* ========================================
   ANLAGE CONNECTIONS IN TREE VIEW
   Simple cable connection display
   ======================================== */

/* Cable connection content (link inside row) */
.kundenkarte-tree-conn-content {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 1 !important;
    padding: 4px 12px !important;
    background: rgba(139, 195, 74, 0.1) !important;
    border: 1px dashed #555 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-decoration: none !important;
}

.kundenkarte-tree-conn-content:hover {
    background: rgba(85, 85, 85, 0.25) !important;
}

/* Legacy conn styles (for root level - used by printTree) */
.kundenkarte-tree-conn {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 12px 4px 40px !important;
    margin: 2px 0 !important;
    background: rgba(139, 195, 74, 0.1) !important;
    border: 1px dashed #555 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-decoration: none !important;
    position: relative !important;
}

/* Senkrechter Strich durch die Kabelzeile (links, durchgehend nach unten) */
.kundenkarte-tree-conn::before {
    content: '' !important;
    position: absolute !important;
    left: 8px !important;
    top: 0 !important;
    width: 2px !important;
    height: 100% !important;
    background: #555 !important;
}

/* Horizontaler Strich zur Kabelzeile */
.kundenkarte-tree-conn::after {
    content: '' !important;
    position: absolute !important;
    left: 8px !important;
    top: 50% !important;
    width: 24px !important;
    height: 2px !important;
    background: #555 !important;
}


.kundenkarte-tree-conn:hover {
    background: rgba(85, 85, 85, 0.25) !important;
}

.kundenkarte-tree-conn .conn-icon,
.kundenkarte-tree-conn-content .conn-icon {
    color: #888 !important;
    font-size: 11px !important;
}

.kundenkarte-tree-conn .conn-main,
.kundenkarte-tree-conn-content .conn-main {
    color: #e0e0e0 !important;
    font-weight: 500 !important;
}

.kundenkarte-tree-conn .conn-label,
.kundenkarte-tree-conn-content .conn-label {
    color: #8bc34a !important;
    background: rgba(139, 195, 74, 0.15) !important;
    padding: 2px 8px !important;
    border-radius: 3px !important;
    font-size: 11px !important;
    margin-left: auto !important;
}

.kundenkarte-tree-conn:hover .conn-label,
.kundenkarte-tree-conn-content:hover .conn-label {
    background: rgba(139, 195, 74, 0.25) !important;
}

/* Connection tooltip (shown on hover) */
.kundenkarte-conn-tooltip {
    position: absolute !important;
    z-index: 10000 !important;
    background: #1e1e1e !important;
    border: 1px solid #27ae60 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
    padding: 12px 15px !important;
    min-width: 220px !important;
    max-width: 320px !important;
    display: none !important;
    pointer-events: none !important;
    font-family: inherit !important;
    font-size: 13px !important;
}

.kundenkarte-conn-tooltip.visible {
    display: block !important;
}

.kundenkarte-conn-tooltip-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #333 !important;
}

.kundenkarte-conn-tooltip-header i {
    color: #27ae60 !important;
    font-size: 16px !important;
}

.kundenkarte-conn-tooltip-header .conn-route {
    color: #e0e0e0 !important;
    font-weight: 500 !important;
}

.kundenkarte-conn-tooltip-fields {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    gap: 4px 10px !important;
}

.kundenkarte-conn-tooltip-fields .field-label {
    color: #888 !important;
    font-size: 0.9em !important;
}

.kundenkarte-conn-tooltip-fields .field-value {
    color: #e0e0e0 !important;
}

.kundenkarte-conn-tooltip-hint {
    margin-top: 10px !important;
    padding-top: 8px !important;
    border-top: 1px solid #333 !important;
    color: #666 !important;
    font-size: 0.85em !important;
    text-align: center !important;
}

.kundenkarte-conn-tooltip-hint i {
    margin-right: 5px !important;
}

/* ========================================
   MOBILE / COMPACT VIEW
   ======================================== */

/* Mobile view toggle button */
.kundenkarte-view-toggle {
    display: none !important;
}

@media (max-width: 768px) {
    .kundenkarte-view-toggle {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        padding: 6px 12px !important;
        background: #333 !important;
        border: 1px solid #555 !important;
        border-radius: 4px !important;
        color: #ddd !important;
        cursor: pointer !important;
        font-size: 12px !important;
    }

    .kundenkarte-view-toggle.active {
        background: #2a4a5e !important;
        border-color: #3a6a8e !important;
    }
}

/* Compact mode styles */
.kundenkarte-tree.compact-mode .kundenkarte-tree-row {
    min-height: 32px !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-item {
    padding: 4px 8px !important;
    font-size: 13px !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-badges,
.kundenkarte-tree.compact-mode .kundenkarte-tree-label-info,
.kundenkarte-tree.compact-mode .kundenkarte-tree-type {
    display: none !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-actions {
    opacity: 0 !important;
    transition: opacity 0.2s !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-item:hover .kundenkarte-tree-actions,
.kundenkarte-tree.compact-mode .kundenkarte-tree-item.expanded .kundenkarte-tree-actions {
    opacity: 1 !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-files {
    margin-left: auto !important;
}

/* Mobile-specific overrides */
@media (max-width: 768px) {
    /* Tree container */
    .kundenkarte-tree {
        padding: 5px 0 !important;
    }

    /* Tree row */
    .kundenkarte-tree-row {
        min-height: 40px !important;
    }

    /* Tree item - touch-friendly */
    .kundenkarte-tree-item {
        padding: 8px 10px !important;
        font-size: 14px !important;
        min-height: 40px !important;
    }

    /* Hide badges and extra info on mobile by default */
    .kundenkarte-tree-badges,
    .kundenkarte-tree-label-info {
        display: none !important;
    }

    /* Smaller type badge */
    .kundenkarte-tree-type {
        font-size: 10px !important;
        padding: 2px 4px !important;
    }

    /* Touch-friendly actions */
    .kundenkarte-tree-actions {
        gap: 12px !important;
    }

    .kundenkarte-tree-actions a {
        padding: 8px !important;
    }

    /* Cable lines - thinner on mobile */
    .cable-line {
        width: 12px !important;
        min-width: 12px !important;
    }

    /* File badge */
    .kundenkarte-tree-file-badge {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    /* System tabs - scrollable */
    .kundenkarte-system-tabs-wrapper {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .kundenkarte-system-tabs {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 5px !important;
    }

    .kundenkarte-system-tabs::-webkit-scrollbar {
        height: 4px !important;
    }

    .kundenkarte-tree-controls {
        justify-content: center !important;
        margin-top: 8px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* Uniform button sizes on mobile */
    .kundenkarte-tree-controls .button,
    .kundenkarte-tree-controls .button.small,
    .kundenkarte-tree-controls a.button,
    .kundenkarte-tree-controls a.button.small,
    .kundenkarte-tree-controls button.button,
    .kundenkarte-view-toggle {
        flex: 1 1 auto !important;
        min-width: 80px !important;
        max-width: 150px !important;
        padding: 10px 8px !important;
        font-size: 12px !important;
        text-align: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* Hide button text on very small screens, show only icons */
    .kundenkarte-tree-controls .button span,
    .kundenkarte-tree-controls a.button span {
        display: inline !important;
    }

    .kundenkarte-tree-controls .button i,
    .kundenkarte-tree-controls a.button i {
        margin-right: 4px !important;
    }

    /* Compact toggle indicator */
    .kundenkarte-tree-toggle {
        padding: 10px !important;
    }

    /* Hide spacer on mobile */
    .kundenkarte-tree-spacer {
        display: none !important;
    }

    /* Tooltip adjustments for mobile */
    .kundenkarte-tooltip {
        max-width: 90vw !important;
        min-width: 200px !important;
    }

    .kundenkarte-file-preview {
        max-width: 85vw !important;
    }

    .kundenkarte-file-preview-thumbs {
        justify-content: flex-start !important;
    }

    .kundenkarte-file-preview-thumb {
        width: 50px !important;
        height: 50px !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .kundenkarte-tree-item {
        padding: 6px 8px !important;
    }

    .kundenkarte-tree-type {
        display: none !important;
    }

    .kundenkarte-tree-actions a {
        font-size: 14px !important;
    }

    /* Only show most important actions */
    .kundenkarte-tree-actions a:not(:first-child):not(:nth-child(2)) {
        display: none !important;
    }

    .cable-line {
        width: 10px !important;
        min-width: 10px !important;
    }

    /* Buttons on very small screens - 2x2 grid */
    .kundenkarte-tree-controls {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .kundenkarte-tree-controls .button,
    .kundenkarte-tree-controls .button.small,
    .kundenkarte-tree-controls a.button,
    .kundenkarte-tree-controls a.button.small,
    .kundenkarte-tree-controls button.button,
    .kundenkarte-view-toggle {
        min-width: unset !important;
        max-width: unset !important;
        width: 100% !important;
        padding: 10px 6px !important;
        font-size: 11px !important;
    }
}

/* Expanded item in compact mode - show details */
.kundenkarte-tree.compact-mode .kundenkarte-tree-item.expanded {
    background: #2a2a2a !important;
    flex-wrap: wrap !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-item.expanded .kundenkarte-tree-badges,
.kundenkarte-tree.compact-mode .kundenkarte-tree-item.expanded .kundenkarte-tree-label-info {
    display: flex !important;
    width: 100% !important;
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid #444 !important;
}

.kundenkarte-tree.compact-mode .kundenkarte-tree-item.expanded .kundenkarte-tree-badges {
    flex-wrap: wrap !important;
    gap: 6px !important;
}
