body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 20px;
}

hr {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 30px 0;
}

/* Form Styling */
.transaction-input form {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Zwei gleich große Spalten für das Haupt-Grid */
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

/* Gruppen, die über 2 Spalten gehen und eigene innere Grids haben */
.type-category-group,
.amount-description-group,
.date-group-flex {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Ihre eigenen zwei Spalten */
    gap: 15px;
}

/* Einzelne Formulargruppen innerhalb dieser flexiblen Gruppen */
.date-group-flex .form-group {
    width: auto;
}

/* Summary Styling for Überschussrechnung */
.summary h3 {
    text-align: center;
    color: #34495e;
    margin-bottom: 10px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    text-align: center;
    margin-bottom: 30px;
}

.summary-grid > div {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.summary-grid p {
    font-size: 1.8em;
    font-weight: bold;
    margin: 0;
}

.income-total {
    color: #28a745;
}

.expense-total {
    color: #dc3545;
}

.balance-total {
    /* Color set by JS */
}

/* Finanzierungsrechner Styling */
.financing-calculator {
    background-color: #e9f5ff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-top: 30px;
    border: 1px solid #cceeff;
}

.financing-calculator h3 {
    color: #007bff;
    margin-bottom: 20px;
}

.financing-calculator .financing-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.financing-calculator .form-group {
    width: auto;
    margin: 0;
}

.financing-calculator .form-group label {
    text-align: left;
    width: 100%;
}

.financing-calculator input[type="number"] {
    width: calc(100% - 22px);
    text-align: center;
}

.financing-calculator button {
    background-color: #6f42c1;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 44px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

.financing-calculator button:hover {
    background-color: #563d7c;
}

.financing-calculator p {
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 20px;
    color: #28a745;
}

#financingAmount {
    color: #0056b3;
}


/* Table Styling */
.transaction-list table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.transaction-list th,
.transaction-list td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.transaction-list th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #555;
}

.transaction-list td.action-buttons {
    display: flex;
    gap: 5px;
}

.transaction-list td button {
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.delete-btn {
     background-color: #dc3545;
}
.delete-btn:hover {
     background-color: #c82333;
}

.edit-btn {
    background-color: #ffc107;
    color: #333;
}
.edit-btn:hover {
    background-color: #e0a800;
}

.income-amount {
    color: #28a745;
    font-weight: bold;
}

.expense-amount {
    color: #dc3545;
    font-weight: bold;
}


/* Data Management Buttons */
.data-management {
    text-align: center;
}

.data-management button {
    padding: 10px 15px;
    margin: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

#exportData {
    background-color: #007bff;
    color: white;
}

#exportData:hover {
    background-color: #0056b3;
}

#importData {
    background-color: #ffc107;
    color: #333;
}

#importData:hover {
    background-color: #e0a800;
}

#clearData {
    background-color: #6c757d;
    color: white;
}

#clearData:hover {
    background-color: #5a6268;
}

#toggleMilestoneAnalysis, #toggleAdvisorAnalysis {
    background-color: #17a2b8;
    color: white;
}

#toggleMilestoneAnalysis:hover, #toggleAdvisorAnalysis:hover {
    background-color: #138496;
}


/* Styling für den neuen Meilenstein-Analyse-Bereich */
#milestoneAnalysisSection {
    background-color: #f0f8ff;
    padding: 30px; /* Erhöht */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-top: 30px;
    border: 1px solid #cceeff;
}

#milestoneAnalysisSection h2 {
    color: #1a5276;
    margin-bottom: 20px;
}

#milestoneResults div.milestone-entry {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#milestoneResults div.milestone-entry h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
}

#milestoneResults p {
    margin: 5px 0;
    font-size: 0.95em;
}

#milestoneResults .milestone-income {
    color: #28a745;
    font-weight: bold;
}

#milestoneResults .milestone-expense {
    color: #dc3545;
    font-weight: bold;
}

#milestoneResults .milestone-balance {
    font-weight: bold;
}

#milestoneResults div.milestone-entry h5 {
    margin-top: 15px;
    margin-bottom: 5px;
    color: #4a6984;
    font-size: 0.9em;
    font-weight: bold;
}

#milestoneResults div.milestone-entry ul {
    list-style: none;
    padding-left: 10px;
    margin: 0;
}

#milestoneResults div.milestone-entry ul li {
    font-size: 0.85em;
    margin-bottom: 3px;
    padding-left: 10px;
    position: relative;
}

#milestoneResults div.milestone-entry ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Styling für den neuen Berateranalyse-Bereich */
#advisorAnalysisSection {
    background-color: #e6ffee; /* Helles Grün */
    padding: 30px; /* Erhöht */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-top: 30px;
    border: 1px solid #b3ffb3; /* Passender Rand */
}

#advisorAnalysisSection h2 {
    color: #228B22; /* Dunkleres Grün für Überschrift */
    margin-bottom: 20px;
}

