* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

nav {
    background: #2c3e50;
    color: white;
    padding: 0.8rem 1rem;
}

.nav-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: bold;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    margin-left: 1.5rem;
}

.nav-links a:hover {
    color: #f39c12;
}

main {
    max-width: 960px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

h1 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 1rem;
    color: #34495e;
    font-size: 1.2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.meter-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.meter-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
}

.meter-card h3 {
    color: #2c3e50;
    margin-bottom: 0.3rem;
}

.meter-desc {
    font-size: 0.85rem;
    color: #666;
}

.meter-type {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.3rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

tfoot td {
    border-top: 2px solid #333;
    font-size: 1.05rem;
}

.flash {
    padding: 0.8rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    position: relative;
    padding-right: 2rem;
}

.flash-dismiss {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0.2rem 0.4rem;
    line-height: 1;
}

.flash-dismiss:hover {
    opacity: 1;
}

.flash.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.flash.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.info {
    color: #666;
    margin-bottom: 1rem;
}

.billing-notes {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fff3cd;
    border-radius: 6px;
    border: 1px solid #ffc107;
}

.billing-notes h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.billing-notes ul {
    padding-left: 1.2rem;
    font-size: 0.9rem;
}

.billing-notes li {
    margin-bottom: 0.2rem;
}

.card h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #34495e;
    font-size: 1.05rem;
}

.table-compact {
    margin-bottom: 1.5rem;
}

.table-compact td, .table-compact th {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.segment-detail {
    margin-top: 0.3rem;
}

.segment-chip {
    display: block;
    font-size: 0.75rem;
    color: #666;
    background: #f0f0f0;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin: 0.2rem 0;
}

.tariff-price {
    font-size: 0.8rem;
    color: #888;
}

.no-tariff {
    color: #e74c3c;
    font-style: italic;
    font-size: 0.85rem;
}

/* balance-due: Nachzahlung (rot) — ehemals fälschlicherweise .balance-positive */
.balance-due {
    color: #e74c3c;
    font-weight: 600;
}

/* balance-credit: Guthaben (grün) — ehemals fälschlicherweise .balance-negative */
.balance-credit {
    color: #27ae60;
    font-weight: 600;
}

.login-container {
    max-width: 360px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    text-align: center;
}

.login-container h1 {
    margin-bottom: 1.5rem;
}

.login-container .form-group {
    text-align: left;
    margin-bottom: 1rem;
}

.action-buttons {
    white-space: nowrap;
}

.action-buttons .btn {
    margin-right: 0.3rem;
}

.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-header-with-action h2 {
    margin: 0;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.section-actions form {
    margin: 0;
}

.col-select {
    width: 2.2rem;
    text-align: center;
}

.col-select input[type="checkbox"] {
    cursor: pointer;
    width: 1rem;
    height: 1rem;
}

.bulk-delete-selected-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comparison-up {
    color: #e74c3c;
    font-weight: 600;
}

.comparison-down {
    color: #27ae60;
    font-weight: 600;
}

.recommendation-note {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: #888;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-small {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn-link {
    background: none;
    border: none;
    color: #e17055;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    vertical-align: middle;
}

.btn-link:hover {
    color: #d63031;
}

.settlement-info {
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #155724;
}

/* PRIV-168: Hinweis auf ueberlappende Ausgleichszahlungen — gelb statt gruen,
   damit User klar sieht: hier ist etwas zu pruefen. */
.settlement-overlap {
    margin-top: 0.5rem;
    padding: 0.5rem 0.7rem;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #664d03;
}

.settlement-form {
    margin-top: 0.5rem;
}

.settlement-form summary {
    cursor: pointer;
}

.settlement-form form {
    margin-top: 0.4rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.settlement-form .form-group {
    margin-bottom: 0.4rem;
}

.settlement-form .form-group label {
    font-size: 0.8rem;
    display: block;
    margin-bottom: 0.15rem;
}

.settlement-form .form-group input {
    padding: 0.3rem;
    font-size: 0.85rem;
    width: 100%;
    box-sizing: border-box;
}

footer {
    text-align: center;
    padding: 1.5rem;
    color: #999;
    font-size: 0.85rem;
}

/* Hamburger Navigation */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem;
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-top: 0.5rem;
    }
    .nav-links.open {
        display: flex;
    }
    .nav-links a {
        margin-left: 0;
        padding: 0.5rem 0;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .nav-content {
        flex-wrap: wrap;
    }
}

.nav-links a.active {
    color: #f39c12;
    font-weight: 600;
}

.reading-stale {
    color: #e17055;
    font-size: 0.8rem;
    font-weight: 600;
}

.reading-ok {
    color: #27ae60;
    font-size: 0.8rem;
}

.meter-card .meter-last-reading {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #555;
}

.meter-card .meter-delta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.2rem;
}

.recurring-form {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.recurring-form h3 {
    margin-top: 0;
    font-size: 1rem;
}

/* Segment chip color variants */
.chip-warning {
    background: #ffeaa7;
    color: #2d3436;
}

.chip-info {
    background: #dfe6e9;
    color: #2d3436;
}

.chip-muted {
    background: #dfe6e9;
    color: #636e72;
}

/* Inline heading inside <summary> */
.inline-heading {
    display: inline;
    font-size: 1rem;
}

/* Page description text (billing, settlements) */
.page-description {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

/* Required field marker (*) */
.required-marker {
    color: #c62828;
    font-weight: bold;
}

/* Required field hint text */
.required-hint {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.75rem;
}

/* Optional field hint text */
.field-hint {
    font-size: 0.8rem;
    color: #888;
    font-weight: normal;
}

/* Info box for contextual explanations */
.info-box {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
}

/* Utility: hidden element */
.hidden {
    display: none !important;
}

/* Utility: muted/secondary text color (JAN-24) */
.text-muted {
    color: #636e72;
}

/* Edit-Mode-Signal: hebt eine Form-Card hervor, sobald der User auf
   "Bearbeiten" klickt. JS setzt die Klasse zusammen mit dem geänderten
   Heading + Submit-Button-Label, damit der Modus auch farblich klar wird
   (siehe JAN-25). */
.card--editing {
    border: 2px solid #f39c12;
    background: #fff8e1;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.25);
}

.card--editing h2 {
    color: #b8741a;
}

.editing-banner {
    background: #fef3c7;
    border-left: 4px solid #f39c12;
    color: #7c5a12;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}
