/* Liturgiebord beheer — zelfde huisstijl als Capelle, opgeschoond. */
:root {
    --brand-primary: #3d8eb9;
    --brand-dark: #2a6a8a;
    --brand-light: #e8f4fa;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.78);
    --surface-sunken: #f6f8fa;
    --bg: #f0f4f8;
    --text-primary: #1a2332;
    --text-secondary: #5a6b7d;
    --text-muted: #8a99ab;
    --border: rgba(0, 0, 0, 0.09);
    --border-hover: rgba(0, 0, 0, 0.18);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --success: #15803d;
    --success-bg: #f0fdf4;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --focus: 0 0 0 3px rgba(61, 142, 185, 0.18);
    --transition: 0.18s ease;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.45;
}
[hidden] { display: none !important; }
a { color: var(--brand-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===================== TOP BAR ===================== */
.topbar {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}
.topbar-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-brand img { height: 26px; }
.topbar-divider { width: 1px; height: 24px; background: var(--border); }
.topbar-title { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.topbar-sub { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav a {
    padding: 7px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
    color: var(--text-secondary); text-decoration: none; transition: all var(--transition);
}
.topbar-nav a:hover { background: var(--surface-sunken); color: var(--text-primary); }
.topbar-nav a[aria-current="page"] { background: var(--brand-light); color: var(--brand-dark); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; }

/* ===================== LAYOUT ===================== */
.main { max-width: 1280px; margin: 0 auto; padding: 32px; }
.page-header { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header p { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 24px; }

/* ===================== CARDS ===================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h2 { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }
.card-body { padding: 24px; }
.card-body > p.hint, .hint { font-size: 0.82rem; color: var(--text-secondary); }
.badge {
    font-size: 0.7rem; font-weight: 600; color: var(--brand-primary); background: var(--brand-light);
    padding: 3px 10px; border-radius: 20px; letter-spacing: 0.02em; white-space: nowrap;
}
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-success { color: var(--success); background: var(--success-bg); }

/* ===================== LITURGY ROWS ===================== */
.liturgy-list { display: flex; flex-direction: column; gap: 8px; }
.liturgy-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px 8px 12px;
    background: var(--surface-sunken);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), background var(--transition);
}
.liturgy-item:hover, .liturgy-item:focus-within { border-color: var(--border-hover); background: #fbfcfd; }
.item-number {
    flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
}
select, input[type="text"], input[type="password"], input[type="file"] {
    font-family: var(--font); font-size: 0.9rem; color: var(--text-primary);
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 12px; outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
select {
    appearance: none; -webkit-appearance: none; cursor: pointer; color: var(--text-secondary);
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6b7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 9px center;
}
select:focus, input:focus { border-color: var(--brand-primary); box-shadow: var(--focus); }
input::placeholder { color: #b6c0cb; }
.liturgy-item select { flex-shrink: 0; }
.liturgy-item input[type="text"] { flex: 1; min-width: 0; }
.row-actions { display: flex; gap: 2px; flex-shrink: 0; }

.icon-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; border-radius: 8px; cursor: pointer;
    color: var(--text-muted); transition: all var(--transition);
}
.icon-btn:hover:not(:disabled) { background: var(--surface); color: var(--text-primary); }
.icon-btn.danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn svg, .btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.icon-btn:focus-visible, .btn:focus-visible, .theme-option:focus-visible { outline: none; box-shadow: var(--focus); }

.empty-state { text-align: center; padding: 32px 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ===================== BUTTONS ===================== */
.form-actions {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 18px 24px; border-top: 1px solid var(--border); background: #fafbfc;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
    font-weight: 500; font-size: 0.85rem; font-family: var(--font);
    transition: all var(--transition); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: default; transform: none !important; box-shadow: none !important; }
.btn-primary { background: var(--brand-primary); color: #fff; box-shadow: 0 1px 3px rgba(61, 142, 185, 0.2); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); box-shadow: 0 4px 12px rgba(61, 142, 185, 0.3); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--border-hover); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); padding: 7px 14px; font-size: 0.82rem; }
.btn-ghost:hover { background: var(--danger-bg); color: var(--danger); border-color: rgba(220, 38, 38, 0.15); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: rgba(220, 38, 38, 0.25); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-small { padding: 6px 12px; font-size: 0.8rem; }
.spacer { flex: 1; }
.save-status { font-size: 0.8rem; color: var(--text-muted); }

/* ===================== PREVIEW ===================== */
.preview-wrapper { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-frame {
    width: 100%; aspect-ratio: 9 / 16; border-radius: var(--radius-sm); overflow: hidden;
    background: #111; box-shadow: 0 0 0 1px var(--border), var(--shadow-md);
}
.preview-frame canvas { width: 100%; height: 100%; display: block; }
.preview-meta { font-size: 0.78rem; color: var(--text-muted); text-align: center; }

/* ===================== THEMES ===================== */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
.theme-option {
    border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
    background: var(--surface); padding: 0; font-family: var(--font); text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.theme-option:hover:not(:disabled) { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.theme-option:disabled { cursor: not-allowed; opacity: 0.45; }
.theme-swatch {
    height: 96px; display: flex; align-items: center; justify-content: center;
    background-size: cover; background-position: center;
    font-size: 1.35rem; letter-spacing: 0.02em;
}
.theme-name {
    display: block; padding: 7px 6px; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary);
    border-top: 1px solid var(--border);
}
.theme-option[aria-pressed="true"] { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(61, 142, 185, 0.14); }
.theme-option[aria-pressed="true"] .theme-name { background: var(--brand-primary); color: #fff; border-top-color: var(--brand-primary); }

.options-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.field-inline { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-secondary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.85rem; color: var(--text-secondary); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 11px; background: #cfd8e1; position: relative; transition: background var(--transition); flex-shrink: 0; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--transition); }
.switch input:checked + .switch-track { background: var(--brand-primary); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }

/* ===================== FORMS (instellingen) ===================== */
.form-grid { display: grid; gap: 14px; max-width: 420px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select { width: 100%; }
.radio-list { display: grid; gap: 8px; }
.radio-card {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.88rem;
}
.radio-card:has(input:checked) { border-color: var(--brand-primary); background: var(--brand-light); }
.radio-card input { accent-color: var(--brand-primary); }
.photo-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.photo-thumb { width: 108px; aspect-ratio: 9 / 16; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 1px var(--border); background: var(--surface-sunken); }
.photo-actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; flex: 1; min-width: 240px; }

table.users { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.users th { text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 12px 10px 0; }
table.users td { padding: 10px 12px 10px 0; border-top: 1px solid var(--border); vertical-align: middle; }
table.users form { display: inline-flex; gap: 6px; align-items: center; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
details.inline-form summary { cursor: pointer; list-style: none; }
details.inline-form summary::-webkit-details-marker { display: none; }
details.inline-form[open] { flex-basis: 100%; }
details.inline-form form { margin-top: 8px; }

/* ===================== FLASH / TOAST ===================== */
.toast-container { position: fixed; top: 80px; right: 32px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
    padding: 12px 18px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
    box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px;
    animation: toastIn 0.25s ease-out;
    background: var(--brand-light); color: var(--brand-dark); border: 1px solid rgba(61, 142, 185, 0.15);
}
.toast.leaving { animation: toastOut 0.3s ease-in forwards; }
.toast-success { background: var(--success-bg); color: var(--success); border-color: rgba(22, 163, 74, 0.15); }
.toast-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(220, 38, 38, 0.15); }
.toast-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(180, 83, 9, 0.15); }
.toast .btn { margin-left: auto; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

.alert { padding: 12px 16px; margin-bottom: 18px; border-radius: 10px; font-size: 0.85rem; font-weight: 500; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.12); }
.alert-info { background: var(--brand-light); color: var(--brand-dark); border: 1px solid rgba(61, 142, 185, 0.12); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22, 163, 74, 0.12); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(180, 83, 9, 0.12); }

/* ===================== LOGIN ===================== */
body.login-page {
    display: flex; justify-content: center; align-items: center; padding: 16px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2ecf3 50%, #dae5ee 100%);
}
.login-card {
    background: var(--surface-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border); padding: 44px 40px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; animation: slideUp 0.45s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.brand { text-align: center; margin-bottom: 32px; }
.brand img { height: 36px; margin-bottom: 16px; }
.brand h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.brand p { font-size: 0.875rem; color: var(--text-secondary); margin-top: 6px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card input { width: 100%; padding: 12px 16px; font-size: 0.95rem; border-radius: 10px; }
.login-card .btn { width: 100%; padding: 13px; font-size: 0.95rem; font-weight: 600; border-radius: 10px; margin-top: 8px; }
.login-footer { text-align: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted); }

/* ===================== ERROR ===================== */
.error-page { max-width: 520px; margin: 12vh auto; text-align: center; padding: 0 16px; }
.error-page .code { font-size: 3rem; font-weight: 700; color: var(--brand-primary); }
.error-page p { color: var(--text-secondary); margin: 8px 0 24px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 960px) {
    .grid { grid-template-columns: 1fr; }
    .preview-frame { max-width: 300px; }
}
@media (max-width: 640px) {
    body { font-size: 14px; }
    .main { padding: 20px 16px; }
    .topbar { padding: 0 16px; }
    .topbar-divider, .topbar-title, .topbar-user { display: none; }
    .card-body { padding: 16px; }
    .card-header, .form-actions { padding: 14px 16px; }
    .liturgy-item { flex-wrap: wrap; }
    .liturgy-item input[type="text"] { flex-basis: calc(100% - 40px); order: 2; margin-left: 32px; }
    .liturgy-item select { margin-right: auto; }
    .toast-container { right: 16px; left: 16px; top: 72px; }
    .login-card { padding: 32px 22px; }
}

/* ===================== AANVULLINGEN ===================== */
.stack-gap { margin-top: 24px; }
.theme-swatch-canvas { display: block; width: 100%; aspect-ratio: 9 / 16; background: #222; }
kbd { font-family: var(--font); font-size: 0.72rem; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }
.liturgy-item.dragging { opacity: 0.6; }
.dirty-dot::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); margin-right: 6px; vertical-align: 1px; }
