/* Feuerwehrrot nur für Konturen – Flächen in Grautönen */
.haushalt-frontend {
    --hh-red: #cc0000;
    --hh-red-dark: #990000;
    --hh-gray-50: #fafafa;
    --hh-gray-100: #f5f5f5;
    --hh-gray-150: #f0f0f1;
    --hh-gray-200: #e8e8ea;
    --hh-gray-300: #dcdcde;
    --hh-gray-400: #c3c4c7;
    --hh-text: #1d2327;
    --hh-text-muted: #646970;
    --hh-surface: #ffffff;
    --hh-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --hh-shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.1);
    --hh-radius: 10px;
    --hh-radius-sm: 6px;

    max-width: 1100px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--hh-text);
    line-height: 1.5;
}

/* Hinweise */
.haushalt-notice {
    padding: 16px 20px;
    background: var(--hh-gray-100);
    border: 1px solid var(--hh-gray-300);
    border-left: 4px solid var(--hh-red);
    border-radius: var(--hh-radius-sm);
    color: var(--hh-text);
}

.haushalt-notice.haushalt-error {
    background: var(--hh-gray-100);
    border-color: var(--hh-gray-300);
    border-left-color: var(--hh-red);
}

/* Kopfbereich */
.haushalt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--hh-red);
    flex-wrap: wrap;
    gap: 16px;
}

.haushalt-header h2 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 600;
    color: var(--hh-text);
    letter-spacing: -0.02em;
}

.haushalt-summary-overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.haushalt-summary-overview-cards {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1 1 auto;
}

.haushalt-badge {
    display: inline-block;
    background: var(--hh-gray-100);
    color: var(--hh-red-dark);
    border: 1px solid var(--hh-red);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.haushalt-year-select label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--hh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.haushalt-year-select select {
    padding: 9px 14px;
    font-size: 15px;
    color: var(--hh-text);
    background: var(--hh-surface);
    border: 1px solid var(--hh-gray-300);
    border-radius: var(--hh-radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.haushalt-year-select select:focus {
    border-color: var(--hh-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

/* Übersicht */
.haushalt-summary-card {
    background: var(--hh-gray-50);
    border: 1px solid var(--hh-gray-300);
    border-left: 4px solid var(--hh-red);
    border-radius: var(--hh-radius);
    padding: 22px 20px;
    text-align: center;
    box-shadow: var(--hh-shadow);
    transition: box-shadow 0.2s;
}

.haushalt-summary-card:hover {
    box-shadow: var(--hh-shadow-hover);
}

.haushalt-summary-card .label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--hh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.haushalt-summary-card .value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--hh-text);
    letter-spacing: -0.02em;
}

.haushalt-locked-notice {
    margin-bottom: 24px;
    background: var(--hh-gray-100);
    border-left-color: var(--hh-red);
}

/* Status */
.haushalt-status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: var(--hh-radius);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.haushalt-status-badge.entwurf {
    background: var(--hh-gray-100);
    color: var(--hh-text-muted);
    border: 1px solid var(--hh-gray-300);
}

.haushalt-status-badge.gesperrt {
    background: var(--hh-gray-100);
    color: var(--hh-text);
    border: 2px solid var(--hh-red);
}

/* Abschnitte */
.haushalt-frontend h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--hh-text);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.haushalt-hint {
    color: var(--hh-text-muted);
    font-size: 14px;
    margin-bottom: 18px;
}

/* Konten-Auswahl */
.haushalt-konten-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 36px;
}

.haushalt-konto-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: var(--hh-gray-50);
    border: 1.5px solid var(--hh-gray-300);
    border-radius: var(--hh-radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.haushalt-konto-checkbox:hover {
    border-color: var(--hh-red);
    background: var(--hh-gray-100);
}

.haushalt-konto-checkbox.active {
    border-color: var(--hh-red);
    background: var(--hh-gray-100);
    box-shadow: var(--hh-shadow);
}

.haushalt-konto-checkbox input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--hh-red);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.haushalt-konto-info {
    flex: 1;
    font-size: 14px;
    line-height: 1.45;
    color: var(--hh-text);
}

.haushalt-konto-info strong {
    color: var(--hh-text);
    font-weight: 600;
}

.haushalt-konto-summe {
    display: block;
    margin-top: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--hh-text-muted);
}

.haushalt-pflicht {
    color: var(--hh-text-muted);
    font-size: 11px;
    font-weight: 500;
    font-style: normal;
}

/* Konto-Panels */
.haushalt-konto-panel {
    background: var(--hh-surface);
    border: 1px solid var(--hh-red);
    border-radius: var(--hh-radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--hh-shadow);
}

.haushalt-konto-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 22px;
    background: var(--hh-gray-100);
    border-bottom: 1px solid var(--hh-red);
}

.haushalt-konto-panel-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--hh-text);
}

.haushalt-konto-total {
    font-weight: 700;
    font-size: 15px;
    color: var(--hh-text);
}

/* Positionen-Tabelle */
.haushalt-konto-panel .haushalt-table-wrap {
    padding: 0 22px 18px;
}

.haushalt-positionen-table {
    width: 100%;
    border-collapse: collapse;
}

.haushalt-positionen-table th,
.haushalt-positionen-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--hh-gray-200);
    vertical-align: top;
    font-size: 14px;
}

.haushalt-begruendung-text {
    display: block;
    overflow: hidden;
    max-height: 4.5em;
    line-height: 1.5;
    word-break: break-word;
}

.haushalt-col-begruendung.is-expandable {
    cursor: pointer;
}

