:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --bg: #f4f6f9;
    --panel-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --success: #16a34a;
    --error: #dc2626;
    --warn: #d97706;
    --radius: 8px;
}

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--primary-dark); }
.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--text); padding: 0.4rem 0.6rem; border-radius: var(--radius); }
.topbar nav a.active, .topbar nav a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.user-area { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); }
.logout-form { margin: 0; display: inline-flex; }
.btn-logout {
    appearance: none; -webkit-appearance: none; background: none; border: none; margin: 0; padding: 0; width: auto;
    font: inherit; cursor: pointer; color: var(--error);
}
.btn-logout:hover { text-decoration: underline; }
.lang-switch { display: flex; gap: 0.25rem; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lang-switch button {
    appearance: none; -webkit-appearance: none; background: #fff; border: none; margin: 0;
    padding: 0.2rem 0.5rem; font-size: 0.78rem; font-weight: 700; font-family: inherit;
    color: var(--muted); cursor: pointer; width: auto;
}
.lang-switch button:hover { background: #f1f5f9; }
.lang-switch button.active { background: var(--primary); color: #fff; }
.login-lang-switch { display: flex; justify-content: center; gap: 0.25rem; margin: 0 0 1rem; }
.login-lang-switch button {
    appearance: none; -webkit-appearance: none; background: #fff; margin: 0; width: auto;
    padding: 0.2rem 0.6rem; font-size: 0.78rem; font-weight: 700; font-family: inherit;
    color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.login-lang-switch button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Layout */
.content { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.footer { text-align: center; color: var(--muted); padding: 1.5rem; font-size: 0.85rem; }

h1 { margin-top: 0; }

.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.card h3 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.card .big { font-size: 1.6rem; font-weight: 700; margin: 0; }
.positive { color: var(--success); }
.negative { color: var(--error); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.panel { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.panel h2 { margin-top: 0; font-size: 1.05rem; }
.link-more { display: inline-block; margin-top: 0.5rem; font-size: 0.9rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
.data-table, .panel table { margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.actions a { margin-right: 0.75rem; font-size: 0.85rem; }
.actions .danger { color: var(--error); }
.muted { color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-angefragt { background: #fef3c7; color: #92400e; }
.status-bestaetigt { background: #dcfce7; color: #166534; }
.status-storniert { background: #fee2e2; color: #991b1b; }
.status-abgeschlossen { background: #e0e7ff; color: #3730a3; }

/* Forms */
.form { max-width: 560px; background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.form label { display: block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 600; color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input, select, textarea {
    width: 100%; padding: 0.55rem 0.65rem; margin-top: 0.3rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.95rem; font-family: inherit; font-weight: 400;
}
textarea { resize: vertical; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: -0.5rem; }

.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; margin-top: 0; }

.checkbox-list { margin-bottom: 1rem; }
.permissions-hint { margin: 0 0 0.6rem; font-size: 0.85rem; color: var(--muted); }
.checkbox-list label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; margin-bottom: 0.4rem; }
.checkbox-list input[type="checkbox"] { width: auto; margin-top: 0; }
.hidden { display: none; }

/* Buttons */
.btn {
    display: inline-block; padding: 0.5rem 0.9rem; border-radius: var(--radius);
    background: #fff; border: 1px solid var(--border); color: var(--text);
    cursor: pointer; font-size: 0.9rem; text-decoration: none;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

/* Flash messages */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 320px; }
.login-box h1 { font-size: 1.3rem; text-align: center; margin-bottom: 1.25rem; }
.login-box button { width: 100%; padding: 0.6rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: 0.95rem; cursor: pointer; margin-top: 0.5rem; }
.login-box button:hover { background: var(--primary-dark); }

/* Calendar */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.calendar-title { font-weight: 700; font-size: 1.1rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekday { text-align: center; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.cal-day {
    background: var(--panel-bg); border: 1px solid var(--border); border-radius: 6px;
    min-height: 70px; padding: 0.35rem; font-size: 0.8rem; position: relative;
}
.cal-day.empty { background: transparent; border: none; }
.cal-day-num { font-weight: 600; color: var(--muted); }
.cal-guest { display: block; margin-top: 0.3rem; font-size: 0.78rem; font-weight: 600; }
.cal-day.occupied.status-angefragt { background: #fef3c7; }
.cal-day.occupied.status-bestaetigt { background: #dcfce7; }
.cal-day.occupied.status-abgeschlossen { background: #e0e7ff; }
.legend { display: flex; gap: 1.25rem; margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.status-angefragt { background: #f59e0b; }
.dot.status-bestaetigt { background: #22c55e; }
.dot.status-abgeschlossen { background: #6366f1; }

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .cal-day { min-height: 50px; font-size: 0.7rem; }
}
