:root {
  --pf-accent: #2563eb;
  --pf-accent-light: #eff6ff;
  --pf-border: #e2e8f0;
  --pf-text-muted: #64748b;
  --pf-bg: #f8fafc;
  --pf-card: #ffffff;
  --pf-radius: 8px;
}

/* ── Layout ── */
body { background: var(--pf-bg); }

nav { border-bottom: 1px solid var(--pf-border); background: var(--pf-card); }
nav ul { gap: 0.25rem; }
nav a { color: var(--pf-text-muted); text-decoration: none; padding: 0.4rem 0.75rem; border-radius: var(--pf-radius); }
nav a:hover, nav a.active { background: var(--pf-accent-light); color: var(--pf-accent); }
nav strong { color: var(--pf-accent); font-size: 1.1rem; }

main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Cards ── */
.card {
  background: var(--pf-card);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ── Dashboard stats ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-box {
  background: var(--pf-card);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.stat-box .num { font-size: 2.25rem; font-weight: 700; color: var(--pf-accent); line-height: 1; }
.stat-box .lbl { font-size: 0.8rem; color: var(--pf-text-muted); margin-top: 0.25rem; }

/* ── Section headers ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.section-header h1, .section-header h2 { margin: 0; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef9c3; color: #92400e; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-red    { background: #fee2e2; color: #b91c1c; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; background: var(--pf-card); }
th { background: var(--pf-bg); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--pf-text-muted); padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--pf-border); }
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--pf-border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--pf-accent-light); }
.table-wrap { border: 1px solid var(--pf-border); border-radius: var(--pf-radius); overflow: hidden; }

/* ── Detail layout ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-field label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--pf-text-muted); display: block; margin-bottom: 0.25rem; }
.detail-field .value { font-size: 0.95rem; }

/* ── Markdown content ── */
.md-content { line-height: 1.7; }
.md-content ol, .md-content ul { padding-left: 1.5rem; }
.md-content li { margin-bottom: 0.3rem; }
.md-content h2, .md-content h3 { margin-top: 1.25rem; margin-bottom: 0.5rem; }
.md-content p { margin-bottom: 0.75rem; }
.md-content code { background: var(--pf-bg); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.875em; }
.md-content table { margin: 0.75rem 0; }
.md-content table th, .md-content table td { border: 1px solid var(--pf-border); padding: 0.4rem 0.6rem; }

/* ── Flow sections ── */
.flow-section { margin-bottom: 1.5rem; }
.flow-section h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pf-text-muted); margin-bottom: 0.75rem; border-bottom: 1px solid var(--pf-border); padding-bottom: 0.4rem; }

/* ── Image gallery ── */
.bild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.bild-item { border: 1px solid var(--pf-border); border-radius: var(--pf-radius); overflow: hidden; }
.bild-item img { width: 100%; display: block; cursor: pointer; }
.bild-item .bild-caption { padding: 0.5rem 0.75rem; font-size: 0.8rem; color: var(--pf-text-muted); }
.bild-item .bild-actions { padding: 0 0.75rem 0.5rem; }

/* ── Business rules list in detail ── */
.br-list { list-style: none; padding: 0; margin: 0; }
.br-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--pf-border); }
.br-list li:last-child { border-bottom: none; }
.br-list .br-id { font-family: monospace; color: var(--pf-accent); margin-right: 0.5rem; }
.br-list .br-quelle { font-size: 0.8rem; color: var(--pf-text-muted); }

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-full { grid-column: 1 / -1; }
.form-hint { font-size: 0.78rem; color: var(--pf-text-muted); margin-top: 0.2rem; }
textarea { font-family: inherit; }
.br-checkboxes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.br-checkboxes label { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.6rem; border: 1px solid var(--pf-border); border-radius: 4px; cursor: pointer; font-size: 0.875rem; }
.br-checkboxes label:has(input:checked) { background: var(--pf-accent-light); border-color: var(--pf-accent); color: var(--pf-accent); }

/* ── Filter bar ── */
.filter-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.25rem; }
.filter-bar input, .filter-bar select { margin: 0; padding: 0.4rem 0.6rem; font-size: 0.875rem; }

/* ── Buttons ── */
.btn-danger { background: #ef4444 !important; border-color: #ef4444 !important; color: white !important; }
.btn-danger:hover { background: #dc2626 !important; }
.btn-sm { font-size: 0.8rem; padding: 0.25rem 0.6rem !important; }
.action-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Empty state ── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--pf-text-muted); }
.empty p { margin-top: 0.5rem; }

/* ── Footer ── */
footer {
  max-width: 1100px;
  margin: 2rem auto 1rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--pf-border);
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--pf-text-muted);
}

/* ── Bootstrap-Banner ── */
.bootstrap-banner {
  background: #fefce8;
  border-bottom: 1px solid #fde047;
  color: #854d0e;
  font-size: 0.875rem;
  padding: 0.6rem 1.5rem;
  text-align: center;
}
.bootstrap-banner a { color: #92400e; font-weight: 600; }

/* ── Image lightbox ── */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 1000; align-items: center; justify-content: center; cursor: pointer; }
#lightbox.open { display: flex; }
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--pf-radius); }
