:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --panel: #ffffff;
    --text: #202428;
    --muted: #68717a;
    --line: #dce2e6;
    --brand: #1f6f78;
    --brand-dark: #15545b;
    --danger: #b83232;
    --green: #2f9e44;
    --red: #d64545;
    --orange: #f08c00;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 32px; }
h2 { font-size: 20px; margin-bottom: 18px; }
p { color: var(--muted); margin: 6px 0 0; }
small { color: var(--muted); font-weight: 400; }

.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

.menu a, .button {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

.menu a {
    background: #fff;
    color: var(--brand-dark);
}

.menu a.active, .button:hover { background: var(--brand-dark); color: #fff; }
.button.ghost { background: transparent; color: var(--brand-dark); }
.button.danger { border-color: var(--danger); background: var(--danger); }
.button.small { padding: 7px 10px; font-size: 13px; }

.panel, .stats article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.narrow { max-width: 520px; margin: 32px auto; }
.grid.two {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 18px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stats span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.stats strong { font-size: 20px; }

.form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

textarea { min-height: 90px; resize: vertical; }

.row-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.row-card span { color: var(--muted); }
.row-card form { grid-row: span 2; }

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid;
}
.alert.error { border-color: #efb2b2; background: #fff0f0; color: #8a1f1f; }
.alert.success { border-color: #a7d8b3; background: #eefaf1; color: #1d6b2e; }

.year-form {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-bottom: 18px;
}

.chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(48px, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 220px;
    overflow-x: auto;
}

.bar-wrap {
    min-width: 48px;
    display: grid;
    grid-template-rows: 32px 180px 22px;
    align-items: end;
    justify-items: center;
    color: var(--muted);
    font-size: 12px;
}

.amount {
    color: var(--text);
    font-weight: 700;
    text-align: center;
}

.bar {
    width: 28px;
    border-radius: 6px 6px 0 0;
    background: var(--red);
}
.bar.bezahlt { background: var(--green); }
.bar.Verzug { background: var(--orange); }
.bar.offen { background: var(--red); }
.bar.inactive { background: #c7cfd5; opacity: .45; }

@media (max-width: 900px) {
    .grid.two, .stats { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
}