.haushalt-col-begruendung.is-expandable:hover .haushalt-begruendung-text {
    color: var(--hh-red-dark);
}

.haushalt-modal {
    position: fixed;
    inset: 0;
    z-index: 100100;
}

.haushalt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.haushalt-modal-dialog {
    position: relative;
    max-width: 560px;
    width: calc(100% - 32px);
    margin: 10vh auto 0;
    background: #fff;
    border: 1px solid var(--hh-red);
    border-radius: var(--hh-radius-md, 8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.haushalt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--hh-red);
    background: var(--hh-gray-100);
}

.haushalt-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--hh-text);
}

.haushalt-modal-header .haushalt-modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--hh-text-muted);
    padding: 0;
}

.haushalt-modal-body {
    padding: 18px;
    max-height: 50vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    color: var(--hh-text);
}

.haushalt-modal-footer {
    padding: 12px 18px 16px;
    text-align: right;
    border-top: 1px solid var(--hh-gray-200);
}

.haushalt-positionen-table th {
    background: var(--hh-gray-100);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--hh-text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--hh-red);
}

.haushalt-positionen-table tbody tr:last-child td {
    border-bottom: none;
}

.haushalt-positionen-table tbody tr:hover td {
    background: var(--hh-gray-50);
}

/* Eingabefelder */
.haushalt-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--hh-gray-300);
    border-radius: var(--hh-radius-sm);
    font-size: 14px;
    color: var(--hh-text);
    background: var(--hh-surface);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.haushalt-input:focus {
    border-color: var(--hh-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.12);
}

textarea.haushalt-input {
    resize: vertical;
    min-height: 52px;
}

.haushalt-row-summe {
    font-weight: 600;
    white-space: nowrap;
    color: var(--hh-text);
}

/* Buttons */
.haushalt-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: var(--hh-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    letter-spacing: 0.01em;
}

.haushalt-btn-primary {
    background: var(--hh-gray-100);
    color: var(--hh-red-dark);
    border: 2px solid var(--hh-red);
}

.haushalt-btn-primary:hover {
    background: var(--hh-gray-150);
    border-color: var(--hh-red-dark);
    color: var(--hh-red-dark);
}

.haushalt-konto-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 22px 18px;
    align-items: center;
}

.haushalt-konto-actions .haushalt-btn-secondary {
    margin: 0;
}

.haushalt-btn-secondary {
    background: var(--hh-gray-50);
    color: var(--hh-text);
    border: 1px solid var(--hh-gray-300);
    margin: 14px 22px 18px;
}

.haushalt-btn-secondary:hover {
    background: var(--hh-gray-100);
    border-color: var(--hh-red);
    color: var(--hh-red-dark);
}

.haushalt-btn-icon {
    background: var(--hh-surface);
    border: 1px solid var(--hh-gray-300);
    border-radius: var(--hh-radius-sm);
    padding: 5px 9px;
    cursor: pointer;
    font-size: 13px;
    color: var(--hh-text-muted);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.haushalt-btn-icon:hover {
    background: var(--hh-gray-100);
    border-color: var(--hh-red);
    color: var(--hh-text);
}

.haushalt-btn-icon.haushalt-delete-row:hover {
    color: var(--hh-red-dark);
    border-color: var(--hh-red);
    background: var(--hh-gray-100);
}

.haushalt-btn-icon.haushalt-copy-next-year {
    font-weight: 700;
    color: var(--hh-red-dark);
}

.haushalt-btn-icon.haushalt-copy-next-year:hover {
    border-color: var(--hh-red);
    background: var(--hh-gray-100);
}

.haushalt-copy-next-year-done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-weight: 700;
    color: var(--hh-text-muted);
}

.haushalt-position-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.haushalt-col-copy,
.haushalt-col-actions {
    width: 56px;
    min-width: 56px;
    text-align: center;
    white-space: nowrap;
}

/* Aktionsbereich */
.haushalt-actions {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 2px solid var(--hh-red);
}

/* Ladezustand */
.haushalt-loading {
    text-align: center;
    padding: 48px;
    color: var(--hh-text-muted);
    font-size: 14px;
}

.haushalt-empty-row td {
    text-align: center;
    color: var(--hh-text-muted);
    font-style: italic;
    padding: 20px;
}

.haushalt-status-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-height: 28px;
}

.haushalt-genehmigung-badge {
    display: inline-block;
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.haushalt-genehmigung-offen {
    background: var(--hh-gray-150);
    color: var(--hh-text-muted);
    border-color: var(--hh-gray-300);
}

.haushalt-genehmigung-genehmigt {
    background: var(--hh-gray-100);
    color: #3d6b4f;
    border-color: #a8cdb5;
}

.haushalt-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--hh-gray-300);
    border-radius: 50%;
    background: var(--hh-surface);
    color: var(--hh-red-dark);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    z-index: 2;
}

.haushalt-info-btn:hover {
    border-color: var(--hh-red);
    background: var(--hh-gray-100);
}

.haushalt-col-info {
    text-align: center;
    vertical-align: middle;
}

.haushalt-genehmigung-abgelehnt {
    background: var(--hh-gray-100);
    color: var(--hh-red-dark);
    border-color: var(--hh-red);
}

/* Responsive */
@media (max-width: 768px) {
    .haushalt-positionen-table {
        display: block;
        overflow-x: auto;
    }

    .haushalt-header {
        flex-direction: column;
    }

    .haushalt-header h2 {
        font-size: 22px;
    }

    .haushalt-summary-card .value {
        font-size: 20px;
    }
}
