body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
    margin: 0;
    padding: 0 0 20px;
    color: #1a1a2e;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.container-narrow {
    max-width: 420px;
    margin-top: 40px;
}

.top-bar {
    background: #1a1a2e;
    color: #fff;
    padding: 10px 20px;
    margin-bottom: 20px;
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: center;
}

.user-badge {
    font-size: 0.9rem;
}

.admin-tag {
    background: #e6a700;
    color: #1a1a2e;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 600;
}

.link-muted {
    color: #a8c5e8;
    text-decoration: none;
}

.link-muted:hover {
    text-decoration: underline;
}

.layout-split {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: visible;
}

.sidebar {
    background: #f0f3f8;
    padding: 24px 16px;
    border-right: 1px solid #e0e4ea;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.sidebar-nav a {
    text-decoration: none;
    color: #1a1a2e;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.nav-active {
    background: #fff;
    font-weight: 600;
}

.sidebar-title {
    font-size: 1rem;
    margin: 0 0 12px;
}

.main-panel {
    padding: 24px 30px 30px;
    min-width: 0;
}

.plan-list {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
}

.plan-list a {
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    color: #1a1a2e;
    text-decoration: none;
    font-size: 0.95rem;
}

.plan-list a:hover,
.plan-list a.plan-active {
    background: #fff;
    font-weight: 600;
}

.plan-empty {
    font-size: 0.85rem;
    color: #666;
    padding: 8px 0;
}

.btn-secondary {
    background: #fff;
    color: #0056b3;
    border: 1px solid #0056b3;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    background: #eef4fb;
}

.btn-secondary.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.btn-danger {
    background: #b42318;
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-danger:hover {
    background: #912018;
}

.btn-danger-text {
    background: none;
    border: none;
    color: #b42318;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
}

.tariff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.tariff-card {
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tariff-card h2 {
    font-size: 1rem;
    margin: 0;
}

.tariff-current {
    border-color: #0056b3;
    box-shadow: 0 0 0 1px #0056b3;
}

.tariff-price {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.tariff-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
}

.tariff-limit {
    font-size: 0.85rem;
    color: #444;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin: 20px 0;
}

.form-inline input[type="text"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 200px;
}

.meta-table {
    text-align: left;
}

.row-muted {
    opacity: 0.6;
}

.inline-form {
    display: inline;
}

.api-docs code,
.api-key-reveal {
    font-size: 0.85rem;
    word-break: break-all;
}

.ai-panel {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid #e0e4ea;
}

.ai-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 8px 0 12px;
    font-family: inherit;
}

.ai-status {
    font-size: 0.9rem;
    min-height: 1.2em;
}

.ai-status-error {
    color: #9b1c1c;
}

.ai-status-ok {
    color: #1e6b34;
}

.ai-chapter-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.ai-chapter-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.ai-chapter-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-badge {
    font-size: 0.75rem;
    color: #1e6b34;
    font-style: normal;
    margin-left: 6px;
}

.ai-chapter-output {
    background: #f8fafc;
    border: 1px solid #e0e4ea;
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
}

.ai-chapter-body {
    white-space: pre-wrap;
    line-height: 1.55;
}

.ai-editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ai-editor-toolbar h3 {
    margin: 0;
    font-size: 1.05rem;
}

.ai-editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-dirty-hint {
    font-size: 0.85rem;
    color: #9b6b00;
}

.ai-chapter-editor {
    width: 100%;
    box-sizing: border-box;
    min-height: 280px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
}

.ai-panel.ai-busy {
    opacity: 0.85;
    pointer-events: none;
}

.guv-scroll {
    overflow-x: auto;
    overflow-y: visible;
    margin-top: 16px;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.guv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.guv-table th,
.guv-table td {
    border: 1px solid #ddd;
    padding: 6px 8px;
}

.guv-table thead th {
    background: #0056b3;
    color: #fff;
}

.guv-input {
    width: 140px;
    max-width: 100%;
    padding: 6px;
    border: 1px solid #e6c200;
    background: #fffbea;
    border-radius: 3px;
    text-align: right;
}

.guv-row-total td,
.guv-row-subtotal td {
    background: #f0f4f8;
    font-weight: 600;
}

.guv-section td {
    background: #eef2f7;
    font-weight: 700;
}

.guv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}

.guv-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.guv-tabs a {
    padding: 8px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #0056b3;
}

.guv-tabs a.tab-active {
    background: #0056b3;
    color: #fff;
    border-color: #0056b3;
}

.guv-scroll-wide {
    max-width: 100%;
    border: 1px solid #e0e4ea;
    border-radius: 4px;
    background: #fff;
}

.guv-scroll-wide .guv-table {
    width: max-content;
    min-width: 100%;
}

.guv-scroll-hint {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: #555;
}

/* GuV-Seite: breiteres Dashboard für Monatsmatrix */
.container.layout-split.layout-guv-wide {
    max-width: min(1780px, calc(100vw - 32px));
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 1480px) {
    .layout-guv-wide .guv-scroll-wide.guv-months-fit {
        overflow-x: visible;
    }

    .layout-guv-wide #guv-months-table,
    .layout-guv-wide #guv-kpi-months {
        width: 100%;
        table-layout: fixed;
    }

    .layout-guv-wide #guv-months-table .guv-month-input {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .layout-guv-wide #guv-months-table .guv-sticky-col2 {
        min-width: 160px;
        width: 18%;
    }

    .layout-guv-wide .guv-scroll-hint-narrow {
        display: none;
    }
}

