* { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: 'Segoe UI', sans-serif; margin: 0; padding: 0 0 20px; background: linear-gradient(135deg, #2c3e50, #3498db); min-height: 100vh; color: #333; }
    .container { background: white; border-radius: 20px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: min(1200px, calc(100% - 32px)); margin: 26px auto 0; }
        h1 { text-align: center; color: #2c3e50; margin-bottom: 10px; font-size: 2.4em; }
        .subtitle { text-align: center; color: #7f8c8d; margin-bottom: 20px; }
        .hinweis-api { background: #fff3cd; border: 2px solid #ffc107; border-radius: 12px; padding: 18px; margin-bottom: 25px; font-size: 14px; }
        .hinweis-api strong { color: #856404; }
        
        .btn {
            padding: 14px 20px;
            background: linear-gradient(140deg, var(--theme-primary, #0f4c81) 0%, var(--theme-primary-2, #1b6ca8) 100%);
            color: var(--theme-accent-2, #ffd166);
            border: 1px solid rgba(255, 209, 102, 0.35);
            border-radius: 12px; 
            font-size: 16px; 
            font-weight: 700; 
            cursor: pointer; 
            margin-bottom: 15px; 
            display: inline-block;
            text-align: center;
            width: auto;
            box-shadow: 0 8px 18px rgba(15, 76, 129, 0.28);
            transition: transform 0.15s ease, filter 0.15s ease;
        }
        .btn:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
        .btn:disabled { background: #c7d0db; color: #5d6f84; border-color: #c7d0db; box-shadow: none; cursor: not-allowed; opacity: 0.75; }
        #speichern-zurueck {
            width: 100%;
            margin-top: 1rem;
            margin-bottom: 0;
            padding: 1rem 2rem;
            border-radius: 6px;
            font-size: 1.1em;
            background: var(--accent, #0f4c81);
            color: #ffd166;
        }

        #speichern-zurueck:hover:not(:disabled) {
            filter: brightness(0.9);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(var(--accent-rgb, 15, 76, 129), 0.4);
        }
        
        .btn-print, .btn-secondary, .btn-refresh, .btn-prognose { 
            width: auto; 
            padding: 14px 20px; 
            display: inline-block; 
            margin: 10px 5px;
            font-size: 16px;
            font-weight: 700;
            white-space: nowrap;
        }
        
        .btn-print,
        .btn-refresh,
        .btn-admin,
        .btn-primary {
            background: linear-gradient(140deg, var(--theme-primary, #0f4c81) 0%, var(--theme-primary-2, #1b6ca8) 100%);
            color: var(--theme-accent-2, #ffd166);
            border-color: rgba(255, 209, 102, 0.35);
        }

        .btn-secondary {
            background: linear-gradient(140deg, #5f738f 0%, #4a5f84 100%);
            color: #f4f7ff;
            border-color: rgba(223, 233, 250, 0.45);
            box-shadow: 0 8px 18px rgba(61, 79, 109, 0.24);
        }
        
        .btn-prognose {
            background: linear-gradient(140deg, #1f5f95 0%, #2b77b3 100%);
            color: var(--theme-accent-2, #ffd166);
            width: 100%; 
            padding: 12px 15px; 
            margin-top: 15px; 
            font-size: 15px;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            border: 1px solid rgba(255, 209, 102, 0.35);
            cursor: pointer;
            min-height: 48px;
            flex-shrink: 0;
        }
        
        .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; }
        .modal-overlay.active { display: flex; }
        .modal-content { background: white; border-radius: 15px; width: 95%; max-width: 900px; max-height: 90vh; overflow-y: auto; }
        .modal-lg { max-width: 1100px; }
        .modal-xl { max-width: 1300px; }
        .modal-header { display: flex; justify-content: space-between; padding: 20px; border-bottom: 2px solid #ecf0f1; }
        .modal-close { background: #e74c3c; color: white; border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
        .modal-body { padding: 25px; }
        .modal-actions { display: flex; gap: 15px; margin-top: 25px; justify-content: flex-end; }
        .druck-tabelle { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 14px; }
        .druck-tabelle th, .druck-tabelle td { border: 1px solid #bdc3c7; padding: 12px; text-align: left; }
        .druck-tabelle th { background: #2c3e50; color: white; }
        
        .preis-karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; display: none; }
        .preis-karte { 
            background: #ffffff; 
            padding: 24px; 
            border-radius: 14px; 
            border: 1px solid #d5e2f7;
            box-shadow: 0 4px 18px rgba(0,0,0,0.08); 
            position: relative; 
            display: flex;
            flex-direction: column;
            min-height: 380px;
            flex-shrink: 0;
        }
        .preis-karte.benutzer { border-color: #cbb6e6; background: #f8f4ff; }
        
        .karten-titel-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            gap: 10px;
            flex-shrink: 0;
        }
        .karten-titel { 
            font-size: 1.25em; 
            font-weight: 700; 
            margin-bottom: 0;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .benutzer-preis-badge {
            background: #9b59b6;
            color: white;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.75em;
            font-weight: 600;
            white-space: nowrap;
            flex-shrink: 0;
            margin-left: 8px;
        }
        
        .karten-icon { font-size: 2.8em; margin-bottom: 12px; flex-shrink: 0; }
        .karten-preis {
            font-size: clamp(1.55em, 2vw, 2.1em);
            font-weight: 800;
            color: #27ae60;
            margin: 8px 0;
            flex-shrink: 0;
            white-space: nowrap;
            line-height: 1.1;
        }
        .preis-karte.benutzer .karten-preis { color: #9b59b6; }
        .karten-mein-preis-row {
            margin-top: -2px;
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-shrink: 0;
            flex-wrap: nowrap;
        }
        .karten-mein-preis-wert {
            font-size: clamp(1.55em, 2vw, 2.1em);
            font-weight: 800;
            color: #27ae60;
            line-height: 1.05;
            white-space: nowrap;
        }
        .mein-preis-badge {
            background: #eef3ff;
            color: #1f355a;
            border: 1px solid #d7e4fb;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.78em;
            font-weight: 700;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .karten-kwh { background: #fff3e0; padding: 10px; border-radius: 8px; font-weight: 700; color: #e74c3c; margin-top: 10px; text-align: center; flex-shrink: 0; }
        .tagesaktuell-badge { background: linear-gradient(135deg, #27ae60, #2ecc71); color: white; padding: 4px 10px; border-radius: 12px; font-size: 0.75em; position: absolute; top: 10px; left: 10px; }
        
        .karten-prognose-row {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            margin-top: 15px;
            flex-shrink: 0;
        }
        
        .phine-input { display: flex; gap: 8px; margin-top: 15px; flex-shrink: 0; }
        .phine-input input { flex: 1; padding: 10px; border: 2px solid #ddd; border-radius: 8px; }
        .phine-input button {
            padding: 10px 12px;
            background: linear-gradient(140deg, var(--theme-primary, #0f4c81) 0%, var(--theme-primary-2, #1b6ca8) 100%);
            color: var(--theme-accent-2, #ffd166);
            border: 1px solid rgba(255, 209, 102, 0.35);
            border-radius: 8px;
            cursor: pointer;
            flex-shrink: 0;
        }
        .phine-input button.delete-btn {
            background: linear-gradient(140deg, #b46a2d 0%, #9e4f27 100%);
            color: #fff7ec;
            border-color: rgba(255, 214, 163, 0.45);
            box-shadow: 0 7px 16px rgba(133, 75, 41, 0.22);
        }
        .phine-input button.delete-btn:hover {
            filter: brightness(1.05);
            transform: translateY(-1px);
        }
        .jahresverbrauch-input {
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .jahresverbrauch-input label {
            font-size: 0.88em;
            font-weight: 700;
            color: #35507a;
        }
        .jahresverbrauch-input input {
            width: 100%;
            padding: 10px;
            border: 2px solid #d0d9e8;
            border-radius: 8px;
        }
        
        .entwicklung-tabelle { width: 100%; border-collapse: collapse; margin: 20px 0; background: white; }
        .entwicklung-tabelle th { background: #2c3e50; color: white; padding: 15px; text-align: center; }
        .entwicklung-tabelle td { padding: 12px; text-align: center; border: 1px solid #ecf0f1; }
        .entwicklung-tabelle tr:nth-child(even) { background: #f8f9fa; }
        .entwicklung-tabelle td:first-child { font-weight: 700; text-align: left; }
        /* Spalte 5J (7) in Drucktabelle ausblenden */
        .druck-tabelle th:nth-child(7),
        .druck-tabelle td:nth-child(7) { display: none; }
        .entwicklung-tabelle th:nth-child(6),
        .entwicklung-tabelle th:nth-child(7),
        .entwicklung-tabelle th:nth-child(8),
        .entwicklung-tabelle td:nth-child(6),
        .entwicklung-tabelle td:nth-child(7),
        .entwicklung-tabelle td:nth-child(8) { display: none; }
        .steigerung-positive { color: #e74c3c; font-weight: 700; }
        .steigerung-moderat { color: #f39c12; font-weight: 700; }
        .steigerung-niedrig { color: #27ae60; font-weight: 700; }
        .prognose-badge { background: #e8f4f8; padding: 4px 8px; border-radius: 6px; font-weight: 600; color: #2980b9; }
        .hinweis { background: #fff9e6; border: 2px solid #f39c12; padding: 22px; border-radius: 12px; margin-top: 30px; font-size: 14px; display: none; }
        .status-nachricht { text-align: center; padding: 10px; margin-top: 10px; border-radius: 8px; display: none; }
        .status-success { background: #d4edda; color: #155724; }
        .status-error { background: #f8d7da; color: #721c24; }
        .mini-loader { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,0.85); color: white; padding: 15px 25px; border-radius: 10px; z-index: 9999; display: none; }
        .mini-loader.active { display: flex; align-items: center; gap: 10px; }
        .loading-spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #fff; border-radius: 50%; border-top-color: transparent; animation: spinner 1s linear infinite; }
        @keyframes spinner { to { transform: rotate(360deg); } }
        .export-content { background: #f8f9fa; padding: 20px; border-radius: 10px; }
        .export-content h3 { color: #16a085; margin-bottom: 15px; }
        .export-content code { display: block; word-break: break-all; font-size: 0.85em; background: white; padding: 15px; border-radius: 6px; margin: 10px 0; max-height: 300px; overflow-y: auto; }
        .export-actions { display: flex; gap: 10px; margin-top: 15px; }
        .quellen-link { margin-top: 8px; font-size: 0.9em; flex-shrink: 0; }
        .quellen-link a { color: #3498db; text-decoration: none; font-weight: 600; }
        .quellen-link a:hover { text-decoration: underline; }
        
        .info-quelle { 
            margin-top: 10px; 
            margin-bottom: 8px; 
            font-size: 0.85em; 
            color: #3498db; 
            cursor: pointer; 
            text-decoration: underline; 
            font-weight: 500;
            display: inline-block;
        }
        .info-quelle:hover { color: #2980b9; font-weight: 600; }
        
        /* ✅ KORREKTUR: Prognose-Items brechen Text um */
        .prognose-details { background: #f8f9fa; padding: 20px; border-radius: 10px; margin: 15px 0; }
        .prognose-details h3 { color: #2c3e50; margin-bottom: 15px; }
        .prognose-grid { 
            display: grid; 
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
            gap: 15px; 
        }
        .prognose-item { 
            background: white; 
            padding: 15px; 
            border-radius: 8px; 
            border-left: 4px solid #3498db;
            white-space: normal; /* ✅ Text darf umbrechen */
            word-wrap: break-word; /* ✅ Lange Wörter umbrechen */
            overflow-wrap: break-word;
        }
        .prognose-item label { 
            display: block; 
            font-weight: 600; 
            color: #7f8c8d; 
            font-size: 0.9em; 
            margin-bottom: 5px;
            line-height: 1.4; /* ✅ Bessere Zeilenhöhe für Label */
        }
        .prognose-item .wert { 
            font-size: 1.4em; 
            font-weight: 700; 
            color: #2c3e50;
            white-space: normal; /* ✅ Wert darf auch umbrechen */
        }
        .prognose-item.positiv .wert { color: #e74c3c; }
        .prognose-item.moderat .wert { color: #f39c12; }
        .prognose-item.niedrig .wert { color: #27ae60; }

        .admin-fallback-table-wrap {
            overflow-x: auto;
            border: 1px solid #e4e8ec;
            border-radius: 10px;
            background: #fdfdfd;
        }
        .admin-fallback-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 720px;
        }
        .admin-fallback-table th,
        .admin-fallback-table td {
            border-bottom: 1px solid #eceff3;
            padding: 10px;
            text-align: left;
            vertical-align: middle;
        }
        .admin-fallback-table th {
            background: #2f3d4a;
            color: #fff;
            font-size: 0.9rem;
            position: sticky;
            top: 0;
        }
        .admin-fallback-table input {
            width: 100%;
            padding: 8px 10px;
            border: 1px solid #ccd3db;
            border-radius: 8px;
            font-size: 0.95rem;
        }

        .admin-source-field-wrap {
            display: grid;
            gap: 6px;
        }

        .admin-source-preview {
            display: none;
            font-size: 0.85rem;
            color: #556273;
            word-break: break-all;
        }

        .admin-source-preview.is-visible {
            display: block;
        }

        .admin-source-preview a {
            color: #2563eb;
            text-decoration: none;
            font-weight: 600;
        }

        .admin-source-preview a:hover {
            text-decoration: underline;
        }

        .admin-source-input-invalid {
            border-color: #dc2626 !important;
            background: #fff6f6;
        }

        .admin-source-error {
            display: none;
            color: #b91c1c;
            font-size: 0.78rem;
            line-height: 1.35;
        }

        .admin-source-error.is-visible {
            display: block;
        }
        
        .druckbereich-druck { display: none; }
        
        @media print {
            html, body {
                height: auto !important;
                overflow: visible !important;
            }

            body > *:not(.golden-layout) { display: none !important; }
            body > .golden-layout {
                display: block !important;
                height: auto !important;
                min-height: 0 !important;
            }
            body > .golden-layout > .golden-layout-left { display: none !important; }
            body > .golden-layout > .golden-layout-right {
                display: block !important;
                width: 100% !important;
                height: auto !important;
                min-height: 0 !important;
                overflow: visible !important;
                padding: 0 !important;
                background: white !important;
            }
            body > .golden-layout > .golden-layout-right > *:not(.druck-print-content) { display: none !important; }
            .modal-overlay:not(.druck-print-active) { display: none !important; }
            
            .druck-print-content {
                display: block !important;
                position: static !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 0 !important;
                padding: 20px !important;
                background: white !important;
                height: auto !important;
                overflow: visible !important;
            }
            
            .druck-print-content .modal-content {
                box-shadow: none !important;
                width: 100% !important;
                max-width: 100% !important;
                border: none !important;
                padding: 0 !important;
            }
            
            .druck-print-content .modal-header {
                display: flex !important;
                border-bottom: 2px solid #2c3e50 !important;
                padding: 20px 0 !important;
                margin-bottom: 20px !important;
            }
            
            .druck-print-content .modal-close {
                display: none !important;
            }
            
            .druck-print-content .modal-actions {
                display: none !important;
            }
            
            .druck-print-content .modal-body {
                padding: 0 !important;
            }
            
            table { page-break-inside: auto; }
            tr { page-break-inside: avoid; page-break-after: auto; }
            thead { display: table-header-group; }
            tfoot { display: table-footer-group; }
        }
        
        .aktions-buttons { 
            display: flex; 
            gap: 12px; 
            margin: 20px 0; 
            justify-content: center; 
            flex-wrap: wrap; 
            align-items: center;
        }
        
        .druck-print-content {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: white;
            z-index: 99999;
            overflow: auto;
            padding: 40px;
        }
        
        .druck-print-active {
            display: block !important;
        }
        
        @media (max-width: 768px) {
            .aktions-buttons {
                flex-direction: column;
                align-items: stretch;
            }
            .btn-print, .btn-secondary, .btn-refresh {
                width: 100%;
                margin: 5px 0;
            }
            .prognose-grid {
                grid-template-columns: 1fr; /* ✅ Mobile: 1 Spalte */
            }
        }

        @media (max-width: 600px) {
            /* Container-Padding reduzieren — war 40px, zu viel auf Handy */
            .container {
                width: 100%;
                margin: 12px 0 0;
                padding: 16px;
                border-radius: 12px;
            }
            /* Karten: 1 Spalte, schmaler */
            .preis-karten {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            .preis-karte {
                min-height: unset;
                padding: 14px;
            }

            .karten-titel {
                font-size: 1.05rem;
                white-space: normal;
            }

            .karten-preis,
            .karten-mein-preis-wert {
                font-size: clamp(1.2rem, 6vw, 1.45rem);
                white-space: normal;
                overflow-wrap: anywhere;
                word-break: break-word;
            }

            .karten-kwh,
            .quellen-link {
                font-size: 0.9rem;
            }

            .btn-prognose {
                font-size: 0.9rem;
                min-height: 42px;
                padding: 10px 12px;
            }
        }

        @media (max-width: 420px) {
            .container {
                padding: 12px;
            }

            .preis-karte {
                padding: 12px;
                border-radius: 10px;
            }

            .karten-icon {
                font-size: 2.1rem;
            }
        }