:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f4f5f7;
    --border: #e5e8eb;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --primary: #3498db;
    --primary-hover: #2980b9;
    --danger: #e74c3c;
    --radius: 10px;
}

[data-theme="dark"] {
    --bg: #15191e;
    --surface: #1e242b;
    --surface-2: #262d35;
    --border: #333c46;
    --text: #e8ecef;
    --text-muted: #9aa5b1;
    --primary: #4aa3e0;
    --primary-hover: #5cb0ea;
    --danger: #e5675a;
}

* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.15s ease, color 0.15s ease;
}

/* ---------- Login ---------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-box {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 320px;
}

.login-box h1 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-box label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.login-box input {
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
}

.login-box button {
    margin-top: 1.2rem;
    padding: 0.7rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

.login-box button:hover {
    background: var(--primary-hover);
}

.flash-error {
    background: #fdecea;
    color: #c0392b;
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .flash-error {
    background: #3a1f1d;
    color: #f0a099;
}

.flash-info {
    background: #eafaf1;
    color: #27ae60;
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

[data-theme="dark"] .flash-info {
    background: #163325;
    color: #6fd99a;
}

/* ---------- Navigation ---------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
    gap: 0.6rem;
}

.topbar h1 {
    font-size: 1.2rem;
    margin: 0;
}

.topbar h1 a {
    color: inherit;
    text-decoration: none;
}

.topbar-nav {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.topbar-nav a {
    color: var(--text);
    text-decoration: none;
    padding: 0.3rem 0.2rem;
    opacity: 0.75;
}

.topbar-nav a:hover {
    opacity: 1;
    color: var(--primary);
}

.topbar-right {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    font-size: 0.9rem;
}

.topbar-right a {
    color: var(--text-muted);
    text-decoration: none;
}

#theme-toggle-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}

.hinweistext {
    max-width: 1000px;
    margin: 0 auto 0.5rem;
    padding: 0 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- Legende ---------- */

.legende {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    font-size: 0.85rem;
}

.legende-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.farbpunkt {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.farbpunkt-rand {
    background: transparent;
    border: 3px solid;
}

/* ---------- Kalender ---------- */

#calendar {
    max-width: 1000px;
    margin: 0 auto 2rem;
    background: var(--surface);
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.fc-theme-standard td, .fc-theme-standard th {
    border-color: var(--border) !important;
}

.fc .fc-toolbar-title, .fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number {
    color: var(--text) !important;
}

.fc-col-header,
.fc-col-header-cell,
.fc-scrollgrid,
.fc-daygrid-day,
.fc-daygrid-day-frame,
.fc-scrollgrid-section > td {
    background: var(--surface) !important;
}

.fc-day-today {
    background: color-mix(in srgb, var(--primary) 15%, var(--surface)) !important;
}

.fc-button-primary {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.fc-button-primary.fc-button-active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.fc-button-primary:disabled {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
    opacity: 0.5;
}

/* ---------- Content-Boxen (Konto, Zahlungen, Admin) ---------- */

.content-box {
    max-width: 800px;
    margin: 1.5rem auto;
    background: var(--surface);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.content-box h2 {
    font-size: 1.1rem;
    margin-top: 1.6rem;
}

.content-box h2:first-child {
    margin-top: 0;
}

.content-box h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 1.4rem;
}

.konto-karten {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 1rem 0;
}

.metric-karte {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 1rem;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1.3rem;
    font-weight: 500;
}

.daten-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0.5rem 0 1rem;
}

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

.daten-tabelle th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin: 0.5rem 0 0.3rem;
}

.inline-form label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.inline-form input,
.inline-form select {
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.inline-form button,
.daten-tabelle button,
.zahlung-btn {
    padding: 0.4rem 0.8rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.inline-form button:hover,
.daten-tabelle button:hover,
.zahlung-btn:hover {
    background: var(--primary-hover);
}

.schmales-feld {
    width: 140px;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-right: 0.4rem;
    background: var(--surface);
    color: var(--text);
}

/* ---------- Modals ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.hidden {
    display: none;
}

.modal {
    background: var(--surface);
    padding: 1.8rem;
    border-radius: 12px;
    width: 320px;
}

.modal h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.modal form {
    display: flex;
    flex-direction: column;
}

.modal label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
}

.modal input,
.modal select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    margin-top: 0.2rem;
    background: var(--surface);
    color: var(--text);
}

.modal-buttons {
    margin-top: 1.4rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.modal-buttons button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.modal-buttons button[type="submit"] {
    background: var(--primary);
    color: white;
}

#cancel-btn,
#event-close-btn {
    background: var(--surface-2);
    color: var(--text);
}

.danger-btn {
    background: var(--danger) !important;
    color: white !important;
}