@media (max-width: 1479px) {
    .guv-scroll-hint-narrow {
        display: block;
    }
}

.guv-sticky-col {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 2;
    min-width: 42px;
}

.guv-sticky-col2 {
    position: sticky;
    left: 42px;
    background: #fff;
    z-index: 2;
    min-width: 220px;
}

.guv-month-input {
    width: 72px;
    min-width: 72px;
    font-size: 0.8rem;
    padding: 4px;
    box-sizing: border-box;
}

.guv-scroll-wide .guv-table th.text-right,
.guv-scroll-wide .guv-table td.text-right {
    white-space: nowrap;
}

.guv-subhead {
    margin-top: 24px;
    font-size: 1rem;
}

.guv-computed {
    font-variant-numeric: tabular-nums;
}

.guv-details {
    margin-top: 20px;
    font-size: 0.95rem;
}

.guv-details summary {
    cursor: pointer;
    color: #0056b3;
    font-weight: 600;
}

.guv-row-total td,
.guv-row-subtotal td,
.guv-row-total,
.guv-row-subtotal {
    background: #f0f4f8;
}

.guv-row-total .guv-computed,
.guv-row-subtotal .guv-computed {
    font-weight: 600;
}

.fal-cover-preview {
    display: block;
    max-width: 100%;
    margin-top: 16px;
    border-radius: 6px;
    border: 1px solid #e0e4ea;
}

.btn-block {
    width: 100%;
    box-sizing: border-box;
}

.form-actions {
    grid-column: span 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.full-width {
    grid-column: span 2;
}

.form-stack input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tabs a {
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    color: #0056b3;
    border: 1px solid #ccc;
}

.tabs a.tab-active {
    background: #0056b3;
    color: #fff;
    border-color: #0056b3;
}

.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin: 0 0 16px;
}

.alert-error {
    background: #fde8e8;
    color: #9b1c1c;
}

.alert-success {
    background: #e6f4ea;
    color: #1e6b34;
}

.results.live-updated {
    outline: 2px solid rgba(0, 86, 179, 0.25);
    border-radius: 6px;
    padding: 8px;
}

.results h2 {
    margin-top: 28px;
    font-size: 1.15rem;
}

.results h2:first-child {
    margin-top: 0;
}

.lead {
    margin-top: 0;
    color: #555;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.form-grid label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-grid input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-actions {
    grid-column: span 2;
}

.btn-primary {
    background: #0056b3;
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-primary:hover {
    background: #004494;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.result-table th,
.result-table td {
    border: 1px solid #ddd;
    padding: 10px;
}

.result-table thead tr {
    background: #0056b3;
    color: white;
}

.text-center {
    text-align: center;
}

.profit-positive {
    font-weight: bold;
    color: green;
}

.profit-negative {
    font-weight: bold;
    color: red;
}

@media (max-width: 768px) {
    .layout-split {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid #e0e4ea;
    }
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .full-width {
        grid-column: span 1;
    }
}