:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e5e7eb;
    --error-bg: #fee2e2;
    --error-text: #b91c1c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.topnav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.topnav .brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    padding: 0.35rem 0.6rem;
    border-radius: 0.375rem;
}

.nav-links a:hover {
    background: var(--bg);
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.card h2 {
    margin-top: 0;
}

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

.table th,
.table td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
}

.muted { color: var(--muted); }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: 0.375rem;
    font-weight: 600;
}

.btn:hover { background: var(--primary-hover); }

.list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.list li:last-child { border-bottom: none; }

.list a {
    color: var(--primary);
    text-decoration: none;
}

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.footer {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem;
    font-size: 0.85rem;
}

code {
    background: var(--bg);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
}

/* Formulare */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.form-row label {
    font-weight: 600;
}

input[type="date"],
input[type="text"],
input[type="number"],
select,
textarea {
    font: inherit;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

.entry-row {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #fafafa;
}

.entry-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.entry-grid .exercise-select {
    grid-column: 1 / -1;
}

.field-group {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.field-group input {
    flex: 1 1 80px;
    min-width: 80px;
}

.entry-grid > input[type="text"] {
    grid-column: 1;
}

.remove-entry {
    grid-column: 2;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    border-radius: 0.375rem;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
}

.remove-entry:hover {
    color: var(--error-text);
    border-color: var(--error-text);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

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

.inline-form {
    display: inline;
}

.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.actions .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.card-head h2 {
    margin: 0;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--primary);
    text-decoration: none;
}

/* Fortschritt / Stats */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat {
    flex: 1 1 120px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.chart-wrap {
    position: relative;
    height: 320px;
}

/* Login */
.login-wrap {
    display: flex;
    justify-content: center;
    padding-top: 2rem;
}

.login-card {
    width: 100%;
    max-width: 360px;
}
