:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --bg: #f8fafc;
    --card-bg: #fff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

.navbar {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}
.navbar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    text-decoration: none;
}
.nav-links { display: flex; gap: 1rem; }
.nav-links a { color: #dbeafe; text-decoration: none; }
.nav-links a:hover { color: #fff; }

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

h1 { margin-bottom: 1rem; }
h2 { margin: 1.5rem 0 0.75rem; }

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}
.centered { max-width: 420px; margin-left: auto; margin-right: auto; }

label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

button, .btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    margin-top: 0.75rem;
    background: var(--primary);
    color: #fff;
}
button:hover, .btn:hover { background: var(--primary-hover); }
.btn-confirm { background: var(--success); }
.btn-confirm:hover { background: #15803d; }
.btn-reject { background: var(--danger); }
.btn-reject:hover { background: #b91c1c; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-pending { background: #fef3c7; color: var(--warning); }
.badge-confirmed { background: #dcfce7; color: var(--success); }
.badge-rejected { background: #fee2e2; color: var(--danger); }
.badge-cancelled { background: #f1f5f9; color: var(--muted); }

.inactive { opacity: 0.5; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.warning { background: #fef3c7; color: #92400e; }

.actions { display: flex; gap: 0.5rem; }
.actions form { margin: 0; }
.actions button { margin: 0; padding: 0.3rem 0.75rem; font-size: 0.85rem; }

.inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}
.inline-form input { flex: 1; min-width: 150px; margin: 0; }
.inline-form button { margin: 0; }

code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ── Collapsible admin sections ── */
.admin-section { margin-bottom: 1rem; }
.admin-section summary { cursor: pointer; list-style: revert; }
.admin-section summary h2 { display: inline; margin: 0; }

/* ── Weekly calendar grid ── */

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.cal-header { gap: 0.35rem; justify-content: flex-start; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; margin: 0; }
.cal-heute { margin-left: 0.75rem; }
.cal-date-input-sm { width: 7rem; padding: 0.1rem 0.2rem; font-size: 0.75rem; margin: 0; border-radius: 4px; }

.cal-grid-wrapper { overflow-x: auto; }

.cal-grid {
    table-layout: fixed;
    border-radius: 8px;
    font-size: 0.82rem;
}
.cal-grid th, .cal-grid td {
    padding: 0;
    text-align: center;
    border: 1px solid var(--border);
}
.cal-time-col { width: 52px; }
.cal-day-header {
    padding: 0.4rem 0 !important;
    font-size: 0.85rem;
}
.cal-day-num { font-size: 1.1rem; }
.cal-today { background: #eff6ff; }

/* Day separator – left border between columns */
.cal-day-sep { border-left: 2px solid #94a3b8; }

/* Weekend colouring */
.cal-slot.cal-weekend { background: #f1f5f9; }
.cal-weekend.cal-day-header { background: #e9eef5; }
/* Status colours still override weekend grey */
.cal-slot.cal-weekend.cal-busy { background: #3b82f6; }
.cal-slot.cal-weekend.cal-confirmed { background: #2563eb; }
.cal-slot.cal-weekend.cal-pending { background: #93c5fd; }

.cal-time {
    font-size: 0.75rem;
    color: var(--muted);
    padding: 0 4px !important;
    vertical-align: top;
    border-right: 2px solid var(--border);
}
.cal-hour-row .cal-time { border-top: 1px solid #cbd5e1; }
.cal-half-row .cal-time { border-top: 1px solid var(--border); }

.cal-slot {
    height: 22px;
    cursor: default;
    position: relative;
    vertical-align: middle;
}
.cal-slot .cal-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 3px;
    font-size: 0.72rem;
    line-height: 22px;
}

/* Slot colours */
.cal-past { background: #f0f0f0; color: #bbb; cursor: default; }
.cal-past_busy { background: #d1d5db; color: #6b7280; cursor: default; }
.cal-free { background: #fff; }
.cal-free[data-free="1"] { cursor: pointer; }
.cal-free[data-free="1"]:hover,
.cal-hover { background: #dbeafe; }

.cal-busy {
    background: #3b82f6;
    color: #fff;
}
.cal-confirmed {
    background: #2563eb;
    color: #fff;
}
.cal-pending {
    background: #93c5fd;
    color: #1e3a5f;
}

/* ── Controls ── */
.cal-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}
.cal-controls select {
    width: auto;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}
.cal-hint { color: var(--muted); }

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
    width: 90%;
    max-width: 440px;
}
.modal-content h2 { margin-top: 0; }
#modal-time-display {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}
.modal-actions button { margin: 0; }
.btn-secondary {
    background: var(--muted);
}
.btn-secondary:hover { background: #475569; }