#advisorAnalysisResults div.advisor-entry {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#advisorAnalysisResults div.advisor-entry h4 {
    margin-top: 0;
    /* Angepasst */
    font-size: 1.3em;
    color: #2c3e50; /* Stärkere Farbe */
    border-bottom: 2px solid #b3ffb3; /* Dickere, farbige Trennlinie */
    padding-bottom: 8px;
    margin-bottom: 15px; /* Erhöht */
}

/* NEU: Flex-Container für Saldo, Einkommen und Ausgaben-Zusammenfassungen */
.total-summary-box {
    background-color: #f0f0f0; /* Leicht grauer Hintergrund */
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px; /* Abstand zur Liste darüber */
    text-align: center;
    font-weight: bold;
}

.income-total-box {
    border: 1px solid #d4edda; /* Grüner Rand für Einnahmen */
    background-color: #d4edda;
}

.expense-total-box {
    border: 1px solid #f8d7da; /* Roter Rand für Ausgaben */
    background-color: #f8d7da;
}

.balance-summary-box {
    margin-top: 20px; /* Mehr Abstand zum Vorherigen */
    padding: 15px;
    border-radius: 8px;
    background-color: #e0f2f7; /* Bläulicher Hintergrund */
    border: 1px solid #b3e0ed;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
}


.advisor-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px; /* Erhöht */
    text-align: center;
}

.category-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px; /* Erhöht */
}

.income-breakdown, .expense-breakdown {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #eee;
}

.income-breakdown h5, .expense-breakdown h5 {
    margin-top: 0;
    color: #34495e;
}

/* Anpassung: Allgemeine Listeneigenschaften, die nicht flex sein sollen */
.income-breakdown ul, .expense-breakdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Anpassung: Nur category-total-line ist flex */
.income-breakdown ul li, .expense-breakdown ul li {
    margin-bottom: 5px; /* Behält den Abstand */
    /* display: flex; und justify-content: space-between; hier entfernt */
}

/* NEU: Styling für die Zeile mit dem Kategorietotal (wenn in Zukunft verwendet) */
.category-total-line {
    display: flex; /* Flexbox für diese spezifische Zeile aktivieren */
    justify-content: space-between; /* Inhalt an die Enden schieben */
    font-weight: bold; /* Macht die Zeile prominenter */
    margin-bottom: 8px; /* Mehr Abstand darunter */
    padding-bottom: 3px; /* Kleiner Innenabstand unten */
    border-bottom: 1px dashed #ddd; /* Dezente Trennlinie */
}

/* NEU: Styling für die einzelnen Transaktionsdetails */
.transaction-detail-item {
    font-size: 0.9em; /* Etwas kleinere Schrift für Details */
    margin-left: 15px; /* Einrücken der Aufzählungspunkte */
    padding-left: 0; /* Standard-Padding von li entfernen */
    position: relative; /* Für benutzerdefinierte Aufzählungszeichen */
}

.transaction-detail-item::before {
    content: "•"; /* Benutzerdefinierter Aufzählungspunkt */
    position: absolute;
    left: -10px; /* Position des Aufzählungspunkts anpassen */
    color: inherit; /* Farbe vom Elternelement erben */
    font-weight: bold;
}


/* Styling für die Formular-Buttons */
.form-buttons {
    grid-column: span 2;
    display: flex;
    gap: 10px;
}

.form-buttons button {
    flex-grow: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s ease;
}

#submitBtn {
    background-color: #28a745;
    color: white;
}

#submitBtn:hover {
    background-color: #218838;
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.secondary-btn:hover {
    background-color: #5a6268;
}

/* Styling for the new allowances section */
.allowances-section {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
    border: 1px solid #e0e0e0;
}

.allowances-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.5em; /* Match h2 font size */
    text-align: left; /* Align text to left within the flex container */
    width: 100%;
}

.allowances-header h2 {
    margin: 0; /* Remove default margin from h2 */
    font-size: 1em; /* Keep original h2 size for the text itself */
    text-align: left;
}

.allowances-header .toggle-button {
    background-color: #17a2b8;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.allowances-header .toggle-button:hover {
    background-color: #138496;
}

.allowances-content {
    display: none; /* Hidden by default */
}

.allowances-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.allowances-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    text-align: center;
}

.allowance-result-item {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.allowance-result-item h3 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.allowance-result-item p {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0;
}

/* Removed .allowance-total as it's no longer needed for the total monthly allowance */


/* Responsive adjustments */
@media (max-width: 768px) {
    .transaction-input form,
    .type-category-group,
    .amount-description-group,
    .date-group-flex,
    .summary-grid,
    .financing-calculator .financing-inputs,
    .category-breakdown-grid,
    .allowances-inputs, /* Added for responsiveness */
    .allowances-results { /* Added for responsiveness */
        grid-template-columns: 1fr;
    }

    .allowances-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .allowances-header .toggle-button {
        margin-top: 10px;
        width: 100%;
    }
}