:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --sidebar: #111827;
    --sidebar-muted: #9ca3af;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 16px;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--sidebar);
    color: white;
    padding: 28px;
}

.main {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    padding: 32px;
    overflow-x: hidden;
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 36px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
}

.brand span {
    display: block;
    color: var(--sidebar-muted);
    font-size: 13px;
    margin-top: 4px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    color: var(--sidebar-muted);
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.topbar h1 {
    margin: 0;
    font-size: 32px;
}

.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
}

.page-section {
    display: grid;
    gap: 24px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.section-head h2 {
    margin: 0;
    font-size: 28px;
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.card,
.kpi-card,
.business-plan-card,
.plan-hero,
.module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 26px;
    min-width: 0;
    max-width: 100%;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    padding: 22px;
    min-width: 0;
}

.kpi-card span {
    color: var(--muted);
    font-weight: 800;
    font-size: 14px;
}

.kpi-card strong {
    display: block;
    font-size: 30px;
    margin: 10px 0;
}

.kpi-card small {
    color: var(--muted);
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-danger-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary,
.btn-secondary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-secondary,
.btn-ghost,
.btn-danger-small {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 14px;
}

.btn-primary:hover,
.btn-secondary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-ghost {
    background: #f3f6fb;
    color: var(--text);
}

.btn-ghost:hover {
    background: #e8eef8;
}

.btn-danger,
.btn-danger-small {
    color: #ffffff;
    background: var(--danger);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
}

.btn-danger {
    min-height: 44px;
    padding: 12px 18px;
    font-size: 15px;
}

.btn-danger:hover,
.btn-danger-small:hover {
    background: var(--danger-dark);
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.business-plan-card {
    padding: 24px;
    display: grid;
    gap: 18px;
}

.plan-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plan-badge {
    background: #e0ecff;
    color: var(--primary);
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.plan-id {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.business-plan-card h3 {
    margin: 0;
    font-size: 24px;
}

.business-plan-card p {
    margin: 0;
    color: var(--muted);
}

.plan-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.plan-meta span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
}

.plan-meta strong {
    font-size: 14px;
}

.plan-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.plan-actions form {
    margin: 0;
}

.plan-hero {
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.plan-hero h2 {
    margin: 14px 0 8px;
    font-size: 34px;
}

.plan-hero p {
    margin: 0;
    color: var(--muted);
}

.plan-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.module-card {
    padding: 22px;
    text-decoration: none;
    color: var(--text);
    display: grid;
    gap: 10px;
    transition: 0.18s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
}

.module-card span {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #e0ecff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
}

.module-card strong {
    font-size: 18px;
}

.module-card small {
    color: var(--muted);
    font-weight: 800;
}

.finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.finance-summary div {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.finance-summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.finance-summary strong {
    font-size: 20px;
}

.plan-table {
    width: 100%;
    border-collapse: collapse;
}

.plan-table th {
    text-align: left;
    background: #f5f7fa;
    padding: 14px;
}

.plan-table td {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.table-head h3 {
    margin: 0;
    font-size: 22px;
}

.table-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.revenue-card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.matrix-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    padding-bottom: 14px;
}

.matrix-table {
    width: max-content;
    min-width: 3000px;
    border-collapse: collapse;
    background: #ffffff;
}

.matrix-table th,
.matrix-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: right;
    font-size: 14px;
}

.matrix-table th {
    background: #f3f6fb;
    color: var(--text);
    font-weight: 900;
}

.matrix-table td {
    color: #111827;
}

.matrix-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    background: #ffffff;
    min-width: 220px;
    max-width: 220px;
}

.matrix-table thead .sticky-col,
.matrix-table tfoot .sticky-col {
    background: #f3f6fb;
    z-index: 3;
}

.position-name {
    font-weight: 900;
}

.row-total {
    font-weight: 900;
    background: #f8fafc;
}

.matrix-table tfoot th {
    background: #e0ecff;
    color: #1d4ed8;
}

.matrix-input {
    width: 92px;
    max-width: 92px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    font-weight: 800;
    text-align: right;
    background: #ffffff;
    color: var(--text);
}

.matrix-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-row {
    display: grid;
    gap: 8px;
}

.form-row label {
    font-weight: 900;
    color: var(--text);
}

.form-row input,
.form-row select {
    width: 100%;
    border: 1px solid var(--border);
    background: white;
    border-radius: 12px;
    padding: 14px 15px;
    font-size: 15px;
    color: var(--text);
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.danger-zone {
    border-color: #fecaca;
    background: #fff7f7;
}

.active-scenario-card {
    border-color: var(--primary);
    box-shadow: 0 18px 45px rgba(37, 99, 235, 0.16);
}

.positive-cell {
    color: #15803d !important;
    font-weight: 900;
}

.negative-cell {
    color: #dc2626 !important;
    font-weight: 900;
}

.cockpit {
    display: grid;
    gap: 24px;
}

.cockpit-hero {
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    color: white;
    border-radius: 24px;
    padding: 34px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow);
}

.cockpit-hero h2 {
    margin: 14px 0 8px;
    font-size: 38px;
}

.cockpit-hero p {
    margin: 0;
    color: #cbd5e1;
}

.cockpit-score {
    min-width: 210px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 22px;
    text-align: center;
}

.cockpit-score span {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.cockpit-score strong {
    font-size: 42px;
}

.cockpit-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.cockpit-bars {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.cockpit-bar-row {
    display: grid;
    grid-template-columns: 130px 1fr 150px;
    gap: 16px;
    align-items: center;
}

.cockpit-bar-row span {
    color: var(--muted);
    font-weight: 900;
}

.cockpit-bar-row div {
    height: 12px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.cockpit-bar-row i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 999px;
}

.cockpit-bar-row strong {
    text-align: right;
}

.traffic {
    display: inline-flex;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 900;
    margin: 12px 0;
}

.traffic-green {
    background: #dcfce7;
    color: #15803d;
}

.traffic-red {
    background: #fee2e2;
    color: #dc2626;
}

.pdf-preview-box {
    max-width: 720px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.pdf-preview-header {
    color: white;
    padding: 28px;
}

.pdf-preview-header strong {
    display: block;
    font-size: 26px;
    margin-bottom: 8px;
}

.pdf-preview-header span {
    opacity: 0.85;
}

.pdf-preview-body {
    padding: 28px;
}

.pdf-preview-line {
    height: 14px;
    width: 70%;
    background: #e5e7eb;
    border-radius: 999px;
    margin-bottom: 14px;
}

.pdf-preview-line.large {
    height: 24px;
    width: 45%;
}

.pdf-preview-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
}

.pdf-preview-kpis div {
    height: 90px;
    border: 3px solid;
    border-radius: 16px;
    background: #f8fafc;
}

.fake-chart {
    height: 280px;
    display: flex;
    align-items: end;
    gap: 18px;
    padding-top: 30px;
}

.fake-chart div {
    width: 70px;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(180deg, var(--primary), #93c5fd);
}

@media (max-width: 1100px) {
    .cockpit-grid {
        grid-template-columns: 1fr;
    }

    .cockpit-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .cockpit-score {
        width: 100%;
    }

    .cockpit-bar-row {
        grid-template-columns: 1fr;
    }

    .cockpit-bar-row strong {
        text-align: left;
    }
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
    }

    .main {
        width: 100%;
        max-width: 100%;
        padding: 20px;
    }

    .topbar,
    .table-head,
    .section-head,
    .plan-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .kpi-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .sidebar,
    .topbar .btn-primary,
    .section-head .btn-ghost,
    .plan-hero-actions {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .main {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    body {
        background: white;
    }

    .card,
    .kpi-card,
    .plan-hero {
        box-shadow: none;
        break-inside: avoid;
    }
}
/* FIX: Matrix nur im weißen Kasten horizontal scrollen */

.main {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
    overflow-x: hidden;
}

.page-section,
.page-section > *,
.card,
.revenue-card {
    min-width: 0 !important;
    max-width: 100% !important;
}

.card.revenue-card {
    width: 100% !important;
    overflow: hidden !important;
}

.matrix-scroll {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    padding-bottom: 16px !important;
}

.matrix-table {
    width: 3200px !important;
    min-width: 3200px !important;
    max-width: none !important;
}

html,
body {
    overflow-x: hidden !important;
}