:root {
    --bg-main: #f0f2f5;
    --nav-dark: #333;
    --border: #e2e8f0;
    --success: #27ae60;
    --ppg-blue: #2563eb;
    --ppg-dark: #1e3a8a;
    --warning: #e67e22;
    --text-main: #333;
    --text-muted: #64748b;
    --white: #ffffff;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}

.container-fluid { 
    padding: 0 30px; 
    width: 100%; 
}

.top-nav {
    background: var(--nav-dark);
    color: #ccc;
    height: 45px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.top-nav ul { 
    display: flex; 
    list-style: none; 
    margin: 0;  
    padding: 0; 
}

.top-nav ul li a {
    color: #ccc;
    text-decoration: none;
    padding: 0 20px;
    height: 45px;         
    display: flex;        
    align-items: center;  
    gap: 8px;        
    font-size: 13px;
    transition: color 0.2s;
}

.top-nav ul li a:hover { 
    color: var(--white); 
}

.top-nav ul li.active { 
    background: #444; 
}

.top-nav ul li.active a { 
    color: #fff; 
}

.top-nav ul li a .icon,
.top-nav ul li a .icon i {
    color: inherit;
}

.top-nav ul li a .icon svg {
    fill: currentColor;  
    width: 16px;   
    height: 16px;
}

.sub-header {
    background: var(--white);
    height: 80px; 
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 45px; 
    z-index: 999;
    width: 100%;
}

.flex-header { 
    display: flex; 
    justify-content: flex-start; 
    align-items: center; 
    height: 100%;
}

.branding {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-logo-container {
    height: 100%;
    display: flex;
    align-items: center;
    padding-right: 25px;
    margin-right: 25px;
    border-right: 1px solid var(--border);
}

.firma-logo-img {
    height: 100%;
    width: auto;
    object-fit: contain;
    padding: 10px 0;
}

.branding-text h1 { 
    font-size: 20px; 
    color: var(--ppg-dark); 
    font-weight: 800;
    margin: 0;
}

.user-name { color: var(--text-muted); font-size: 13px; }

.page-split-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 30px;
    padding: 30px;
    width: 100%;
    min-height: calc(100vh - 125px); 
}

.main-content-area {
    flex: 1; 
    min-width: 0;
}

.hilfe-sidebar {
    width: 200px; 
    flex-shrink: 0;
    position: sticky;
    top: 155px; 
}

.card, .hilfe-widget {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    border-top: 4px solid var(--ppg-blue); 
    padding: 25px;
    margin-bottom: 25px;
    width: 100%;
}

.card h2 {
    margin-top: 0;
    font-size: 18px;
    color: var(--ppg-dark);
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
    margin-bottom: 15px;
    font-weight: 700;
}

.card p {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 10px;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-success:hover { opacity: 0.9; }

.footer-simple {
    text-align: left;
    padding: 20px 30px;
    font-size: 11px;
    color: var(--text-muted);
}

.footer-simple a {
    color: var(--text-muted);
    text-decoration: none;
    margin-right: 15px;
}

.footer-simple a:hover { text-decoration: underline; }

    .sub-header {
        background: #ffffff;
        border-bottom: 1px solid #e2e8f0;
        height: 80px; 
        padding: 0;
        width: 100%;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .flex-header {
        display: flex;
        justify-content: flex-start; 
        align-items: center;
        height: 100%;
        width: 100%;
        margin: 0; 
        padding: 0 30px; 
    }

    .branding {
        display: flex;
        align-items: center;
        height: 100%;
        gap: 25px;
    }

    .header-logo-container {
        height: 100%;
        display: flex;
        align-items: center;
        padding-right: 25px;
        border-right: 1px solid #e2e8f0; 
    }

    .firma-logo-img {
        height: 100%;
        width: auto;
        display: block;
        object-fit: contain;
        padding: 10px 0; 
    }

    .branding-text {
        text-align: left;
    }

    .branding-text h1 {
        margin: 0;
        font-size: 1.4rem; 
        color: #1e3a8a;
        font-weight: 800;
        line-height: 1.1;
    }

    .user-name {
        font-size: 0.9rem;
        color: #64748b;
        display: block;
        margin-top: 4px;
    }

    .dashboard-header {
                display: flex;
                justify-content: space-between;
                align-items: flex-start;
                gap: 16px;
                margin-bottom: 20px;
                flex-wrap: wrap;
            }

            .dashboard-header h1 {
                margin: 0 0 8px 0;
                font-size: 2rem;
                line-height: 1.1;
            }

            .dashboard-header-actions {
                display: flex;
                gap: 12px;
            }

            .dashboard-wrap {
                display: flex;
                flex-direction: column;
                gap: 20px;
            }

            .dashboard-empty {
                padding: 32px;
                border-radius: 18px;
                border: 2px dashed #cbd5e1;
                background: #f8fafc;
                text-align: center;
                color: #64748b;
            }

            .dashboard-canvas {
                position: relative;
                display: grid;
                grid-template-columns: repeat(12, 1fr);
                grid-auto-rows: 180px;
                gap: 16px;
                min-height: 500px;
            }

            .dashboard-grid-overlay {
                display: none;
                position: absolute;
                inset: 0;
                z-index: 1;
                pointer-events: none;
                grid-template-columns: repeat(12, 1fr);
                grid-auto-rows: 180px;
                gap: 16px;
            }

            .dashboard-edit-mode .dashboard-grid-overlay {
                display: grid;
                pointer-events: auto;
            }

            .grid-cell-button,
            .grid-cell-blocked {
                width: 100%;
                height: 100%;
                border-radius: 14px;
            }

            .grid-cell-button {
                border: 1px dashed rgba(37, 99, 235, 0.35);
                background: rgba(37, 99, 235, 0.03);
                color: #2563eb;
                font-size: 1.4rem;
                font-weight: 700;
                cursor: pointer;
            }

            .grid-cell-button:hover {
                background: rgba(37, 99, 235, 0.08);
            }

            .grid-cell-blocked {
                border: 1px dashed rgba(148, 163, 184, 0.18);
                background: rgba(148, 163, 184, 0.04);
            }

            .dashboard-widget {
                position: relative;
                z-index: 2;
                background: rgba(255, 255, 255, 0.96);
                border: 1px solid rgba(226, 232, 240, 0.95);
                border-radius: 18px;
                box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
                padding: 16px;
                overflow: auto;
                transition: box-shadow 0.15s ease, transform 0.15s ease;
            }

            .dashboard-edit-mode .dashboard-widget {
                cursor: move;
            }

            .dashboard-widget.dragging,
            .dashboard-widget.resizing {
                opacity: 0.9;
                box-shadow: 0 16px 32px rgba(37, 99, 235, 0.20);
                transform: scale(1.01);
            }

            .widget-topbar {
                display: flex;
                justify-content: space-between;
                align-items: center;
                gap: 12px;
                margin-bottom: 14px;
                position: relative;
            }

            .drag-handle {
                cursor: move;
                user-select: none;
            }

            .widget-body h3 {
                margin: 10px 0 10px 0;
            }

            .widget-type-badge {
                display: inline-flex;
                align-items: center;
                padding: 6px 10px;
                border-radius: 999px;
                background: var(--ppg-primary-soft);
                color: var(--ppg-primary-dark);
                font-size: 0.78rem;
                font-weight: 800;
                margin-bottom: 8px;
            }

            .widget-text {
                white-space: pre-wrap;
                color: var(--ppg-text);
                line-height: 1.7;
            }

            .delete-widget-form {
                margin: 0;
                display: none;
                position: absolute;
                top: 8px;
                right: 8px;
            }

            .dashboard-edit-mode .delete-widget-form {
                display: block;
            }

            .btn-delete {
                background: #dc2626;
                box-shadow: none;
                min-height: 38px;
                padding: 8px 12px;
            }

            .btn-delete:hover {
                background: #b91c1c;
            }

            .widget-resize-handle {
                display: none;
                position: absolute;
                right: 8px;
                bottom: 8px;
                width: 18px;
                height: 18px;
                border-radius: 6px;
                background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
                box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
                cursor: nwse-resize;
                z-index: 5;
            }

            .widget-resize-handle::before {
                content: "";
                position: absolute;
                inset: 4px;
                border-right: 2px solid rgba(255,255,255,0.9);
                border-bottom: 2px solid rgba(255,255,255,0.9);
            }

            .dashboard-edit-mode .widget-resize-handle {
                display: block;
            }

            .widget-dialog-backdrop {
                display: none;
                position: fixed;
                inset: 0;
                z-index: 1000;
                background: rgba(15, 23, 42, 0.45);
                padding: 24px;
                align-items: center;
                justify-content: center;
            }

            .widget-dialog-backdrop.active {
                display: flex;
            }

            .widget-dialog {
                width: 100%;
                max-width: 760px;
                background: rgba(255, 255, 255, 0.99);
                border: 1px solid rgba(226, 232, 240, 0.95);
                border-radius: 22px;
                box-shadow: 0 20px 60px rgba(15, 23, 42, 0.20);
                padding: 22px;
            }

            .widget-dialog-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                gap: 12px;
                margin-bottom: 18px;
            }

            .widget-dialog-header h2 {
                margin: 0;
                font-size: 1.35rem;
            }

            .dialog-close {
                min-height: 40px;
                width: 40px;
                padding: 0;
                border-radius: 12px;
                font-size: 1.2rem;
                box-shadow: none;
            }

            .wizard-steps {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 10px;
                margin-bottom: 18px;
            }

            .wizard-step {
                padding: 10px 12px;
                border-radius: 12px;
                background: #f8fafc;
                border: 1px solid #e2e8f0;
                color: #64748b;
                font-weight: 700;
                font-size: 0.9rem;
                text-align: center;
            }

            .wizard-step.active {
                background: var(--ppg-primary-soft);
                color: var(--ppg-primary-dark);
                border-color: #bfdbfe;
            }

            .wizard-panel {
                display: none;
                min-height: 180px;
            }

            .wizard-panel.active {
                display: block;
            }

            .widget-type-list {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 14px;
            }

            .widget-type-card {
                min-height: 120px;
                text-align: left;
                padding: 16px;
                border-radius: 16px;
                background: #ffffff;
                border: 1px solid #dbeafe;
                box-shadow: none;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                justify-content: flex-start;
                gap: 8px;
            }

            .widget-type-card strong {
                font-size: 1rem;
            }

            .widget-type-card span {
                color: #64748b;
                line-height: 1.5;
                font-weight: 500;
            }

            .widget-type-card.active {
                border-color: #2563eb;
                background: #eff6ff;
            }

            .dynamic-type-fields.hidden {
                display: none;
            }

            .widget-size-grid {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
            }

            .wizard-actions {
                display: flex;
                justify-content: space-between;
                gap: 12px;
                margin-top: 18px;
                flex-wrap: wrap;
            }

            .hidden {
                display: none !important;
            }

            .widget-type-empty {
                grid-column: 1 / -1;
                padding: 18px;
                border-radius: 16px;
                border: 1px dashed #cbd5e1;
                background: #f8fafc;
                color: #475569;
                line-height: 1.6;
            }

            .widget-type-empty code {
                background: #e2e8f0;
                padding: 2px 6px;
                border-radius: 6px;
                font-size: 0.85em;
            }

            @media (max-width: 1100px) {
                .dashboard-canvas {
                    grid-template-columns: repeat(6, 1fr);
                }

                .dashboard-grid-overlay {
                    grid-template-columns: repeat(6, 1fr);
                }

                .grid-cell-button:nth-child(n+49),
                .grid-cell-blocked:nth-child(n+49) {
                    display: none;
                }
            }

            @media (max-width: 768px) {
                .dashboard-canvas {
                    grid-template-columns: repeat(1, 1fr);
                    grid-auto-rows: auto;
                }

                .dashboard-grid-overlay {
                    display: none !important;
                }

                .dashboard-widget {
                    grid-column: span 1 !important;
                    grid-row: span 1 !important;
                }

                .widget-dialog-backdrop {
                    padding: 12px;
                }

                .widget-dialog {
                    padding: 16px;
                }

                .wizard-steps {
                    grid-template-columns: repeat(2, 1fr);
                }

                .widget-type-list {
                    grid-template-columns: 1fr;
                }

                .widget-size-grid {
                    grid-template-columns: repeat(2, 1fr);
                }

                .wizard-actions {
                    flex-direction: column;
                }
            }