:root {
    --color-primary: #1e6f4c;
    --color-primary-dark: #14523a;
    --color-primary-light: #2f8f63;
    --color-bg: #f4f7f5;
    --color-card: #ffffff;
    --color-border: #e7ebe8;
    --color-text: #1f2a24;
    --color-muted: #667a70;
    --color-free: #e7f5ee;
    --color-free-border: #9fd6bb;
    --color-booked: #f1f2f1;
    --color-booked-border: #d5d8d6;
    --color-own: #dfeaff;
    --color-own-border: #93b8f2;
    --color-blocked: #fdeaea;
    --color-blocked-border: #f0b3b3;
    --color-error: #c0362c;
    --color-success: #1e6f4c;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(20, 40, 30, 0.06), 0 1px 1px rgba(20, 40, 30, 0.04);
    --shadow-md: 0 10px 30px rgba(20, 40, 30, 0.08), 0 2px 8px rgba(20, 40, 30, 0.06);
    --shadow-lg: 0 24px 60px rgba(15, 30, 22, 0.18);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    line-height: 1.25;
    letter-spacing: -0.01em;
}

a { color: var(--color-primary); }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 36px 24px 80px;
}

/* ---- Topbar ---- */
.topbar {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.topbar nav {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.topbar nav a {
    color: #eafff2;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.92;
    transition: opacity 0.15s ease;
}
.topbar nav a:hover { opacity: 1; }
.topbar nav a.active { text-decoration: underline; text-underline-offset: 4px; }
.user-chip {
    background: rgba(255,255,255,0.16);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
}
.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 0.95rem;
    padding: 0;
}
.topbar .btn-link { color: #fff; opacity: 0.92; }
.topbar .btn-link:hover { opacity: 1; }

/* ---- Cards / forms ---- */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 28px 30px;
    margin-bottom: 28px;
}
.card h2 { margin-top: 0; }

.muted { color: var(--color-muted); }
.muted.small { font-size: 0.85rem; }

.notice {
    background: #fff8e8;
    border: 1px solid #f2d187;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin: 16px 0;
    line-height: 1.6;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=search], select {
    padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(47, 143, 99, 0.15);
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 13px 22px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }

.form-grid {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: end;
}
.form-grid label.grow { flex: 1 1 200px; }

.checkbox-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    font-weight: 500;
}
/* Der Label-Text (inkl. eines evtl. enthaltenen Links, z.B. bei der
   Datenschutz-Zustimmung) steht bewusst in einem einzelnen <span> statt als
   freier Text/Link direkt im flex-Label: sonst erzeugt der Browser für
   jeden Text-/Link-Abschnitt ein eigenes, unabhängiges Flex-Item (inkl.
   "gap" dazwischen), was zu einer sichtbar zerrissenen/merkwürdigen
   Umbruch-Formatierung führt. Das <span> hält den Text als normalen
   Fließtext zusammen. */
.checkbox-row input {
    width: auto;
    flex-shrink: 0;
    margin-top: 3px;
}
.checkbox-row span {
    font-weight: 400;
    line-height: 1.5;
}

.message { min-height: 1.2em; font-size: 0.9rem; margin-top: 12px; }
.message-error { color: var(--color-error); }
.message-success { color: var(--color-success); }

/* ---- Auth pages ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e6f4c, #0f3d29);
    padding: 24px;
}
.auth-card {
    background: #fff;
    padding: 40px 36px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 { margin-top: 0; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.auth-card p.muted { text-align: center; margin-top: 20px; }

/* ---- Calendar controls ---- */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
}
.legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.legend-item { display: flex; align-items: center; gap: 7px; }
.dot {
    width: 13px; height: 13px; border-radius: 50%; display: inline-block;
    border: 1px solid transparent;
}
.dot-free { background: var(--color-free); border-color: var(--color-free-border); }
.dot-booked { background: var(--color-booked); border-color: var(--color-booked-border); }
.dot-own { background: var(--color-own); border-color: var(--color-own-border); }
.dot-blocked { background: var(--color-blocked); border-color: var(--color-blocked-border); }

/* ---- Calendar grid ---- */
.calendar-grid { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.calendar-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.calendar-table th, .calendar-table td {
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    padding: 12px 14px;
    text-align: center;
    font-size: 0.85rem;
    white-space: nowrap;
}
.calendar-table th:last-child, .calendar-table td:last-child { border-right: none; }
.calendar-table thead th {
    background: #eef3f0;
    font-weight: 700;
    padding: 16px 14px;
}
.time-col { font-weight: 600; background: #fafbfa; }

.slot-cell.free { background: var(--color-free); cursor: pointer; transition: filter 0.12s ease, transform 0.08s ease; }
.slot-cell.free:hover { filter: brightness(0.96); }
.slot-cell.booked { background: var(--color-booked); color: var(--color-muted); }
.slot-cell.own { background: var(--color-own); cursor: pointer; font-weight: 600; transition: filter 0.12s ease; }
.slot-cell.own:hover { filter: brightness(0.97); }
.slot-cell.blocked { background: var(--color-blocked); color: #8a3b3b; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 25, 20, 0.5);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 440px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.modal-close {
    position: absolute; top: 16px; right: 18px;
    background: none; border: none; font-size: 1.5rem;
    cursor: pointer; color: var(--color-muted);
    transition: color 0.15s ease;
}
.modal-close:hover { color: var(--color-text); }
.modal h2 { margin-top: 0; }
.price-preview { font-weight: 700; margin: 18px 0; font-size: 1.05rem; }
.hidden { display: none !important; }

/* ---- Auth-Modal (Login/Registrieren als Overlay) ---- */
.auth-tabs {
    display: flex;
    gap: 4px;
    margin: -6px -6px 20px;
    border-bottom: 1px solid var(--color-border);
}
.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.auth-tab:hover { color: var(--color-primary-dark); }
.auth-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.auth-tab-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---- Data tables (admin) ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
}
.data-table th, .data-table td {
    border-bottom: 1px solid var(--color-border);
    padding: 12px 14px;
    text-align: left;
    font-size: 0.9rem;
}
.data-table th { background: #eef3f0; font-weight: 700; }
.data-table tbody tr:hover { background: #fafbfa; }
#member-search { width: 100%; margin-top: 10px; }
