/* Wiederherstellung des kompletten Designs inkl. Text und Controls */
:root {
    --bg-page: #f5f7f4;
    --ink: #17212b;
    --muted: #5b6672;
    --line: #d8ded7;
    --head: #103f3a;
    --accent: #0f766e;
    --accent-soft: #dcefeb;
}

/* --- Layout-Bereich (Text & Filter) --- */

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 22px;
    padding: 0 5px; /* Kleiner Puffer zum Rand */
}

.top p { 
    margin: 0; 
    color: var(--muted); 
    font-size: 0.95rem;
}

.links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.links a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid currentColor;
}

.controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
    gap: 12px;
    margin: 0 0 14px;
    padding: 0 5px;
}

input, select, button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

input, select {
    width: 100%;
    padding: 0 12px;
    background: white;
    color: var(--ink);
}

button {
    padding: 0 16px;
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.status {
    min-height: 42px;
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    color: var(--muted);
    font-size: 0.9rem;
}

/* --- Tabellen-Bereich (Größe & Scrollable) --- */

.table-wrap {
    display: block;
    width: 100%;
    /* Entferne oder überschreibe eventuelle feste Breiten */
    max-width: 100%; 
    overflow-x: auto;
    overflow-y: auto;
    max-height: 550px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    margin: 20px 0;
    box-shadow: 0 18px 45px rgba(20, 31, 27, .12);
    /* WICHTIG: Verhindert, dass der Container selbst rechts klebt */
    box-sizing: border-box; 
}

table {
    width: auto; /* Geändert von 100% auf auto */
    min-width: 100%; /* Sorgt dafür, dass sie mindestens den Container füllt */
    border-collapse: separate;
    border-spacing: 0;
}

/* Erzeugt einen kleinen Puffer am rechten Ende der Tabelle */
th:last-child, td:last-child {
    padding-right: 30px; 
}

th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--head);
    color: white;
    padding: 11px 12px;
    font-size: .82rem;
    text-align: right;
    border-bottom: 1px solid var(--line);
}

th:first-child, td:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    min-width: 155px;
    text-align: left;
}

th:first-child {
    z-index: 12;
    background: #0b302d;
}

td:first-child {
    background: white;
    font-weight: 700;
}

td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    white-space: nowrap;
    background: white;
}

tbody tr:nth-child(even) td,
tbody tr:nth-child(even) td:first-child { background: #fbfcfa; }
tbody tr:hover td,
tbody tr:hover td:first-child { background: var(--accent-soft); }

/* --- Diagramm --- */

.chart-panel {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

canvas {
    max-width: 100% !important;
}