* { box-sizing: border-box; }
body {
    background: #f0f0f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    margin: 0;
    color: #2c3e50;
}

/* Navigation */
.topnav {
    background: #2c3e50;
    padding: 10px 20px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.topnav a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
}
.topnav a:hover, .topnav a.active {
    background: #3498db;
}
.topnav .brand {
    font-size: 20px;
    margin-right: auto;
}

/* Layout */
.page {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 15px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 25px 0 12px 0;
    color: #2c3e50;
}
.hint {
    color: #666;
    font-size: 14px;
    margin: -6px 0 16px 0;
}

/* Formulare */
.form-box {
    background: white;
    border-radius: 14px;
    padding: 25px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
}
.form-box label {
    font-size: 15px;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
    margin-top: 14px;
}
.form-box label:first-child { margin-top: 0; }
.form-box input, .form-box textarea, .form-box select {
    width: 100%;
    padding: 10px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
}
.form-box textarea { min-height: 70px; resize: vertical; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn-save {
    padding: 14px 28px;
    font-size: 17px;
    font-weight: 700;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 18px;
}
.btn-save:hover { background: #219a52; }
.btn-save:disabled { background: #bdc3c7; cursor: not-allowed; }

.btn-secondary {
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}
.btn-secondary:hover { background: #2980b9; }

.btn-danger {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.btn-danger:hover { background: #c0392b; }

/* Listen */
.list-item {
    background: white;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 10px;
    border: 2px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.list-item .name { font-weight: 700; font-size: 17px; }
.list-item .details { color: #666; font-size: 14px; }
.list-item .actions { display: flex; gap: 8px; }

/* Positionstabelle Rechnungen */
.pos-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
}
.pos-table th {
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    background: #2c3e50;
    padding: 10px 8px;
}
.pos-table td { padding: 8px; border-top: 1px solid #eee; }
.pos-table tbody tr:nth-child(even) { background: #f7f9fa; }
.pos-table tbody tr:hover { background: #eef4fb; }
.pos-table input { width: 100%; padding: 8px; font-size: 14px; border: 2px solid #ddd; border-radius: 8px; background: white; }
.pos-table .col-beschreibung { width: 30%; }
.pos-table .col-datum { width: 16%; }
.pos-table .col-menge, .pos-table .col-preis, .pos-table .col-mwst { width: 15%; }
.pos-table .col-remove { width: 5%; text-align: center; }
.pos-table .remove-btn {
    background: none; border: none; color: #e74c3c; font-size: 20px; cursor: pointer; line-height: 1;
}

.summe-box {
    background: white;
    border-radius: 14px;
    padding: 18px 20px;
    border: 2px solid #ddd;
    margin-bottom: 16px;
}
.summe-box .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 15px; }
.summe-box .row.total { font-weight: 700; font-size: 19px; color: #27ae60; border-top: 1px solid #eee; margin-top: 6px; padding-top: 10px; }

/* Meldungen */
.erfolg, .fehler {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}
.erfolg { background: #27ae60; color: white; }
.fehler { background: #e74c3c; color: white; }

.logo-preview { max-width: 200px; max-height: 100px; display: block; margin: 10px 0; border-radius: 8px; }

.badge {
    display: inline-block;
    background: #eef2f5;
    color: #2c3e50;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}
.badge-anzahlung { background: #fdebd0; color: #a05a00; }
.badge-schlussrechnung { background: #d6eaf8; color: #1a5276; }

.hidden { display: none; }

/* Anzahlungs-Auswahl */
.anzahlung-option {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7f9fa;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 8px;
    cursor: pointer;
}
.anzahlung-option input[type="checkbox"] { width: auto; margin: 0; }
.anzahlung-option .anzahlung-info { flex: 1; }
.anzahlung-option .anzahlung-info .name { font-weight: 600; }
.anzahlung-option .anzahlung-info .details { color: #666; font-size: 13px; }
