body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    display: flex;
    flex-direction: column; /* <-- DIESE ZEILE HINZUFÜGEN */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}
#app-container {
    width: 100%;
    max-width: 900px;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
}
.form-group {
    margin-bottom: 20px;
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

/* *** NEU: Container für Label und Hilfs-Button *** */
.label-with-helper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-with-helper label {
    margin-bottom: 0; /* Entfernt den unteren Rand vom Label, da der Container ihn hat */
}

.paste-helper-btn {
    padding: 4px 10px;
    font-size: 12px;
    background-color: #eaf2f8;
    color: #3498db;
    border: 1px solid #aed6f1;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.paste-helper-btn:hover {
    background-color: #d4e6f1;
    border-color: #85c1e9;
}

textarea, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}
textarea {
    min-height: 150px;
    resize: vertical;
}
button {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}
button:disabled {
    background-color: #a9cce3;
    cursor: not-allowed;
}
button:hover:not(:disabled) {
    background-color: #2980b9;
}
#result-container {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    min-height: 100px;
    white-space: pre-wrap;
    line-height: 1.6;
    font-family: "Courier New", Courier, monospace;
}
.loader {
    text-align: center;
    font-size: 18px;
    color: #777;
    display: none; /* Standardmäßig ausgeblendet */
}

/* --- NEUE STYLES FÜR DIE FORTSCHRITTSANZEIGE --- */
.progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden; /* Stellt sicher, dass der innere Balken nicht überläuft */
    display: none;
    /* Standardmäßig ausgeblendet */
}

.progress-bar {
    width: 0%; /* Startet bei 0% */
    height: 20px;
    background-color: #3498db;
    text-align: center;
    line-height: 20px;
    color: white;
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
    /* Sorgt für einen flüssigen Übergang */
}
/* --- NEUE STYLES FÜR DIE AUSGABE-TABELLEN --- */
#result-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    white-space: normal; /* Erlaubt normalen Zeilenumbruch */
}

#result-container h3 {
    color: #2c3e50;
    margin-top: 25px;
    margin-bottom: 10px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

#result-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#result-container th, #result-container td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

#result-container th {
    background-color: #f2f2f2;
    font-weight: 600;
}

#result-container tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* --- SPEZIELLE FORMATIERUNG FÜR DATENTYPEN --- */

/* Styling für die Rechnungsnummern */
.invoice-ids {
    font-weight: bold;
    color: #2c3e50;
}

/* Allgemeines Styling für Geldbeträge */
.amount {
    text-align: right;
    font-family: "Courier New", Courier, monospace;
    white-space: nowrap; /* Verhindert Umbruch bei Beträgen */
    text-align: right !important;
}

/* Spezifische Farben für die Differenzen */
.difference-over {
    color: #27ae60;
    /* Grün für Guthaben/Überzahlung */
    font-weight: bold;
}

.difference-under {
    color: #c0392b;
    /* Rot für Schulden/Unterzahlung */
    font-weight: bold;
}
/* Container für die Einstellungen */
.settings-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.settings-container .form-group {
    flex: 1; /* Beide Felder nehmen gleich viel Platz ein */
    margin-bottom: 0;
}

/* Disclaimer am Seitenende */
.disclaimer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: #777;
    max-width: 900px;
}

/* Header-Bereich der Ergebnisse mit dem Export-Button */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

.result-header h2 {
    margin: 0;
    color: #2c3e50;
}

/* Export-Button */
#export-excel-btn {
    padding: 8px 15px;
    background-color: #27ae60; /* Grüner Button */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    max-width: 240px;
}

#export-excel-btn:hover {
    background-color: #229954;
}

/* Anpassung des alten Containers */
#result-container {
    margin-top: 10px;
    /* Reduzierter Abstand, da der Header nun den Platz einnimmt */
}

/* Verstecke den gesamten Ergebnisbereich initial */
#result-area {
    display: none;
}

/* --- GEÄNDERTE/NEUE REGEL FÜR PROZENTANZEIGE --- */
.percentage {
    font-size: 1em;
    color: #000;
    margin-left: 0px;
    font-weight: normal;
}

/* Stil für die Anzeige der Berechnungsmethode */
.method-info {
    font-size: 13px;
    color: #555;
    background-color: #eaf2f8;
    border: 1px solid #aed6f1;
    border-left: 5px solid #3498db;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* *** NEU: Styling für die Checkbox-Gruppe *** */
.checkbox-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #fdfefe;
    border: 1px solid #e5e8e8;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #34495e;
    cursor: pointer;
    margin: 0;
}
.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    transform: scale(1.2);
}
.checkbox-group span {
    font-size: 12px;
    color: #777;
    margin-top: 5px;
    padding-left: 27px;
    /* Einrücken unter den Text */
}
/* --- *** NEU: STYLES FÜR DAS MODALFENSTER *** --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 700px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #333;
}

.modal-content h2 {
    margin-top: 0;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 15px;
}
.modal-content p {
    text-align: center;
    color: #555;
    margin-bottom: 25px;
    font-size: 15px;
}

.modal-form-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.modal-form-container .form-group {
    flex: 1;
    margin: 0;
}

.modal-form-container textarea {
    min-height: 250px;
    font-size: 14px;
}

.modal-content button {
    background-color: #27ae60;
    font-size: 16px;
}
.modal-content button:hover {
    background-color: #229954;
}

.modal-error-message {
    color: #c0392b;
    background-color: #fdedec;
    border: 1px solid #e6b0aa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
}